diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index a7964ea01d5d93cbcbbd8498048d21b6102f8224..02e8f74bf56c3e44bb052f0b9a5cc525eccf5646 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -1,11 +1,13 @@ +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license + name: CI CPU testing on: # https://help.github.com/en/actions/reference/events-that-trigger-workflows push: - branches: [ master, develop ] + branches: [master, develop] pull_request: # The branches below must be a subset of the branches above - branches: [ master, develop ] + branches: [master, develop] jobs: cpu-tests: @@ -14,9 +16,9 @@ jobs: strategy: fail-fast: false matrix: - os: [ ubuntu-latest, macos-latest, windows-latest ] - python-version: [ 3.8 ] - model: [ 'yolov5s' ] # models to test + os: [ubuntu-latest, macos-latest, windows-latest] + python-version: [3.8] + model: ['yolov5s'] # models to test # Timeout: https://stackoverflow.com/a/59076067/4521646 timeout-minutes: 50 diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 458465d90eef06b80565c87f75974f9c00974c14..2305ea07e902713f38d2fe7a4e978ceedaca9f00 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -15,7 +15,7 @@ jobs: strategy: fail-fast: false matrix: - language: [ 'python' ] + language: ['python'] # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] # Learn more: # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml index ddd739ea5769d5b1123402c6b46c6932542d7b46..c557e77f3b70cede314ee22035b9cfb359e806c7 100644 --- a/.github/workflows/greetings.yml +++ b/.github/workflows/greetings.yml @@ -1,6 +1,8 @@ +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license + name: Greetings -on: [ pull_request_target, issues ] +on: [pull_request_target, issues] jobs: greeting: diff --git a/.github/workflows/rebase.yml b/.github/workflows/rebase.yml index 38e14578216cd3eee306cd4a035f3b76aea47a14..e86c57744b844d179f02f16cebcce030d7cf5b2f 100644 --- a/.github/workflows/rebase.yml +++ b/.github/workflows/rebase.yml @@ -3,7 +3,7 @@ name: Automatic Rebase on: issue_comment: - types: [ created ] + types: [created] jobs: rebase: diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index d620e540706a91a1056870c819156940afe0a442..c81c0ca18c2fbc9a0e95a55c0a3baa5c16e2a325 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -1,3 +1,5 @@ +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license + name: Close stale issues on: schedule: diff --git a/Dockerfile b/Dockerfile index e22c1106f23db1f84555b005c26fe8e26d1d47f8..858b22bc63835d963b6c0cafe14928371908db39 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,5 @@ +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license + # Start FROM Nvidia PyTorch image https://ngc.nvidia.com/catalog/containers/nvidia:pytorch FROM nvcr.io/nvidia/pytorch:21.05-py3 diff --git a/data/Argoverse.yaml b/data/Argoverse.yaml index 3bf91ce7d504290f7466be62bb2b117c9325670f..1625dd1b9d2ba06b48a1c6c65b705d53ab783693 100644 --- a/data/Argoverse.yaml +++ b/data/Argoverse.yaml @@ -1,4 +1,4 @@ -# YOLOv5 🚀 by Ultralytics https://ultralytics.com, licensed under GNU GPL v3.0 +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license # Argoverse-HD dataset (ring-front-center camera) http://www.cs.cmu.edu/~mengtial/proj/streaming/ # Example usage: python train.py --data Argoverse.yaml # parent diff --git a/data/GlobalWheat2020.yaml b/data/GlobalWheat2020.yaml index de9c7837cf57179060dd5e409300252c2e88ed6a..75b3bfdff43e85ce0fc09dbf90e5f825a281265b 100644 --- a/data/GlobalWheat2020.yaml +++ b/data/GlobalWheat2020.yaml @@ -1,4 +1,4 @@ -# YOLOv5 🚀 by Ultralytics https://ultralytics.com, licensed under GNU GPL v3.0 +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license # Global Wheat 2020 dataset http://www.global-wheat.com/ # Example usage: python train.py --data GlobalWheat2020.yaml # parent diff --git a/data/Objects365.yaml b/data/Objects365.yaml index 457b9fd9bf69e36515ace7dd8040b962f1dbca21..dc5bfbc7faa412941fc8c75a73aa67638fea1cb2 100644 --- a/data/Objects365.yaml +++ b/data/Objects365.yaml @@ -1,4 +1,4 @@ -# YOLOv5 🚀 by Ultralytics https://ultralytics.com, licensed under GNU GPL v3.0 +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license # Objects365 dataset https://www.objects365.org/ # Example usage: python train.py --data Objects365.yaml # parent diff --git a/data/SKU-110K.yaml b/data/SKU-110K.yaml index c85fa81d2e035ecb184d761e3047a843a8c44fea..653485e2079abe227664474fafe83831ee3be237 100644 --- a/data/SKU-110K.yaml +++ b/data/SKU-110K.yaml @@ -1,4 +1,4 @@ -# YOLOv5 🚀 by Ultralytics https://ultralytics.com, licensed under GNU GPL v3.0 +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license # SKU-110K retail items dataset https://github.com/eg4000/SKU110K_CVPR19 # Example usage: python train.py --data SKU-110K.yaml # parent diff --git a/data/VOC.yaml b/data/VOC.yaml index e59fb6afd2fd2814079ea9c2bf1714b5e4a663de..8dbaacf9c2900c63ad2e22b591651e50cfe9aad3 100644 --- a/data/VOC.yaml +++ b/data/VOC.yaml @@ -1,4 +1,4 @@ -# YOLOv5 🚀 by Ultralytics https://ultralytics.com, licensed under GNU GPL v3.0 +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license # PASCAL VOC dataset http://host.robots.ox.ac.uk/pascal/VOC # Example usage: python train.py --data VOC.yaml # parent diff --git a/data/VisDrone.yaml b/data/VisDrone.yaml index fe6cb9199ce19366e3fc3137c1053d3e44ebb742..7753da98269e4285836a8a495c7fd36ab67c35dd 100644 --- a/data/VisDrone.yaml +++ b/data/VisDrone.yaml @@ -1,4 +1,4 @@ -# YOLOv5 🚀 by Ultralytics https://ultralytics.com, licensed under GNU GPL v3.0 +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license # VisDrone2019-DET dataset https://github.com/VisDrone/VisDrone-Dataset # Example usage: python train.py --data VisDrone.yaml # parent diff --git a/data/coco.yaml b/data/coco.yaml index acf8e84f3e21e59e6d44d28cb32962103ff0f9ec..2ccc6478b620ad82413de7ff88e691798aa3fe27 100644 --- a/data/coco.yaml +++ b/data/coco.yaml @@ -1,4 +1,4 @@ -# YOLOv5 🚀 by Ultralytics https://ultralytics.com, licensed under GNU GPL v3.0 +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license # COCO 2017 dataset http://cocodataset.org # Example usage: python train.py --data coco.yaml # parent diff --git a/data/coco128.yaml b/data/coco128.yaml index eda39dcdaa8da19ebc4eceddfeab0daf817397ed..70cf52c397afb597e01da9e3e1cb271fbfe3e606 100644 --- a/data/coco128.yaml +++ b/data/coco128.yaml @@ -1,4 +1,4 @@ -# YOLOv5 🚀 by Ultralytics https://ultralytics.com, licensed under GNU GPL v3.0 +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license # COCO128 dataset https://www.kaggle.com/ultralytics/coco128 (first 128 images from COCO train2017) # Example usage: python train.py --data coco128.yaml # parent diff --git a/data/hyps/hyp.finetune.yaml b/data/hyps/hyp.finetune.yaml index 237cd5bc19a1802f7cb364d657e31b623a64dee8..b89d66ff8deeadeccd1ad358d1ed8259349b14ab 100644 --- a/data/hyps/hyp.finetune.yaml +++ b/data/hyps/hyp.finetune.yaml @@ -1,8 +1,8 @@ +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license # Hyperparameters for VOC finetuning # python train.py --batch 64 --weights yolov5m.pt --data VOC.yaml --img 512 --epochs 50 # See tutorials for hyperparameter evolution https://github.com/ultralytics/yolov5#tutorials - # Hyperparameter Evolution Results # Generations: 306 # P R mAP.5 mAP.5:.95 box obj cls diff --git a/data/hyps/hyp.finetune_objects365.yaml b/data/hyps/hyp.finetune_objects365.yaml index 435fa7a451191cb11041b4eb9a950b040766cfe3..073720a65be5a35acf661c2428883528710ed649 100644 --- a/data/hyps/hyp.finetune_objects365.yaml +++ b/data/hyps/hyp.finetune_objects365.yaml @@ -1,3 +1,5 @@ +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license + lr0: 0.00258 lrf: 0.17 momentum: 0.779 diff --git a/data/hyps/hyp.scratch-p6.yaml b/data/hyps/hyp.scratch-p6.yaml index fc1d8ebe087604d949f8188d90644435525eeaa5..7aad818e5b16bd4a60e04d79a2902e6e6393fd28 100644 --- a/data/hyps/hyp.scratch-p6.yaml +++ b/data/hyps/hyp.scratch-p6.yaml @@ -1,8 +1,8 @@ +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license # Hyperparameters for COCO training from scratch # python train.py --batch 32 --cfg yolov5m6.yaml --weights '' --data coco.yaml --img 1280 --epochs 300 # See tutorials for hyperparameter evolution https://github.com/ultralytics/yolov5#tutorials - lr0: 0.01 # initial learning rate (SGD=1E-2, Adam=1E-3) lrf: 0.2 # final OneCycleLR learning rate (lr0 * lrf) momentum: 0.937 # SGD momentum/Adam beta1 diff --git a/data/hyps/hyp.scratch.yaml b/data/hyps/hyp.scratch.yaml index b2cf2e32c6384c11dd8a9605d71340ee8122944c..77405a53706720e33206b42aa232d412aa01cbbf 100644 --- a/data/hyps/hyp.scratch.yaml +++ b/data/hyps/hyp.scratch.yaml @@ -1,8 +1,8 @@ +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license # Hyperparameters for COCO training from scratch # python train.py --batch 40 --cfg yolov5m.yaml --weights '' --data coco.yaml --img 640 --epochs 300 # See tutorials for hyperparameter evolution https://github.com/ultralytics/yolov5#tutorials - lr0: 0.01 # initial learning rate (SGD=1E-2, Adam=1E-3) lrf: 0.2 # final OneCycleLR learning rate (lr0 * lrf) momentum: 0.937 # SGD momentum/Adam beta1 diff --git a/data/scripts/download_weights.sh b/data/scripts/download_weights.sh index a576c956d008d0d6e38a8cbf1afd65b762fd682f..b4b0ccd7857e15376f84c2e8c41a35f1f0ed04e3 100755 --- a/data/scripts/download_weights.sh +++ b/data/scripts/download_weights.sh @@ -1,5 +1,5 @@ #!/bin/bash -# YOLOv5 🚀 by Ultralytics https://ultralytics.com, licensed under GNU GPL v3.0 +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license # Download latest models from https://github.com/ultralytics/yolov5/releases # Example usage: bash path/to/download_weights.sh # parent diff --git a/data/scripts/get_coco.sh b/data/scripts/get_coco.sh index f6c075689709d3cbe279d13cfa9caa731a6b3f33..0210c8ebbda4c8f2f2c03f064b73f8f51d3a7425 100755 --- a/data/scripts/get_coco.sh +++ b/data/scripts/get_coco.sh @@ -1,5 +1,5 @@ #!/bin/bash -# YOLOv5 🚀 by Ultralytics https://ultralytics.com, licensed under GNU GPL v3.0 +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license # Download COCO 2017 dataset http://cocodataset.org # Example usage: bash data/scripts/get_coco.sh # parent diff --git a/data/scripts/get_coco128.sh b/data/scripts/get_coco128.sh index 6eb47bfe5595960fc24d8f96598b28db1ab46dda..4238e3634dbb2947ffe21449fa6abeeacdedc459 100644 --- a/data/scripts/get_coco128.sh +++ b/data/scripts/get_coco128.sh @@ -1,5 +1,5 @@ #!/bin/bash -# YOLOv5 🚀 by Ultralytics https://ultralytics.com, licensed under GNU GPL v3.0 +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license # Download COCO128 dataset https://www.kaggle.com/ultralytics/coco128 (first 128 images from COCO train2017) # Example usage: bash data/scripts/get_coco128.sh # parent diff --git a/data/xView.yaml b/data/xView.yaml index e191188da0f055a6113f11cebce55120acde069a..fabcdb0bdd139c155d8ed5a0b24b0571e379f2e1 100644 --- a/data/xView.yaml +++ b/data/xView.yaml @@ -1,4 +1,4 @@ -# YOLOv5 🚀 by Ultralytics https://ultralytics.com, licensed under GNU GPL v3.0 +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license # xView 2018 dataset https://challenge.xviewdataset.org # -------- DOWNLOAD DATA MANUALLY from URL above and unzip to 'datasets/xView' before running train command! -------- # Example usage: python train.py --data xView.yaml diff --git a/detect.py b/detect.py index db0c545b063559005aa9c00aab5db8f20a2dab37..49ebbe96c068220744e8275d5174150bc42922e7 100644 --- a/detect.py +++ b/detect.py @@ -1,4 +1,6 @@ -"""Run inference with a YOLOv5 model on images, videos, directories, streams +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license +""" +Run inference on images, videos, directories, streams, etc. Usage: $ python path/to/detect.py --source path/to/img.jpg --weights yolov5s.pt --img 640 diff --git a/export.py b/export.py index db5a6918845cb4865a82968d502857616fd44fbd..db805cb45e6ec20e3b13bb93f2c6eda62e0d2c98 100644 --- a/export.py +++ b/export.py @@ -1,4 +1,6 @@ -"""Export a YOLOv5 *.pt model to TorchScript, ONNX, CoreML formats +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license +""" +Export a PyTorch model to TorchScript, ONNX, CoreML formats Usage: $ python path/to/export.py --weights yolov5s.pt --img 640 --batch 1 diff --git a/hubconf.py b/hubconf.py index 93ea84d69dd385fa78434fd08f600edc9a1e03f1..36f3bd86bc11251883a5d76b4162beddaf6db3ae 100644 --- a/hubconf.py +++ b/hubconf.py @@ -1,4 +1,6 @@ -"""YOLOv5 PyTorch Hub models https://pytorch.org/hub/ultralytics_yolov5/ +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license +""" +PyTorch Hub models https://pytorch.org/hub/ultralytics_yolov5/ Usage: import torch diff --git a/models/common.py b/models/common.py index 35790804ca520525935ceb20168ce86f614f9e9a..fe4319b0f3707a7b02620f8733f837a29e68aa19 100644 --- a/models/common.py +++ b/models/common.py @@ -1,11 +1,14 @@ -# YOLOv5 common modules +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license +""" +Common modules +""" import logging +import math import warnings from copy import copy from pathlib import Path -import math import numpy as np import pandas as pd import requests diff --git a/models/experimental.py b/models/experimental.py index 5c690cce3d997d9c0905760e721a4af0313adb36..7dfaf9611bec8349d4e38e168ef9af8c00237cd4 100644 --- a/models/experimental.py +++ b/models/experimental.py @@ -1,10 +1,13 @@ -# YOLOv5 experimental modules +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license +""" +Experimental modules +""" import numpy as np import torch import torch.nn as nn -from models.common import Conv, DWConv +from models.common import Conv from utils.downloads import attempt_download diff --git a/models/hub/anchors.yaml b/models/hub/anchors.yaml index 57512955ac1f2b8d3e5bc0f837b8cdea3888b558..e4d7beb06e07f295eaf58b1ebb2430a67997d2d4 100644 --- a/models/hub/anchors.yaml +++ b/models/hub/anchors.yaml @@ -1,4 +1,5 @@ -# Default YOLOv5 anchors for COCO data +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license +# Default anchors for COCO data # P5 ------------------------------------------------------------------------------------------------------------------- diff --git a/models/hub/yolov3-spp.yaml b/models/hub/yolov3-spp.yaml index ddc0549f50d6db65d061e1229faeaa5e0cf017dc..c66982158ce82d4e4ed7241c469b6f0166f0db49 100644 --- a/models/hub/yolov3-spp.yaml +++ b/models/hub/yolov3-spp.yaml @@ -1,3 +1,5 @@ +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license + # Parameters nc: 80 # number of classes depth_multiple: 1.0 # model depth multiple diff --git a/models/hub/yolov3-tiny.yaml b/models/hub/yolov3-tiny.yaml index 537ad755b1660c24167e14e62e9b382828b4da88..b28b443152485e39dcf690d18c403780c898bfab 100644 --- a/models/hub/yolov3-tiny.yaml +++ b/models/hub/yolov3-tiny.yaml @@ -1,3 +1,5 @@ +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license + # Parameters nc: 80 # number of classes depth_multiple: 1.0 # model depth multiple diff --git a/models/hub/yolov3.yaml b/models/hub/yolov3.yaml index 3adfc2c6d2f9fef6c5ff645e3a1041a1249b06f1..4f4b240e6c36658436f426531485843d4ce0e5a6 100644 --- a/models/hub/yolov3.yaml +++ b/models/hub/yolov3.yaml @@ -1,3 +1,5 @@ +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license + # Parameters nc: 80 # number of classes depth_multiple: 1.0 # model depth multiple diff --git a/models/hub/yolov5-bifpn.yaml b/models/hub/yolov5-bifpn.yaml index 69f7b5938c58afced93ba08a9773eec1a84e6dec..119aebb1523a4ddff2b39bdd067bfbaa6299d5bf 100644 --- a/models/hub/yolov5-bifpn.yaml +++ b/models/hub/yolov5-bifpn.yaml @@ -1,3 +1,5 @@ +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license + # Parameters nc: 80 # number of classes depth_multiple: 1.0 # model depth multiple diff --git a/models/hub/yolov5-fpn.yaml b/models/hub/yolov5-fpn.yaml index 217e4ca6ac969f21c32b503c2d42ba7e34d3d411..707b2136cee12c5e5c9218ede03a30e16e036401 100644 --- a/models/hub/yolov5-fpn.yaml +++ b/models/hub/yolov5-fpn.yaml @@ -1,3 +1,5 @@ +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license + # Parameters nc: 80 # number of classes depth_multiple: 1.0 # model depth multiple diff --git a/models/hub/yolov5-p2.yaml b/models/hub/yolov5-p2.yaml index 6a932a868229a3a3601152f7bf4a95a22302881c..44d8da55dafb6a75d2d6c345b20a3913b09d99f2 100644 --- a/models/hub/yolov5-p2.yaml +++ b/models/hub/yolov5-p2.yaml @@ -1,3 +1,5 @@ +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license + # Parameters nc: 80 # number of classes depth_multiple: 1.0 # model depth multiple diff --git a/models/hub/yolov5-p6.yaml b/models/hub/yolov5-p6.yaml index 58b86b0ca892e894583c1b7ecd2e622c5c80898d..85e142539ce305a758fc9d6709335bab1c854101 100644 --- a/models/hub/yolov5-p6.yaml +++ b/models/hub/yolov5-p6.yaml @@ -1,3 +1,5 @@ +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license + # Parameters nc: 80 # number of classes depth_multiple: 1.0 # model depth multiple diff --git a/models/hub/yolov5-p7.yaml b/models/hub/yolov5-p7.yaml index f6e8fc7928cce8200b26e234af604afeef34cb75..88a7a95cbbd1f68aa3a5a68d91e6378b00428704 100644 --- a/models/hub/yolov5-p7.yaml +++ b/models/hub/yolov5-p7.yaml @@ -1,3 +1,5 @@ +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license + # Parameters nc: 80 # number of classes depth_multiple: 1.0 # model depth multiple diff --git a/models/hub/yolov5-panet.yaml b/models/hub/yolov5-panet.yaml index c5f3b4817102448ad9c30aeea7ccea6c229ba2ff..76b9b7e74e338922b60f11ba004f59cda54425f0 100644 --- a/models/hub/yolov5-panet.yaml +++ b/models/hub/yolov5-panet.yaml @@ -1,3 +1,5 @@ +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license + # Parameters nc: 80 # number of classes depth_multiple: 1.0 # model depth multiple diff --git a/models/hub/yolov5l6.yaml b/models/hub/yolov5l6.yaml index d5afd7d84100d71378e092188833b007fd7429f1..1288f15f940b66196167361f5ac2339ea8419bd9 100644 --- a/models/hub/yolov5l6.yaml +++ b/models/hub/yolov5l6.yaml @@ -1,3 +1,5 @@ +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license + # Parameters nc: 80 # number of classes depth_multiple: 1.0 # model depth multiple diff --git a/models/hub/yolov5m6.yaml b/models/hub/yolov5m6.yaml index 16a841a0b4b0cd23aca474b18da66f10a5aafb57..f14f0b0ebcce6c895ca94b95c4c21b0e69312d02 100644 --- a/models/hub/yolov5m6.yaml +++ b/models/hub/yolov5m6.yaml @@ -1,3 +1,5 @@ +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license + # Parameters nc: 80 # number of classes depth_multiple: 0.67 # model depth multiple diff --git a/models/hub/yolov5s-ghost.yaml b/models/hub/yolov5s-ghost.yaml index d99d56d26e8566aab0d4bd3628c2f0238ae4b3a0..dbf2c8e0348937794605000adbbdedfe4c36bd6a 100644 --- a/models/hub/yolov5s-ghost.yaml +++ b/models/hub/yolov5s-ghost.yaml @@ -1,3 +1,5 @@ +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license + # Parameters nc: 80 # number of classes depth_multiple: 0.33 # model depth multiple diff --git a/models/hub/yolov5s-transformer.yaml b/models/hub/yolov5s-transformer.yaml index b999ebb7583df8027e33a2890ad4530c0baa3ae9..aeac1acb058273d01732f848180722100a563e09 100644 --- a/models/hub/yolov5s-transformer.yaml +++ b/models/hub/yolov5s-transformer.yaml @@ -1,3 +1,5 @@ +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license + # Parameters nc: 80 # number of classes depth_multiple: 0.33 # model depth multiple diff --git a/models/hub/yolov5s6.yaml b/models/hub/yolov5s6.yaml index 2fb24505005322a292245c361b00f999b1b3148c..2baee5af9e0522d9f3d97940cfe24df04b796996 100644 --- a/models/hub/yolov5s6.yaml +++ b/models/hub/yolov5s6.yaml @@ -1,3 +1,5 @@ +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license + # Parameters nc: 80 # number of classes depth_multiple: 0.33 # model depth multiple diff --git a/models/hub/yolov5x6.yaml b/models/hub/yolov5x6.yaml index c5187101072bfa7857186cba6ac15439101e7f60..e94f592fc19a56771de6d1ace8a5262a42324032 100644 --- a/models/hub/yolov5x6.yaml +++ b/models/hub/yolov5x6.yaml @@ -1,3 +1,5 @@ +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license + # Parameters nc: 80 # number of classes depth_multiple: 1.33 # model depth multiple diff --git a/models/yolo.py b/models/yolo.py index 88adb71f8feaf850b8e785c891f72ae3222eef41..f3c1516f49f7524c3752b5271a96b8f8350cab60 100644 --- a/models/yolo.py +++ b/models/yolo.py @@ -1,4 +1,6 @@ -"""YOLOv5-specific modules +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license +""" +YOLO-specific modules Usage: $ python path/to/models/yolo.py --cfg yolov5s.yaml diff --git a/models/yolov5l.yaml b/models/yolov5l.yaml index 0c130c1514af8fbba9ac35ccf7ace38eeaf1d491..30b22a25a483d41d75aad35582dc7e5910db8dba 100644 --- a/models/yolov5l.yaml +++ b/models/yolov5l.yaml @@ -1,3 +1,5 @@ +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license + # Parameters nc: 80 # number of classes depth_multiple: 1.0 # model depth multiple diff --git a/models/yolov5m.yaml b/models/yolov5m.yaml index e477b3433d397dfea3a52322ad0dfb64e15b1ee1..f5f518ad8ab307ce441caef312b3bb4d63e78c8f 100644 --- a/models/yolov5m.yaml +++ b/models/yolov5m.yaml @@ -1,3 +1,5 @@ +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license + # Parameters nc: 80 # number of classes depth_multiple: 0.67 # model depth multiple diff --git a/models/yolov5s.yaml b/models/yolov5s.yaml index e85442dc9188421c47fb4e7cb6f727174a141da2..b311ab7fd50aa049f66f7467475a1b72cb9e7f9a 100644 --- a/models/yolov5s.yaml +++ b/models/yolov5s.yaml @@ -1,3 +1,5 @@ +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license + # Parameters nc: 80 # number of classes depth_multiple: 0.33 # model depth multiple diff --git a/models/yolov5x.yaml b/models/yolov5x.yaml index c7ca03589ab8ea1bfee5efbe3c7b80b46ed9f8b0..7dcb822b8b846d351049f3404740e6e4cb602b2e 100644 --- a/models/yolov5x.yaml +++ b/models/yolov5x.yaml @@ -1,3 +1,5 @@ +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license + # Parameters nc: 80 # number of classes depth_multiple: 1.33 # model depth multiple diff --git a/train.py b/train.py index 24152f1a1198f7455661ba0c586625c43398a3fc..0aa7a13628dc528de766442dfad31eee5ea8d801 100644 --- a/train.py +++ b/train.py @@ -1,4 +1,6 @@ -"""Train a YOLOv5 model on a custom dataset +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license +""" +Train a YOLOv5 model on a custom dataset Usage: $ python path/to/train.py --data coco128.yaml --weights yolov5s.pt --img 640 @@ -6,6 +8,7 @@ Usage: import argparse import logging +import math import os import random import sys @@ -13,7 +16,6 @@ import time from copy import deepcopy from pathlib import Path -import math import numpy as np import torch import torch.distributed as dist diff --git a/utils/activations.py b/utils/activations.py index 92a3b5eaa54bcb46464dff900db247b0436e5046..62eb532b3f95e753732d1ff8daf40871af44ddf6 100644 --- a/utils/activations.py +++ b/utils/activations.py @@ -1,4 +1,7 @@ -# Activation functions +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license +""" +Activation functions +""" import torch import torch.nn as nn diff --git a/utils/augmentations.py b/utils/augmentations.py index cf64f2f9db1f9f4013880a693d3bb4ece40fda38..49f957e6fd62ecb21409977fe1627f9b28e819c5 100644 --- a/utils/augmentations.py +++ b/utils/augmentations.py @@ -1,10 +1,13 @@ -# YOLOv5 image augmentation functions +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license +""" +Image augmentation functions +""" import logging +import math import random import cv2 -import math import numpy as np from utils.general import colorstr, segment2box, resample_segments, check_version diff --git a/utils/autoanchor.py b/utils/autoanchor.py index eca1d5be8ebed2b0d4d36894601287b4b36e0cb0..66a2712dfd5d1e1a4f223f0cd1bbefe491bdc59c 100644 --- a/utils/autoanchor.py +++ b/utils/autoanchor.py @@ -1,4 +1,7 @@ -# Auto-anchor utils +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license +""" +Auto-anchor utils +""" import random diff --git a/utils/callbacks.py b/utils/callbacks.py index a204ec1ceaaf50adc173d80c28861463aba22043..19c334430b5db871b692725eb64ec668e2099cf3 100644 --- a/utils/callbacks.py +++ b/utils/callbacks.py @@ -1,4 +1,8 @@ -#!/usr/bin/env python +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license +""" +Callback utils +""" + class Callbacks: """" diff --git a/utils/datasets.py b/utils/datasets.py index b402723f9c49e9f98eba09a09bd652bd72ec9394..7d831cd632307f1a7f16deb447b5afe3f9475e0f 100755 --- a/utils/datasets.py +++ b/utils/datasets.py @@ -1,4 +1,7 @@ -# YOLOv5 dataset utils and dataloaders +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license +""" +Dataloaders and dataset utils +""" import glob import hashlib diff --git a/utils/downloads.py b/utils/downloads.py index 6b2c37433b5be2836ed2958abedba50b30ccbf13..27cb899cd606bc465c00063240a19321202a818b 100644 --- a/utils/downloads.py +++ b/utils/downloads.py @@ -1,4 +1,7 @@ -# Download utils +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license +""" +Download utils +""" import os import platform diff --git a/utils/flask_rest_api/README.md b/utils/flask_rest_api/README.md index 6c835936dde6ed361b3b40d627e75bf25c8b0699..a726acbd92043458311dd949cc09c0195cd35400 100644 --- a/utils/flask_rest_api/README.md +++ b/utils/flask_rest_api/README.md @@ -1,9 +1,13 @@ # Flask REST API -[REST](https://en.wikipedia.org/wiki/Representational_state_transfer) [API](https://en.wikipedia.org/wiki/API)s are commonly used to expose Machine Learning (ML) models to other services. This folder contains an example REST API created using Flask to expose the YOLOv5s model from [PyTorch Hub](https://pytorch.org/hub/ultralytics_yolov5/). + +[REST](https://en.wikipedia.org/wiki/Representational_state_transfer) [API](https://en.wikipedia.org/wiki/API)s are +commonly used to expose Machine Learning (ML) models to other services. This folder contains an example REST API +created using Flask to expose the YOLOv5s model from [PyTorch Hub](https://pytorch.org/hub/ultralytics_yolov5/). ## Requirements [Flask](https://palletsprojects.com/p/flask/) is required. Install with: + ```shell $ pip install Flask ``` @@ -65,4 +69,5 @@ The model inference results are returned as a JSON response: ] ``` -An example python script to perform inference using [requests](https://docs.python-requests.org/en/master/) is given in `example_request.py` +An example python script to perform inference using [requests](https://docs.python-requests.org/en/master/) is given +in `example_request.py` diff --git a/utils/general.py b/utils/general.py index 4fc32f5691fccbddc85c37542a77e20ea7bd067e..850ca6ba0b1f87aea14f63d5fa85cd8053858c43 100755 --- a/utils/general.py +++ b/utils/general.py @@ -1,8 +1,12 @@ -# YOLOv5 general utils +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license +""" +General utils +""" import contextlib import glob import logging +import math import os import platform import random @@ -16,7 +20,6 @@ from pathlib import Path from subprocess import check_output import cv2 -import math import numpy as np import pandas as pd import pkg_resources as pkg diff --git a/utils/loggers/__init__.py b/utils/loggers/__init__.py index d40c0c350fde990dc4e661b9ee076c3b33fb6423..3d67e9307b4c4cdd44ecb4a3914b1a6d0953c597 100644 --- a/utils/loggers/__init__.py +++ b/utils/loggers/__init__.py @@ -1,4 +1,8 @@ -# YOLOv5 experiment logging utils +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license +""" +Logging utils +""" + import warnings from threading import Thread diff --git a/utils/loggers/wandb/wandb_utils.py b/utils/loggers/wandb/wandb_utils.py index 019aebf094e122e18a96c391a1051b9ec60d5a85..4631e8a1f8fd1358e4c8545751d98602ac4e646c 100644 --- a/utils/loggers/wandb/wandb_utils.py +++ b/utils/loggers/wandb/wandb_utils.py @@ -507,4 +507,4 @@ def all_logging_disabled(highest_level=logging.CRITICAL): try: yield finally: - logging.disable(previous_level) \ No newline at end of file + logging.disable(previous_level) diff --git a/utils/loss.py b/utils/loss.py index 79e8f24359c138e3350b056e3801553d8f03662d..29aac3191c10c539d89fde0d938b09e173d59949 100644 --- a/utils/loss.py +++ b/utils/loss.py @@ -1,4 +1,7 @@ -# Loss functions +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license +""" +Loss functions +""" import torch import torch.nn as nn diff --git a/utils/metrics.py b/utils/metrics.py index c94c4a76a96457084cb1ff346af181055bd2aa42..ddc425910a7590f60489e99246ea373fb1743572 100644 --- a/utils/metrics.py +++ b/utils/metrics.py @@ -1,9 +1,12 @@ -# Model validation metrics +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license +""" +Model validation metrics +""" +import math import warnings from pathlib import Path -import math import matplotlib.pyplot as plt import numpy as np import torch diff --git a/utils/plots.py b/utils/plots.py index 71e90b00241d1a2cba2a699ab614a32cbf2c3ae2..76c161a13d1a6f6f6bb1477e8af27d15ebdaa50b 100644 --- a/utils/plots.py +++ b/utils/plots.py @@ -1,4 +1,7 @@ -# Plotting utils +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license +""" +Plotting utils +""" import math from copy import copy diff --git a/utils/torch_utils.py b/utils/torch_utils.py index 628f672a010d667064eb9a4d17e44f0514dc7141..dff0617e87c946a6221e8bde8c33b9f62b889e22 100644 --- a/utils/torch_utils.py +++ b/utils/torch_utils.py @@ -1,7 +1,11 @@ -# YOLOv5 PyTorch utils +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license +""" +PyTorch utils +""" import datetime import logging +import math import os import platform import subprocess @@ -10,7 +14,6 @@ from contextlib import contextmanager from copy import deepcopy from pathlib import Path -import math import torch import torch.backends.cudnn as cudnn import torch.distributed as dist diff --git a/val.py b/val.py index 4c1d7d26b0dea424d150b6d0bb89c2da0883d40b..cbee8cf1c026c946613a2f5403e0a99271816373 100644 --- a/val.py +++ b/val.py @@ -1,4 +1,6 @@ -"""Validate a trained YOLOv5 model accuracy on a custom dataset +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license +""" +Validate a trained YOLOv5 model accuracy on a custom dataset Usage: $ python path/to/val.py --data coco128.yaml --weights yolov5s.pt --img 640