# Yolo-v4 and Yolo-v3/v2 for Windows and Linux
### (neural network for object detection) - Tensor Cores can be used on [Linux](https://github.com/AlexeyAB/darknet#how-to-compile-on-linux) and [Windows](https://github.com/AlexeyAB/darknet#how-to-compile-on-windows-using-cmake-gui)
Paper Yolo v4: https://arxiv.org/abs/2004.10934
More details: [medium link](https://medium.com/@alexeyab84/yolov4-the-most-accurate-real-time-neural-network-on-ms-coco-dataset-73adfd3602fe?source=friends_link&sk=6039748846bbcf1d960c3061542591d7)
Discussion: [Reddit](https://www.reddit.com/r/MachineLearning/comments/gydxzd/p_yolov4_the_most_accurate_realtime_neural/)
About Darknet framework: http://pjreddie.com/darknet/
[![Darknet Continuous Integration](https://github.com/AlexeyAB/darknet/workflows/Darknet%20Continuous%20Integration/badge.svg)](https://github.com/AlexeyAB/darknet/actions?query=workflow%3A%22Darknet+Continuous+Integration%22)
[![CircleCI](https://circleci.com/gh/AlexeyAB/darknet.svg?style=svg)](https://circleci.com/gh/AlexeyAB/darknet)
[![TravisCI](https://travis-ci.org/AlexeyAB/darknet.svg?branch=master)](https://travis-ci.org/AlexeyAB/darknet)
[![Contributors](https://img.shields.io/github/contributors/AlexeyAB/Darknet.svg)](https://github.com/AlexeyAB/darknet/graphs/contributors)
[![License: Unlicense](https://img.shields.io/badge/license-Unlicense-blue.svg)](https://github.com/AlexeyAB/darknet/blob/master/LICENSE)
[![DOI](https://zenodo.org/badge/75388965.svg)](https://zenodo.org/badge/latestdoi/75388965)
[![arxiv.org](http://img.shields.io/badge/cs.CV-arXiv%3A2004.10934-B31B1B.svg)](https://arxiv.org/abs/2004.10934)
[![colab](https://user-images.githubusercontent.com/4096485/86174089-b2709f80-bb29-11ea-9faf-3d8dc668a1a5.png)](https://colab.research.google.com/drive/12QusaaRj_lUwCGDvQNfICpa7kA7_a2dE)
[![colab](https://user-images.githubusercontent.com/4096485/86174097-b56b9000-bb29-11ea-9240-c17f6bacfc34.png)](https://colab.research.google.com/drive/1_GdoqCJWXsChrOiY8sZMr_zbr_fH-0Fg)
* [YOLOv4 model zoo](https://github.com/AlexeyAB/darknet/wiki/YOLOv4-model-zoo)
* [Requirements (and how to install dependecies)](#requirements)
* [Pre-trained models](#pre-trained-models)
* [FAQ - frequently asked questions](https://github.com/AlexeyAB/darknet/wiki/FAQ---frequently-asked-questions)
* [Explanations in issues](https://github.com/AlexeyAB/darknet/issues?q=is%3Aopen+is%3Aissue+label%3AExplanations)
* [Yolo v4 in other frameworks (TensorRT, TensorFlow, PyTorch, OpenVINO, OpenCV-dnn, TVM,...)](#yolo-v4-in-other-frameworks)
* [Datasets](#datasets)
0. [Improvements in this repository](#improvements-in-this-repository)
1. [How to use](#how-to-use-on-the-command-line)
2. How to compile on Linux
* [Using cmake](#how-to-compile-on-linux-using-cmake)
* [Using make](#how-to-compile-on-linux-using-make)
3. How to compile on Windows
* [Using CMake-GUI](#how-to-compile-on-windows-using-cmake)
* [Using vcpkg](#how-to-compile-on-windows-using-vcpkg)
* [Legacy way](#how-to-compile-on-windows-legacy-way)
4. [Training and Evaluation of speed and accuracy on MS COCO](https://github.com/AlexeyAB/darknet/wiki#training-and-evaluation-of-speed-and-accuracy-on-ms-coco)
5. [How to train with multi-GPU:](#how-to-train-with-multi-gpu)
6. [How to train (to detect your custom objects)](#how-to-train-to-detect-your-custom-objects)
7. [How to train tiny-yolo (to detect your custom objects)](#how-to-train-tiny-yolo-to-detect-your-custom-objects)
8. [When should I stop training](#when-should-i-stop-training)
9. [How to improve object detection](#how-to-improve-object-detection)
10. [How to mark bounded boxes of objects and create annotation files](#how-to-mark-bounded-boxes-of-objects-and-create-annotation-files)
11. [How to use Yolo as DLL and SO libraries](#how-to-use-yolo-as-dll-and-so-libraries)
| ![Darknet Logo](http://pjreddie.com/media/files/darknet-black-small.png) | ![modern_gpus](https://user-images.githubusercontent.com/4096485/82835867-f1c62380-9ecd-11ea-9134-1598ed2abc4b.png) AP50:95 / AP50 - FPS (Tesla V100) Paper: https://arxiv.org/abs/2004.10934 |
|---|---|
tkDNN-TensorRT accelerates YOLOv4 **~2x** times for batch=1 and **3x-4x** times for batch=4.
* tkDNN: https://github.com/ceccocats/tkDNN
* OpenCV: https://gist.github.com/YashasSamaga/48bdb167303e10f4d07b754888ddbdcf
#### GeForce RTX 2080 Ti:
| Network Size | Darknet, FPS (avg)| tkDNN TensorRT FP32, FPS | tkDNN TensorRT FP16, FPS | OpenCV FP16, FPS | tkDNN TensorRT FP16 batch=4, FPS | OpenCV FP16 batch=4, FPS | tkDNN Speedup |
|:-----:|:--------:|--------:|--------:|--------:|--------:|--------:|------:|
|320 | 100 | 116 | **202** | 183 | 423 | **430** | **4.3x** |
|416 | 82 | 103 | **162** | 159 | 284 | **294** | **3.6x** |
|512 | 69 | 91 | 134 | **138** | 206 | **216** | **3.1x** |
|608 | 53 | 62 | 103 | **115**| 150 | **150** | **2.8x** |
|Tiny 416 | 443 | 609 | **790** | 773 | **1774** | 1353 | **3.5x** |
|Tiny 416 CPU Core i7 7700HQ | 3.4 | - | - | 42 | - | 39 | **12x** |
* Yolo v4 Full comparison: [map_fps](https://user-images.githubusercontent.com/4096485/80283279-0e303e00-871f-11ea-814c-870967d77fd1.png)
* Yolo v4 tiny comparison: [tiny_fps](https://user-images.githubusercontent.com/4096485/85734112-6e366700-b705-11ea-95d1-fcba0de76d72.png)
* CSPNet: [paper](https://arxiv.org/abs/1911.11929) and [map_fps](https://user-images.githubusercontent.com/4096485/71702416-6645dc00-2de0-11ea-8d65-de7d4b604021.png) comparison: https://github.com/WongKinYiu/CrossStagePartialNetworks
* Yolo v3 on MS COCO: [Speed / Accuracy (mAP@0.5) chart](https://user-images.githubusercontent.com/4096485/52151356-e5d4a380-2683-11e9-9d7d-ac7bc192c477.jpg)
* Yolo v3 on MS COCO (Yolo v3 vs RetinaNet) - Figure 3: https://arxiv.org/pdf/1804.02767v1.pdf
* Yolo v2 on Pascal VOC 2007: https://hsto.org/files/a24/21e/068/a2421e0689fb43f08584de9d44c2215f.jpg
* Yolo v2 on Pascal VOC 2012 (comp4): https://hsto.org/files/3a6/fdf/b53/3a6fdfb533f34cee9b52bdd9bb0b19d9.jpg
#### Youtube video of results
[![Yolo v4](http://img.youtube.com/vi/1_SiUOYUoOI/0.jpg)](https://youtu.be/1_SiUOYUoOI "Yolo v4")
Others: https://www.youtube.com/user/pjreddie/videos
#### How to evaluate AP of YOLOv4 on the MS COCO evaluation server
1. Download and unzip test-dev2017 dataset from MS COCO server: http://images.cocodataset.org/zips/test2017.zip
2. Download list of images for Detection taks and replace the paths with yours: https://raw.githubusercontent.com/AlexeyAB/darknet/master/scripts/testdev2017.txt
3. Download `yolov4.weights` file: https://drive.google.com/open?id=1cewMfusmPjYWbrnuJRuKhPMwRe_b9PaT
4. Content of the file `cfg/coco.data` should be
```
classes= 80
train = <replace with your path>/trainvalno5k.txt
valid = <replace with your path>/testdev2017.txt
names = data/coco.names
backup = backup
eval=coco
```
5. Create `/results/` folder near with `./darknet` executable file
6. Run validation: `./darknet detector valid cfg/coco.data cfg/yolov4.cfg yolov4.weights`
7. Rename the file `/results/coco_results.json` to `detections_test-dev2017_yolov4_results.json` and compress it to `detections_test-dev2017_yolov4_results.zip`
8. Submit file `detections_test-dev2017_yolov4_results.zip` to the MS COCO evaluation server for the `test-dev2019 (bbox)`
#### How to evaluate FPS of YOLOv4 on GPU
1. Compile Darknet with `GPU=1 CUDNN=1 CUDNN_HALF=1 OPENCV=1` in the `Makefile` (or use the same settings with Cmake)
2. Download `yolov4.weights` file 245 MB: [yolov4.weights](https://github.com/AlexeyAB/darknet/releases/download/darknet_yolo_v3_optimal/yolov4.weights) (Google-drive mirror [yolov4.weights](https://drive.google.com/open?id=1cewMfusmPjYWbrnuJRuKhPMwRe_b9PaT) )
3. Get any .avi/.mp4 video file (preferably not more than 1920x1080 to avoid bottlenecks in CPU performance)
4. Run one of two commands and look at the AVG FPS:
* include video_capturing + NMS + drawing_bboxes:
`./darknet detector demo cfg/coco.data
蜡笔小流
- 粉丝: 2529
- 资源: 1360
最新资源
- 基于Java spring boot冷链溯源管理系统文档+源码+全部资料+高分项目.zip
- 基于HyperledgerFabric实现的牛奶溯源项目文档+源码+全部资料+高分项目.zip
- 基于frp-0.58.1魔改二开,随机化socks5账户密码及端口、钉钉上线下线通知、配置文件oss加密读取、域前置防止溯源、源码替换编译混淆等文档+源码+全部资料+高分项目.zip
- 基于nem链的区块链汽车零配件溯源项目文档+源码+全部资料+高分项目.zip
- 基于SpringBoot框架的、基于国密算法与群签名的可溯源区块链模拟系统文档+源码+全部资料+高分项目.zip
- 基于lumen开发的微信小程序农场生态管理API设计,文档+源码+全部资料+高分项目.zip
- 基于vue2.0+vuex+vue-router+element-ui开发的农产品溯源系统后台文档+源码+全部资料+高分项目.zip
- 基于超级账本的简易牛奶溯源系统的区块链子系统实现文档+源码+全部资料+高分项目.zip
- 基于开发者平台的供应链溯源案例(网易云课程)文档+源码+全部资料+高分项目.zip
- 基于农产品溯源 基于fisco-bcos实现 分管理和商城两端文档+源码+全部资料+高分项目.zip
- 基于可视水印检测识别的数字媒体溯源应用系统,文档+源码+全部资料+高分项目.zip
- 基于区块链的供应链金融溯源系统文档+源码+全部资料+高分项目.zip
- 基于区块链(fabric)农产品溯源平台文档+源码+全部资料+高分项目.zip
- 基于区块链Hyperledger Fabric V2.5的农产品溯源商品通用溯源应用模板,部署简单,附压测工具、区块链浏览器,文档+源码+全部资料+高分项目.z
- 基于区块链的商品溯源系统文档+源码+全部资料+高分项目.zip
- 基于区块链的食品溯源系统文档+源码+全部资料+高分项目.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