Questions about deepstream plugin dewarper and nvanalytics

I have 4 fisheye cameras, now I use nvdewarper plugin to dewarp my image into two surfaces, then these surfaces (2*4)downstream to streammux->infer->track->analytics, but analytics plugin analyse stream not per surface.I want to set different ways to analyse different surfaces in one frame.

Thank you for your answer!

Hey, could you also share your setup with us?

Thank you for your reply.
This is my dewarper config:

[property]
#dewarp-dump-frames=10
num-batch-buffers=2
#aisle-calibration-file property is getting used in case of deepstream-360d-app,
#if set below properties under group [surfaceX] will be ignored
#aisle-calibration-file=csv_files/nvaisle_2M.csv
#spot-calibration-file property is getting used in case of deepstream-360d-app,
#if set below properties under group [surfaceX] will be ignored
#spot-calibration-file=csv_files/nvspot_2M.csv
#########################################
#Note - Max 4 surfaces are supported
#########################################
[surface0]
#1=PushBroom, 2=VertRadCyl
projection-type=2
surface-index=0
#dewarped surface parameters
width=1902
height=1500
top-angle=80
bottom-angle=3
pitch=0
yaw=0
roll=318
focal-length=600
[surface1]
#1=PushBroom, 2=VertRadCyl
projection-type=2
surface-index=1
#dewarped surface parameters
width=1902
height=1500
top-angle=95
bottom-angle=10
pitch=0
yaw=0
roll=138
focal-length=600

This is my analytics config:

[property]
enable=1
#Width height used for configuration to which below configs are configured
config-width=1920
config-height=1080
#osd-mode 0: Dont display any lines, rois and text
#1: Display only lines, rois and static text i.e. labels
#2: Display all info from 1 plus information about counts
osd-mode=2
#Set OSD font size that has to be displayed
display-font-size=12
#Entry config in camera0
[line-crossing-stream-0]
enable=1
#Label;direction;lc
line-crossing-Entry=1066;250;1071;268;1273;258;743;251
line-crossing-Exit=1000;255;985;233;738;238;1250;240
class-id=0
#extended when 0- only counts crossing on the configured Line
#1- assumes extended Line crossing counts all the crossing
extended=0
#LC modes supported:
#loose : counts all crossing without strong adherence to direction
#balanced: Strict direction adherence expected compared to mode=loose
#strict : Strict direction adherence expected compared to mode=balanced
mode=loose

This is whole config:

