In docker, can not open camerra, even i run "--device=/dev/video0"

i was run yolov5 with docker in my jetson tx2, the following is my command:

sudo docker run
-id
–name=camera_test
–network host
–device=/dev/video0
–runtime nvidia
-w /home/yolo
-v ~/Desktop/yolov5_5.0:/home/yolo
-v /tmp/.X11-unix:/tmp/.X11-unix
-e DISPLAY=:0.0
-e GDK_SCALE
-e GDK_DPI_SCALE
nvcr.io/nvidia/l4t-ml:r32.6.1-py3

and then i install cheese , and run cheese, but is show


the error message is:
(cheese:2126): GLib-GIO-CRITICAL **: 10:30:20.855: g_dbus_proxy_new_sync: assertion ‘G_IS_DBUS_CONNECTION (connection)’ failed

(cheese:2126): Gtk-WARNING **: 10:30:21.425: Theme parsing error: cheese.css:7:35: The style property GtkScrollbar:min-slider-length is deprecated and shouldn’t be used anymore. It will be removed in a future version
** Message: 10:30:22.127: cheese-application.vala:211: Error during camera setup: No device found

(cheese:2126): cheese-CRITICAL **: 10:30:22.275: cheese_camera_device_get_name: assertion ‘CHEESE_IS_CAMERA_DEVICE (device)’ failed

(cheese:2126): GLib-CRITICAL **: 10:30:22.275: g_variant_new_string: assertion ‘string != NULL’ failed

(cheese:2126): GLib-CRITICAL **: 10:30:22.276: g_variant_ref_sink: assertion ‘value != NULL’ failed

(cheese:2126): GLib-GIO-CRITICAL **: 10:30:22.276: g_settings_schema_key_type_check: assertion ‘value != NULL’ failed

(cheese:2126): GLib-CRITICAL **: 10:30:22.276: g_variant_get_type_string: assertion ‘value != NULL’ failed

(cheese:2126): GLib-GIO-CRITICAL **: 10:30:22.276: g_settings_set_value: key ‘camera’ in ‘org.gnome.Cheese’ expects type ‘s’, but a GVariant of type ‘(null)’ was given

(cheese:2126): GLib-CRITICAL **: 10:30:22.276: g_variant_unref: assertion ‘value != NULL’ failed

** (cheese:2126): CRITICAL **: 10:30:22.276: cheese_preferences_dialog_setup_resolutions_for_device: assertion ‘device != NULL’ failed

(cheese:2126): dconf-WARNING **: 10:30:22.279: failed to commit changes to dconf: Failed to execute child process ?dbus-launch? (No such file or directory)

how to solve thie problem?

hi, add some information
my device is jetson TX2 nx,
jetpack:4.6.4
the camera is USBcamera, not csi camera

if i run “ls /dev/video*”, i can get “/dev/video0”
but cheese can not finnd device

I’d appreciate it if anyone could help me

Hi,

Does the camera work outside of the container?
Thanks.

Hi, thanks for your replay!

The camera works outside the container

Hi, Add some information

this picture is outside the container

this picture is in the container

Hi,

It looks like the camera mounted is correct.
Would you mind validating this by running the GStreamer command inside the container?

If it works well, the cause should come from the cheese.

Thanks.

sure, how should i do?

But when i run yolov5 in docker, i get the following error:

you are right!

I run this command: gst-launch-1.0 v4l2src device=/dev/video0 ! image/jpeg,width=1280,height=720,framerate=30/1 ! jpegdec ! videoconvert ! xvimagesink

And i got images!
Seems to be cheese’s problem

Actully, my real problem as above, when i run yolov5 detect.py, it can not run sucessful

Do you know the cause of the problem?

Anyway, I was appreciate for you replay!

I get reason!

It was not about docker or others

It was yolo’s problem

should change files: utils–>datasets.py
line 280:

original:
if ‘youtube.com/’ in url or ‘youtu.be/’ in url: # if source is YouTube video
modified:
if ‘youtube.com/’ in str(url) or ‘youtu.be/’ in str(url): # if source is YouTube video

Then it’s work succeed

Thanks~
This topic can close

I have some question:

  1. If I want to learn this knowledge systematically, is there any guidance?
    (about nvidia-container)

  2. I was use x11 foword display frames, but it was frame drops, do you have solution?

Hi,

We provide several examples in the below repo.
Please give it a check: GitHub - dusty-nv/jetson-containers: Machine Learning Containers for NVIDIA Jetson and JetPack-L4T

Please monitor the device status with sudo tegrastats first.
If the GPU utilization is full (99%), this might be the hardware limitation (device capability).

Thanks.