Git Product home page Git Product logo

dockerfile-yolov5-jetson's Introduction

Hi there ๐Ÿ‘‹

mahjong yaku detection app


About Me

skils = {
  code: ['C', 'Python'],
  also_code : ['Javascript', 'C++', 'Ruby', 'dart'],
  love: ['security', 'machine learning', 'computer vision'],
  where: ['server side', 'embedded']
  os: ['linux', 'windows', 'OSX'],
  medium : 'https://medium.com/@hiroyuki.obinata',
}

My GitHub Stats

otamajakusi

dockerfile-yolov5-jetson's People

Contributors

otamajakusi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

dockerfile-yolov5-jetson's Issues

jetpack 4.5 support

Hey thanks for publishing this, awesome work! Because jetpack 4.5 is now I got an issue with the current dockerfile, but changing the first line to nvcr.io/nvidia/l4t-pytorch:r32.5.0-pth1.6-py3 fixed this.

OCI runtime create failed:

Hello,

I am trrying to run the docker on a Jetson Xavier NX, with jetpack 4.6

I get this error
nvidia@nvidia-desktop:~/dockerfile-yolov5-jetson$ ./build.sh Sending build context to Docker daemon 144.9kB Step 1/20 : FROM nvcr.io/nvidia/l4t-base:r32.5.0 ---> d9141f00a2c3 Step 2/20 : ENV DEBIAN_FRONTEND=noninteractive ---> Using cache ---> 0bb3cc1f9c51 Step 3/20 : RUN apt update ---> Running in a298309c1b77 failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: error adding seccomp filter rule for syscall clone3: permission denied: unknown

How can I fix it?

[SOLVED] docker: unknown server OS: .

Hi @otamajakusi thank you for this amazing repo. I did however notice a small error when trying to run the "./run.sh" command.

The error was:

non-network local connections being added to access control list
docker: unknown server OS: .
See 'docker run --help'.

The solution was to add sudo docker run:

#!/bin/bash
xhost +local:
sudo docker run -it --rm --runtime nvidia --network host --device /dev/video0:/dev/video0:mrw -e DISPLAY=$DISPLAY -v /tmp/.X11-unix/:/tmp/.X11-unix yolov5 python3 detect.py --source 0

Once again, Thank you!

Wrong Python Version

In README.md, in the last command "run with your own weights", instead of python3 it should be python3.8. The run.sh file uses python3.8 and hence it works. But running the docker command directly doesn't work.

This is how the commands should look:

mkdir -p /path/to/weights
cp my-weights.pt /path/to/weights
xhost +local:
docker run -it --rm \
           --runtime nvidia \
           --network host \
           --device /dev/video0:/dev/video0:mrw \
           -e DISPLAY=$DISPLAY \
           -e LD_PRELOAD=/usr/lib/aarch64-linux-gnu/libgomp.so.1 \
           -v /tmp/.X11-unix/:/tmp/.X11-unix \
           -v /path/to/weights:/weights \
           yolov5 python3.8 detect.py --source 0 --weights /weights/my-weights.pt

Also, one might run into issues related to Argus daemon. Its can be easily fixed by including -v /tmp/argus_socket:/tmp/argus_socket. It would really help if this information can also be added in the README.md file. I wasted almost two days to figure it out. For details, one can refer #3

Cannot run yolov5 on Python3.6

Hi
I am running the command on terminal:
./run.sh
But I am getting error:
AssertionError: Python 3.7.0 required by Yolov5, but Python 3.6.9 is currently installed.

Can you help me how did you run detect.py on Python 3.6 on Jetson Nano?
Thank you in advance.

RuntimeError: CUDA error: device kernel image is invalid

First off i want to say thanks soooooooo much!
I've been trying to get Yolo on the Jetson for three days and was about to give up when i found your repo.
So i started from scratch on my Jetson with the latest clean image. All i did was to get VNC running. Then i installed your repo.
Then i get this error;
`

import torch
torch.cuda.is_available()
True
device = torch.device("cuda")
torch.rand(10).to(device)
Traceback (most recent call last):
File "", line 1, in
RuntimeError: CUDA error: device kernel image is invalid

`

^ that was the result of a test i ran in the container. I'm going to keep trying to track it down. I'll post an update if i get to the bottom of it. But any clues would be much appreciated.

Thanks in advance.

could it be that my version is # R32 (release), REVISION: 5.1 ?

ImportError: /usr/lib/aarch64-linux-gnu/libgomp.so.1: cannot allocate memory in static TLS block

