We’re going to learn in this tutorial how to install and run Yolo on the Nvidia Jetson Nano using its 128 cuda cores gpu.
All the steps described in this blog posts are available on the Video Tutorial, so you can easily watch the video where I show and explain everythin step by step.
Yolo is a really popular DNN (Deep Neural Network) object detection algorythm, which is really fast and works also on not so powerfull devices.
I explained in this post, how to run Yolo on the CPU (so the computer processor) using opencv, and I’m going to explain today how to run Yolo on the GPU (the graphic processor), to get more speed.
How to install YOLO V3?
Before showing the steps to the installation, I want to clarify what is Yolo and what is a Deep Neural Network.
YOLO is an Object Detection algorythm, and it’s the acronym of (You Only Look Once). An object detection algorythm need a DNN (Deep Neural Network) framework to run.
DARKNET is the DNN that was developed to run Yolo. And we’re going to see today how to install Darknet.
Let’s start with the installation.
- Update the libraries
sudo apt-get update
- Export Cuda path
export PATH=/usr/local/cuda-10.0/bin${PATH:+:${PATH}} export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} - Download Darknet and Yolo
git clone https://github.com/AlexeyAB/darknet cd darknet wget https://pjreddie.com/media/files/yolov3.weights wget https://pjreddie.com/media/files/yolov3-tiny.weights
- Enable the GPU
We need to Edit the Makefile to enable the GPU, Cuda and Opencv. Let’s edit the Makefile by typing.
sudo vi Makefile
Set the values:
GPU=1
CUDNN=1
OPENCV=1
and the rest leave it as it is.
- Compile the Darknet
make
The installation is now completed.
How to run YOLO V3?
You can run Yolo from the Linux terminal.
Once you open the terminal you need first to access the Darknet folder. So just type:
cd darknet
Then you can choose one of the following line, depending of the detection you want to perform.
Image detection:
Edit “dog.jpg” with the path of your image.
./darknet detector test cfg/coco.data yolov3.cfg yolov3.weights -ext_output dog.jpg
Detection from Webcam:
The 0 at the end of the line is the index of the Webcam. So if you have more webcams, you can change the index (with 1, 2, and so on) to use a different webcam.
./darknet detector demo cfg/coco.data cfg/yolov3.cfg yolov3.weights -c 0
Detection from a Videofile:
Edit “test.mp4” with the path of your videofile.
./darknet detector demo cfg/coco.data cfg/yolov3.cfg yolov3.weights -ext_output test.mp4
For more and detailed info, you can check the darknet github page or evaluate the purchase of my Object Detection course .

