NVIDIA DeepStream SDK API Reference

9.2 Release
9.2/sources/libs/ds3d/datafilter/lidarinference/lidarinference_filter_impl.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef DS3D_DATAFILTER_LIDAR_INFERENCE_FILTER_IMPL_H
19 #define DS3D_DATAFILTER_LIDAR_INFERENCE_FILTER_IMPL_H
20 
21 #include "lidarinference_filter.h"
22 
23 #include "ds3d/common/helper/safe_queue.h"
24 #include "ds3d/common/helper/cuda_utils.h"
25 #include "ds3d/common/hpp/datafilter.hpp"
26 #include "ds3d/common/hpp/lidar_custom_process.hpp"
27 #include "ds3d/common/hpp/frame.hpp"
28 #include "ds3d/common/impl/impl_datafilter.h"
29 
30 #include "lidarinference_config.h"
31 
32 #include "infer_icontext.h"
33 #include "nvdsinferserver_config.pb.h"
34 #include "nvdsinferserver_plugin.pb.h"
35 #include "infer_options.h"
36 
37 namespace ic = nvdsinferserver::config;
38 
39 namespace ds3d { namespace impl { namespace filter {
40 
41 namespace dsis = nvdsinferserver;
42 using SharedInferContext = std::shared_ptr<dsis::IInferContext>;
43 using namespace nvdsinferserver;
44 
45 typedef IInferCustomPreprocessor* (*CreateCustomProcessorFunc)();
46 
47 class LidarInferenceFilter : public BaseImplDataFilter {
48 public:
49  LidarInferenceFilter() = default;
50  ~LidarInferenceFilter() override;
51 
52 protected:
53  ErrCode processImpl(
54  GuardDataMap datamap, OnGuardDataCBImpl outputDataCb,
55  OnGuardDataCBImpl inputConsumedCb) override;
56  ErrCode stopImpl() override;
57  ErrCode flushImpl() override;
58  ErrCode startImpl(const std::string& content, const std::string& path);
59 
60 private:
61  ErrCode reserveInputMem(uint& devId, uint32_t count, int& batchSize);
62  ErrCode copyDatamapToInputs(GuardDataMap datamap, SharedBatchArray batchArray);
63  ErrCode copy2DFrameToTensor(Frame2DGuard& frame, SharedBatchBuf& tensor);
64  ErrCode copyFrameToTensor(FrameGuard& frame, SharedBatchBuf& tensor);
65 
66  Config _config;
67  std::unordered_map<std::string, std::shared_ptr<BufferPool<UniqCudaTensorBuf>>> _inputBuferPoolMap;
68  volatile bool _inProcess = false;
69  ic::PluginControl _PluginConfig;
70  SharedInferContext _InferCtx;
71  std::shared_ptr<IInferCustomPreprocessor> _customPreprocess;
72  Ptr<CudaStream> _cudaStream;
73 };
74 
75 }}} // namespace ds3d::impl::filter
76 
77 
78 #endif // DS3D_DATAFILTER_LIDAR_INFERENCE_FILTER_IMPL_H
nvdsinferserver
This is a header file for pre-processing cuda kernels with normalization and mean subtraction require...
Definition: includes/nvdsinferserver/infer_custom_process.h:29
nvdsinferserver::SharedBatchBuf
std::shared_ptr< BaseBatchBuffer > SharedBatchBuf
Common buffer interfaces (internal).
Definition: sources/libs/nvdsinferserver/infer_common.h:76
lidarinference_config.h
nvdsinferserver::SharedBatchArray
std::shared_ptr< BaseBatchArray > SharedBatchArray
Definition: sources/libs/nvdsinferserver/infer_common.h:80
uint
unsigned int uint
Definition: sources/libs/nvmultiobjecttracker/include/modules/cuDCFv2/helper_math.h:25
ds3d::ErrCode
ErrCode
Definition: includes/ds3d/common/common.h:47
ds3d::FrameGuard
GuardDataT< abiFrame > FrameGuard
Definition: includes/ds3d/common/hpp/frame.hpp:29
ds3d::Frame2DGuard
GuardDataT< abi2DFrame > Frame2DGuard
Definition: includes/ds3d/common/hpp/frame.hpp:57
SharedInferContext
std::shared_ptr< dsis::IInferContext > SharedInferContext
Definition: sources/gst-plugins/gst-nvinferserver/gstnvinferserver_impl.h:67
nvdsinferserver::config::PluginControl
Definition: sources/libs/nvdsinferserver/nvdsinferserver_plugin.pb.h:1594
ds3d
Definition: includes/ds3d/common/abi_dataprocess.h:25
lidarinference_filter.h
nvdsinferserver::config
Definition: sources/libs/nvdsinferserver/nvdsinferserver_common.pb.h:52