NVIDIA DeepStream SDK API Reference

8.0 Release
post_processor_segmentation.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2022-2024 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 #include <functional>
29 
31 
32 public:
33  SegmentationModelPostProcessor(int id, int gpuId = 0)
35 
36  ~SegmentationModelPostProcessor() override = default;
37 
39  initResource(NvDsPostProcessContextInitParams& initParams) override;
40 
41  NvDsPostProcessStatus parseEachFrame(const std::vector <NvDsInferLayerInfo>&
42  outputLayers,
43  NvDsPostProcessFrameOutput &result) override;
44 
45  void
46  attachMetadata (NvBufSurface *surf, gint batch_idx,
47  NvDsBatchMeta *batch_meta,
48  NvDsFrameMeta *frame_meta,
49  NvDsObjectMeta *object_meta,
50  NvDsObjectMeta *parent_obj_meta,
51  NvDsPostProcessFrameOutput & detection_output,
53  std::set <gint> & filterOutClassIds,
54  int32_t unique_id,
55  gboolean output_instance_mask,
56  gboolean process_full_frame,
57  float segmentationThreshold,
58  gboolean maintain_aspect_ratio,
59  NvDsRoiMeta *roi_meta,
60  gboolean symmetric_padding) override;
61 
62 
63  void releaseFrameOutput(NvDsPostProcessFrameOutput& frameOutput) override;
64 private:
65  NvDsPostProcessStatus fillSegmentationOutput(
66  const std::vector<NvDsInferLayerInfo>& outputLayers,
68 
69  float m_SegmentationThreshold = 0.50;
71  uint32_t m_NumClasses = 0;
72 };
73 
74 #endif
SegmentationModelPostProcessor::SegmentationModelPostProcessor
SegmentationModelPostProcessor(int id, int gpuId=0)
Definition: post_processor_segmentation.h:33
NvDsPostProcessDetectionParams
Holds detection and bounding box grouping parameters.
Definition: post_processor_struct.h:218
ModelPostProcessor
Definition: post_processor.h:57
NvBufSurface
Holds information about batched buffers.
Definition: nvbufsurface.h:577
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:257
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, NvDsRoiMeta *roi_meta, gboolean symmetric_padding) override
_NvDsPostProcessContextInitParams
Holds the initialization parameters required for the NvDsPostProcessContext interface.
Definition: post_processor_struct.h:262
SegmentationModelPostProcessor
Definition: post_processor_segmentation.h:30
NvDsPostProcessFrameOutput
Holds the information inferred by the network on one frame.
Definition: post_processor_struct.h:508
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:467
SegmentationModelPostProcessor::parseEachFrame
NvDsPostProcessStatus parseEachFrame(const std::vector< NvDsInferLayerInfo > &outputLayers, NvDsPostProcessFrameOutput &result) override
NvDsPostProcessTensorOrder
NvDsPostProcessTensorOrder
Defines UFF layer orders.
Definition: post_processor_struct.h:181
NvDsRoiMeta
Holds Information about ROI Metadata.
Definition: nvds_roi_meta.h:90
SegmentationModelPostProcessor::releaseFrameOutput
void releaseFrameOutput(NvDsPostProcessFrameOutput &frameOutput) override
_NvDsFrameMeta
Holds metadata for a frame in a batch.
Definition: nvdsmeta.h:301
SegmentationModelPostProcessor::~SegmentationModelPostProcessor
~SegmentationModelPostProcessor() override=default
_NvDsObjectMeta
Holds metadata for an object in the frame.
Definition: nvdsmeta.h:360