Hi there, I’m the founder of Pysource.
I’m a Computer Vision Consultant, developer and Course instructor.
I help Companies and Developers to build efficient computer vision software.
FPS 2.0 is . no good.. you get 20 FPS using yolo tiny with almost the same accuracy on Jetson Nano..
I totally agree. 2 FPS is not good at all, while with tiny yolo it’s stable at around 16 FPS which is acceptable
Can you please share your git repo… I am using tiny yolo but still I get around 4FPS
Thanks in advance
the same accurate between yolov3 and tiny??? i dont think so, yolov3 detect more details
Thank you for the tutorial. I have used your instructions to run darknet on jetson nano, tx2 and Xavier. I think the tags OPENMP and LIBSO should both be set to 1 for nano. LIBSO will produce a .so file which can be imported into python to run inference. OPENMPI is supported on jetson nano as well. What do you think?
i got error
Thank you so much for this tutorial. It really gave me a structure to follow and understand what to do.
On the last step I always got an error with the last command. It always gave me the error: VIDEOIO ERROR: V4L2: Pixel format of incoming image is unsupportet by OpenCV and the video stopped. So if anyone has the same error: It helped to change the first 4 lines in the yolo.cfg file (which is in darknet/cfg) to:
batch=1
subdivisions=1
width=220
height=220
And then run in darknet:
./darknet detector demo cfg/coco.data cfg/yolov3.cfg yolov3.weights ‘nvarguscamerasrc auto-exposure=1 ! video/x-raw(memory:NVMM), width=(int)1280, height=(int)720, format=(string)NV12, framerate=(fraction)60/1 ! nvvidconv flip-method=0 ! video/x-raw, width=(int)1280, height=(int)720, format=(string)BGRx ! videoconvert ! video/x-raw, format=(string)BGR ! appsink -e’
when I try to run by simple camera -0 option, a green window is popping up. I tried your solution but this error is coming:
bash: syntax error near unexpected token `(‘
I think there is a typo in my suggested command: Try to use this ‘ instead of ’
That means: ./darknet detector demo cfg/coco.data cfg/yolov3.cfg yolov3.weights ‘nvarguscamerasrc auto-exposure=1 ! video/x-raw(memory:NVMM), width=(int)1280, height=(int)720, format=(string)NV12, framerate=(fraction)60/1 ! nvvidconv flip-method=0 ! video/x-raw, width=(int)1280, height=(int)720, format=(string)BGRx ! videoconvert ! video/x-raw, format=(string)BGR ! appsink -e’
I ran into the same green screen error. Did you ever get past this? Thanks
I see green screen too. Has anyone solve this issue
What version of opencv should be installed?
help me thank you
while compiling the darknet , i am getting the following error:
./src/image_opencv.cpp:15:10: fatal error: opencv2/core/version.hpp: No such file or directory
#include
^~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Makefile:149: recipe for target ‘obj/image_opencv.o’ failed
make: *** [obj/image_opencv.o] Error 1
kindly provide the solution
same here 🙁
use another versin of jetpack =jetson-nano-sd-card-image-r32.2
old purge old open cv and install open cv version 3.4.3-
same here with TX2
going the cmake route works:
from the cloned darknet directory;
mkdir build-release
cd build-release
cmake ..
make
make install
you saved my day !
Worked with Jetpack 4.3 for me
Had the same issue as shefali
Any advice on how we can have an output file for the annotation and time of detection?
Why huge difference in deepstream when run using following link https://devtalk.nvidia.com/default/topic/1050377/jetson-nano/deep-learning-inference-benchmarking-instructions/ for tiny-yolov3 it gives output as:
Total number of images used for inference : 500
100 %
Network Type : yolov3-tiny Precision : kHALF Batch Size : 1 Inference time per image : 29.6826 ms which is equivalent to approximately 33fps .
While using darknet tiny-yolov3 gives 16fps and as per given benchmark, it is 25fps. Why so?
They are using INT8 precision
There is a typo in your `Image detection:` section, requires (noting ‘cfg/yolov3.cfg’):
` ./darknet detector test cfg/coco.data cfg/yolov3.cfg yolov3.weights -ext_output dog.jpg`
Can some one please help understand how are you able to change the value of below ? I tried multiple times but the keyboard / mouse dosent accept to remove the 0, is there any other key I need to click to change ?
Set the values:
GPU=1
CUDNN=1
OPENCV=1
press ‘s’ and edit these values to ‘1’. after all press esc, ‘:’, “wq!” and enter
shubh@shubh-desktop:~/darknet$ make
chmod +x *.sh
g++ -std=c++11 -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config –cflags opencv` -DGPU -I/usr/local/cuda/include/ -DCUDNN -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -DCUDNN -I/usr/local/cudnn/include -c ./src/image_opencv.cpp -o obj/image_opencv.o
Package opencv was not found in the pkg-config search path.
Perhaps you should add the directory containing `opencv.pc’
to the PKG_CONFIG_PATH environment variable
No package ‘opencv’ found
./src/image_opencv.cpp:15:10: fatal error: opencv2/core/version.hpp: No such file or directory
#include
^~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Makefile:159: recipe for target ‘obj/image_opencv.o’ failed
make: *** [obj/image_opencv.o] Error 1
unable to run make
Hi I manage to fix this:
1. Try search opencv4.pc and notice the location of the file
2. Then rename it to opencv.pc
3. Add `export PKG_CONFIG_PATH=/path/to/` to .bashrc so terminal recognized it.
Then you are good to go
Hi Daniel,
I’m unable to find the opencv4.pc but i found the opencv4 folder only
can you please guide me how to export the path of bashrc to terminal for it’s recognition
This is the version of open cv I installed
>>> import cv2
>>> print(cv2.__version__)
4.1.0
>>>
You probably have opencv 4.x installed. Installing an older version solved the problem.
Instrucions here: https://jkjung-avt.github.io/opencv-on-nano/
Is there anyone who ca help me out with this error
after make my terminal popping up with this error
chmod +x *.sh
make: *** No rule to make target ‘obj/image_opencv.o’, needed by ‘darknet’. Stop.
Why did you post a non-working instruction here???
Hi guys. I recently installed yoloV3 as this instruction and encountered error during compiling
I installed Jetpack 4.3. The error said that “nvcc not found”, so I googled and found a solotuion.
Instead of typing the commands in “Export CUDA path”, typing the following commands worked fine for me.
export PATH=”/usr/local/cuda/bin:$PATH”
export LD_LIBRARY_PATH=”/usr/local/cuda/lib64:$LD_LIBRARY_PATH”
DId you change the export path from step 2?
I still keep getting
/bin/sh: 1: nvcc: not found
Makefile:170: recipe for target ‘obj/convolutional_kernels.o’ failed
make: *** [obj/convolutional_kernels.o] Error 127
did you change the line of code in Makefile also for NVCC?
NVCC=nvcc
or did you leave it alone.
I searched for the nvcc compiler and found it in /usr/local/cuda10.0/bin
adding that to the PATH solved the problem. export PATH=$PATH:/usr/local/cuda10.0/bin
Thanks so much for your good work. I need your assistance on the conversion of rectangle bounding box of yolov3 to circle bounding in the image.c of darknet… I will glad if you provide me this edited image.c file and a script to convert my Yolo txt of images to circle bounding. Thanks
I’m using darknet on a Jetson Nano and get about 3.3 fps with a custom model (using your panda tutorial – thanks). Using darknet, how can I get the bounding box coordinates of tracked objects with a webcam in a python script? I’m trying to capture this data and so I can send it to a microcontroller. Thank you.
Nevermind, I found the scripts in the darknet folder and the LIBSO=1 for the Makefile to create the library. Works well.
Great Job! I was trying to install YOLO on the etson TX2 and this instructions solved the issues that I had with cuda address declaration.
./darknet detector test cfg/coco.data cfg/yolov3.cfg yolov3.weights data/dog.jpg for those who cannot run yolo on images
yolo v4 may give better fps. Maybe one can try.