I'm trying to run run.sh file but I keep getting this error:

  File "detect.py", line 41, in <module>
    from models.common import DetectMultiBackend
  File "/yolov5/models/common.py", line 14, in <module>
    import cv2
  File "/usr/local/lib/python3.8/dist-packages/cv2/__init__.py", line 181, in <module>
    bootstrap()
  File "/usr/local/lib/python3.8/dist-packages/cv2/__init__.py", line 153, in bootstrap
    native_module = importlib.import_module("cv2")
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: /usr/lib/aarch64-linux-gnu/libgomp.so.1: cannot allocate memory in static TLS block

I found that the general workaround for this problem is to do

export LD_PRELOAD=/usr/lib/aarch64-linux-gnu/libgomp.so.1

However I'm still getting the same error. I suppose that docker doesn't really care about what I'm preloading in the shell. I think this is discussed in this issue: sudo-project/sudo#46 . Any ideas how to get this to work?

Run Yolov5 on host environment instead of container

Hi @otamajakusi, say I wanted to run the yolov5 on my Jetson Nano host environment instead of running it in a container (so that I could access the CSI camera for example), could I accomplish this by simply running the commands in the Dockerfile 1 by 1 on the terminal?

The only problem I see is the PyTorch 1.6.0 and Torchvision v0.7.0 installations which are pre-installed on the Base Image.

Have you ever tried running the yolov5 on the Jetson Nano host environment before and if so do you happen to have the installation steps?

Thanks and Regards!

Dockerfile Failed to clone 'opencv_extra' at step 15/19

Hi @otamajakusi I am facing this problem when building the Dockerfile, would really appreciate your help in solving this issue. Or the reason why it is happening. Thank you.

Step 15/19 : RUN git clone --recursive https://github.com/skvark/opencv-python.git
 ---> Running in beafaa710239
