Object Clustering using DBSCAN in Deepstream

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU): Triton Inference Server
• DeepStream Version Deepstream 5.1

I am doing crowd detection for a video. Using deepstream_nvdsanalytics.py as a base. I have added cluster_mode=1 in config file.

Now i dont understand how will i receive the information related to object cluster in python program.

I dont see any difference with and without seting the cluster mode in the config file.

Any example which can help me understand how clustering information can be retrieved. Would like to draw bounding box over the clusters detected in the sample video. (Clusters of more than 2 people together)

Please refer: Gst-nvinfer — DeepStream 6.1 Release documentation (nvidia.com)

Thanks for the reply, i have gone through the documentation. i would like to know how to change the color property for the rectangle returned as a cluster so that i can differentiate between the cluster and person detection.

Any example would be of great help.

I am hereby attaching a output video that i get after setting cluster parameters on a sample video provided in deepstream sdk

I am using deepstream_nvdsanalytics.py and sample video ///opt/nvidia/deepstream/deepstream-5.1/samples/streams/sample_720p.mp4

Config file is as below

################################################################################
# Copyright (c) 2018-2021, NVIDIA CORPORATION. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
################################################################################

# Following properties are mandatory when engine files are not specified:
#   int8-calib-file(Only in INT8)
#   Caffemodel mandatory properties: model-file, proto-file, output-blob-names
#   UFF: uff-file, input-dims, uff-input-blob-name, output-blob-names
#   ONNX: onnx-file
#
# Mandatory properties for detectors:
#   num-detected-classes
#
# Optional properties for detectors:
#   cluster-mode(Default=Group Rectangles), interval(Primary mode only, Default=0)
#   custom-lib-path
#   parse-bbox-func-name
#
# Mandatory properties for classifiers:
#   classifier-threshold, is-classifier
#
# Optional properties for classifiers:
#   classifier-async-mode(Secondary mode only, Default=false)
#
# Optional properties in secondary mode:
#   operate-on-gie-id(Default=0), operate-on-class-ids(Defaults to all classes),
#   input-object-min-width, input-object-min-height, input-object-max-width,
#   input-object-max-height
#
# Following properties are always recommended:
#   batch-size(Default=1)
#
# Other optional properties:
#   net-scale-factor(Default=1), network-mode(Default=0 i.e FP32),
#   model-color-format(Default=0 i.e. RGB) model-engine-file, labelfile-path,
#   mean-file, gie-unique-id(Default=0), offsets, process-mode (Default=1 i.e. primary),
#   custom-lib-path, network-mode(Default=0 i.e FP32)
#
# The values in the config file are overridden by values set through GObject
# properties.

[property]
gpu-id=0
net-scale-factor=0.0039215697906911373
model-file=../../../../samples/models/Primary_Detector/resnet10.caffemodel
proto-file=../../../../samples/models/Primary_Detector/resnet10.prototxt
model-engine-file=../../../../samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine
labelfile-path=../../../../samples/models/Primary_Detector/labels.txt
int8-calib-file=../../../../samples/models/Primary_Detector/cal_trt.bin
force-implicit-batch-dim=1
batch-size=1
process-mode=1
model-color-format=0
network-mode=1
num-detected-classes=4
interval=0
gie-unique-id=1
output-blob-names=conv2d_bbox;conv2d_cov/Sigmoid
cluster-mode=1

[class-attrs-all]
pre-cluster-threshold=0.7
eps=0.4
group-threshold=1
dbscan-min-score=0.3
minBoxes=3
threshold=0.5

i dont see any clusters and also the output video is completely distorted. Kindly help

What is your expected result?

i want to find groups of people any where in the frame. Like three or more people standing/moving together has to be detected as a cluster.

How do i do this using dbscan algorithm on the above sample video

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

Please refer: Gst-nvinfer — DeepStream 6.1 Release documentation (nvidia.com). DBSCAN is clustering algorithm which remove overlay bound box. I think it isn’t what your needed.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.