YOLOv5 Repo on Xavier?

Hello,

I have been using darknet YOLOv3 to perform object detection from an RTSP source on my Xavier. YOLOv5 is supposed to be much faster but not supported by darknet. I followed the detect.py example for YOLOv5 on https://github.com/ultralytics/yolov5 but cannot get past some python dependancies espcially nump/scipy incompatibility. Has anyone gotten these repo instructions to work on Xavier/Nano? TIA

pip3 install --user --upgrade scipy

ERROR: Command errored out with exit status 1: /usr/bin/python3 /usr/local/lib/python3.6/dist-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpemj_eboc Check the logs for full command output.

Hi,

You will need to build scipy from source.
Please check this comment for more information:

Thanks.

1 Like

Thank you very much. I will try that.

I’m very tempted to do a Docker version, so I’ll be following in these footsteps.
I’d be happy to collaborate, and will share the results.

Russ. I’m making great progress. A container image would be lovely. So far, the secret sauce has been:

Use Dusty’s script to install pytorch (https://github.com/dusty-nv/jetson-inference/blob/master/tools/install-pytorch.sh)

Use apt-get for matplotlib (sudo apt-get install python3-matplotlib)

Use pip3 install for the rest
Cython
numpy==1.17
opencv-python
pillow
tensorboard
PyYAML>=5.3
torchvision
scipy
tqdm

Excellent. Thank you. I’ll report when I push the first Dockerfile.

scipy and PyTorch (+torchvision) are already installed in the l4t-ml container, so you could use that as a base rather than build scipy from source.

1 Like

It’s alive!! YOLOv5 training is working on my Xavier. I updated the GitHub Issue here: https://github.com/dusty-nv/jetson-inference/issues/623#issuecomment-649006550

Update: Ran training for 600 iterations on the Xavier. Model works but the accuracy and performance of this detect.py on an RTSP stream is inferior to the old darknet C binary.

Great to see your progress, @dennis.faucher.
And thanks for your input, @dusty_nv.

I’ve committed the start of the Dockerfile, in my fork here: https://github.com/topiaruss/yolov5.
It contains a tip for @dusty_nv about upgrading pip3 in the base.

You’ll see I created Dockerfiles to build a base image and a repo-specific image.
Look in the Notes file for simple instructions.
I have not attempted training using these images yet, so there may still be parts missing. The run_xavier_detect scripts seems to work.
My next steps:
get a video stream running
then work on training on the Docker images.
I’ll be leaning on what @dennis.faucher posted about RTSP, earlier.
Thanks for your helpful notes.

1 Like

Do you know how to use tensorrt for your yolov5 ?

Update. As planned, I now have a 512x640 RTSP input stream running. I kludged detect.py to dump pngs of the annotated frames to the inference/output folder, just to get an idea of what’s happening.
Next, I want to have a look at training, just to check that the docker image has all components needed for train/test.
repo: https://github.com/topiaruss/yolov5

I don’t. The direction for Yolov5 is pytorch, as I understand it.

I have trained a model in yolov5. how can I dockerize it and use in jetson nano?
is thid repo helful in jetson nano?

I’ve been running detect.py from Yolov5 within Docker.
Yesterday I allowed some Ubuntu updates, and I’m dead in the water at the moment, trying to get back to my successful recent CUDA/Docker environment from Friday. In the meantime, the repo I link to above has two Dockerfiles that create a base and an app image. You should probably be able to get something running.
I’d welcome your comments.

can you lead me how to do it with docker?
I pull image from https://github.com/ultralytics/yolov5 and it was successfull but when I run the container I have erroes. Do you know a good github repo for docker ?

In my slightly out-of-date fork of ultralytics repo, you can find aarch64.Dockerfile, and yolov5.app.Dockerfile. They build on an image provided by nvidia that includes pre-built pytorch. Look at how they work with run_xavier_detect.py.
There are brief instructions, here: https://github.com/topiaruss/yolov5/blob/master/Xavier_NV_Notes.md

I’m running on Xavier NV, but had a frustrating day, yesterday, due to accepting some upgrades, so I can’t be of much more help until I rebuild a dev environment.

Good luck.

Ty very much russ.ferriday

did u convert yolov5 to tensorrt?
I could run yolov5 without docker at the end although detects images but it writes:
segmentation fault (core dumped)
I think it’s because of trt. and even frame rate is about 3 on yolovs5. that’s very low.
what was your framerate?