You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 13KB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. <div align="center">
  2. <p>
  3. <a align="left" href="https://ultralytics.com/yolov5" target="_blank">
  4. <img width="850" src="https://github.com/ultralytics/yolov5/releases/download/v1.0/splash.jpg"></a>
  5. </p>
  6. <br>
  7. <div>
  8. <a href="https://github.com/ultralytics/yolov5/actions"><img src="https://github.com/ultralytics/yolov5/workflows/CI%20CPU%20testing/badge.svg" alt="CI CPU testing"></a>
  9. <a href="https://zenodo.org/badge/latestdoi/264818686"><img src="https://zenodo.org/badge/264818686.svg" alt="YOLOv5 Citation"></a>
  10. <br>
  11. <a href="https://colab.research.google.com/github/ultralytics/yolov5/blob/master/tutorial.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"></a>
  12. <a href="https://www.kaggle.com/ultralytics/yolov5"><img src="https://kaggle.com/static/images/open-in-kaggle.svg" alt="Open In Kaggle"></a>
  13. <a href="https://hub.docker.com/r/ultralytics/yolov5"><img src="https://img.shields.io/docker/pulls/ultralytics/yolov5?logo=docker" alt="Docker Pulls"></a>
  14. </div>
  15. <br>
  16. <div align="center">
  17. <a href="https://github.com/ultralytics">
  18. <img src="https://github.com/ultralytics/yolov5/releases/download/v1.0/logo-social-github.png" width="2%"/>
  19. </a>
  20. <img width="2%" />
  21. <a href="https://www.linkedin.com/company/ultralytics">
  22. <img src="https://github.com/ultralytics/yolov5/releases/download/v1.0/logo-social-linkedin.png" width="2%"/>
  23. </a>
  24. <img width="2%" />
  25. <a href="https://twitter.com/ultralytics">
  26. <img src="https://github.com/ultralytics/yolov5/releases/download/v1.0/logo-social-twitter.png" width="2%"/>
  27. </a>
  28. <img width="2%" />
  29. <a href="https://youtube.com/ultralytics">
  30. <img src="https://github.com/ultralytics/yolov5/releases/download/v1.0/logo-social-youtube.png" width="2%"/>
  31. </a>
  32. <img width="2%" />
  33. <a href="https://www.facebook.com/ultralytics">
  34. <img src="https://github.com/ultralytics/yolov5/releases/download/v1.0/logo-social-facebook.png" width="2%"/>
  35. </a>
  36. <img width="2%" />
  37. <a href="https://www.instagram.com/ultralytics/">
  38. <img src="https://github.com/ultralytics/yolov5/releases/download/v1.0/logo-social-instagram.png" width="2%"/>
  39. </a>
  40. </div>
  41. <br>
  42. <p>
  43. YOLOv5 🚀 is a family of object detection architectures and models pretrained on the COCO dataset, and represents <a href="https://ultralytics.com">Ultralytics</a>
  44. open-source research into future vision AI methods, incorporating lessons learned and best practices evolved over thousands of hours of research and development.
  45. </p>
  46. <!--
  47. <a align="center" href="https://ultralytics.com/yolov5" target="_blank">
  48. <img width="800" src="https://github.com/ultralytics/yolov5/releases/download/v1.0/banner-api.png"></a>
  49. -->
  50. </div>
  51. ## <div align="center">Documentation</div>
  52. See the [YOLOv5 Docs](https://docs.ultralytics.com) for full documentation on training, testing and deployment.
  53. ## <div align="center">Quick Start Examples</div>
  54. <details open>
  55. <summary>Install</summary>
  56. [**Python>=3.6.0**](https://www.python.org/) is required with all
  57. [requirements.txt](https://github.com/ultralytics/yolov5/blob/master/requirements.txt) installed including
  58. [**PyTorch>=1.7**](https://pytorch.org/get-started/locally/):
  59. <!-- $ sudo apt update && apt install -y libgl1-mesa-glx libsm6 libxext6 libxrender-dev -->
  60. ```bash
  61. $ git clone https://github.com/ultralytics/yolov5
  62. $ cd yolov5
  63. $ pip install -r requirements.txt
  64. ```
  65. </details>
  66. <details open>
  67. <summary>Inference</summary>
  68. Inference with YOLOv5 and [PyTorch Hub](https://github.com/ultralytics/yolov5/issues/36). Models automatically download
  69. from the [latest YOLOv5 release](https://github.com/ultralytics/yolov5/releases).
  70. ```python
  71. import torch
  72. # Model
  73. model = torch.hub.load('ultralytics/yolov5', 'yolov5s') # or yolov5m, yolov5l, yolov5x, custom
  74. # Images
  75. img = 'https://ultralytics.com/images/zidane.jpg' # or file, Path, PIL, OpenCV, numpy, list
  76. # Inference
  77. results = model(img)
  78. # Results
  79. results.print() # or .show(), .save(), .crop(), .pandas(), etc.
  80. ```
  81. </details>
  82. <details>
  83. <summary>Inference with detect.py</summary>
  84. `detect.py` runs inference on a variety of sources, downloading models automatically from
  85. the [latest YOLOv5 release](https://github.com/ultralytics/yolov5/releases) and saving results to `runs/detect`.
  86. ```bash
  87. $ python detect.py --source 0 # webcam
  88. file.jpg # image
  89. file.mp4 # video
  90. path/ # directory
  91. path/*.jpg # glob
  92. 'https://youtu.be/NUsoVlDFqZg' # YouTube
  93. 'rtsp://example.com/media.mp4' # RTSP, RTMP, HTTP stream
  94. ```
  95. </details>
  96. <details>
  97. <summary>Training</summary>
  98. Run commands below to reproduce results
  99. on [COCO](https://github.com/ultralytics/yolov5/blob/master/data/scripts/get_coco.sh) dataset (dataset auto-downloads on
  100. first use). Training times for YOLOv5s/m/l/x are 2/4/6/8 days on a single V100 (multi-GPU times faster). Use the
  101. largest `--batch-size` your GPU allows (batch sizes shown for 16 GB devices).
  102. ```bash
  103. $ python train.py --data coco.yaml --cfg yolov5s.yaml --weights '' --batch-size 64
  104. yolov5m 40
  105. yolov5l 24
  106. yolov5x 16
  107. ```
  108. <img width="800" src="https://user-images.githubusercontent.com/26833433/90222759-949d8800-ddc1-11ea-9fa1-1c97eed2b963.png">
  109. </details>
  110. <details open>
  111. <summary>Tutorials</summary>
  112. * [Train Custom Data](https://github.com/ultralytics/yolov5/wiki/Train-Custom-Data)&nbsp; 🚀 RECOMMENDED
  113. * [Tips for Best Training Results](https://github.com/ultralytics/yolov5/wiki/Tips-for-Best-Training-Results)&nbsp; ☘️
  114. RECOMMENDED
  115. * [Weights & Biases Logging](https://github.com/ultralytics/yolov5/issues/1289)&nbsp; 🌟 NEW
  116. * [Supervisely Ecosystem](https://github.com/ultralytics/yolov5/issues/2518)&nbsp; 🌟 NEW
  117. * [Multi-GPU Training](https://github.com/ultralytics/yolov5/issues/475)
  118. * [PyTorch Hub](https://github.com/ultralytics/yolov5/issues/36)&nbsp; ⭐ NEW
  119. * [TorchScript, ONNX, CoreML Export](https://github.com/ultralytics/yolov5/issues/251) 🚀
  120. * [Test-Time Augmentation (TTA)](https://github.com/ultralytics/yolov5/issues/303)
  121. * [Model Ensembling](https://github.com/ultralytics/yolov5/issues/318)
  122. * [Model Pruning/Sparsity](https://github.com/ultralytics/yolov5/issues/304)
  123. * [Hyperparameter Evolution](https://github.com/ultralytics/yolov5/issues/607)
  124. * [Transfer Learning with Frozen Layers](https://github.com/ultralytics/yolov5/issues/1314)&nbsp; ⭐ NEW
  125. * [TensorRT Deployment](https://github.com/wang-xinyu/tensorrtx)
  126. </details>
  127. ## <div align="center">Environments and Integrations</div>
  128. Get started in seconds with our verified environments and integrations,
  129. including [Weights & Biases](https://wandb.ai/site?utm_campaign=repo_yolo_readme) for automatic YOLOv5 experiment
  130. logging. Click each icon below for details.
  131. <div align="center">
  132. <a href="https://colab.research.google.com/github/ultralytics/yolov5/blob/master/tutorial.ipynb">
  133. <img src="https://github.com/ultralytics/yolov5/releases/download/v1.0/logo-colab-small.png" width="15%"/>
  134. </a>
  135. <a href="https://www.kaggle.com/ultralytics/yolov5">
  136. <img src="https://github.com/ultralytics/yolov5/releases/download/v1.0/logo-kaggle-small.png" width="15%"/>
  137. </a>
  138. <a href="https://hub.docker.com/r/ultralytics/yolov5">
  139. <img src="https://github.com/ultralytics/yolov5/releases/download/v1.0/logo-docker-small.png" width="15%"/>
  140. </a>
  141. <a href="https://github.com/ultralytics/yolov5/wiki/AWS-Quickstart">
  142. <img src="https://github.com/ultralytics/yolov5/releases/download/v1.0/logo-aws-small.png" width="15%"/>
  143. </a>
  144. <a href="https://github.com/ultralytics/yolov5/wiki/GCP-Quickstart">
  145. <img src="https://github.com/ultralytics/yolov5/releases/download/v1.0/logo-gcp-small.png" width="15%"/>
  146. </a>
  147. <a href="https://wandb.ai/site?utm_campaign=repo_yolo_readme">
  148. <img src="https://github.com/ultralytics/yolov5/releases/download/v1.0/logo-wb-small.png" width="15%"/>
  149. </a>
  150. </div>
  151. ## <div align="center">Compete and Win</div>
  152. We are super excited about our first-ever Ultralytics YOLOv5 🚀 EXPORT Competition with **$10,000** in cash prizes!
  153. <p align="center">
  154. <a href="https://github.com/ultralytics/yolov5/discussions/3213">
  155. <img width="850" src="https://github.com/ultralytics/yolov5/releases/download/v1.0/banner-export-competition.png"></a>
  156. </p>
  157. ## <div align="center">Why YOLOv5</div>
  158. <p align="center"><img width="800" src="https://user-images.githubusercontent.com/26833433/114313216-f0a5e100-9af5-11eb-8445-c682b60da2e3.png"></p>
  159. <details>
  160. <summary>YOLOv5-P5 640 Figure (click to expand)</summary>
  161. <p align="center"><img width="800" src="https://user-images.githubusercontent.com/26833433/114313219-f1d70e00-9af5-11eb-9973-52b1f98d321a.png"></p>
  162. </details>
  163. <details>
  164. <summary>Figure Notes (click to expand)</summary>
  165. * GPU Speed measures end-to-end time per image averaged over 5000 COCO val2017 images using a V100 GPU with batch size
  166. 32, and includes image preprocessing, PyTorch FP16 inference, postprocessing and NMS.
  167. * EfficientDet data from [google/automl](https://github.com/google/automl) at batch size 8.
  168. * **Reproduce** by
  169. `python val.py --task study --data coco.yaml --iou 0.7 --weights yolov5s6.pt yolov5m6.pt yolov5l6.pt yolov5x6.pt`
  170. </details>
  171. ### Pretrained Checkpoints
  172. [assets]: https://github.com/ultralytics/yolov5/releases
  173. |Model |size<br><sup>(pixels) |mAP<sup>val<br>0.5:0.95 |mAP<sup>test<br>0.5:0.95 |mAP<sup>val<br>0.5 |Speed<br><sup>V100 (ms) | |params<br><sup>(M) |FLOPs<br><sup>640 (B)
  174. |--- |--- |--- |--- |--- |--- |---|--- |---
  175. |[YOLOv5s][assets] |640 |36.7 |36.7 |55.4 |**2.0** | |7.3 |17.0
  176. |[YOLOv5m][assets] |640 |44.5 |44.5 |63.1 |2.7 | |21.4 |51.3
  177. |[YOLOv5l][assets] |640 |48.2 |48.2 |66.9 |3.8 | |47.0 |115.4
  178. |[YOLOv5x][assets] |640 |**50.4** |**50.4** |**68.8** |6.1 | |87.7 |218.8
  179. | | | | | | | | |
  180. |[YOLOv5s6][assets] |1280 |43.3 |43.3 |61.9 |**4.3** | |12.7 |17.4
  181. |[YOLOv5m6][assets] |1280 |50.5 |50.5 |68.7 |8.4 | |35.9 |52.4
  182. |[YOLOv5l6][assets] |1280 |53.4 |53.4 |71.1 |12.3 | |77.2 |117.7
  183. |[YOLOv5x6][assets] |1280 |**54.4** |**54.4** |**72.0** |22.4 | |141.8 |222.9
  184. | | | | | | | | |
  185. |[YOLOv5x6][assets] TTA |1280 |**55.0** |**55.0** |**72.0** |70.8 | |- |-
  186. <details>
  187. <summary>Table Notes (click to expand)</summary>
  188. * AP<sup>test</sup> denotes COCO [test-dev2017](http://cocodataset.org/#upload) server results, all other AP results
  189. denote val2017 accuracy.
  190. * AP values are for single-model single-scale unless otherwise noted. **Reproduce mAP**
  191. by `python val.py --data coco.yaml --img 640 --conf 0.001 --iou 0.65`
  192. * Speed<sub>GPU</sub> averaged over 5000 COCO val2017 images using a
  193. GCP [n1-standard-16](https://cloud.google.com/compute/docs/machine-types#n1_standard_machine_types) V100 instance, and
  194. includes FP16 inference, postprocessing and NMS. **Reproduce speed**
  195. by `python val.py --data coco.yaml --img 640 --conf 0.25 --iou 0.45 --half`
  196. * All checkpoints are trained to 300 epochs with default settings and hyperparameters (no autoaugmentation).
  197. * Test Time Augmentation ([TTA](https://github.com/ultralytics/yolov5/issues/303)) includes reflection and scale
  198. augmentation. **Reproduce TTA** by `python val.py --data coco.yaml --img 1536 --iou 0.7 --augment`
  199. </details>
  200. ## <div align="center">Contribute</div>
  201. We love your input! We want to make contributing to YOLOv5 as easy and transparent as possible. Please see
  202. our [Contributing Guide](CONTRIBUTING.md) to get started.
  203. ## <div align="center">Contact</div>
  204. For issues running YOLOv5 please visit [GitHub Issues](https://github.com/ultralytics/yolov5/issues). For business or
  205. professional support requests please visit [https://ultralytics.com/contact](https://ultralytics.com/contact).
  206. <br>
  207. <div align="center">
  208. <a href="https://github.com/ultralytics">
  209. <img src="https://github.com/ultralytics/yolov5/releases/download/v1.0/logo-social-github.png" width="3%"/>
  210. </a>
  211. <img width="3%" />
  212. <a href="https://www.linkedin.com/company/ultralytics">
  213. <img src="https://github.com/ultralytics/yolov5/releases/download/v1.0/logo-social-linkedin.png" width="3%"/>
  214. </a>
  215. <img width="3%" />
  216. <a href="https://twitter.com/ultralytics">
  217. <img src="https://github.com/ultralytics/yolov5/releases/download/v1.0/logo-social-twitter.png" width="3%"/>
  218. </a>
  219. <img width="3%" />
  220. <a href="https://youtube.com/ultralytics">
  221. <img src="https://github.com/ultralytics/yolov5/releases/download/v1.0/logo-social-youtube.png" width="3%"/>
  222. </a>
  223. <img width="3%" />
  224. <a href="https://www.facebook.com/ultralytics">
  225. <img src="https://github.com/ultralytics/yolov5/releases/download/v1.0/logo-social-facebook.png" width="3%"/>
  226. </a>
  227. <img width="3%" />
  228. <a href="https://www.instagram.com/ultralytics/">
  229. <img src="https://github.com/ultralytics/yolov5/releases/download/v1.0/logo-social-instagram.png" width="3%"/>
  230. </a>
  231. </div>