Comments (8)
Hi @abuelgasimsaadeldin, thank you for the reporting, but I think this is not a docker problem. This problem seems to be CSI on Jetson platform problem. Anyway I'd like to solve this problem. Thanks.
from dockerfile-yolov5-jetson.
Awesome! thanks allot, will test it out soon.
from dockerfile-yolov5-jetson.
Hi @otamajakusi, sorry my bad for not realizing that, it worked great after adding -v /tmp/argus_socket:/tmp/argus_socket
. Thanks!
from dockerfile-yolov5-jetson.
see https://github.com/JetsonHacksNano/CSI-Camera
$ python3 simple_camera.py
works fine on the host environment, but doesn't work on the container environment.
GStreamer seems to be supported on the host environment, but does not on the container environment.
Opencv build seems to be required on the container environment.
from dockerfile-yolov5-jetson.
how do opencv build on the container environment?
from dockerfile-yolov5-jetson.
77c133a supports CSI camera.
But please make sure yolov5 with CSI camera requires yolov5 modification like this:
diff --git a/utils/datasets.py b/utils/datasets.py
index 43e4e59..14fa5c9 100755
--- a/utils/datasets.py
+++ b/utils/datasets.py
@@ -280,7 +280,35 @@ class LoadStreams: # multiple IP or RTSP cameras
import pafy
s = pafy.new(s).getbest(preftype="mp4").url # YouTube URL
s = eval(s) if s.isnumeric() else s # i.e. s = '0' local webcam
- cap = cv2.VideoCapture(s)
+
+ def gstreamer_pipeline(
+ capture_width=1280,
+ capture_height=720,
+ display_width=1280,
+ display_height=720,
+ framerate=60,
+ flip_method=0,
+ ):
+ return (
+ "nvarguscamerasrc ! "
+ "video/x-raw(memory:NVMM), "
+ "width=(int)%d, height=(int)%d, "
+ "format=(string)NV12, framerate=(fraction)%d/1 ! "
+ "nvvidconv flip-method=%d ! "
+ "video/x-raw, width=(int)%d, height=(int)%d, format=(string)BGRx ! "
+ "videoconvert ! "
+ "video/x-raw, format=(string)BGR ! appsink"
+ % (
+ capture_width,
+ capture_height,
+ framerate,
+ flip_method,
+ display_width,
+ display_height,
+ )
+ )
+
+ cap = cv2.VideoCapture(gstreamer_pipeline(flip_method=0), cv2.CAP_GSTREAMER)
assert cap.isOpened(), f'Failed to open {s}'
w = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
h = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
from dockerfile-yolov5-jetson.
Hi @otamajakusi, I have just tested out the new Dockerfile with CSI Camera support. I built the Dockerfile and made the changes as mentioned above to datasets.py as shown in my image below:
I then proceeded to mount the new folder "utils" which is located locally (with the changes made to datasets.py) to the docker container using the "--volume" command (I verified in the container that the datasets.py had been updated successfully).
Finally when trying to run the "run.sh" script, I ran into the following error message:
Fusing layers...
Model Summary: 224 layers, 7266973 parameters, 0 gradients
Gtk-Message: 06:44:03.233: Failed to load module "canberra-gtk-module"
(test:1): GStreamer-WARNING **: 06:44:03.459: External plugin loader failed. This most likely means that the plugin loader helper binary was not found or could not be run. You might need to set the GST_PLUGIN_SCANNER environment variable if your setup is unusual. This should normally not be required though.
(Argus) Error FileOperationFailed: Connecting to nvargus-daemon failed: No such file or directory (in src/rpc/socket/client/SocketClientDispatch.cpp, function openSocketConnection(), line 201)
(Argus) Error FileOperationFailed: Cannot create camera provider (in src/rpc/socket/client/SocketClientDispatch.cpp, function createCameraProvider(), line 102)
Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, execute:639 Failed to create CameraProvider
(test:1): GStreamer-CRITICAL **: 06:44:09.303: gst_mini_object_set_qdata: assertion 'object != NULL' failed
[ WARN:0] global /tmp/pip-req-build-bn4gnwkh/opencv/modules/videoio/src/cap_gstreamer.cpp (1081) open OpenCV | GStreamer warning: Cannot query video position: status=0, value=-1, duration=-1
1/1: 0... success (1280x720 at 60.00 FPS).
Traceback (most recent call last):
File "detect.py", line 183, in <module>
detect(opt=opt)
File "detect.py", line 52, in detect
dataset = LoadStreams(source, img_size=imgsz, stride=stride)
File "/yolov5/utils/datasets.py", line 325, in _init_
s = np.stack([letterbox(x, self.img_size, stride=self.stride)[0].shape for x in self.imgs], 0) # shapes
File "/yolov5/utils/datasets.py", line 325, in <listcomp>
s = np.stack([letterbox(x, self.img_size, stride=self.stride)[0].shape for x in self.imgs], 0) # shapes
File "/yolov5/utils/datasets.py", line 852, in letterbox
shape = img.shape[:2] # current shape [height, width]
AttributeError: 'NoneType' object has no attribute 'shape'
Your help in solving this issue would be highly appreciated.
best,
Abu
from dockerfile-yolov5-jetson.
@abuelgasimsaadeldin
Sorry for the lack of comments, but -v /tmp/argus_socket:/tmp/argus_socket
is required to use CSI camera (=gstreamer support) for docker run command.
Please check run-csi-camera.sh
from dockerfile-yolov5-jetson.
Related Issues (14)
- jetpack 4.5 support HOT 2
- Dockerfile Failed to clone 'opencv_extra' at step 15/19 HOT 2
- Purpose of the Dockerfile Base Image if we are installing torch and torchvision? HOT 4
- Is it possible to reduce launch time? HOT 4
- OCI runtime create failed: HOT 2
- Build.sh complains about unknown JetPack version even though I'm on 4.6 HOT 2
- ImportError: /usr/lib/aarch64-linux-gnu/libgomp.so.1: cannot allocate memory in static TLS block HOT 7
- Wrong Python Version HOT 5
- [SOLVED] docker: unknown server OS: .
- RuntimeError: CUDA error: device kernel image is invalid HOT 13
- Run Yolov5 on host environment instead of container HOT 2
- Cannot run yolov5 on Python3.6 HOT 2
- Jetsonnano + YOLOv5 could not work on python 3.6.9 HOT 16
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dockerfile-yolov5-jetson.