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.