:zap:Yolo-Fastest:zap:[](https://doi.org/10.5281/zenodo.5131532)

August 11, 2021 · View on GitHub

:zap:Yolo-Fastest:zap:DOI

  • Simple, fast, compact, easy to transplant
  • A real-time target detection algorithm for all platforms
  • The fastest and smallest known universal target detection algorithm based on yolo
  • Optimized design for ARM mobile terminal, optimized to support NCNN reasoning framework
  • Based on NCNN deployed on RK3399 ,Raspberry Pi 4b... and other embedded devices to achieve full real-time 30fps+

image

  • 中文介绍https://zhuanlan.zhihu.com/p/234506503
  • 相比AlexeyAB/darknet,此版本的darknet修复分组卷积在某些旧架构GPU推理耗时异常的问题(例如1050ti:40ms->4ms速度提升10倍),强烈建议用此仓库框架训练模型
  • Compared with AlexeyAB/darknet, this version of darknet fixes the problem of abnormal time-consuming inference of grouped convolution in some old architecture GPUs (for example, 1050ti:40ms->4ms speed up 10 times), it is strongly recommended to use this warehouse framework for training model
  • Darknet CPU推理效率优化不好,不建议使用Darknet作为CPU端的推理框架,建议使用NCNN
  • Darknet CPU reasoning efficiency optimization is not good, it is not recommended to use Darknet as the CPU side reasoning framework, it is recommended to use ncnn
  • Based on pytorch training framework: https://github.com/dog-qiuqiu/yolov3

Evaluating indicator/Benchmark

NetworkCOCO mAP(0.5)ResolutionRun Time(Ncnn 4xCore)Run Time(Ncnn 1xCore)FLOPSParamsWeight size
Yolo-Fastest-1.124.40 %320X3205.59 ms7.52 ms0.252BFlops0.35M1.4M
Yolo-Fastest-1.1-xl34.33 %320X3209.27ms15.72ms0.725BFlops0.925M3.7M
Yolov3-Tiny-Prn33.1%416X416%ms%ms3.5BFlops4.7M18.8M
Yolov4-Tiny40.2%416X41623.67ms40.14ms6.9 BFlops5.77M23.1M
  • Test platform Mi 11 Snapdragon 888 CPU,Based on NCNN
  • COCO 2017 Val mAP(no group label)
  • Suitable for hardware with extremely tight computing resources
  • This model is recommended to do some simple single object detection suitable for simple application scenarios

Yolo-Fastest-1.1 Multi-platform benchmark

EquipmentComputing backendSystemFrameworkRun time
Mi 11Snapdragon 888Android(arm64)ncnn5.59ms
Mate 30Kirin 990Android(arm64)ncnn6.12ms
Meizu 16Snapdragon 845Android(arm64)ncnn7.72ms
Development boardSnapdragon 835(Monkey version)Android(arm64)ncnn20.52ms
Development boardRK3399Linux(arm64)ncnn35.04ms
Raspberrypi 3B4xCortex-A53Linux(arm64)ncnn62.31ms
Orangepi Zero LtsH2+ 4xCortex-A7Linux(armv7)ncnn550ms
NvidiaGtx 1050tiUbuntu(x64)darknet4.73ms
Inteli7-8700Ubuntu(x64)ncnn5.78ms

Pascal VOC performance index comparison

NetworkModel SizemAP(VOC 2007)FLOPS
Tiny YOLOv260.5MB57.1%6.97BFlops
Tiny YOLOv333.4MB58.4%5.52BFlops
YOLO Nano4.0MB69.1%4.51Bflops
MobileNetv2-SSD-Lite13.8MB68.6%&Bflops
MobileNetV2-YOLOv311.52MB70.20%2.02Bflos
Pelee-SSD21.68MB70.09%2.40Bflos
Yolo Fastest1.3MB61.02%0.23Bflops
Yolo Fastest-XL3.5MB69.43%0.70Bflops
MobileNetv2-Yolo-Lite8.0MB73.26%1.80Bflops

Yolo-Fastest-1.1 Pedestrian detection

EquipmentSystemFrameworkRun time
Raspberrypi 3BLinux(arm64)ncnn62ms
  • Simple real-time pedestrian detection model based on yolo-fastest-1.1
  • Enable bf16s optimization,Raspberrypi 64 Bit OS

Demo

image image

Compile

How to compile on Linux

Just do make in the Yolo-Fastest-master directory. Before make, you can set such options in the Makefile: link

  • GPU=1 to build with CUDA to accelerate by using GPU (CUDA should be in /usr/local/cuda)
  • CUDNN=1 to build with cuDNN v5-v7 to accelerate training by using GPU (cuDNN should be in /usr/local/cudnn)
  • CUDNN_HALF=1 to build for Tensor Cores (on Titan V / Tesla V100 / DGX-2 and later) speedup Detection 3x, Training 2x
  • OPENCV=1 to build with OpenCV 4.x/3.x/2.4.x - allows to detect on video files and video streams from network cameras or web-cams
  • Set the other options in the Makefile according to your need.

Test/Demo

*Run Yolo-Fastest , Yolo-Fastest-xl , Yolov3 or Yolov4 on image or video inputs

Demo on image input

*Note: change .data , .cfg , .weights and input image file in image_yolov3.sh for Yolo-Fastest-x1, Yolov3 and Yolov4

  sh image_yolov3.sh

Demo on video input

*Note: Use any input video and place in the data folder or use 0 in the video_yolov3.sh for webcam

*Note: change .data , .cfg , .weights and input video file in video_yolov3.sh for Yolo-Fastest-x1, Yolov3 and Yolov4

  sh video_yolov3.sh

Yolo-Fastest Test

image

Yolo-Fastest-xl Test

image

How to Train

Generate a pre-trained model for the initialization of the model backbone

  ./darknet partial yolo-fastest.cfg yolo-fastest.weights yolo-fastest.conv.109 109

Train

  ./darknet detector train voc.data yolo-fastest.cfg yolo-fastest.conv.109 

Deploy

NCNN

NCNN Conversion Tutorial

NCNN Sample

MNN&TNN&MNN

ONNX&TensorRT

  • https://github.com/CaoWGG/TensorRT-YOLOv4
  • It is not efficient to run on Psacal and earlier GPU architectures. It is not recommended to deploy on such devices such as jeston nano(17ms/img), Tx1, Tx2, but there is no such problem in Turing GPU, such as jetson-Xavier-NX Can run efficiently

OpenCV DNN

Thanks

Cite as

dog-qiuqiu. (2021, July 24). dog-qiuqiu/Yolo-Fastest: yolo-fastest-v1.1.0 (Version v.1.1.0). Zenodo. http://doi.org/10.5281/zenodo.5131532