Installing YOLOv5 on Jetson Nano with PyTorch & TorchVision

Posted by

L-5 YOLOv5 on Jetson Nano | PyTorch & TorchVision Installation

L-5 YOLOv5 on Jetson Nano

If you are looking to run the YOLOv5 object detection model on your Jetson Nano, you’ve come to the right place. YOLOv5 is a popular deep learning model for real-time object detection, and running it on the Jetson Nano can provide great performance for edge computing applications.

PyTorch & TorchVision Installation

The first step in getting YOLOv5 up and running on your Jetson Nano is to install PyTorch and TorchVision. These are the foundational libraries that YOLOv5 relies on for its deep learning capabilities. Here’s a step-by-step guide to installing PyTorch and TorchVision on your Jetson Nano:

  1. First, make sure your Jetson Nano is running the latest version of the operating system. You can update it by running the following command in the terminal:
  2. sudo apt-get update && sudo apt-get upgrade

  3. Next, you’ll need to install the dependencies for PyTorch and TorchVision. Run the following commands in the terminal:
  4. sudo apt-get install libopenblas-base libopenmpi-dev

  5. Now, it’s time to install PyTorch and TorchVision. You can use the following pip commands to install the required packages:
  6. sudo apt-get install python3-pip
    pip3 install torch torchvision

  7. Once the installation is complete, you can verify that PyTorch and TorchVision are working correctly by importing them in a Python script and running some basic operations.

With PyTorch and TorchVision successfully installed on your Jetson Nano, you are now ready to proceed with running YOLOv5. Utilizing the power of the Jetson Nano’s GPU, you can achieve fast and accurate object detection with YOLOv5. Whether you’re looking to build a smart security camera, a drone with object tracking capabilities, or any other edge computing application, YOLOv5 on the Jetson Nano is a great choice.

0 0 votes
Article Rating
45 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
@user-pv7tl9lq3n
6 months ago

can you make video key point detection using yolov8 on jetson nano

@MIKO-pe7bu
6 months ago

Good video, but unfortunately not working because of ultralytics issues.

@user-zm8pw5bo3z
6 months ago

Hi
I'm currently attempting to install PyTorch v1.8 with torchvision v0.9.0. Unfortunately, I've encountered the following issue:

~/install_dir/torchvision$ python3 setup.py install –user
Traceback (most recent call last):
File "setup.py", line 12, in <module>
import torch
File "/home/jetson/.local/lib/python3.6/site-packages/torch/__init__.py", line 195, in <module>
_load_global_deps()
File "/home/jetson/.local/lib/python3.6/site-packages/torch/__init__.py", line 148, in _load_global_deps
ctypes.CDLL(lib_path, mode=ctypes.RTLD_GLOBAL)
File "/usr/lib/python3.6/ctypes/_init__.py", line 348, in __init_
self._handle = _dlopen(self._name, mode)
OSError: libmpi_cxx.so.20: cannot open shared object file: No such file or directory

Your assistance in resolving this matter would be greatly appreciated.

@user-hu6zr5ld1o
6 months ago

our jetpack version is 5.1.1.. we used 1.14 pytorch verson. python version is 3.7.1.. but is shows ERROR: torch-1.14.9-cp36-cp36m-linux_aarch64.whl is not a supported wheel on this platform. what can i do for this?

@phoenix1799
6 months ago

@Aarohi , I am facing issues installing ultralytics on my jetson nano. As Ultralytivs wont support python below 3.7.0 and jetson nano runs 3.6.9. Any solutions?

@user-zp2rg6rw9p
6 months ago

any one tell me how to install cupy in this board with python3.6 ubuntu18.04

@glitche9515
6 months ago

Mam can you please make a video on using yolov8 with csi camera jetson nano

@Georgesbarsukov
6 months ago

How did you install ultralytics in the requirements.txt? I keep looking around and see that it's only available in python>=3.7

@user-vo7hd5oy7v
6 months ago

Hello! I noticed your tutorial on running YOLOv8 inference on CPU due to compatibility issues with Ultralytics https://youtu.be/pAEkHsNkul0. However, since Ultralytics requires a higher Python version and you can't install it on your Python 3.6.9 environment , How do run inference using GPU? since Torch and Torchvision do support Python 3.6.9 on Jetpack 4.6.1, which might offer a solution for enhanced performance.

@bheemkill4282
6 months ago

Im getting cannot open shared object file no such file or directory error when i import torch please help. My torch vision v0.11.1

@asishkillamsetty7281
6 months ago

hllo,
i got some errors while running the last command
RuntimeError: Running cythonize failed!

can u please help me with this error…

@mstone680
6 months ago

Hello Ma'am,
Thank you so much for your content!! It helped a lot, I learned so much , and you safed my group work!

@john1587
6 months ago

HI there, Im trying to install yolov5 but now it downloads with a requirements.txt file that requires ultralytics package for yolov5 and python 3.6.9 is not compatible, I cant find a repo with tht requirements.txt file that you have

@tegmac2647
6 months ago

Thank you for the video! I have to ask when I run the csi-camera it shows late responses about a second difference, is that supposed to happen? Thank you!

@gagalterok2141
6 months ago

Thank you so much for great video. May I know did you run Jupiter notebook in Virtual environment?

@YigalBZ
6 months ago

Here is my feedback about your videos: The videos are clear, go step by step, with good (not perfect) documentation. It is also easy to understand what you say, and your explanations are very clear. I followed your guidelines but it fails at the last stage because of versions mismatch. I think the root cause is that you had your SW installed already, so you don't face exactly what the user is facing. I would recommend with such a video series that you will go exactly as the user goes. Nothing pre-installed. Also, from time to time you missed packages that were needed, from same reason. I am aborting here because of that. Again, thank you for your investment.

@YigalBZ
6 months ago

Would a model trained with Yolov8 work with yoloV5?

@YigalBZ
6 months ago

When installing the requirement.txt, I get "ERROR: No matching distribution found for gitpython>=3.1.30". Is that a showstopper?

@aishwaryapalit100
6 months ago

I am getting error while installing ultralytics-yolov5. Error message – "No matching distribution found for ultralytics-yolov5

@fizzamasood1553
6 months ago

Hi Arohi!
Could you provide your email id.
I got an error and want to resolve that issue by providing you errors screenshots.