prominenceai / deepstream-services-library

A shared library of on-demand DeepStream Pipeline Services for Python and C/C++
MIT License
283 stars 64 forks source link

Have DSL support YoloV4,YoloV5 tensorrt models?? #822

Closed Ritesh1991 closed 2 years ago

Ritesh1991 commented 2 years ago

HI have DSl library support Yolov4, YoloV5 versoin of models or not ?

rjhowell44 commented 2 years ago

@Ritesh1991 yes, although I use the nvidia supplied models for all the examples, I think most users are actually using Yolo versions.

@youngjae-avikus I believe you're using YoloV4 ... correct?

YoungjaeDev commented 2 years ago

Yolov3, v4, v5 work well

Ritesh1991 commented 2 years ago

yes right now with yolov4 and tiny yolov4.Thanks for your reply. @youngjae-avikus Do you have any example of yolov4 working with DSL? Can you share it? I have one more question which is different from this thread discussion. How to access USB Camera with DSL? If any example you have then it's very good for me. Thanks in advance

rjhowell44 commented 2 years ago

@Ritesh1991 most of the examples use either a file source or URI source. Any of the examples can easily be updated to use a USB source instead. See dsl_source_usb_new.

rjhowell44 commented 2 years ago

@Ritesh1991 most examples use a primary GIE by defining the paths to the inference config file and model engine file.

# Filespecs for the Primary GIE and IOU Trcaker
primary_infer_config_file = \
    '/opt/nvidia/deepstream/deepstream/samples/configs/deepstream-app/config_infer_primary_nano.txt'
primary_model_engine_file = \
    '/opt/nvidia/deepstream/deepstream/samples/models/Primary_Detector_Nano/resnet10.caffemodel_b8_gpu0_fp16.engine'

The PGIE is then defined as follows

    retval = dsl_infer_gie_primary_new('primary-gie', 
            primary_infer_config_file, primary_model_engine_file, 0)

If you're already using yolov4 then all you need to do is to update the file paths to use your config and model engine files. This should be fairly simple and straight forward.

Ritesh1991 commented 2 years ago

hi Thanks for your reply If i want to use more than 1 usb camera than how to define it with dsl_source_usb_new.

rjhowell44 commented 2 years ago

That's a good question @Ritesh1991. It looks like I need to provide services to get/set the device location which defaults to /dev/video0 ... see documentation on the v4l2src plugin https://gstreamer.freedesktop.org/documentation/video4linux2/v4l2src.html#v4l2src:device.

I will add a new issue for this.

Ritesh1991 commented 2 years ago

thanks for your reply. add service also for multiple csi cameras.

rjhowell44 commented 2 years ago

@Ritesh1991 I've merged updates into the v0.26.alpha dev branch that should allow you to create multiple CSI and USB Camera Sources... please see the update documentation/rules

I only have one of each type at the moment. I'll be ordering some new ones soon for more testing. Until then, if you could try the updates and let me know how they work for you I'd appreciate it.

Ritesh1991 commented 2 years ago

I dont have csi cameras but I have several USB cameras. I will test it and let you know

Ritesh1991 commented 2 years ago

Hi I tested with multiple cameras but with set property as well as without set property. But It always take input from first camera and ignore 2nd camera.

I tried with 2uri_file_pgie_ktl_demuxer_1osd_1overlay_1window.py in this example i replace two uri source with two cameras but it wouldnt worked it show only one camera frames on display and not 2nd one Then after i trie with dyn source example in that I assigned first source as camera, then next source uri but it only shows the first camera source and then after no update when dynamically added of the source.

This is my observation upto now. let me know if i am doing anything wrong Thanks .

rjhowell44 commented 2 years ago

@Ritesh1991 could I ask you to run a simple test with two USB cameras while capturing a log. First, could you type in the following to see how they enumerate. $ ls /dev/video*

Then, set the debug output to a file $ export GST_DEBUG_FILE=./output.txt then set the logging output level with the below - this sets the DSL logging level to info. $ export GST_DEBUG=1,DSL:4 ... run your example and then send me the file I should have more cameras in a couple of days, but If you can send this I would very much appreciate it.

(edit) enter the following to reset the logging output to the console $ export GST_DEBUG_FILE=

Ritesh1991 commented 2 years ago

I modified below attached file and i Got result as in output.log file both the cameras connected i check it with ls /dev/video* [output.log](https://github.com/prominenceai/deepstream- 1uri_file_pgie_ktl_tiler_osd_window_h265_mp4.zip services-library/files/9667777/output.log I think camera initialization issue

(edit) https://github.com/prominenceai/deepstream-services-library/files/9667777/output.log

rjhowell44 commented 2 years ago

@Ritesh1991 Is there a chance that something else is running that might be accessing the camera?

Ritesh1991 commented 2 years ago

No, because I freshly flash jetson nano with a new image, install deep stream library and dependency. No other thing or application is running that accesses camera. As well as I also used the command fuser /dev/video0 and fuser /dev/video1 for checking which application accessing or using camera but I didn't find anything with it.

Have you checked the python file in which I made changes, did I modify it correctly? Or you can give me some sample code that I can test it

rjhowell44 commented 2 years ago

@Ritesh1991 I've merged a change into the v0.26.alpha branch that should fix the problem with the constructor. You can remove the call to set the device-location.

There was one mistake in the script

        retval = dsl_source_usb_device_location_set('uri-source1', '/dev/video1')
        retval = dsl_source_usb_new('uri-source1', source_width, source_height, 25, 1)

You would need to create the source first, then update its device-location.

The above is failing which you can see in the log

DSL src/DslServicesSource.cpp:202:SourceUsbDeviceLocationSet:  : Component name 'uri-source1' was not found

But there should be no need to set it with the fix I've merged in.

Ritesh1991 commented 2 years ago

`retval = dsl_source_usb_new('uri-source0', source_width, source_height, 25, 1) if retval != DSL_RETURN_SUCCESS: break

retval = dsl_source_usb_new('uri-source1', source_width, source_height, 25, 1) if retval != DSL_RETURN_SUCCESS: break ` this will work after download in recompile correct ?

rjhowell44 commented 2 years ago

@Ritesh1991 yes, it should. Normally, I would fully test before merging, but don't want to hold you up

Ritesh1991 commented 2 years ago

Thanks for this. These how we all thrive by helping each other

rjhowell44 commented 2 years ago

@Ritesh1991 did it work for you?

Ritesh1991 commented 2 years ago

yes it worked and I m doing more testing. Thanks for asking