[application]
enable-perf-measurement=1
perf-measurement-interval-sec=5
#gie-kitti-output-dir=streamscl
[tiled-display]
enable=1
rows=2
columns=2
width=1920
height=1080
gpu-id=0
#(0): nvbuf-mem-default - Default memory allocated, specific to particular platform
#(1): nvbuf-mem-cuda-pinned - Allocate Pinned/Host cuda memory, applicable for Tesla
#(2): nvbuf-mem-cuda-device - Allocate Device cuda memory, applicable for Tesla
#(3): nvbuf-mem-cuda-unified - Allocate Unified cuda memory, applicable for Tesla
#(4): nvbuf-mem-surface-array - Allocate Surface Array memory, applicable for Jetson
nvbuf-memory-type=0
[dewarper0]
#for different source dewarper
enable=1
#config-file=config_dewarper_perspective56.txt
config-file=config_dewarper_VertRadCyl56.txt
[dewarper3]
enable=0
#config-file=config_dewarper_perspective57.txt
config-file=config_dewarper_VertRadCyl57.txt
[dewarper2]
enable=0
#config-file=config_dewarper_perspective58.txt
config-file=config_dewarper_VertRadCyl58.txt
[dewarper1]
enable=1
#config-file=config_dewarper_perspective59.txt
config-file=config_dewarper_VertRadCyl59.txt
[source0]
enable=1
#Type - 1=CameraV4L2 2=URI 3=MultiURI
type=2
#uri=file:///tmp/vlab_agv/video/sample_720p.mp4
uri=rtsp://admin:password@103.0.180.56/cam/realmonitor?channel=1&subtype=0
num-sources=1
gpu-id=0
#(0): memtype_device - Memory type Device
#(1): memtype_pinned - Memory type Host Pinned
#(2): memtype_unified - Memory type Unified
cudadec-memtype=0
[source1]
enable=1
#Type - 1=CameraV4L2 2=URI 3=MultiURI
type=2
#uri=file:///tmp/vlab_agv/video/sample_720p1.mp4
uri=rtsp://admin:password@103.0.180.57/cam/realmonitor?channel=1&subtype=0
num-sources=1
gpu-id=0
#(0): memtype_device - Memory type Device
#(1): memtype_pinned - Memory type Host Pinned
#(2): memtype_unified - Memory type Unified
cudadec-memtype=0
[source2]
enable=1
#Type - 1=CameraV4L2 2=URI 3=MultiURI
type=2
#uri=file:///tmp/vlab_agv/video/sample_720p2.mp4
uri=rtsp://admin:password@103.0.180.58/cam/realmonitor?channel=1&subtype=0
num-sources=1
gpu-id=0
#(0): memtype_device - Memory type Device
#(1): memtype_pinned - Memory type Host Pinned
#(2): memtype_unified - Memory type Unified
cudadec-memtype=0
[source3]
enable=1
#Type - 1=CameraV4L2 2=URI 3=MultiURI
type=2
#uri=file:///tmp/vlab_agv/video/sample_720p3.mp4
uri=rtsp://admin:password@103.0.180.59/cam/realmonitor?channel=1&subtype=0
num-sources=1
gpu-id=0
#(0): memtype_device - Memory type Device
#(1): memtype_pinned - Memory type Host Pinned
#(2): memtype_unified - Memory type Unified
cudadec-memtype=0
[sink0]
enable=1
#Type - 1=FakeSink 2=EglSink 3=File
type=2
sync=0
source-id=0
gpu-id=0
nvbuf-memory-type=0
[sink1]
enable=1
#Type - 1=FakeSink 2=EglSink 3=File 4=UDPSink 5=nvoverlaysink 6=MsgConvBroker
type=6
msg-conv-config=dstest5_msgconv_sample_config.txt
#(0): PAYLOAD_DEEPSTREAM - Deepstream schema payload
#(1): PAYLOAD_DEEPSTREAM_MINIMAL - Deepstream schema payload minimal
#(256): PAYLOAD_RESERVED - Reserved type
#(257): PAYLOAD_CUSTOM - Custom schema payload
msg-conv-payload-type=257
msg-broker-proto-lib=/opt/nvidia/deepstream/deepstream-5.0/lib/libnvds_kafka_proto.so
#Provide your msg-broker-conn-str here
msg-broker-conn-str=103.0.180.66;9092
topic=deepstream-app-vlab
#disable-msgconv=1
[osd]
enable=1
gpu-id=0
border-width=1
text-size=15
text-color=1;1;1;1;
text-bg-color=0.3;0.3;0.3;1
font=Serif
show-clock=0
clock-x-offset=800
clock-y-offset=820
clock-text-size=12
clock-color=1;0;0;0
nvbuf-memory-type=0
[streammux]
gpu-id=0
##Boolean property to inform muxer that sources are live
live-source=1
num-surfaces-per-frame=2
batch-size=8
##time out in usec, to wait after the first buffer is available
##to push the batch even if the complete batch is not formed
batched-push-timeout=40000
##Set muxer output width and height
width=1920
height=1080
##Enable to maintain aspect ratio wrt source, and allow black borders, works
##along with width, height properties
enable-padding=0
nvbuf-memory-type=0
#config-file property is mandatory for any gie section.
#Other properties are optional and if set will override the properties set in
#the infer config file.
[primary-gie]
enable=1
gpu-id=0
#model-engine-file=model_b1_gpu0_int8.engine
#labelfile-path=labels.txt
batch-size=1
#Required by the app for OSD, not a plugin property
bbox-border-color0=1;0;0;1
bbox-border-color1=0;1;1;1
bbox-border-color2=0;0;1;1
bbox-border-color3=0;1;0;1
interval=2
gie-unique-id=1
nvbuf-memory-type=0
#config-file=/opt/nvidia/deepstream/deepstream-5.0/sources/objectDetector_YoloV4/config_infer_primary_yoloV4.txt
config-file=/opt/nvidia/deepstream/deepstream-5.0/sources/objectDetector_Yolo.orig/config_infer_primary_yoloV3.txt
[tracker]
enable=1
tracker-width=640
tracker-height=384
ll-lib-file=/opt/nvidia/deepstream/deepstream-5.0/lib/libnvds_mot_klt.so
[nvds-analytics]
enable=1
config-file=config_nvdsanalytics.txt
[img-save]
enable=0
output-folder-path=/tmp/vlab_agv/
save-img-full-frame=1
#save-img-cropped-obj
frame-to-skip-rules-path=/tmp/vlab_agv/
#second-to-skip-interval
min-confidence=0.5
#max-confidence
min-box-width=1
#min-box-height
[tests]
file-loop=0

My question is:
I dewarp my image into 2 surfaces, how can I apply different analytics ways to per surface?
Config above just apply same way to both surfaces. It’s not what I expected

Thank you, I will be waiting for your reply!

Sorry for the late, I think stream-n should be for surface-n, have you tried that and met some issues?

Thank you for your reply very much!
I try to replace stream-n with surface-n. it does not work. I read the document about nvanalytics gst-nvanalytics.It seems to have different strategies for handling different streams, but don’t have different strataegies for different surfaces in one stream. You know, in plugin “gst-nvdewarpper”, it can handle one video up to 4 surfaces. I want to use “gst-nvanalytics” after that and apply different strategies for different surfaces. How can I do for this?

No, it shuold be stream-n instead of surface-n, I mean when dewaper divided one stream to 4 sufaces, when you set stream-n, it should work per surface.

Thank you for your reply.

I know the usage of stream-n. I just want to apply different strategies to different surfaces which are divided from one stream.

Hi, I have the same problem described by the OP. When I use the dewarper together with nvdsanalytics, the same lines are applied to each surface of a specific source, even if the analytics plugin config file contains multiple sources and lines. Is there any way to make the dewarped surfaces act as individual sources to be able to map them to the analytics config file?

I attached an image describing the problem.

Thanks!

Hi, I have the same problem too.
I think the point is make n-surfaces to n-streams.
But, is there no plugins to do this, right?

I tried insert “tee” command before “nvdewarper” to branch a input-stream
and dewarp each stream with set “num-batch-buffers=1”.
The dewarped parameters set the above one surface parameter to one branched-stream.
(e.g. Stream1 dewarper set prms equivalent to [surface0], also Stream2 set [surface1] as [surface0) at another config txtfile.)
After that, mux and analyze each stream.

It seems work well, but latency is increased.
I think it is because of memory copy of large-size input-stream by “tee”.

Is there any smart way without wasted memory copy?

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

Could you share your pipeline with us, I think nvstreammux will generate a batch from the output of dewaper plugin, so the surface will act as a stream, would you mind to share a simple repro with us if it cannot work.

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