|
|
NVIDIA DeepStream SDK API Reference
|
9.2 Release
|
Go to the documentation of this file.
18 #ifndef VISUALTRACKERLIB_VISUALTRACKER_HPP_
19 #define VISUALTRACKERLIB_VISUALTRACKER_HPP_
22 #include <unordered_map>
23 #include "modules/cuDCFv2/cuDCF.h"
24 #include "modules/cuDCFv2/featureExtractor.hpp"
25 #include "modules/VisualTracker/IVisualTracker.hpp"
26 #include "modules/NvMultiObjectTracker/NvTrackerParams.hpp"
27 #include "modules/NvMultiObjectTracker/NvTrackedObject.hpp"
28 #include "modules/utility/dataTypes.hpp"
59 void read(
const YAML::Node &fn)
override;
172 const uint maxDetectorBboxesPerFrame,
const std::shared_ptr<NvTrackedObjectManager> &targetManager
187 const std::map<NvMOTStreamId, NvMOTFrame *> inputMeta,
188 const std::map<
NvMOTStreamId, std::deque<DetectedObjInfo>> &detectedObjects
195 void update(
const std::map<NvMOTStreamId, NvMOTFrame *> inputMeta)
override;
267 void checkInputOutput(
const std::map<NvMOTStreamId, NvMOTFrame*> &inputMeta);
316 const std::map<
NvMOTStreamId, std::deque<DetectedObjInfo>> &detectedObjects
345 float *
extractVisualFeatures(
const std::map<NvMOTStreamId, NvMOTFrame*> &inputMeta,
const bool isForLocalization);
348 std::shared_ptr<TrackerVizOutput> m_vizOutput;
349 float *m_batchCudaArray_host;
357 std::vector<cv::Mat> fetchBatchDataToHost_perObj(
const float *deviceData,
const bool multiChannelInput=
false);
360 std::map<NvMOTStreamId, cv::Mat> getSrcImagesAtHost();
366 #endif // VISUALTRACKERLIB_VISUALTRACKER_HPP_
cudaStream_t m_cudaStream
CUDA stream used for tracker operations.
float * m_trackingConfidence_d
detectorBbox_t * m_detectorBboxes_d
The detector bbox center points to be looked up at each tracker's correlation response.
void update(const std::map< NvMOTStreamId, NvMOTFrame * > inputMeta) override
Update each target's correlation-filter model from an input batch.
cufftComplex * m_dcfFilter_F
Learned filter in a batched Fourier-space CUDA buffer.
float m_debugParamFloat0
First floating-point debugging parameter.
Defines the interface implemented by visual trackers.
bool isInitialized() override
Report whether tracker initialization completed.
float * m_maskingWindow4Src
Masking window for input image feature (a Batch CUDA memory buffer).
float * m_channelWeightSum
The filter weight sums used for filter weight normalization, but play as a workplace only (a Batch CU...
NvBufSurfaceColorFormat colorFormat
Input source image color format.
float * m_corrResponseAtDetectedPt_h
float * m_confidenceAtDetectedPt_d
Tracking confidence at each detector bbox center.
VisualTrackerConfigParams m_params
Config params for visual tracker module.
void cudaCalculateResponse(float *ftrs)
Given the Fourier-transformed extracted features and the learned filters, compute the correlation res...
bool m_vizWriteSegMask
Save the filter mask generated by the segmenter.
bool m_vizWriteEachCompletedTrajectory
Write each completed trajectory.
int featureChannelSize
Number of channels in a feature vector.
cudaEvent_t m_eventStop
Event stop point for GPU timers.
cufftHandle * m_cufftHandle_C2R_perCh
Cufft handler for all the batch elements (i.e., (# of elements in single feature mat) * (# of feature...
uint * m_detectorBboxes_size_h
uint32_t * m_trackerAge_d
Tracker age.
float * m_maxCorrResponse_h
bool * m_trackerUseMaskSeg_h
uint32_t * m_trackerAge_h
float2 * m_targetDisplacement2D_d
The target displacement in correlation response (a Batch CUDA memory buffer).
NvMotDataTypes::Size srcImageSize
The size of the source image.
bool m_isInit
Indicates whether tracker initialization completed.
cufftComplex * m_ftrs_F
Extracted features in a batched Fourier-space CUDA buffer.
int m_showGpuTiming
Controls whether GPU timing is displayed.
detectorBbox_t * m_detectorBboxes_h
bool m_vizWriteAllTrajectoriesOnEveryFrame
Write the whole frame with trajectories of all targets in the scene.
virtual ~VisualTracker()
Release CUDA DCF tracker resources.
bool m_useRgb
Enables the RGB feature.
VisualTrackerRunTimeParams m_paramsRt
Config params for visual tracker module.
void getDetectorBboxCorrelationResponses(const std::map< NvMOTStreamId, std::deque< DetectedObjInfo >> &detectedObjects)
Retrieve each tracker's correlation response at nearby detector bounding boxes.
float * m_work_I
A temporary work space for float (a Batch CUDA memory buffer).
uint maxDetectorBboxesPerFrame
Maximum number of detector bounding boxes per frame.
cudaEvent_t m_eventStart
Event start point for GPU timers.
int m_debugVerboseLevel
Debug message verbose mode level.
bool m_useGray
Enables the grayscale pixel-intensity feature.
bool * m_trackerDoProcessing_d
True when this tracker is updated for this batch.
int m_debugVerboseLevel_gpumemory
GPU memory debug verbosity level.
void queryParams(NvMOTQuery ¶msQuery)
Populate the visual tracker's capability query.
void initialize(const SourceFrameInfo &frameInfo, const uint maxTargetsToTrack, const uint maxDetectorBboxesPerFrame, const std::shared_ptr< NvTrackedObjectManager > &targetManager) override
Initialize variables and allocate memories.
void checkInputOutput(const std::map< NvMOTStreamId, NvMOTFrame * > &inputMeta)
Check the input and find the detection interval.
Detector bbox in correlation-response coordinates.
float * m_maxCorrResponse_ma_h
The moving average of the max corr resp.
Tracks objects with a CUDA discriminative correlation filter.
int singleFeatureChannelElementSize_F
Number of elements in one Fourier feature matrix, which has half the image size because of conjugate ...
int m_debugParamInt2
Third integer debugging parameter.
float * m_trackingConfidence_h
The tracking confidence derived from the instant and the moving average of the max corr resp.
void * m_cufftWorkspce
Cufft workspace memory on device.
int detectorInputInterval
Interval between external detector inputs.
bool m_useColorNames
Enables the ColorNames feature.
float m_gaussianSigma
Sigma for Gaussian for desired response.
float m_debugParamFloat1
Second floating-point debugging parameter.
bool m_useHog
Enables the HOG feature.
float m_featureImgSize
Maximum template length in one dimension.
float4 * m_maskSegRois_d
Filter ROI to crop segmentation masks.
bool m_useHighPrecisionFeature
Enables high-precision 16-bit VPI output instead of low-precision 8-bit output.
float m_peakCorrLr
Learning rate for peak correlation response in exponential moving average.
std::string m_vizOutDirectory
The directory to write the outputs.
float m_minConfidence4SegmentationFilter
Minimum confidence for using a segmentation mask during filter learning.
cufftComplex * m_work_F_2
Second temporary batched complex workspace.
void updateParams(const YAML::Node &fn)
Update any Dynamic Params as provided during runtime by the user.
VISUAL_TRACKER_TYPES
Visual tracker implementations that can be selected by configuration.
float m_filterLr
Learning rate for DCF filter in exponential moving average.
int featureVecBatchElementSize
Number of feature-vector elements for the current tracker batch.
float * m_maskingSegWindow4Model
Masking window for the model for filter learning (a Batch CUDA memory buffer).
std::map< NvMOTStreamId, std::vector< std::pair< uint, NvMotDataTypes::Rect2f > > > m_featureRoisInBatch
Trackers' search regions as ROI for feature extraction.
float m_featureFocusOffsetFactor_y
Vertical Hanning-window center offset relative to the feature height.
std::map< NvMOTStreamId, NvMOTFrame * > m_inputMeta
Hold the input metadata.
float m_filterChannelWeightsLr
Learning rate for DCF filter channel weights in exponential moving average.
void makeBatchAndSendFloatMatToDevice(const NvMotDataTypes::RowMajorMatrixXf &srcMat, void *devMem, uint batchSize, float *workarea_host)
Duplicate one host matrix into a batched float buffer and copy it to the device.
Provides common loading helpers for tracker configuration parameters.
int m_debugParamInt1
Second integer debugging parameter.
int getCufftPlanId(int num_target)
Select a cuFFT plan large enough for the requested target count.
Eigen::Vector2f convertSrcImgCoordToCorrRespCoord(const NvMotDataTypes::Rect2f &roi, const Eigen::Vector2f pt_img) const
Map a source-image point into a tracker's correlation-response coordinates.
VISUAL_TRACKER_TYPES m_visualTrackerType
The type of visual tracker.
void read(const YAML::Node &fn) override
Read visual tracker parameters from a YAML node.
float getTemplateRescaleRatio(const NvMotDataTypes::Rect2f &roi) const
Compute the scale that maps a search region to the fixed feature-image size.
bool m_isInit
Indicates whether the parameters have been initialized.
void cudaFilterUpdate(const float *ftrs)
Create and update the DCF filter.
VisualTrackerConfigParams()
Construct the default configuration.
std::map< NvMOTStreamId, uint32_t > isDetectionDonePerStream
Indicates whether inference completed for each stream.
Configuration parameters for the visual tracker.
bool m_vizWriteSrcImgPatchesAndCorrResp
Write the cropped/scaled image patches and correlation response.
void updateLocalizationResults(const std::map< NvMOTStreamId, NvMOTFrame * > &inputMeta)
Update target states from their correlation responses.
bool m_vizWriteBirdsEyeView
Write the bird's-eye view.
float * m_corrResponseAtDetectedPt_d
Correlation response at each detector bbox center.
int singleFeatureChannelElementSize
Number of elements in a single feature matrix.
cufftHandle * m_cufftHandle_C2R_perObj
Cufft handler for a smaller subset (i.e., (# of elements in single feature mat) * (# of trackers)).
Holds the capabilities and requirements reported by the tracker library.
int m_vizJpegImageQuality
JPEG output quality in the range [1, 100].
float * m_channelWeights
The adaptive filter weights for the channels on device (a Batch CUDA memory buffer).
cufftComplex * m_desiredResp_F
Desired response in a batched Fourier-space CUDA buffer.
float * extractVisualFeatures(const std::map< NvMOTStreamId, NvMOTFrame * > &inputMeta, const bool isForLocalization)
Extract a batched visual feature vector for localization or model update.
int m_cufftHandleQuantFactor
Clustering size for cuFFT plans.
void allocateCudaMemories()
Pre-allocate required cuda memories on GPU.
NvMotDataTypes::Size originalSrcImageSize
The size of the original video source image.
bool * m_trackerDoProcessing_h
NvMotDataTypes::Size templateSize
Size of the rescaled search-region template.
const VISUAL_TRACKER_TYPES getVisualTrackerType() override
Return the configured visual tracker type.
float * m_maxCorrResponse_ma_d
int cudaKernelMaxBatchSize
Maximum CUDA batch size across feature channels and target trackers.
void localize(const std::map< NvMOTStreamId, NvMOTFrame * > inputMeta, const std::map< NvMOTStreamId, std::deque< DetectedObjInfo >> &detectedObjects) override
Localize tracked targets and evaluate nearby detections across an input batch.
uint m_cufftPlanSize
Number of cuFFT plans.
uint * m_detectorBboxes_size_d
The number of detector bbox candidate for each target.
int cudaKernelBatchSize
Number of feature matrices in the current CUDA batch.
float * m_confidenceAtDetectedPt_h
uint maxStreams
Maximum number of supported video streams.
VisualTracker(const std::string &configFilePath)
Construct from a configuration file path.
size_t srcImagePitch
Memory pitch of the source frame.
int featureVecMaxBatchElementSize_F
Maximum number of Fourier feature-vector elements across all supported trackers.
Represents a two-dimensional integer size.
float2 * m_targetDisplacement2D_h
Information about the input source frames for the input frame batch.
std::shared_ptr< NvTrackedObjectManager > m_targetManager
Target manager.
bool m_generateTrackerVisualization
Enables tracker visualization generation.
int featureVecMaxBatchElementSize
Maximum number of feature-vector elements across all supported trackers.
bool m_useCpuBackends4VPI
Enables CPU backends for VPI instead of CUDA.
int m_debugParamInt0
First integer debugging parameter.
uint maxTargetsToTrack
Maximum number of targets tracked across all streams.
float m_debugParamFloat2
Third floating-point debugging parameter.
int m_debugVerboseLevel_cufft
Debug verbosity level for cuFFT.
int m_vizDebugStreamId
Video stream ID selected for visualization debugging.
bool * m_trackerUseMaskSeg_d
True when this tracker is updated for this batch.
float m_modelMaskingWindowFactor
Masking-window factor used for focused filter learning.
int m_hogCellSize
Cell size of HOG feature.
NvMotDataTypes::Size singleFeatureMatSize
Dimensions of a single feature matrix processed on the GPU.
RowMajorMatrixX< float > RowMajorMatrixXf
FeatureExtractor m_featureExtractor
Feature extractor that performs bbox cropping, scaling, and compose a feature vec batch.
cufftComplex * m_work_F_1
First temporary batched complex workspace.
cufftHandle * m_cufftHandle_R2C_perCh
Cufft R2C handle for all the batch elements (i.e., (# of elements in single feature mat) * (# of feat...
void updateData4Processing(const int lastTrackerInd)
Adjust processing dimensions after the active tracker count changes.
Renders and writes visual tracker debugging output.
float * m_maskingWindow4Model
Masking window for the model for filter learning (a Batch CUDA memory buffer).
Stores runtime dimensions and processing state for the CUDA DCF tracker.
NvBufSurfaceColorFormat
Defines color formats for NvBufSurface.
float * m_corrResponses_d
The correlation response maps for targets (a Batch CUDA memory buffer).
int detCorrRespSearchWindowSize
Correlation-response search radius used to tolerate detector jitter.
float * m_maxCorrResponse_d
The max correlation response for targets (a Batch CUDA memory buffer).
float m_lambda
Regularization factor used in DCF filter creation.