|
NVIDIA DeepStream SDK API Reference
|
6.4 Release
|
Go to the documentation of this file.
22 #ifndef __GSTNVINFERSERVER_IMPL_H__
23 #define __GSTNVINFERSERVER_IMPL_H__
30 #include <condition_variable>
44 #include "nvtx3/nvToolsExt.h"
49 #include "nvdsinferserver_config.pb.h"
50 #include "nvdsinferserver_plugin.pb.h"
57 const char* log_message,
void* user_ctx);
60 namespace ic = nvdsinferserver::config;
65 class BatchSurfaceBuffer;
96 typedef std::unordered_map<uint64_t, SharedObjHistory>
106 gulong last_cleanup_frame_num = 0;
108 gulong last_seen_frame_num = 0;
137 struct RequestBuffer;
149 class ObjTrackingData {
161 bool initSource(uint32_t
id) {
171 void removeSource(uint32_t
id) { m_SourceInfo.erase(
id); }
189 bool hasSource(uint32_t
id)
const {
190 return m_SourceInfo.find(
id) != m_SourceInfo.end();
202 uint32_t sourceId, uint64_t objId);
213 uint32_t sourceId, uint64_t objId);
219 void clear() { m_SourceInfo.clear(); }
231 void clearUpHistory(uint64_t seqId);
236 std::unordered_map<uint32_t, GstNvInferServerSourceInfo> m_SourceInfo;
240 gulong m_LastMapCleanupSeqId = 0;
243 using FuncItem = std::function<void()>;
352 return m_NvtxDomain.get();
357 const ic::PluginControl&
config()
const {
return m_PluginConfig; }
358 void updateInterval(guint interval) {m_PluginConfig.mutable_input_control()->set_interval(interval);}
424 std::shared_ptr<RequestBuffer> reqBuf, std::vector<dsis::SharedBatchBuf> batchBuf);
437 void InferenceDone(std::shared_ptr<RequestBuffer> req);
481 ic::PluginControl& mutableConfig() {
return m_PluginConfig; }
482 bool isClassify()
const;
483 bool isDetection()
const;
484 bool isSegmentation()
const;
485 bool isOtherNetowrk()
const;
486 bool isFullFrame()
const;
487 bool maintainAspectRatio()
const;
488 bool needOutputTensorMeta()
const;
489 bool hasCustomProcess()
const;
490 uint32_t inferInterval()
const {
return m_PluginConfig.input_control().interval(); }
491 bool inputTensorFromMeta()
const
493 return m_PluginConfig.infer_config().has_input_tensor_from_meta();
505 bool validatePluginConfig(
506 ic::PluginControl&
config,
const std::string& path,
507 const GstNvInferServerProperties& update);
533 bool shouldInferObject(
NvDsObjectMeta* obj_meta, uint32_t frameNum,
534 GstNvInferServerObjectHistory* history);
545 bool outputLoop(FuncItem func);
551 using OutputThread = dsis::QueueThread<std::list<FuncItem>>;
558 mutable std::mutex m_ProcessMutex;
560 ic::PluginControl m_PluginConfig;
562 ObjTrackingData m_ObjTrackingData;
565 std::unique_ptr<OutputThread> m_OutputThread;
568 std::unique_ptr<nvtxDomainRegistration, std::function<void(nvtxDomainRegistration*)>>
572 bool m_Stopped =
false;
581 uint32_t m_IntervalCounter = 0;
583 uint64_t m_UntrackedObjectWarnPts = UINT64_C(-1);
586 bool m_1stInferDone =
false;
GstNvInferServerObjectHistoryMap object_history_map
Map of object tracking IDs and inference history of the object.
Copyright (c) 2021, NVIDIA CORPORATION.
Holds the box parameters of the box to be overlayed.
uint64_t last_inferred_frame_num
Number of the frame in the stream when the object was last inferred on.
std::vector< int32_t > operateOnClassIds
std::shared_ptr< IBatchBuffer > SharedIBatchBuffer
NvDsInferStatus lastError() const
NvDsInferStatus start()
Reads the configuration file and sets up processing context.
uint64_t last_accessed_frame_num
Number of the frame in the stream when the object was last accessed.
Header file for the data types used in the inference processing.
Holds information about batched buffers.
std::string classifierType
bool addTrackingSource(uint32_t sourceId)
Add a new source to the object history structure.
void updateInterval(guint interval)
const std::string & classifierType() const
void gst_nvinfer_server_logger(uint32_t unique_id, NvDsInferLogLevel log_level, const char *log_message, void *user_ctx)
Function to output the logs using the GStreamer's debugging subsystem.
Class of the nvinferserver element implementation.
@ NVDSINFER_SUCCESS
NvDsInferContext operation succeeded.
void eraseTrackingSource(uint32_t sourceId)
Removes a source from the object history structure.
typedefG_BEGIN_DECLS struct _GstNvInferServer GstNvInferServer
NvDsInferLogLevel
Enum for the log levels of NvDsInferContext.
Header file containing utility functions and classes used by the nvinferserver low level library.
GstNvInferServerImpl(GstNvInferServer *infer)
Constructor, registers the handle of the parent GStreamer element.
void resetIntervalCounter()
Resets the inference interval used in frame process mode to 0.
std::unordered_map< uint64_t, SharedObjHistory > GstNvInferServerObjectHistoryMap
Map for maintaining inference history for objects based on their tracking ids: Object ID : Object His...
GstNvInferServerProperties m_GstProperties
Holds information about the model network.
Holds information about one layer in the model.
uint32_t maxBatchSize() const
NvDsInferStatus stop()
Deletes the inference context.
Inference context library interface header file.
std::shared_ptr< dsis::IInferContext > SharedInferContext
nvtxDomainHandle_t nvtxDomain()
NvDsInferStatus processBatchMeta(NvDsBatchMeta *batchMeta, NvBufSurface *inSurf, uint64_t seqId, void *gstBuf)
Submits the input batch for inference.
std::weak_ptr< GstNvInferServerObjectHistory > WeakObjHistory
bool canSupportGpu(int gpuId) const
void setRawoutputCb(RawOutputCallback cb)
Saves the callback function pointer for the raw tensor output.
bool under_inference
Boolean indicating if the object is already being inferred on.
Holds information about the detected objects in the specific input source.
~GstNvInferServerImpl()
Constructor, do nothing.
uint32_t uniqueId() const
NvDsInferStatus sync()
Waits for the output thread to finish processing queued operations.
NvDsInferStatus queueOperation(FuncItem func)
Queues the inference done operation for the request to the output thread.
Holds the inference information/history for one object based on its tracking ID.
const ic::PluginControl & config() const
NvOSD_RectParams last_inferred_coords
Bounding box co-ordinates of the object when it was last inferred on.
std::shared_ptr< GstNvInferServerObjectHistory > SharedObjHistory
std::function< void(void *, NvDsInferNetworkInfo &, NvDsInferLayerInfo *, uint32_t, uint32_t)> RawOutputCallback
Function for raw output callback .
InferClassificationOutput cached_info
Cached object information.
Holds the configuration information from the nvinferserver element properties.
NvDsInferStatus
Enum for the status codes returned by NvDsInferContext.