Browse Source

Standardize headers and docstrings (#4417)

* Implement new headers

* Reformat 1

* Reformat 2

* Reformat 3 - math

* Reformat 4 - yaml
modifyDataloader
Glenn Jocher GitHub 3 years ago
parent
commit
24bea5e4b7
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
64 changed files with 164 additions and 54 deletions
  1. +7
    -5
      .github/workflows/ci-testing.yml
  2. +1
    -1
      .github/workflows/codeql-analysis.yml
  3. +3
    -1
      .github/workflows/greetings.yml
  4. +1
    -1
      .github/workflows/rebase.yml
  5. +2
    -0
      .github/workflows/stale.yml
  6. +2
    -0
      Dockerfile
  7. +1
    -1
      data/Argoverse.yaml
  8. +1
    -1
      data/GlobalWheat2020.yaml
  9. +1
    -1
      data/Objects365.yaml
  10. +1
    -1
      data/SKU-110K.yaml
  11. +1
    -1
      data/VOC.yaml
  12. +1
    -1
      data/VisDrone.yaml
  13. +1
    -1
      data/coco.yaml
  14. +1
    -1
      data/coco128.yaml
  15. +1
    -1
      data/hyps/hyp.finetune.yaml
  16. +2
    -0
      data/hyps/hyp.finetune_objects365.yaml
  17. +1
    -1
      data/hyps/hyp.scratch-p6.yaml
  18. +1
    -1
      data/hyps/hyp.scratch.yaml
  19. +1
    -1
      data/scripts/download_weights.sh
  20. +1
    -1
      data/scripts/get_coco.sh
  21. +1
    -1
      data/scripts/get_coco128.sh
  22. +1
    -1
      data/xView.yaml
  23. +3
    -1
      detect.py
  24. +3
    -1
      export.py
  25. +3
    -1
      hubconf.py
  26. +5
    -2
      models/common.py
  27. +5
    -2
      models/experimental.py
  28. +2
    -1
      models/hub/anchors.yaml
  29. +2
    -0
      models/hub/yolov3-spp.yaml
  30. +2
    -0
      models/hub/yolov3-tiny.yaml
  31. +2
    -0
      models/hub/yolov3.yaml
  32. +2
    -0
      models/hub/yolov5-bifpn.yaml
  33. +2
    -0
      models/hub/yolov5-fpn.yaml
  34. +2
    -0
      models/hub/yolov5-p2.yaml
  35. +2
    -0
      models/hub/yolov5-p6.yaml
  36. +2
    -0
      models/hub/yolov5-p7.yaml
  37. +2
    -0
      models/hub/yolov5-panet.yaml
  38. +2
    -0
      models/hub/yolov5l6.yaml
  39. +2
    -0
      models/hub/yolov5m6.yaml
  40. +2
    -0
      models/hub/yolov5s-ghost.yaml
  41. +2
    -0
      models/hub/yolov5s-transformer.yaml
  42. +2
    -0
      models/hub/yolov5s6.yaml
  43. +2
    -0
      models/hub/yolov5x6.yaml
  44. +3
    -1
      models/yolo.py
  45. +2
    -0
      models/yolov5l.yaml
  46. +2
    -0
      models/yolov5m.yaml
  47. +2
    -0
      models/yolov5s.yaml
  48. +2
    -0
      models/yolov5x.yaml
  49. +4
    -2
      train.py
  50. +4
    -1
      utils/activations.py
  51. +5
    -2
      utils/augmentations.py
  52. +4
    -1
      utils/autoanchor.py
  53. +5
    -1
      utils/callbacks.py
  54. +4
    -1
      utils/datasets.py
  55. +4
    -1
      utils/downloads.py
  56. +7
    -2
      utils/flask_rest_api/README.md
  57. +5
    -2
      utils/general.py
  58. +5
    -1
      utils/loggers/__init__.py
  59. +1
    -1
      utils/loggers/wandb/wandb_utils.py
  60. +4
    -1
      utils/loss.py
  61. +5
    -2
      utils/metrics.py
  62. +4
    -1
      utils/plots.py
  63. +5
    -2
      utils/torch_utils.py
  64. +3
    -1
      val.py

+ 7
- 5
.github/workflows/ci-testing.yml View File

@@ -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

+ 1
- 1
.github/workflows/codeql-analysis.yml View File

@@ -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

+ 3
- 1
.github/workflows/greetings.yml View File

@@ -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:

+ 1
- 1
.github/workflows/rebase.yml View File

@@ -3,7 +3,7 @@ name: Automatic Rebase

on:
issue_comment:
types: [ created ]
types: [created]

jobs:
rebase:

+ 2
- 0
.github/workflows/stale.yml View File

@@ -1,3 +1,5 @@
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license

name: Close stale issues
on:
schedule:

+ 2
- 0
Dockerfile View File

@@ -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


+ 1
- 1
data/Argoverse.yaml View File

@@ -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

+ 1
- 1
data/GlobalWheat2020.yaml View File

@@ -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

+ 1
- 1
data/Objects365.yaml View File

@@ -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

+ 1
- 1
data/SKU-110K.yaml View File

@@ -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

+ 1
- 1
data/VOC.yaml View File

@@ -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

+ 1
- 1
data/VisDrone.yaml View File

@@ -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

+ 1
- 1
data/coco.yaml View File

@@ -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

+ 1
- 1
data/coco128.yaml View File

@@ -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

+ 1
- 1
data/hyps/hyp.finetune.yaml View File

@@ -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

+ 2
- 0
data/hyps/hyp.finetune_objects365.yaml View File

@@ -1,3 +1,5 @@
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license

lr0: 0.00258
lrf: 0.17
momentum: 0.779

+ 1
- 1
data/hyps/hyp.scratch-p6.yaml View File

@@ -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

+ 1
- 1
data/hyps/hyp.scratch.yaml View File

@@ -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

+ 1
- 1
data/scripts/download_weights.sh View File

@@ -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

+ 1
- 1
data/scripts/get_coco.sh View File

@@ -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

+ 1
- 1
data/scripts/get_coco128.sh View File

@@ -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

+ 1
- 1
data/xView.yaml View File

@@ -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

+ 3
- 1
detect.py View File

@@ -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

+ 3
- 1
export.py View File

@@ -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

+ 3
- 1
hubconf.py View File

@@ -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

+ 5
- 2
models/common.py View File

@@ -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

+ 5
- 2
models/experimental.py View File

@@ -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



+ 2
- 1
models/hub/anchors.yaml View File

@@ -1,4 +1,5 @@
# Default YOLOv5 anchors for COCO data
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
# Default anchors for COCO data


# P5 -------------------------------------------------------------------------------------------------------------------

+ 2
- 0
models/hub/yolov3-spp.yaml View File

@@ -1,3 +1,5 @@
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license

# Parameters
nc: 80 # number of classes
depth_multiple: 1.0 # model depth multiple

+ 2
- 0
models/hub/yolov3-tiny.yaml View File

@@ -1,3 +1,5 @@
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license

# Parameters
nc: 80 # number of classes
depth_multiple: 1.0 # model depth multiple

+ 2
- 0
models/hub/yolov3.yaml View File

@@ -1,3 +1,5 @@
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license

# Parameters
nc: 80 # number of classes
depth_multiple: 1.0 # model depth multiple

+ 2
- 0
models/hub/yolov5-bifpn.yaml View File

@@ -1,3 +1,5 @@
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license

# Parameters
nc: 80 # number of classes
depth_multiple: 1.0 # model depth multiple

+ 2
- 0
models/hub/yolov5-fpn.yaml View File

@@ -1,3 +1,5 @@
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license

# Parameters
nc: 80 # number of classes
depth_multiple: 1.0 # model depth multiple

+ 2
- 0
models/hub/yolov5-p2.yaml View File

@@ -1,3 +1,5 @@
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license

# Parameters
nc: 80 # number of classes
depth_multiple: 1.0 # model depth multiple

+ 2
- 0
models/hub/yolov5-p6.yaml View File

@@ -1,3 +1,5 @@
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license

# Parameters
nc: 80 # number of classes
depth_multiple: 1.0 # model depth multiple

+ 2
- 0
models/hub/yolov5-p7.yaml View File

@@ -1,3 +1,5 @@
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license

# Parameters
nc: 80 # number of classes
depth_multiple: 1.0 # model depth multiple

+ 2
- 0
models/hub/yolov5-panet.yaml View File

@@ -1,3 +1,5 @@
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license

# Parameters
nc: 80 # number of classes
depth_multiple: 1.0 # model depth multiple

+ 2
- 0
models/hub/yolov5l6.yaml View File

@@ -1,3 +1,5 @@
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license

# Parameters
nc: 80 # number of classes
depth_multiple: 1.0 # model depth multiple

+ 2
- 0
models/hub/yolov5m6.yaml View File

@@ -1,3 +1,5 @@
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license

# Parameters
nc: 80 # number of classes
depth_multiple: 0.67 # model depth multiple

+ 2
- 0
models/hub/yolov5s-ghost.yaml View File

@@ -1,3 +1,5 @@
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license

# Parameters
nc: 80 # number of classes
depth_multiple: 0.33 # model depth multiple

+ 2
- 0
models/hub/yolov5s-transformer.yaml View File

@@ -1,3 +1,5 @@
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license

# Parameters
nc: 80 # number of classes
depth_multiple: 0.33 # model depth multiple

+ 2
- 0
models/hub/yolov5s6.yaml View File

@@ -1,3 +1,5 @@
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license

# Parameters
nc: 80 # number of classes
depth_multiple: 0.33 # model depth multiple

+ 2
- 0
models/hub/yolov5x6.yaml View File

@@ -1,3 +1,5 @@
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license

# Parameters
nc: 80 # number of classes
depth_multiple: 1.33 # model depth multiple

+ 3
- 1
models/yolo.py View File

@@ -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

+ 2
- 0
models/yolov5l.yaml View File

@@ -1,3 +1,5 @@
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license

# Parameters
nc: 80 # number of classes
depth_multiple: 1.0 # model depth multiple

+ 2
- 0
models/yolov5m.yaml View File

@@ -1,3 +1,5 @@
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license

# Parameters
nc: 80 # number of classes
depth_multiple: 0.67 # model depth multiple

+ 2
- 0
models/yolov5s.yaml View File

@@ -1,3 +1,5 @@
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license

# Parameters
nc: 80 # number of classes
depth_multiple: 0.33 # model depth multiple

+ 2
- 0
models/yolov5x.yaml View File

@@ -1,3 +1,5 @@
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license

# Parameters
nc: 80 # number of classes
depth_multiple: 1.33 # model depth multiple

+ 4
- 2
train.py View File

@@ -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

+ 4
- 1
utils/activations.py View File

@@ -1,4 +1,7 @@
# Activation functions
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
"""
Activation functions
"""

import torch
import torch.nn as nn

+ 5
- 2
utils/augmentations.py View File

@@ -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

+ 4
- 1
utils/autoanchor.py View File

@@ -1,4 +1,7 @@
# Auto-anchor utils
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
"""
Auto-anchor utils
"""

import random


+ 5
- 1
utils/callbacks.py View File

@@ -1,4 +1,8 @@
#!/usr/bin/env python
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
"""
Callback utils
"""


class Callbacks:
""""

+ 4
- 1
utils/datasets.py View File

@@ -1,4 +1,7 @@
# YOLOv5 dataset utils and dataloaders
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
"""
Dataloaders and dataset utils
"""

import glob
import hashlib

+ 4
- 1
utils/downloads.py View File

@@ -1,4 +1,7 @@
# Download utils
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
"""
Download utils
"""

import os
import platform

+ 7
- 2
utils/flask_rest_api/README.md View File

@@ -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`

+ 5
- 2
utils/general.py View File

@@ -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

+ 5
- 1
utils/loggers/__init__.py View File

@@ -1,4 +1,8 @@
# YOLOv5 experiment logging utils
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
"""
Logging utils
"""

import warnings
from threading import Thread


+ 1
- 1
utils/loggers/wandb/wandb_utils.py View File

@@ -507,4 +507,4 @@ def all_logging_disabled(highest_level=logging.CRITICAL):
try:
yield
finally:
logging.disable(previous_level)
logging.disable(previous_level)

+ 4
- 1
utils/loss.py View File

@@ -1,4 +1,7 @@
# Loss functions
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
"""
Loss functions
"""

import torch
import torch.nn as nn

+ 5
- 2
utils/metrics.py View File

@@ -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

+ 4
- 1
utils/plots.py View File

@@ -1,4 +1,7 @@
# Plotting utils
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
"""
Plotting utils
"""

import math
from copy import copy

+ 5
- 2
utils/torch_utils.py View File

@@ -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

+ 3
- 1
val.py View File

@@ -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

Loading…
Cancel
Save