This is to share some tips and my personal experinece to solve errors when installing YOLOv5 on Jetson Nano.
For anyone who would like to begin with βHow to install YOLOv5 on Jetson Nanoβ, please search it in google.
There are tons of githubs and blogs which kindly give you the instructions on βhow to install YOLOv5 on Jetson Nanoβ in google.
The requirement for Python version is >= 3.7.0, but YOLOv5 actaully works with the pre-installed Python 3.6.9.
pip3 install
command to install libraries.You can see that YOLOv5 on Jetson Nano works with Python 3.6.9 in the images below!
I tried to utilize the pre-installed opencv-python, but it kept giving me some errors.
For the ease of operation without trivial errors, I recommend you to install OpenCV in your Jetson Nano.
We all know that it is super annoying to install OpenCV in Ubuntu.
Surprisingly, Q-engineering has kindly shared his technology to build OpenCV very easily.
Just click the link above, and follow his perfect instructions!
Things to be careful when installing OpenCV:
/sbin/dphys-swapfile
β CONF_MAXSWAP=4096
(this is only for OpenCV 4.5.2)/etc/dphys-swapfile
β CONF_SWARSIZE=4096
(this is only for OpenCV 4.5.2)/etc/dphys-swapfile
β CONF_SWARSIZE=4096
(this is only for OpenCV version other than 4.5.2)jtop
that OpenCV has been successfully compiled with CUDA.In my case, I uninstalled opencv-python. However, when running the yolov5 (detect.py), it kept installing the opencv-python and this eventually caused errors.
Therefore, I commented out opencv-python line in the requirements.txt file.
Some of you guys may suffer from larger screen frame than the size of the monitor.
I suffered as I am using a mini monitor for Jetson Nano (check the image below).
In this case, you can simply resolve this matter by checking the supported frame sizes of the camera, and add two more lines under the class LoadStreams:
in datasets.py file.
For your information, the location of datasets.py is yolov5 β utils β datasets.py
yolov5/
β ...
ββββutils/
β datasets.py
β ...
I uploaded the edited datasets.py in this repository! Please read the followings before you use it! π
Check the supported frame sizes of the camera in the terminal.
v4l2-ctl --list-formats-ext
Add two more lines under the class LoadStreams:
in datasets.py file.
int(cap.set(cv2.CAP_PROP_FRAME_WIDTH, supported width value))
int(cap.set(cv2.CAP_PROP_FRAME_HEIGHT, supported height value))
Open the .bashrc file in the terminal: sudo vi ~/.bashrc
or sudo nano ~/.bashrc
Add export OPENBLAS_CORETYPE=ARMV8
at the bottom of the .bashrc file, and save/exit.
Type source ~/.bashrc
in the terminal to apply the setting without rebooting the system.
Try to downgrade your torch and torchvision versions.
Please check the compatible torch and torchvision versions in the Nvidia developer forum.
Go to the link attached above, click Installation, then you can see the compatible versions as below:
In my case, I installed torch 1.7.0 and torchvision 0.8.1, and did not get the error anymore.
This is because your PIL has been compiled without libfreetype.
Try the following commands in the terminal.
sudo apt-get install libfreetype6-dev
sudo pip3 uninstall pillow
sudo pip3 install Pillow==7.1.2
pip3
because I am using python3.Please visit my co-researcherβs github as well!
https://github.com/jinsoo9595