Running Yolov5 on Deepstream with USB Camera

Hi
I’m using deepstream 6.0 to run the Tolov5 model like this repo on GitHub. (DeepStream-Yolo)
when I run this command:
deepstream-app -c deepstream_app_config.txt
model runs entirely but on the sample video in deepstreame video samples.
I want to use USB Camera (Logitech C615).
I don’t have an IP Camera and…
the device address is: /dev/video1
here Is my config file:

[application]
enable-perf-measurement=1
perf-measurement-interval-sec=5

[tiled-display]
enable=1
rows=1
columns=1
width=1280
height=720
gpu-id=0
nvbuf-memory-type=0

[source0]
enable=1
type=3
uri=file:///opt/nvidia/deepstream/deepstream/samples/streams/sample_1080p_h264.mp4
#uri=rtsp://deep:deep@127.0.0.1:8080/dev/video1
num-sources=1
gpu-id=0
cudadec-memtype=0

[sink0]
enable=1
type=2
sync=0
gpu-id=0
nvbuf-memory-type=0

[osd]
enable=1
gpu-id=0
border-width=5
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
live-source=0
batch-size=1
batched-push-timeout=40000
width=1920
height=1080
enable-padding=0
nvbuf-memory-type=0

[primary-gie]
enable=1
gpu-id=0
gie-unique-id=1
nvbuf-memory-type=0
config-file=config_infer_primary_yoloV5.txt

[tests]
file-loop=0

You can try to use the v4l2 source in your config file:

[source0]
enable=1
#Type - 1=CameraV4L2 2=URI 3=MultiURI
type=1
camera-width=640
camera-height=480
camera-fps-n=30
camera-fps-d=1
camera-v4l2-dev-node=0

@yuweiw
thanks for your response
I’m trying to add these configs to my file, but it doesn’t work.
shows me a blank black screen and then, gives me this error:

** INFO: <bus_callback:160>: incorrect camera parameters provided, please provide supported resolution and frame rate

** INFO: <bus_callback:180>:Pipeline running

** INFO: <bus_callback:218>:Recieve EOS. Exiting ...

Quitting
App run failed

You need to modify the relevant parameters based on your own camera, like camera-width=xxx camera-height=xxx camera-fps-n=xxx camera-v4l2-dev-node=xxx.

@yuweiw
seems he can’t find the camera.
It says to me:
ERROR from src-elem: Internal data stream error
how can I get these parameters of my camera ?!
here is my camera information:
command: v4lt2-ctl --device=/dev/video1 --all

Driver Info (not using libv4l2):
	Driver name   : uvcvideo
	Card type     : HD Webcam C615
	Bus info      : usb-70090000.xusb-3.4
	Driver version: 4.9.255
	Capabilities  : 0x84200001
		Video Capture
		Streaming
		Extended Pix Format
		Device Capabilities
	Device Caps   : 0x04200001
		Video Capture
		Streaming
		Extended Pix Format
Priority: 2
Video input : 0 (Camera 1: ok)
Format Video Capture:
	Width/Height      : 1280/720
	Pixel Format      : 'MJPG'
	Field             : None
	Bytes per Line    : 0
	Size Image        : 1843200
	Colorspace        : sRGB
	Transfer Function : Default (maps to sRGB)
	YCbCr/HSV Encoding: Default (maps to ITU-R 601)
	Quantization      : Default (maps to Full Range)
	Flags             : 
Crop Capability Video Capture:
	Bounds      : Left 0, Top 0, Width 1280, Height 720
	Default     : Left 0, Top 0, Width 1280, Height 720
	Pixel Aspect: 1/1
Selection: crop_default, Left 0, Top 0, Width 1280, Height 720
Selection: crop_bounds, Left 0, Top 0, Width 1280, Height 720
Streaming Parameters Video Capture:
	Capabilities     : timeperframe
	Frames per second: 30.000 (30/1)
	Read buffers     : 0
                     brightness 0x00980900 (int)    : min=0 max=255 step=1 default=128 value=128
                       contrast 0x00980901 (int)    : min=0 max=255 step=1 default=32 value=32
                     saturation 0x00980902 (int)    : min=0 max=255 step=1 default=32 value=32
 white_balance_temperature_auto 0x0098090c (bool)   : default=1 value=1
                           gain 0x00980913 (int)    : min=0 max=255 step=1 default=64 value=63
           power_line_frequency 0x00980918 (menu)   : min=0 max=2 default=2 value=2
      white_balance_temperature 0x0098091a (int)    : min=2800 max=6500 step=1 default=4000 value=5868 flags=inactive
                      sharpness 0x0098091b (int)    : min=0 max=255 step=1 default=22 value=22
         backlight_compensation 0x0098091c (int)    : min=0 max=1 step=1 default=1 value=1
                  exposure_auto 0x009a0901 (menu)   : min=0 max=3 default=3 value=3
              exposure_absolute 0x009a0902 (int)    : min=3 max=2047 step=1 default=166 value=332 flags=inactive
         exposure_auto_priority 0x009a0903 (bool)   : default=0 value=1
                   pan_absolute 0x009a0908 (int)    : min=-36000 max=36000 step=3600 default=0 value=0
                  tilt_absolute 0x009a0909 (int)    : min=-36000 max=36000 step=3600 default=0 value=0
                 focus_absolute 0x009a090a (int)    : min=0 max=255 step=17 default=51 value=68 flags=inactive
                     focus_auto 0x009a090c (bool)   : default=1 value=1
                  zoom_absolute 0x009a090d (int)    : min=1 max=5 step=1 default=1 value=1

I set every parameter in the config file compatible with the camera setting, such as width and height, and fps.
but I still get this error and don’t run…

@DaneLLL
I see this topic and I get how can I connect to IP Cameras.
but here I want to use USB Cameras that I tell above.
but it doesn’t work…
can you help me?

From the info you attached, you connect your camera to /dev/video1. Could you try the parameters below:

[source0]
enable=1
#Type - 1=CameraV4L2 2=URI 3=MultiURI
type=1
camera-width=1280
camera-height=720
camera-fps-n=30
camera-fps-d=1
camera-v4l2-dev-node=1

@yuweiw
@DaneLLL
I paste this on my config file but I get this error:

0:01:58.534404971  8432     0x2786c6a0 INFO                 nvinfer gstnvinfer_impl.cpp:313:notifyLoadModelStatus:<primary_gie> [UID 1]: Load new model:/home/deep/Projects/DeepStream-Yolo/config_infer_primary_yoloV5.txt sucessfully

Runtime commands:
	h: Print this help
	q: Quit

	p: Pause
	r: Resume

NOTE: To expand a source in the 2D tiled display and view object details, left-click on the source.
      To go back to the tiled display, right-click anywhere on the window.


**PERF:  FPS 0 (Avg)	
**PERF:  0.00 (0.00)	
** INFO: <bus_callback:194>: Pipeline ready

** INFO: <bus_callback:180>: Pipeline running

ERROR from src_elem: Internal data stream error.
Debug info: gstbasesrc.c(3055): gst_base_src_loop (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin0/GstV4l2Src:src_elem:
streaming stopped, reason not-negotiated (-4)
** INFO: <bus_callback:160>: incorrect camera parameters provided, please provide supported resolution and frame rate

** INFO: <bus_callback:217>: Received EOS. Exiting ...

Quitting
App run failed

it still doesn’t work…
Everything is ok when I run on sample movie…

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

From the log attached, the parameters from your camera is still wrong. You can confirm it again and fill in the correct parameters. You can refer to the our open source code:

samples\configs\deepstream-app\source1_usb_dec_infer_resnet_int8.txt

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