Standardize headers and docstrings (#4417)
* Implement new headers * Reformat 1 * Reformat 2 * Reformat 3 - math * Reformat 4 - yaml
This commit is contained in:
parent
bb0aed1ba6
commit
24bea5e4b7
|
|
@ -1,11 +1,13 @@
|
||||||
|
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||||
|
|
||||||
name: CI CPU testing
|
name: CI CPU testing
|
||||||
|
|
||||||
on: # https://help.github.com/en/actions/reference/events-that-trigger-workflows
|
on: # https://help.github.com/en/actions/reference/events-that-trigger-workflows
|
||||||
push:
|
push:
|
||||||
branches: [ master, develop ]
|
branches: [master, develop]
|
||||||
pull_request:
|
pull_request:
|
||||||
# The branches below must be a subset of the branches above
|
# The branches below must be a subset of the branches above
|
||||||
branches: [ master, develop ]
|
branches: [master, develop]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
cpu-tests:
|
cpu-tests:
|
||||||
|
|
@ -14,9 +16,9 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ ubuntu-latest, macos-latest, windows-latest ]
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
python-version: [ 3.8 ]
|
python-version: [3.8]
|
||||||
model: [ 'yolov5s' ] # models to test
|
model: ['yolov5s'] # models to test
|
||||||
|
|
||||||
# Timeout: https://stackoverflow.com/a/59076067/4521646
|
# Timeout: https://stackoverflow.com/a/59076067/4521646
|
||||||
timeout-minutes: 50
|
timeout-minutes: 50
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
language: [ 'python' ]
|
language: ['python']
|
||||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
|
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
|
||||||
# Learn more:
|
# 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
|
# 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
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
|
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||||
|
|
||||||
name: Greetings
|
name: Greetings
|
||||||
|
|
||||||
on: [ pull_request_target, issues ]
|
on: [pull_request_target, issues]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
greeting:
|
greeting:
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ name: Automatic Rebase
|
||||||
|
|
||||||
on:
|
on:
|
||||||
issue_comment:
|
issue_comment:
|
||||||
types: [ created ]
|
types: [created]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
rebase:
|
rebase:
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||||
|
|
||||||
name: Close stale issues
|
name: Close stale issues
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||||
|
|
||||||
# Start FROM Nvidia PyTorch image https://ngc.nvidia.com/catalog/containers/nvidia:pytorch
|
# Start FROM Nvidia PyTorch image https://ngc.nvidia.com/catalog/containers/nvidia:pytorch
|
||||||
FROM nvcr.io/nvidia/pytorch:21.05-py3
|
FROM nvcr.io/nvidia/pytorch:21.05-py3
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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/
|
# Argoverse-HD dataset (ring-front-center camera) http://www.cs.cmu.edu/~mengtial/proj/streaming/
|
||||||
# Example usage: python train.py --data Argoverse.yaml
|
# Example usage: python train.py --data Argoverse.yaml
|
||||||
# parent
|
# parent
|
||||||
|
|
|
||||||
|
|
@ -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/
|
# Global Wheat 2020 dataset http://www.global-wheat.com/
|
||||||
# Example usage: python train.py --data GlobalWheat2020.yaml
|
# Example usage: python train.py --data GlobalWheat2020.yaml
|
||||||
# parent
|
# parent
|
||||||
|
|
|
||||||
|
|
@ -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/
|
# Objects365 dataset https://www.objects365.org/
|
||||||
# Example usage: python train.py --data Objects365.yaml
|
# Example usage: python train.py --data Objects365.yaml
|
||||||
# parent
|
# parent
|
||||||
|
|
|
||||||
|
|
@ -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
|
# SKU-110K retail items dataset https://github.com/eg4000/SKU110K_CVPR19
|
||||||
# Example usage: python train.py --data SKU-110K.yaml
|
# Example usage: python train.py --data SKU-110K.yaml
|
||||||
# parent
|
# parent
|
||||||
|
|
|
||||||
|
|
@ -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
|
# PASCAL VOC dataset http://host.robots.ox.ac.uk/pascal/VOC
|
||||||
# Example usage: python train.py --data VOC.yaml
|
# Example usage: python train.py --data VOC.yaml
|
||||||
# parent
|
# parent
|
||||||
|
|
|
||||||
|
|
@ -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
|
# VisDrone2019-DET dataset https://github.com/VisDrone/VisDrone-Dataset
|
||||||
# Example usage: python train.py --data VisDrone.yaml
|
# Example usage: python train.py --data VisDrone.yaml
|
||||||
# parent
|
# parent
|
||||||
|
|
|
||||||
|
|
@ -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
|
# COCO 2017 dataset http://cocodataset.org
|
||||||
# Example usage: python train.py --data coco.yaml
|
# Example usage: python train.py --data coco.yaml
|
||||||
# parent
|
# parent
|
||||||
|
|
|
||||||
|
|
@ -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)
|
# COCO128 dataset https://www.kaggle.com/ultralytics/coco128 (first 128 images from COCO train2017)
|
||||||
# Example usage: python train.py --data coco128.yaml
|
# Example usage: python train.py --data coco128.yaml
|
||||||
# parent
|
# parent
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
|
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||||
# Hyperparameters for VOC finetuning
|
# Hyperparameters for VOC finetuning
|
||||||
# python train.py --batch 64 --weights yolov5m.pt --data VOC.yaml --img 512 --epochs 50
|
# 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
|
# See tutorials for hyperparameter evolution https://github.com/ultralytics/yolov5#tutorials
|
||||||
|
|
||||||
|
|
||||||
# Hyperparameter Evolution Results
|
# Hyperparameter Evolution Results
|
||||||
# Generations: 306
|
# Generations: 306
|
||||||
# P R mAP.5 mAP.5:.95 box obj cls
|
# P R mAP.5 mAP.5:.95 box obj cls
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||||
|
|
||||||
lr0: 0.00258
|
lr0: 0.00258
|
||||||
lrf: 0.17
|
lrf: 0.17
|
||||||
momentum: 0.779
|
momentum: 0.779
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
|
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||||
# Hyperparameters for COCO training from scratch
|
# Hyperparameters for COCO training from scratch
|
||||||
# python train.py --batch 32 --cfg yolov5m6.yaml --weights '' --data coco.yaml --img 1280 --epochs 300
|
# 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
|
# See tutorials for hyperparameter evolution https://github.com/ultralytics/yolov5#tutorials
|
||||||
|
|
||||||
|
|
||||||
lr0: 0.01 # initial learning rate (SGD=1E-2, Adam=1E-3)
|
lr0: 0.01 # initial learning rate (SGD=1E-2, Adam=1E-3)
|
||||||
lrf: 0.2 # final OneCycleLR learning rate (lr0 * lrf)
|
lrf: 0.2 # final OneCycleLR learning rate (lr0 * lrf)
|
||||||
momentum: 0.937 # SGD momentum/Adam beta1
|
momentum: 0.937 # SGD momentum/Adam beta1
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
|
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||||
# Hyperparameters for COCO training from scratch
|
# Hyperparameters for COCO training from scratch
|
||||||
# python train.py --batch 40 --cfg yolov5m.yaml --weights '' --data coco.yaml --img 640 --epochs 300
|
# 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
|
# See tutorials for hyperparameter evolution https://github.com/ultralytics/yolov5#tutorials
|
||||||
|
|
||||||
|
|
||||||
lr0: 0.01 # initial learning rate (SGD=1E-2, Adam=1E-3)
|
lr0: 0.01 # initial learning rate (SGD=1E-2, Adam=1E-3)
|
||||||
lrf: 0.2 # final OneCycleLR learning rate (lr0 * lrf)
|
lrf: 0.2 # final OneCycleLR learning rate (lr0 * lrf)
|
||||||
momentum: 0.937 # SGD momentum/Adam beta1
|
momentum: 0.937 # SGD momentum/Adam beta1
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#!/bin/bash
|
#!/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
|
# Download latest models from https://github.com/ultralytics/yolov5/releases
|
||||||
# Example usage: bash path/to/download_weights.sh
|
# Example usage: bash path/to/download_weights.sh
|
||||||
# parent
|
# parent
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#!/bin/bash
|
#!/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
|
# Download COCO 2017 dataset http://cocodataset.org
|
||||||
# Example usage: bash data/scripts/get_coco.sh
|
# Example usage: bash data/scripts/get_coco.sh
|
||||||
# parent
|
# parent
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#!/bin/bash
|
#!/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)
|
# Download COCO128 dataset https://www.kaggle.com/ultralytics/coco128 (first 128 images from COCO train2017)
|
||||||
# Example usage: bash data/scripts/get_coco128.sh
|
# Example usage: bash data/scripts/get_coco128.sh
|
||||||
# parent
|
# parent
|
||||||
|
|
|
||||||
|
|
@ -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
|
# xView 2018 dataset https://challenge.xviewdataset.org
|
||||||
# -------- DOWNLOAD DATA MANUALLY from URL above and unzip to 'datasets/xView' before running train command! --------
|
# -------- DOWNLOAD DATA MANUALLY from URL above and unzip to 'datasets/xView' before running train command! --------
|
||||||
# Example usage: python train.py --data xView.yaml
|
# Example usage: python train.py --data xView.yaml
|
||||||
|
|
|
||||||
|
|
@ -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:
|
Usage:
|
||||||
$ python path/to/detect.py --source path/to/img.jpg --weights yolov5s.pt --img 640
|
$ python path/to/detect.py --source path/to/img.jpg --weights yolov5s.pt --img 640
|
||||||
|
|
|
||||||
|
|
@ -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:
|
Usage:
|
||||||
$ python path/to/export.py --weights yolov5s.pt --img 640 --batch 1
|
$ python path/to/export.py --weights yolov5s.pt --img 640 --batch 1
|
||||||
|
|
|
||||||
|
|
@ -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:
|
Usage:
|
||||||
import torch
|
import torch
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,14 @@
|
||||||
# YOLOv5 common modules
|
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||||
|
"""
|
||||||
|
Common modules
|
||||||
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
import math
|
||||||
import warnings
|
import warnings
|
||||||
from copy import copy
|
from copy import copy
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import math
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import requests
|
import requests
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,13 @@
|
||||||
# YOLOv5 experimental modules
|
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||||
|
"""
|
||||||
|
Experimental modules
|
||||||
|
"""
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import torch
|
import torch
|
||||||
import torch.nn as nn
|
import torch.nn as nn
|
||||||
|
|
||||||
from models.common import Conv, DWConv
|
from models.common import Conv
|
||||||
from utils.downloads import attempt_download
|
from utils.downloads import attempt_download
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
# Default YOLOv5 anchors for COCO data
|
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||||
|
# Default anchors for COCO data
|
||||||
|
|
||||||
|
|
||||||
# P5 -------------------------------------------------------------------------------------------------------------------
|
# P5 -------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||||
|
|
||||||
# Parameters
|
# Parameters
|
||||||
nc: 80 # number of classes
|
nc: 80 # number of classes
|
||||||
depth_multiple: 1.0 # model depth multiple
|
depth_multiple: 1.0 # model depth multiple
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||||
|
|
||||||
# Parameters
|
# Parameters
|
||||||
nc: 80 # number of classes
|
nc: 80 # number of classes
|
||||||
depth_multiple: 1.0 # model depth multiple
|
depth_multiple: 1.0 # model depth multiple
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||||
|
|
||||||
# Parameters
|
# Parameters
|
||||||
nc: 80 # number of classes
|
nc: 80 # number of classes
|
||||||
depth_multiple: 1.0 # model depth multiple
|
depth_multiple: 1.0 # model depth multiple
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||||
|
|
||||||
# Parameters
|
# Parameters
|
||||||
nc: 80 # number of classes
|
nc: 80 # number of classes
|
||||||
depth_multiple: 1.0 # model depth multiple
|
depth_multiple: 1.0 # model depth multiple
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||||
|
|
||||||
# Parameters
|
# Parameters
|
||||||
nc: 80 # number of classes
|
nc: 80 # number of classes
|
||||||
depth_multiple: 1.0 # model depth multiple
|
depth_multiple: 1.0 # model depth multiple
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||||
|
|
||||||
# Parameters
|
# Parameters
|
||||||
nc: 80 # number of classes
|
nc: 80 # number of classes
|
||||||
depth_multiple: 1.0 # model depth multiple
|
depth_multiple: 1.0 # model depth multiple
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||||
|
|
||||||
# Parameters
|
# Parameters
|
||||||
nc: 80 # number of classes
|
nc: 80 # number of classes
|
||||||
depth_multiple: 1.0 # model depth multiple
|
depth_multiple: 1.0 # model depth multiple
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||||
|
|
||||||
# Parameters
|
# Parameters
|
||||||
nc: 80 # number of classes
|
nc: 80 # number of classes
|
||||||
depth_multiple: 1.0 # model depth multiple
|
depth_multiple: 1.0 # model depth multiple
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||||
|
|
||||||
# Parameters
|
# Parameters
|
||||||
nc: 80 # number of classes
|
nc: 80 # number of classes
|
||||||
depth_multiple: 1.0 # model depth multiple
|
depth_multiple: 1.0 # model depth multiple
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||||
|
|
||||||
# Parameters
|
# Parameters
|
||||||
nc: 80 # number of classes
|
nc: 80 # number of classes
|
||||||
depth_multiple: 1.0 # model depth multiple
|
depth_multiple: 1.0 # model depth multiple
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||||
|
|
||||||
# Parameters
|
# Parameters
|
||||||
nc: 80 # number of classes
|
nc: 80 # number of classes
|
||||||
depth_multiple: 0.67 # model depth multiple
|
depth_multiple: 0.67 # model depth multiple
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||||
|
|
||||||
# Parameters
|
# Parameters
|
||||||
nc: 80 # number of classes
|
nc: 80 # number of classes
|
||||||
depth_multiple: 0.33 # model depth multiple
|
depth_multiple: 0.33 # model depth multiple
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||||
|
|
||||||
# Parameters
|
# Parameters
|
||||||
nc: 80 # number of classes
|
nc: 80 # number of classes
|
||||||
depth_multiple: 0.33 # model depth multiple
|
depth_multiple: 0.33 # model depth multiple
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||||
|
|
||||||
# Parameters
|
# Parameters
|
||||||
nc: 80 # number of classes
|
nc: 80 # number of classes
|
||||||
depth_multiple: 0.33 # model depth multiple
|
depth_multiple: 0.33 # model depth multiple
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||||
|
|
||||||
# Parameters
|
# Parameters
|
||||||
nc: 80 # number of classes
|
nc: 80 # number of classes
|
||||||
depth_multiple: 1.33 # model depth multiple
|
depth_multiple: 1.33 # model depth multiple
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
"""YOLOv5-specific modules
|
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||||
|
"""
|
||||||
|
YOLO-specific modules
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
$ python path/to/models/yolo.py --cfg yolov5s.yaml
|
$ python path/to/models/yolo.py --cfg yolov5s.yaml
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||||
|
|
||||||
# Parameters
|
# Parameters
|
||||||
nc: 80 # number of classes
|
nc: 80 # number of classes
|
||||||
depth_multiple: 1.0 # model depth multiple
|
depth_multiple: 1.0 # model depth multiple
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||||
|
|
||||||
# Parameters
|
# Parameters
|
||||||
nc: 80 # number of classes
|
nc: 80 # number of classes
|
||||||
depth_multiple: 0.67 # model depth multiple
|
depth_multiple: 0.67 # model depth multiple
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||||
|
|
||||||
# Parameters
|
# Parameters
|
||||||
nc: 80 # number of classes
|
nc: 80 # number of classes
|
||||||
depth_multiple: 0.33 # model depth multiple
|
depth_multiple: 0.33 # model depth multiple
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||||
|
|
||||||
# Parameters
|
# Parameters
|
||||||
nc: 80 # number of classes
|
nc: 80 # number of classes
|
||||||
depth_multiple: 1.33 # model depth multiple
|
depth_multiple: 1.33 # model depth multiple
|
||||||
|
|
|
||||||
6
train.py
6
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:
|
Usage:
|
||||||
$ python path/to/train.py --data coco128.yaml --weights yolov5s.pt --img 640
|
$ python path/to/train.py --data coco128.yaml --weights yolov5s.pt --img 640
|
||||||
|
|
@ -6,6 +8,7 @@ Usage:
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import logging
|
import logging
|
||||||
|
import math
|
||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
import sys
|
import sys
|
||||||
|
|
@ -13,7 +16,6 @@ import time
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import math
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import torch
|
import torch
|
||||||
import torch.distributed as dist
|
import torch.distributed as dist
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,7 @@
|
||||||
# Activation functions
|
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||||
|
"""
|
||||||
|
Activation functions
|
||||||
|
"""
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
import torch.nn as nn
|
import torch.nn as nn
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,13 @@
|
||||||
# YOLOv5 image augmentation functions
|
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||||
|
"""
|
||||||
|
Image augmentation functions
|
||||||
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
import math
|
||||||
import random
|
import random
|
||||||
|
|
||||||
import cv2
|
import cv2
|
||||||
import math
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from utils.general import colorstr, segment2box, resample_segments, check_version
|
from utils.general import colorstr, segment2box, resample_segments, check_version
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,7 @@
|
||||||
# Auto-anchor utils
|
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||||
|
"""
|
||||||
|
Auto-anchor utils
|
||||||
|
"""
|
||||||
|
|
||||||
import random
|
import random
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,8 @@
|
||||||
#!/usr/bin/env python
|
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||||
|
"""
|
||||||
|
Callback utils
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
class Callbacks:
|
class Callbacks:
|
||||||
""""
|
""""
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,7 @@
|
||||||
# YOLOv5 dataset utils and dataloaders
|
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||||
|
"""
|
||||||
|
Dataloaders and dataset utils
|
||||||
|
"""
|
||||||
|
|
||||||
import glob
|
import glob
|
||||||
import hashlib
|
import hashlib
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,7 @@
|
||||||
# Download utils
|
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||||
|
"""
|
||||||
|
Download utils
|
||||||
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,13 @@
|
||||||
# Flask REST API
|
# 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
|
## Requirements
|
||||||
|
|
||||||
[Flask](https://palletsprojects.com/p/flask/) is required. Install with:
|
[Flask](https://palletsprojects.com/p/flask/) is required. Install with:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ pip install Flask
|
$ 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`
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,12 @@
|
||||||
# YOLOv5 general utils
|
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||||
|
"""
|
||||||
|
General utils
|
||||||
|
"""
|
||||||
|
|
||||||
import contextlib
|
import contextlib
|
||||||
import glob
|
import glob
|
||||||
import logging
|
import logging
|
||||||
|
import math
|
||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
import random
|
import random
|
||||||
|
|
@ -16,7 +20,6 @@ from pathlib import Path
|
||||||
from subprocess import check_output
|
from subprocess import check_output
|
||||||
|
|
||||||
import cv2
|
import cv2
|
||||||
import math
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import pkg_resources as pkg
|
import pkg_resources as pkg
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,8 @@
|
||||||
# YOLOv5 experiment logging utils
|
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||||
|
"""
|
||||||
|
Logging utils
|
||||||
|
"""
|
||||||
|
|
||||||
import warnings
|
import warnings
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,7 @@
|
||||||
# Loss functions
|
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||||
|
"""
|
||||||
|
Loss functions
|
||||||
|
"""
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
import torch.nn as nn
|
import torch.nn as nn
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,12 @@
|
||||||
# Model validation metrics
|
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||||
|
"""
|
||||||
|
Model validation metrics
|
||||||
|
"""
|
||||||
|
|
||||||
|
import math
|
||||||
import warnings
|
import warnings
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import math
|
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import torch
|
import torch
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,7 @@
|
||||||
# Plotting utils
|
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||||
|
"""
|
||||||
|
Plotting utils
|
||||||
|
"""
|
||||||
|
|
||||||
import math
|
import math
|
||||||
from copy import copy
|
from copy import copy
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,11 @@
|
||||||
# YOLOv5 PyTorch utils
|
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
|
||||||
|
"""
|
||||||
|
PyTorch utils
|
||||||
|
"""
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
import logging
|
import logging
|
||||||
|
import math
|
||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
@ -10,7 +14,6 @@ from contextlib import contextmanager
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import math
|
|
||||||
import torch
|
import torch
|
||||||
import torch.backends.cudnn as cudnn
|
import torch.backends.cudnn as cudnn
|
||||||
import torch.distributed as dist
|
import torch.distributed as dist
|
||||||
|
|
|
||||||
4
val.py
4
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:
|
Usage:
|
||||||
$ python path/to/val.py --data coco128.yaml --weights yolov5s.pt --img 640
|
$ python path/to/val.py --data coco128.yaml --weights yolov5s.pt --img 640
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue