Accuracy Discrepancy between NvDCF Tracker and Non Tracker output

Please provide complete information as applicable to your setup.

• Hardware Platform : NVIDIA Tesla T4
• DeepStream Version : 8.0
• TensorRT Version : N/A
• NVIDIA GPU Driver Version : 595.58.03
• Issue Type : NvDCF ReID tracker configurations causing improper detections
• How to reproduce the issue ? : I’m using a custom YOLO based deepstream-app pipeline with the NvDCF Accuracy tracker (with ghost_reid.onnx and updated tracker configs) and comparing its output against deepstream-app without any tracker, it seems evident that the outputs of tracker based deepstream-app are much more inconsistent and have lower accuracies compared to the one without tracker. I have set interval=2 in pgie configs and the accuracies across the two runs seem different, worse in the one with tracker.

here is the pgie config

[property]
gpu-id=0
net-scale-factor=0.0039215697906911373
model-color-format=0
onnx-file=/opt/nvidia/deepstream/deepstream-8.0/sources/apps/sample_apps/deepstream-app/weights/model.onnx
model-engine-file=/opt/nvidia/deepstream/deepstream-8.0/sources/apps/sample_apps/deepstream-app/model_b2_gpu0_fp16.engine
#int8-calib-file=calib.table
labelfile-path=./labels/labels.txt
batch-size=2
network-mode=2
output-tensor-meta=1    
num-detected-classes=48
interval=2
gie-unique-id=1
process-mode=1
network-type=0
cluster-mode=2
maintain-aspect-ratio=1
symmetric-padding=1
#workspace-size=2000
parse-bbox-func-name=NvDsInferParseYolo
#parse-bbox-func-name=NvDsInferParseYoloCuda
custom-lib-path=../custom_lib/nvdsinfer_custom_impl_Yolo/libnvdsinfer_custom_impl_Yolo.so
engine-create-func-name=NvDsInferYoloCudaEngineGet
filter-out-class-ids = 

[class-attrs-all]
nms-iou-threshold=0.5
pre-cluster-threshold=0.1
topk=300

tracker-config-file contents:

####################################################################################################
# SPDX-FileCopyrightText: Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation and any modifications thereto. Any use, reproduction,
# disclosure or distribution of this material and related documentation
# without an express license agreement from NVIDIA CORPORATION or
# its affiliates is strictly prohibited.
####################################################################################################

BaseConfig:
  minDetectorConfidence: 0.0    # If the confidence of a detector bbox is lower than this, then it won't be considered for tracking

TargetManagement:
  enableBboxUnClipping: 1    # In case the bbox is likely to be clipped by image border, unclip bbox
  preserveStreamUpdateOrder: 0    # When assigning new target ids, preserve input streams' order to keep target ids in a deterministic order over multuple runs
  maxTargetsPerStream: 200    # Max number of targets to track per stream. Recommended to set >10. Note: this value should account for the targets being tracked in shadow mode as well. Max value depends on the GPU memory capacity

  # [Creation & Termination Policy]
  minIouDiff4NewTarget: 0.999    # If the IOU between the newly detected object and any of the existing targets is higher than this threshold, this newly detected object will be discarded.
  minTrackerConfidence: 0.0   # If the confidence of an object tracker is lower than this on the fly, then it will be tracked in shadow mode. Valid Range: [0.0, 1.0]
  probationAge: 0    # If the target's age exceeds this, the target will be considered to be valid.
  maxShadowTrackingAge: 9999    # Max length of shadow tracking. If the shadowTrackingAge exceeds this limit, the tracker will be terminated.
  earlyTerminationAge: 9999    # If the shadowTrackingAge reaches this threshold while in TENTATIVE period, the target will be terminated prematurely.

TrajectoryManagement:
  useUniqueID: 0    # Use 64-bit long Unique ID when assignining tracker ID. Default is [true]
  enableReAssoc: 1    # Enable Re-Assoc

  # [Re-Assoc Metric: Thresholds for valid candidates]
  minMatchingScore4Overall: 0.2    # min matching score for overall
  minTrackletMatchingScore: 0.29    # min tracklet similarity score for re-assoc
  minMatchingScore4ReidSimilarity: 0.2    # min reid similarity score for re-assoc

  # [Re-Assoc Metric: Weights]
  matchingScoreWeight4TrackletSimilarity: 0.7981    # weight for tracklet similarity score
  matchingScoreWeight4ReidSimilarity: 0.3848    # weight for reid similarity score

  # [Re-Assoc: Motion-based]
  minTrajectoryLength4Projection: 34    # min trajectory length required to make projected trajectory
  prepLength4TrajectoryProjection: 58    # the length of the trajectory during which the state estimator is updated to make projections
  trajectoryProjectionLength: 60    # the length of the projected trajectory
  maxAngle4TrackletMatching: 67    # max angle difference for tracklet matching [degree]
  minSpeedSimilarity4TrackletMatching: 0.05    # min speed similarity for tracklet matching
  minBboxSizeSimilarity4TrackletMatching: 0.1    # min bbox size similarity for tracklet matching
  maxTrackletMatchingTimeSearchRange: 300    # the search space in time for max tracklet similarity
  trajectoryProjectionProcessNoiseScale: 0.0050    # trajectory projector's process noise scale w.r.t. state estimator
  trajectoryProjectionMeasurementNoiseScale: 200    # trajectory projector's measurement noise scale w.r.t. state estimator
  trackletSpacialSearchRegionScale: 0.100    # the search region scale for peer tracklet

  # [Re-Assoc: Reid based. Reid model params are set in ReID section]
  reidExtractionInterval: 8    # frame interval to extract reid features per target

DataAssociator:
  dataAssociatorType: 0    # the type of data associator among { DEFAULT= 0 }
  associationMatcherType: 1    # the type of matching algorithm among { GREEDY=0, CASCADED=1 }
  checkClassMatch: 1    # If checked, only the same-class objects are associated with each other. Default: true

  # [Association Metric: Thresholds for valid candidates]
  minMatchingScore4Overall: 0.0    # Min total score
  minMatchingScore4SizeSimilarity: 0.0    # Min bbox size similarity score
  minMatchingScore4Iou: 0.0   # Min IOU score
  minMatchingScore4VisualSimilarity: 0.0    # Min visual similarity score

  # [Association Metric: Weights]
  matchingScoreWeight4VisualSimilarity: 0.6    # Weight for the visual similarity (in terms of correlation response ratio)
  matchingScoreWeight4SizeSimilarity: 0.3    # Weight for the Size-similarity score
  matchingScoreWeight4Iou: 0.4033    # Weight for the IOU score

  # [Association Metric: Tentative detections] only uses iou similarity for tentative detections
  tentativeDetectorConfidence: 0.0    # If a detection's confidence is lower than this but higher than minDetectorConfidence, then it's considered as a tentative detection
  minMatchingScore4TentativeIou: 0.0    # Min iou threshold to match targets and tentative detection

StateEstimator:
  stateEstimatorType: 2    # the type of state estimator among { DUMMY=0, SIMPLE=1, REGULAR=2 }

  # [Dynamics Modeling]
  processNoiseVar4Loc: 6810.8668    # Process noise variance for bbox center
  processNoiseVar4Size: 1541.8647   # Process noise variance for bbox size
  processNoiseVar4Vel: 1348.4874    # Process noise variance for velocity
  measurementNoiseVar4Detector: 100.0000   # Measurement noise variance for detector's detection
  measurementNoiseVar4Tracker: 150.3238    # Measurement noise variance for tracker's localization

VisualTracker:
  visualTrackerType: 1    # the type of visual tracker among { DUMMY=0, NvDCF=1 }

  # [NvDCF: Feature Extraction]
  useColorNames: 1    # Use ColorNames feature
  useHog: 1    # Use Histogram-of-Oriented-Gradient (HOG) feature
  featureImgSizeLevel: 5    # Size of a feature image. Valid range: {1, 2, 3, 4, 5}, from the smallest to the largest
  featureFocusOffsetFactor_y: -0.1054    # The offset for the center of hanning window relative to the feature height. The center of hanning window would move by (featureFocusOffsetFactor_y*featureMatSize.height) in vertical direction

  # [NvDCF: Correlation Filter]
  filterLr: 0.0767    # learning rate for DCF filter in exponential moving average. Valid Range: [0.0, 1.0]
  filterChannelWeightsLr: 0.0339    # learning rate for the channel weights among feature channels. Valid Range: [0.0, 1.0]
  gaussianSigma: 0.5687    # Standard deviation for Gaussian for desired response when creating DCF filter [pixels]   

ReID:
  reidType: 2    # The type of reid among { DUMMY=0, NvDEEPSORT=1, Reid based reassoc=2, both NvDEEPSORT and reid based reassoc=3}

  # [Reid Network Info]
  batchSize: 100    # Batch size of reid network
  workspaceSize: 1000    # Workspace size to be used by reid engine, in MB
  reidFeatureSize: 512    # Size of reid feature
  reidHistorySize: 512    # Max number of reid features kept for one object
  inferDims: [3,384, 128]    # Reid network input dimension CHW or HWC based on inputOrder
  networkMode: 1    # Reid network inference precision mode among {fp32=0, fp16=1, int8=2 }

  # [Input Preprocessing]
  inputOrder: 0    # Reid network input order among { NCHW=0, NHWC=1 }. Batch will be converted to the specified order before reid input.
  colorFormat: 0    # Reid network input color format among {RGB=0, BGR=1 }. Batch will be converted to the specified color before reid input.
  offsets: [109.1250, 102.6000, 91.3500]   # Array of values to be subtracted from each input channel, with length equal to number of channels
  netScaleFactor: 0.01742919    # Scaling factor for reid network input after substracting offsets
  keepAspc: 1    # Whether to keep aspc ratio when resizing input objects for reid
  #useVPICropScaler: 1 # Use VPI for image cropping and rescaling

  # [Output Postprocessing]
  addFeatureNormalization: 1       # If reid feature is not normalized in network, adding normalization on output so each reid feature has l2 norm equal to 1
  minVisibility4GalleryUpdate: 0.3 # Add ReID embedding to the gallery only if the visibility is not lower than this

  # [Paths and Names]
  onnxFile: "/opt/nvidia/deepstream/deepstream/samples/models/Tracker/ghost_reid.onnx" # NVIDIA TAO model path
  tltModelKey: "nvidia_tao" # NVIDIA TAO model key
  modelEngineFile: "/opt/nvidia/deepstream/deepstream/samples/models/Tracker/ghost_reid.onnx_b100_gpu0_fp16.engine" # Engine file path

Issues faced with NvDCF custom tracker configs:

  • Random Flickering BBOXes
  • ID Swapping between objects of different classes
  • Excessive VRAM Usage when maxTargetsPerStream is over 100 and multiple streams are active
  • No detections with tracker on with frozen frame videos (single frame running in loop as an mp4 / rtsp stream)

please let me know if there is a solution to preserve pgie level accuracy (similar to python .pt performance) and maintain re-id with tracker from deepstream

Please upgrade to the latest DeepStream 9.0 release. We always improve nvtracker accuracy during DeepStream release. Please also try don’t set the inference interval and use the default NvDCF Accuracy config file.

Hi, changing to NvDCF Accuracy file improves the tracking but still is not 1 to 1 to the non tracker output at interval: 2, i tried with interval: 0, it seems better but it slows down the pipeline heavily, and also the track id of the objects besides person ID is not well maintained, and not re-identified accurately. Is there any other way to improve long term tracking accuracy and maintaining re-id for multiple classes (or even just person class) using NvDCF tracker or any other nvidia provided base tracker without affecting performance too much? Overfitting the tracker configs gives random detections too so that isn’t reliable or matching the non tracker output. Please suggest methods to improve performance for re-id and accuracy over skipped frames close to non tracker output with minimal compute overhead if possible. (P.S. I have the entire project setup in Deepstream 8.0 for now, if possible can you suggest all methods of improvement within this setup?) Thank you!

Nvtracker is trying to balance the accuracy and compute resources. The first max_perf config file is to configure the NvDCF tracker to consume the least amount of resources, while the second perf config file is for the use case where a decent balance between performance and accuracy is required. The last accuracy config file is to maximize the accuracy and robustness by enabling most of the features to their full capability, especially the target re-association. You can refer here: Gst-nvtracker — DeepStream documentation. So we also need to trade off between tracking accuracy and compute resources. But latest DeepStream version always improve tracking accuracy. So please upgrade to the latest DeepStream 9.0 release.

Even after shifting to Deepstream 9.0 the performance difference is minimal and the Accuracy config is missing out a lot of detections detected by the Primary GIE, I want to ensure that all the tracked detections are maintained and not lost via the tracker’s config parameters. If possible could you suggest the best tracker configs or parameters to preserve the model’s raw detections and associate reid tracking normally. Im currently using NvDCF_accuracy tracker configs.

Also on enabling Re-ID based tracker configs, it seems like videos with static frame in them (i.e. one frame being played in a loop as an mp4 / rtsp) make the person class track id accuracy really poor. The default tracker (NvDCF_perf) doesn’t remove any person detections in the same input video with a frozen frame, however the one with Re-ID enabled i.e. NvDCF_accuracy.yml seems to have removed / not detected the person class and thus leading to missed detections.

Please address these issues and suggest me the best config parameters to adjust and maintain 1-to-1 mapping of the onnx file pgie detections.

Some of the object is tracking in shadow tracking mode. You can check the shadow tracking target by refer here: Gst-nvtracker — DeepStream documentation. probationAge will remove some bboxes, I found you already set “probationAge: 0” in your configure file.

There is no update from you for a period, assuming this is not an issue anymore. Hence we are closing this topic. If need further support, please open a new one. Thanks.