From fe11bf97108a41119801b7f9cdcc1a452ba981ef Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Sat, 14 Aug 2021 20:59:01 +0200 Subject: [PATCH 1/5] Implement new headers --- .github/workflows/ci-testing.yml | 2 ++ .github/workflows/greetings.yml | 2 ++ .github/workflows/stale.yml | 2 ++ Dockerfile | 2 ++ data/Argoverse.yaml | 2 +- data/GlobalWheat2020.yaml | 2 +- data/Objects365.yaml | 2 +- data/SKU-110K.yaml | 2 +- data/VOC.yaml | 2 +- data/VisDrone.yaml | 2 +- data/coco.yaml | 2 +- data/coco128.yaml | 2 +- data/hyps/hyp.finetune.yaml | 2 +- data/hyps/hyp.finetune_objects365.yaml | 2 ++ data/hyps/hyp.scratch-p6.yaml | 2 +- data/hyps/hyp.scratch.yaml | 2 +- data/scripts/download_weights.sh | 2 +- data/scripts/get_coco.sh | 2 +- data/scripts/get_coco128.sh | 2 +- data/xView.yaml | 2 +- detect.py | 4 +++- export.py | 4 +++- hubconf.py | 4 +++- models/common.py | 5 ++++- models/experimental.py | 7 +++++-- models/hub/anchors.yaml | 3 ++- models/hub/yolov3-spp.yaml | 2 ++ models/hub/yolov3-tiny.yaml | 2 ++ models/hub/yolov3.yaml | 2 ++ models/hub/yolov5-bifpn.yaml | 2 ++ models/hub/yolov5-fpn.yaml | 2 ++ models/hub/yolov5-p2.yaml | 2 ++ models/hub/yolov5-p6.yaml | 2 ++ models/hub/yolov5-p7.yaml | 2 ++ models/hub/yolov5-panet.yaml | 2 ++ models/hub/yolov5l6.yaml | 2 ++ models/hub/yolov5m6.yaml | 2 ++ models/hub/yolov5s-ghost.yaml | 2 ++ models/hub/yolov5s-transformer.yaml | 2 ++ models/hub/yolov5s6.yaml | 2 ++ models/hub/yolov5x6.yaml | 2 ++ models/yolo.py | 4 +++- models/yolov5l.yaml | 2 ++ models/yolov5m.yaml | 2 ++ models/yolov5s.yaml | 2 ++ models/yolov5x.yaml | 2 ++ train.py | 4 +++- utils/activations.py | 5 ++++- utils/augmentations.py | 5 ++++- utils/autoanchor.py | 5 ++++- utils/callbacks.py | 5 ++++- utils/datasets.py | 5 ++++- utils/downloads.py | 5 ++++- utils/general.py | 5 ++++- utils/loggers/__init__.py | 6 +++++- utils/loss.py | 5 ++++- utils/metrics.py | 5 ++++- utils/plots.py | 5 ++++- utils/torch_utils.py | 5 ++++- val.py | 4 +++- 60 files changed, 141 insertions(+), 37 deletions(-) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index a7964ea01d5d..c78a28add7b7 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -1,3 +1,5 @@ +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license + name: CI CPU testing on: # https://help.github.com/en/actions/reference/events-that-trigger-workflows diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml index ddd739ea5769..e3a3c6fd3000 100644 --- a/.github/workflows/greetings.yml +++ b/.github/workflows/greetings.yml @@ -1,3 +1,5 @@ +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license + name: Greetings on: [ pull_request_target, issues ] diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index d620e540706a..c81c0ca18c2f 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 e22c1106f23d..858b22bc6383 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 3bf91ce7d504..1625dd1b9d2b 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 de9c7837cf57..75b3bfdff43e 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 457b9fd9bf69..dc5bfbc7faa4 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 c85fa81d2e03..653485e2079a 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 e59fb6afd2fd..8dbaacf9c290 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 fe6cb9199ce1..7753da98269e 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 acf8e84f3e21..2ccc6478b620 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 eda39dcdaa8d..70cf52c397af 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 237cd5bc19a1..b89d66ff8dee 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 435fa7a45119..073720a65be5 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 fc1d8ebe0876..7aad818e5b16 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 b2cf2e32c638..77405a537067 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 a576c956d008..b4b0ccd7857e 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 f6c075689709..0210c8ebbda4 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 6eb47bfe5595..4238e3634dbb 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 e191188da0f0..fabcdb0bdd13 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 db0c545b0635..49ebbe96c068 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 db5a6918845c..db805cb45e6e 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 93ea84d69dd3..36f3bd86bc11 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 35790804ca52..01e3b61f05ff 100644 --- a/models/common.py +++ b/models/common.py @@ -1,4 +1,7 @@ -# YOLOv5 common modules +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license +""" +Common modules +""" import logging import warnings diff --git a/models/experimental.py b/models/experimental.py index 5c690cce3d99..7dfaf9611bec 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 57512955ac1f..e4d7beb06e07 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 ddc0549f50d6..c66982158ce8 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 537ad755b166..b28b44315248 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 3adfc2c6d2f9..4f4b240e6c36 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 69f7b5938c58..119aebb1523a 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 217e4ca6ac96..707b2136cee1 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 6a932a868229..44d8da55dafb 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 58b86b0ca892..85e142539ce3 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 f6e8fc7928cc..88a7a95cbbd1 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 c5f3b4817102..76b9b7e74e33 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 d5afd7d84100..1288f15f940b 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 16a841a0b4b0..f14f0b0ebcce 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 d99d56d26e85..dbf2c8e03489 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 b999ebb7583d..aeac1acb0582 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 2fb245050053..2baee5af9e05 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 c5187101072b..e94f592fc19a 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 88adb71f8fea..f3c1516f49f7 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 0c130c1514af..30b22a25a483 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 e477b3433d39..f5f518ad8ab3 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 e85442dc9188..b311ab7fd50a 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 c7ca03589ab8..7dcb822b8b84 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 24152f1a1198..4cb74ba807bd 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 diff --git a/utils/activations.py b/utils/activations.py index 92a3b5eaa54b..62eb532b3f95 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 cf64f2f9db1f..8cc98a81ef8a 100644 --- a/utils/augmentations.py +++ b/utils/augmentations.py @@ -1,4 +1,7 @@ -# YOLOv5 image augmentation functions +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license +""" +Image augmentation functions +""" import logging import random diff --git a/utils/autoanchor.py b/utils/autoanchor.py index eca1d5be8ebe..66a2712dfd5d 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 a204ec1ceaaf..efb2eedb3053 100644 --- a/utils/callbacks.py +++ b/utils/callbacks.py @@ -1,4 +1,7 @@ -#!/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 b402723f9c49..7d831cd63230 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 6b2c37433b5b..27cb899cd606 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/general.py b/utils/general.py index 4fc32f5691fc..f20b2ee4cd0e 100755 --- a/utils/general.py +++ b/utils/general.py @@ -1,4 +1,7 @@ -# YOLOv5 general utils +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license +""" +General utils +""" import contextlib import glob diff --git a/utils/loggers/__init__.py b/utils/loggers/__init__.py index d40c0c350fde..3d67e9307b4c 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/loss.py b/utils/loss.py index 79e8f24359c1..29aac3191c10 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 c94c4a76a964..5e78da0ca598 100644 --- a/utils/metrics.py +++ b/utils/metrics.py @@ -1,4 +1,7 @@ -# Model validation metrics +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license +""" +Model validation metrics +""" import warnings from pathlib import Path diff --git a/utils/plots.py b/utils/plots.py index 71e90b00241d..76c161a13d1a 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 628f672a010d..c93310cc1131 100644 --- a/utils/torch_utils.py +++ b/utils/torch_utils.py @@ -1,4 +1,7 @@ -# YOLOv5 PyTorch utils +# YOLOv5 🚀 by Ultralytics, GPL-3.0 license +""" +PyTorch utils +""" import datetime import logging diff --git a/val.py b/val.py index 4c1d7d26b0de..cbee8cf1c026 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 From 8fc449955b837a6272caee139f8e94bce1d34202 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Sat, 14 Aug 2021 21:03:06 +0200 Subject: [PATCH 2/5] Reformat 1 --- utils/callbacks.py | 1 + utils/loggers/wandb/wandb_utils.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/utils/callbacks.py b/utils/callbacks.py index efb2eedb3053..19c334430b5d 100644 --- a/utils/callbacks.py +++ b/utils/callbacks.py @@ -3,6 +3,7 @@ Callback utils """ + class Callbacks: """" Handles all registered callbacks for YOLOv5 Hooks diff --git a/utils/loggers/wandb/wandb_utils.py b/utils/loggers/wandb/wandb_utils.py index 019aebf094e1..4631e8a1f8fd 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) From 253d03f5bc81315bc8ccb66137ff1ada7fe002b9 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Sat, 14 Aug 2021 21:03:43 +0200 Subject: [PATCH 3/5] Reformat 2 --- utils/flask_rest_api/README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/utils/flask_rest_api/README.md b/utils/flask_rest_api/README.md index 6c835936dde6..a726acbd9204 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` From e102ff0d8926a95b11ba851df83d2922dee6cdc5 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Sat, 14 Aug 2021 21:06:04 +0200 Subject: [PATCH 4/5] Reformat 3 - math --- models/common.py | 2 +- train.py | 2 +- utils/augmentations.py | 2 +- utils/general.py | 2 +- utils/metrics.py | 2 +- utils/torch_utils.py | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/models/common.py b/models/common.py index 01e3b61f05ff..fe4319b0f370 100644 --- a/models/common.py +++ b/models/common.py @@ -4,11 +4,11 @@ """ 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/train.py b/train.py index 4cb74ba807bd..0aa7a13628dc 100644 --- a/train.py +++ b/train.py @@ -8,6 +8,7 @@ import argparse import logging +import math import os import random import sys @@ -15,7 +16,6 @@ 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/augmentations.py b/utils/augmentations.py index 8cc98a81ef8a..49f957e6fd62 100644 --- a/utils/augmentations.py +++ b/utils/augmentations.py @@ -4,10 +4,10 @@ """ 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/general.py b/utils/general.py index f20b2ee4cd0e..850ca6ba0b1f 100755 --- a/utils/general.py +++ b/utils/general.py @@ -6,6 +6,7 @@ import contextlib import glob import logging +import math import os import platform import random @@ -19,7 +20,6 @@ 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/metrics.py b/utils/metrics.py index 5e78da0ca598..ddc425910a75 100644 --- a/utils/metrics.py +++ b/utils/metrics.py @@ -3,10 +3,10 @@ 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/torch_utils.py b/utils/torch_utils.py index c93310cc1131..dff0617e87c9 100644 --- a/utils/torch_utils.py +++ b/utils/torch_utils.py @@ -5,6 +5,7 @@ import datetime import logging +import math import os import platform import subprocess @@ -13,7 +14,6 @@ from copy import deepcopy from pathlib import Path -import math import torch import torch.backends.cudnn as cudnn import torch.distributed as dist From 42547610e8747297871ed55ab161237dc474debf Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Sat, 14 Aug 2021 21:06:20 +0200 Subject: [PATCH 5/5] Reformat 4 - yaml --- .github/workflows/ci-testing.yml | 10 +++++----- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/greetings.yml | 2 +- .github/workflows/rebase.yml | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index c78a28add7b7..02e8f74bf56c 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -4,10 +4,10 @@ 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: @@ -16,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 458465d90eef..2305ea07e902 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 e3a3c6fd3000..c557e77f3b70 100644 --- a/.github/workflows/greetings.yml +++ b/.github/workflows/greetings.yml @@ -2,7 +2,7 @@ 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 38e14578216c..e86c57744b84 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: