Zephyrnet Logo

Accelerate YOLOv4 real time object detection on Jetson Nano

Date:


YOLOv4 was released at the end of April. It soon gained popularity among the machine learning community. You can check it out with following link.

Compared with YOLOv3, YOLOv4’s AP has increased by 10%, while its FPS has increased by 12%. But can Jetson Nano handle YOLOv4? If you have tried YOLOv3 (darknet version) on Jetson Nano to perform real-time object detection, especially using the darknet version, you know what I’m saying. Usually, Jetson can only run the detection at around 1 FPS.

YOLOv3 Performance (darknet version)

But with YOLOv4, Jetson Nano can run detection at more than 2 FPS.

YOLOv4 Performace (darknet version)

Although YOLOv4 runs 167 layers of neural network, which is about 50% more than YOLOv3, 2 FPS is still too low. Now let’s try to accelerate it with PyTorch.

Run the following command

1
2
3
4
5
git clone https://github.com/ultralytics/yolov3 && cd yolov3
#down load yolov4 pre-trained weights
wget https://github.com/AlexeyAB/darknet/releases/download/darknet_yolo_v3_optimal/yolov4.weights
#convert darknet cfg/weights to pytorch model
python3 -c "from models import *; convert('cfg/yolov4.cfg', 'yolov4.weights')"

When success, you can run the YOLOv4 PyTorch model by using the following command

1
python3 detect.py --cfg cfg/yolov4.cfg --weights weights/yolov4.pt --source 0
YOLOv4 Performance

Now you can enjoy the 10 FPS full YOLO on Jetson Nano!

Source: /blog/2020/06/03/accelerate-yolov4-real-time-object-detection-on-jetson-nano/

spot_img

Latest Intelligence

spot_img

Chat with us

Hi there! How can I help you?