Cloning into 'opencv-python'...
Submodule 'multibuild' (https://github.com/matthew-brett/multibuild.git) registered for path 'multibuild'
Submodule 'opencv' (https://github.com/opencv/opencv.git) registered for path 'opencv'
Submodule 'opencv_contrib' (https://github.com/opencv/opencv_contrib.git) registered for path 'opencv_contrib'
Submodule 'opencv_extra' (https://github.com/opencv/opencv_extra.git) registered for path 'opencv_extra'
Cloning into '/opencv-python/multibuild'...
Cloning into '/opencv-python/opencv'...
Cloning into '/opencv-python/opencv_contrib'...
Cloning into '/opencv-python/opencv_extra'...
error: RPC failed; curl 56 GnuTLS recv error (-9): A TLS packet with unexpected length was received.
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
fatal: clone of 'https://github.com/opencv/opencv_extra.git' into submodule path '/opencv-python/opencv_extra' failed
Failed to clone 'opencv_extra'. Retry scheduled
Cloning into '/opencv-python/opencv_extra'...
error: RPC failed; curl 56 GnuTLS recv error (-9): A TLS packet with unexpected length was received.
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
fatal: clone of 'https://github.com/opencv/opencv_extra.git' into submodule path '/opencv-python/opencv_extra' failed
Failed to clone 'opencv_extra' a second time, aborting
The command '/bin/sh -c git clone --recursive https://github.com/skvark/opencv-python.git' returned a non-zero code: 1

Failed to load module "canberra-gtk-module" using MIPI CSI Camera

Hi @otamajakusi, thank you for this amazing repo. I am using an imx219 mipi csi camera connected to /dev/video0 on the Jetson Nano and when running the command run.sh everything runs properly and as expected except that I cannot view my camera feed and all I see is a green screen. The results of running the command ./run.sh is as follows:

Namespace(agnostic_nms=False, augment=False, classes=None, conf_thres=0.25, device='', exist_ok=False, img_size=640, iou_thres=0.45, name='exp', nosave=False, project='runs/detect', save_conf=False, save_txt=False, source='0', update=False, view_img=False, weights='yolov5s.pt')
YOLOv5 \U0001f680 v5.0-14-g238583b torch 1.8.0 CUDA:0 (NVIDIA Tegra X1, 3956.1328125MB)

Downloading https://github.com/ultralytics/yolov5/releases/download/v5.0/yolov5s.pt to yolov5s.pt...
100%|######################################| 14.1M/14.1M [00:12<00:00, 1.20MB/s]

Fusing layers... 
Model Summary: 224 layers, 7266973 parameters, 0 gradients, 17.0 GFLOPS
Gtk-Message: 02:13:00.303: Failed to load module "canberra-gtk-module"
[ WARN:0] global /tmp/pip-build-3fcriusp/opencv-python/opencv/modules/videoio/src/cap_v4l.cpp (1914) getProperty VIDEOIO(V4L2:/dev/video0): Unable to get camera FPS
1/1: 0...  success (3264x2464 at 99.00 FPS).

0: 512x640 Done. (2.845s)
0: 512x640 Done. (0.174s)
0: 512x640 Done. (0.173s)

Is there anyway I could solve this issue?

Thank you & Best Regards,
Abu

Is it possible to reduce launch time?

Hi @otamajakusi, thank you for this tutorial. It is very helpful. I was wondering if it is possible to reduce the launch time (currently taking around 5 minutes on my Jetson Nano 2gb)? Also, is it possible to run a different version of the detect.py (stored locally) in the same way when running with our own weights?

Thanks and regards!

Build.sh complains about unknown JetPack version even though I'm on 4.6

I am trying to get this to work on Jetson Nano with Jetpack 4.6.1-b110 or 4.6.2-b5 installed. I don't know for sure since
sudo apt-cache show nvidia-jetpack
gives me both of those versions:

  Version: 4.6.2-b5
  Architecture: arm64
  Maintainer: NVIDIA Corporation
  Installed-Size: 194
  Depends: nvidia-cuda (= 4.6.2-b5), nvidia-opencv (= 4.6.2-b5), nvidia-cudnn8 (= 4.6.2-b5), nvidia-tensorrt (= 4.6.2-b5), nvidia-visionworks (= 4.6.2-b5), nvidia-container (= 4.6.2-b5), nvidia-vpi (= 4.6.2-b5), nvidia-l4t-jetson-multimedia-api (>> 32.7-0), nvidia-l4t-jetson-multimedia-api (<< 32.8-0)
  Homepage: http://developer.nvidia.com/jetson
  Priority: standard
  Section: metapackages
  Filename: pool/main/n/nvidia-jetpack/nvidia-jetpack_4.6.2-b5_arm64.deb
  Size: 29378
  SHA256: 925f4abff97e6024d86cff3b9e132e7c7554d05fb83590487381b7e925d5b2bb
  SHA1: e3ef727e87df5c331aece34508c110d57d744fe9
  MD5sum: 7cb2e387af41bc8143ac7b6525af7794
  Description: NVIDIA Jetpack Meta Package
  Description-md5: ad1462289bdbc54909ae109d1d32c0a8
  
  Package: nvidia-jetpack
  Version: 4.6.1-b110
  Architecture: arm64
  Maintainer: NVIDIA Corporation
  Installed-Size: 194
  Depends: nvidia-cuda (= 4.6.1-b110), nvidia-opencv (= 4.6.1-b110), nvidia-cudnn8 (= 4.6.1-b110), nvidia-tensorrt (= 4.6.1-b110), nvidia-visionworks (= 4.6.1-b110), nvidia-container (= 4.6.1-b110), nvidia-vpi (= 4.6.1-b110), nvidia-l4t-jetson-multimedia-api (>> 32.7-0), nvidia-l4t-jetson-multimedia-api (<< 32.8-0)
  Homepage: http://developer.nvidia.com/jetson
  Priority: standard
  Section: metapackages
  Filename: pool/main/n/nvidia-jetpack/nvidia-jetpack_4.6.1-b110_arm64.deb
  Size: 29366
  SHA256: acfd9e75af780eab165361d61de4b4fe4974890864fe191060b402ac4c2f54d5
  SHA1: a016568ac53705acc145a9f7e60505707bea259f
  MD5sum: 79be976b184a8c885bd9169ea5b7fb7b
  Description: NVIDIA Jetpack Meta Package
  Description-md5: ad1462289bdbc54909ae109d1d32c0a8

It seems 4.6 is supported but when trying to execute build.sh it says:
unknown jetpack 7.2

From the .sh file I see that it checks for Revision number,which in my case is:
# R32 (release), REVISION: 7.2, GCID: 30192233, BOARD: t210ref, EABI: aarch64, DATE: Wed Apr 20 21:34:48 UTC 2022

I wonder if this is just a revision issue and not the broader Jetpack version issue can this be worked around? Sorry I'm not well versed in shell scripting. Thanks for your work!


I got the image to build just using sudo docker build -t yolov5 . I'll leave the issue open since I'm not sure if everything works fine.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.