NVIDIA DeepStream SDK API Reference

7.0 Release
post_processor_segmentation.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: MIT
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in
13  * all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21  * DEALINGS IN THE SOFTWARE.
22  */
23 
24 #ifndef __POST_PROCESSOR_SEGMENTATION_HPP__
25 #define __POST_PROCESSOR_SEGMENTATION_HPP__
26 
27 #include "post_processor.h"
28 
30 
31 public:
32  SegmentationModelPostProcessor(int id, int gpuId = 0)
34 
35  ~SegmentationModelPostProcessor() override = default;
36 
38  initResource(NvDsPostProcessContextInitParams& initParams) override;
39 
40  NvDsPostProcessStatus parseEachFrame(const std::vector <NvDsInferLayerInfo>&
41  outputLayers,
42  NvDsPostProcessFrameOutput &result) override;
43 
44  void
45  attachMetadata (NvBufSurface *surf, gint batch_idx,
46  NvDsBatchMeta *batch_meta,
47  NvDsFrameMeta *frame_meta,
48  NvDsObjectMeta *object_meta,
49  NvDsObjectMeta *parent_obj_meta,
50  NvDsPostProcessFrameOutput & detection_output,
52  std::set <gint> & filterOutClassIds,
53  int32_t unique_id,
54  gboolean output_instance_mask,
55  gboolean process_full_frame,
56  float segmentationThreshold,
57  gboolean maintain_aspect_ratio) override;
58 
59 
60  void releaseFrameOutput(NvDsPostProcessFrameOutput& frameOutput) override;
61 private:
62  NvDsPostProcessStatus fillSegmentationOutput(
63  const std::vector<NvDsInferLayerInfo>& outputLayers,
65 
66  float m_SegmentationThreshold = 0.50;
68  uint32_t m_NumClasses = 0;
69 };
70 
71 #endif
SegmentationModelPostProcessor::SegmentationModelPostProcessor
SegmentationModelPostProcessor(int id, int gpuId=0)
Definition: post_processor_segmentation.h:32
NvDsPostProcessDetectionParams
Holds detection and bounding box grouping parameters.
Definition: post_processor_struct.h:216
ModelPostProcessor
Definition: post_processor.h:57
NvBufSurface
Holds information about batched buffers.
Definition: nvbufsurface.h:509
post_processor.h
NvDsPostProcessStatus
NvDsPostProcessStatus
Enum for the status codes returned by NvDsPostProcessAlgorithm.
Definition: post_processor_struct.h:84
NvDsPostProcessTensorOrder_kNCHW
@ NvDsPostProcessTensorOrder_kNCHW
Definition: post_processor_struct.h:182
SegmentationModelPostProcessor::initResource
NvDsPostProcessStatus initResource(NvDsPostProcessContextInitParams &initParams) override
_NvDsBatchMeta
Holds information about a formed batch containing frames from different sources.
Definition: nvdsmeta.h:241
_NvDsPostProcessContextInitParams
Holds the initialization parameters required for the NvDsPostProcessContext interface.
Definition: post_processor_struct.h:260
SegmentationModelPostProcessor
Definition: post_processor_segmentation.h:29
NvDsPostProcessFrameOutput
Holds the information inferred by the network on one frame.
Definition: post_processor_struct.h:483
NvDsPostProcessNetworkType_Segmentation
@ NvDsPostProcessNetworkType_Segmentation
Specifies a segmentation network.
Definition: post_processor_struct.h:201
NvDsPostProcessSegmentationOutput
Holds information parsed from segmentation network output for one frame.
Definition: post_processor_struct.h:463
SegmentationModelPostProcessor::parseEachFrame
NvDsPostProcessStatus parseEachFrame(const std::vector< NvDsInferLayerInfo > &outputLayers, NvDsPostProcessFrameOutput &result) override
NvDsPostProcessTensorOrder
NvDsPostProcessTensorOrder
Defines UFF layer orders.
Definition: post_processor_struct.h:181
SegmentationModelPostProcessor::releaseFrameOutput
void releaseFrameOutput(NvDsPostProcessFrameOutput &frameOutput) override
_NvDsFrameMeta
Holds metadata for a frame in a batch.
Definition: nvdsmeta.h:285
SegmentationModelPostProcessor::~SegmentationModelPostProcessor
~SegmentationModelPostProcessor() override=default
SegmentationModelPostProcessor::attachMetadata
void attachMetadata(NvBufSurface *surf, gint batch_idx, NvDsBatchMeta *batch_meta, NvDsFrameMeta *frame_meta, NvDsObjectMeta *object_meta, NvDsObjectMeta *parent_obj_meta, NvDsPostProcessFrameOutput &detection_output, NvDsPostProcessDetectionParams *all_params, std::set< gint > &filterOutClassIds, int32_t unique_id, gboolean output_instance_mask, gboolean process_full_frame, float segmentationThreshold, gboolean maintain_aspect_ratio) override
_NvDsObjectMeta
Holds metadata for an object in the frame.
Definition: nvdsmeta.h:343