diff --git a/.github/translate-readme.yml b/.github/translate-readme.yml
new file mode 100644
index 00000000..e3dbace3
--- /dev/null
+++ b/.github/translate-readme.yml
@@ -0,0 +1,26 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+# README translation action to translate README.md to Chinese as README.zh-CN.md on any change to README.md
+
+name: Translate README
+
+on:
+ push:
+ branches:
+ - translate_readme # replace with 'main' to enable action
+ paths:
+ - README.md
+
+jobs:
+ Translate:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+ - name: Setup Node.js
+ uses: actions/setup-node@v3
+ with:
+ node-version: 16
+ # ISO Language Codes: https://cloud.google.com/translate/docs/languages
+ - name: Adding README - Chinese Simplified
+ uses: dephraiim/translate-readme@main
+ with:
+ LANG: zh-CN
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index e1f89cf4..1b4e3c71 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -1,4 +1,4 @@
-# YOLO 🚀 by Ultralytics, GPL-3.0 license
+# Ultralytics YOLO 🚀, GPL-3.0 license
# YOLO Continuous Integration (CI) GitHub Actions tests
name: Ultralytics CI
diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml
index ca3cc856..bcade984 100644
--- a/.github/workflows/docker.yaml
+++ b/.github/workflows/docker.yaml
@@ -1,4 +1,4 @@
-# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
+# Ultralytics YOLO 🚀, GPL-3.0 license
# Builds ultralytics/ultralytics:latest images on DockerHub https://hub.docker.com/r/ultralytics
name: Publish Docker Images
diff --git a/README.md b/README.md
index a88a5374..0cd9c9d4 100644
--- a/README.md
+++ b/README.md
@@ -68,7 +68,22 @@ pip install ultralytics
Usage
-YOLOv8 may be used in a python environment:
+YOLOv8 may be used directly in the Command Line Interface (CLI) with a `yolo` command:
+
+```bash
+yolo task=detect mode=predict model=yolov8n.pt source="https://ultralytics.com/images/bus.jpg"
+```
+
+`yolo` can be used for a variety of tasks and modes and accepts additional arguments, i.e. `imgsz=640`. See a full list of available `yolo` [arguments](https://docs.ultralytics.com/config/) in the YOLOv8 [Docs](https://docs.ultralytics.com).
+
+```bash
+yolo task=detect mode=train model=yolov8n.pt args...
+ classify predict yolov8n-cls.yaml args...
+ segment val yolov8n-seg.yaml args...
+ export yolov8n.pt format=onnx args...
+```
+
+YOLOv8 may also be used directly in a Python environment, and accepts the same [arguments](https://docs.ultralytics.com/config/) as in the CLI example above:
```python
from ultralytics import YOLO
@@ -81,18 +96,16 @@ model.predict(source="https://ultralytics.com/images/bus.jpg") # predict on an
model.export(format="onnx") # export the model to ONNX format
```
-Or with CLI `yolo` commands:
-
-```bash
-yolo task=detect mode=train model=yolov8n.pt args...
- classify predict yolov8n-cls.yaml args...
- segment val yolov8n-seg.yaml args...
- export yolov8n.pt format=onnx args...
-```
-
[Models](https://github.com/ultralytics/ultralytics/tree/main/ultralytics/yolo/v8/models) download automatically from the latest
Ultralytics [release](https://github.com/ultralytics/ultralytics/releases).
+### Known Issues / TODOs
+
+- [ ] TensorFlow exports
+- [ ] GPU exports
+- [ ] DDP resume
+- [ ] [arxiv.org](https://arxiv.org) paper
+
##
Checkpoints
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 41d71e65..146293f3 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -1,4 +1,4 @@
-# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
+# Ultralytics YOLO 🚀, GPL-3.0 license
# Builds ultralytics/ultralytics:latest image on DockerHub https://hub.docker.com/r/ultralytics/ultralytics
# Image is CUDA-optimized for YOLOv5 single/multi-GPU training and inference
diff --git a/docker/Dockerfile-arm64 b/docker/Dockerfile-arm64
index d44e6f33..93f60171 100644
--- a/docker/Dockerfile-arm64
+++ b/docker/Dockerfile-arm64
@@ -1,4 +1,4 @@
-# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
+# Ultralytics YOLO 🚀, GPL-3.0 license
# Builds ultralytics/ultralytics:latest-arm64 image on DockerHub https://hub.docker.com/r/ultralytics/ultralytics
# Image is aarch64-compatible for Apple M1 and other ARM architectures i.e. Jetson Nano and Raspberry Pi
diff --git a/docker/Dockerfile-cpu b/docker/Dockerfile-cpu
index ba9441e1..dcd7b2d4 100644
--- a/docker/Dockerfile-cpu
+++ b/docker/Dockerfile-cpu
@@ -1,4 +1,4 @@
-# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
+# Ultralytics YOLO 🚀, GPL-3.0 license
# Builds ultralytics/ultralytics:latest-cpu image on DockerHub https://hub.docker.com/r/ultralytics/ultralytics
# Image is CPU-optimized for ONNX, OpenVINO and PyTorch YOLOv5 deployments
diff --git a/requirements.txt b/requirements.txt
index 9ea67f2f..df2a999f 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -2,7 +2,6 @@
# Usage: pip install -r requirements.txt
# Base ----------------------------------------
-fire>=0.4.0
hydra-core>=1.2.0
matplotlib>=3.2.2
numpy>=1.18.5
diff --git a/setup.py b/setup.py
index 1eb06a35..a5d13d95 100644
--- a/setup.py
+++ b/setup.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
import re
from pathlib import Path
diff --git a/tests/test_cli.py b/tests/test_cli.py
index f8b8b259..41f3ac48 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
import os
from pathlib import Path
diff --git a/tests/test_engine.py b/tests/test_engine.py
index d0bd83fa..d40632f7 100644
--- a/tests/test_engine.py
+++ b/tests/test_engine.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
from ultralytics import YOLO
from ultralytics.yolo.configs import get_config
from ultralytics.yolo.utils import DEFAULT_CONFIG, ROOT
diff --git a/tests/test_python.py b/tests/test_python.py
index 833455a7..e7963bed 100644
--- a/tests/test_python.py
+++ b/tests/test_python.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
from pathlib import Path
from ultralytics import YOLO
diff --git a/tutorial.ipynb b/tutorial.ipynb
deleted file mode 100644
index 9f21d905..00000000
--- a/tutorial.ipynb
+++ /dev/null
@@ -1,675 +0,0 @@
-{
- "nbformat": 4,
- "nbformat_minor": 0,
- "metadata": {
- "colab": {
- "name": "YOLOv8 Tutorial",
- "provenance": [],
- "toc_visible": true
- },
- "kernelspec": {
- "name": "python3",
- "display_name": "Python 3"
- },
- "accelerator": "GPU"
- },
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "t6MPjfT5NrKQ"
- },
- "source": [
- "\n",
- "\n",
- "
\n",
- " 
\n",
- "\n",
- "\n",
- "
\n",
- "

\n",
- "

\n",
- "

\n",
- "
\n",
- "\n",
- "Welcome to the Ultralytics YOLOv8 🚀 notebook! YOLOv8 is the latest version of the YOLO (You Only Look Once) object detection and image segmentation model developed by
Ultralytics. This notebook serves as the starting point for exploring the various resources available to help you get started with YOLOv8 and understand its features and capabilities.\n",
- "\n",
- "The YOLOv8 models are designed to be fast, accurate, and easy to use, making them an excellent choice for a wide range of object detection and image segmentation tasks. They can be trained on large datasets and are capable of running on a variety of hardware platforms, from CPUs to GPUs.\n",
- "\n",
- "Whether you are a seasoned machine learning practitioner or new to the field, we hope that the resources on this page will help you get the most out of YOLOv8. Please feel free to browse the
YOLOv8 Docs and reach out to us with any questions or feedback.\n",
- "\n",
- "
"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "7mGmQbAO5pQb"
- },
- "source": [
- "# Setup\n",
- "\n",
- "Clone GitHub [repository](https://github.com/ultralytics/ultralytics), install [dependencies](https://github.com/ultralytics/ultralytics/blob/master/requirements.txt) and check PyTorch and GPU."
- ]
- },
- {
- "cell_type": "code",
- "metadata": {
- "id": "wbvMlHd_QwMG",
- "colab": {
- "base_uri": "https://localhost:8080/"
- },
- "outputId": "276a3983-eedd-4eeb-9701-2ae78e1b4c44"
- },
- "source": [
- "# Pip install (recommended)\n",
- "!pip install ultralytics\n",
- "\n",
- "from IPython import display\n",
- "display.clear_output()\n",
- "!yolo mode=checks"
- ],
- "execution_count": null,
- "outputs": [
- {
- "output_type": "stream",
- "name": "stdout",
- "text": [
- "\u001b[2K\r\u001b[2K\rUltralytics YOLO 🚀 0.0.59 Python-3.8.16 torch-1.13.0+cu116 CUDA:0 (Tesla T4, 15110MiB)\n",
- "Setup complete ✅ (2 CPUs, 12.7 GB RAM, 23.1/166.8 GB disk)\n"
- ]
- }
- ]
- },
- {
- "cell_type": "code",
- "source": [
- "# Git clone (requires GitHub token)\n",
- "!git clone https://github.com/ultralytics/ultralytics\n",
- "!pip install -e ultralytics\n",
- "\n",
- "from IPython import display\n",
- "display.clear_output()\n",
- "!yolo mode=checks"
- ],
- "metadata": {
- "id": "TUFPge7f_1ms"
- },
- "execution_count": null,
- "outputs": []
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "4JnkELT0cIJg"
- },
- "source": [
- "# 1. Predict\n",
- "\n",
- "`yolo mode=predict` runs YOLOv8 inference on a variety of sources, downloading models automatically from the [latest YOLOv8 release](https://github.com/ultralytics/ultralytics/releases), and saving results to `runs/predict`.\n"
- ]
- },
- {
- "cell_type": "code",
- "metadata": {
- "id": "zR9ZbuQCH7FX",
- "colab": {
- "base_uri": "https://localhost:8080/"
- },
- "outputId": "b4d62712-a064-4f5b-856f-8a1a58e900ec"
- },
- "source": [
- "!yolo task=detect mode=predict model=yolov8n.pt conf=0.25 source='https://ultralytics.com/images/zidane.jpg'\n",
- "# display.Image(filename='runs/detect/predict/zidane.jpg', width=600)"
- ],
- "execution_count": null,
- "outputs": [
- {
- "output_type": "stream",
- "name": "stdout",
- "text": [
- "Downloading https://ultralytics.com/images/zidane.jpg to zidane.jpg...\n",
- "100% 165k/165k [00:00<00:00, 72.6MB/s]\n",
- "Ultralytics YOLO 🚀 0.0.59 Python-3.8.16 torch-1.13.0+cu116 CUDA:0 (Tesla T4, 15110MiB)\n",
- "Downloading https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n.pt to yolov8n.pt...\n",
- "100% 6.24M/6.24M [00:03<00:00, 2.14MB/s]\n",
- "\n",
- "Fusing layers... \n",
- "YOLOv8n summary: 168 layers, 3151904 parameters, 0 gradients, 8.7 GFLOPs\n",
- "image 1/1 /content/zidane.jpg: 384x640 2 persons, 1 tie, 78.0ms\n",
- "Speed: 0.6ms pre-process, 78.0ms inference, 29.2ms postprocess per image at shape (1, 3, 640, 640)\n",
- "Results saved to \u001b[1mruns/detect/predict\u001b[0m\n"
- ]
- }
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "hkAzDWJ7cWTr"
- },
- "source": [
- " \n",
- "
"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "0eq1SMWl6Sfn"
- },
- "source": [
- "# 2. Val\n",
- "Validate a model's accuracy on the [COCO](https://cocodataset.org/#home) dataset's `val` or `test` splits. Models are downloaded automatically from the [latest YOLOv8 release](https://github.com/ultralytics/ultralytics/releases). To show results by class use the `--verbose` flag."
- ]
- },
- {
- "cell_type": "code",
- "metadata": {
- "id": "WQPtK1QYVaD_"
- },
- "source": [
- "# Download COCO val\n",
- "import torch\n",
- "torch.hub.download_url_to_file('https://ultralytics.com/assets/coco2017val.zip', 'tmp.zip') # download (780M - 5000 images)\n",
- "!unzip -q tmp.zip -d ../datasets && rm tmp.zip # unzip"
- ],
- "execution_count": null,
- "outputs": []
- },
- {
- "cell_type": "code",
- "metadata": {
- "id": "X58w8JLpMnjH",
- "colab": {
- "base_uri": "https://localhost:8080/"
- },
- "outputId": "a3853c39-e2d3-40ca-bdab-32880af1751b"
- },
- "source": [
- "# Validate YOLOv8n on COCO128 val\n",
- "!yolo task=detect mode=val model=yolov8n.pt data=coco128.yaml"
- ],
- "execution_count": null,
- "outputs": [
- {
- "output_type": "stream",
- "name": "stdout",
- "text": [
- "Ultralytics YOLO 🚀 0.0.59 Python-3.8.16 torch-1.13.0+cu116 CUDA:0 (Tesla T4, 15110MiB)\n",
- "Fusing layers... \n",
- "YOLOv8n summary: 168 layers, 3151904 parameters, 0 gradients, 8.7 GFLOPs\n",
- "\n",
- "Dataset not found ⚠️, missing paths ['/datasets/coco128/images/train2017']\n",
- "Downloading https://ultralytics.com/assets/coco128.zip to coco128.zip...\n",
- "100% 6.66M/6.66M [00:03<00:00, 2.27MB/s]\n",
- "Dataset download success ✅ (4.8s), saved to \u001b[1m/datasets\u001b[0m\n",
- "Downloading https://ultralytics.com/assets/Arial.ttf to /root/.config/Ultralytics/Arial.ttf...\n",
- "100% 755k/755k [00:00<00:00, 115MB/s]\n",
- "\u001b[34m\u001b[1mval: \u001b[0mScanning /datasets/coco128/labels/train2017... 126 images, 2 backgrounds, 0 corrupt: 100% 128/128 [00:00<00:00, 948.62it/s] \n",
- "\u001b[34m\u001b[1mval: \u001b[0mNew cache created: /datasets/coco128/labels/train2017.cache\n",
- " Class Images Instances Box(P R mAP50 mAP50-95): 100% 8/8 [00:07<00:00, 1.08it/s]\n",
- " all 128 929 0.639 0.523 0.608 0.447\n",
- " person 128 254 0.82 0.679 0.767 0.54\n",
- " bicycle 128 6 0.369 0.167 0.294 0.203\n",
- " car 128 46 0.746 0.196 0.24 0.147\n",
- " motorcycle 128 5 0.687 0.8 0.898 0.707\n",
- " airplane 128 6 0.645 0.667 0.851 0.689\n",
- " bus 128 7 0.743 0.714 0.727 0.633\n",
- " train 128 3 0.532 0.667 0.741 0.554\n",
- " truck 128 12 0.667 0.333 0.448 0.263\n",
- " boat 128 6 0.226 0.167 0.332 0.184\n",
- " traffic light 128 14 0.535 0.143 0.193 0.146\n",
- " stop sign 128 2 0.601 0.5 0.828 0.68\n",
- " bench 128 9 0.716 0.444 0.518 0.292\n",
- " bird 128 16 0.815 0.75 0.859 0.499\n",
- " cat 128 4 0.782 0.909 0.945 0.749\n",
- " dog 128 9 0.603 0.889 0.764 0.58\n",
- " horse 128 2 0.73 1 0.995 0.572\n",
- " elephant 128 17 0.794 0.882 0.934 0.74\n",
- " bear 128 1 0.615 1 0.995 0.995\n",
- " zebra 128 4 0.837 1 0.995 0.964\n",
- " giraffe 128 9 0.717 1 0.975 0.676\n",
- " backpack 128 6 0.584 0.333 0.432 0.276\n",
- " umbrella 128 18 0.83 0.556 0.674 0.409\n",
- " handbag 128 19 1 0.11 0.255 0.111\n",
- " tie 128 7 0.669 0.714 0.711 0.519\n",
- " suitcase 128 4 0.773 0.867 0.945 0.644\n",
- " frisbee 128 5 0.586 0.8 0.732 0.686\n",
- " skis 128 1 0.733 1 0.995 0.497\n",
- " snowboard 128 7 1 0.546 0.753 0.516\n",
- " sports ball 128 6 0.574 0.5 0.464 0.263\n",
- " kite 128 10 0.597 0.5 0.548 0.22\n",
- " baseball bat 128 4 0.496 0.5 0.269 0.12\n",
- " baseball glove 128 7 0.598 0.429 0.429 0.293\n",
- " skateboard 128 5 0.806 0.6 0.635 0.411\n",
- " tennis racket 128 7 0.955 0.429 0.564 0.373\n",
- " bottle 128 18 0.601 0.444 0.444 0.281\n",
- " wine glass 128 16 0.815 0.562 0.604 0.377\n",
- " cup 128 36 0.606 0.25 0.425 0.308\n",
- " fork 128 6 0.518 0.167 0.17 0.169\n",
- " knife 128 16 0.646 0.438 0.581 0.365\n",
- " spoon 128 22 0.491 0.227 0.334 0.186\n",
- " bowl 128 28 0.643 0.536 0.632 0.498\n",
- " banana 128 1 0 0 0.142 0.0529\n",
- " sandwich 128 2 0.226 0.5 0.414 0.414\n",
- " orange 128 4 1 0 0.87 0.562\n",
- " broccoli 128 11 0.416 0.182 0.239 0.197\n",
- " carrot 128 24 0.719 0.458 0.583 0.377\n",
- " hot dog 128 2 0.269 0.5 0.695 0.695\n",
- " pizza 128 5 0.673 1 0.995 0.859\n",
- " donut 128 14 0.673 1 0.976 0.886\n",
- " cake 128 4 0.627 1 0.945 0.824\n",
- " chair 128 35 0.428 0.543 0.498 0.251\n",
- " couch 128 6 0.47 0.5 0.673 0.537\n",
- " potted plant 128 14 0.808 0.643 0.714 0.501\n",
- " bed 128 3 0.842 0.667 0.741 0.559\n",
- " dining table 128 13 0.413 0.538 0.47 0.378\n",
- " toilet 128 2 0.618 0.5 0.62 0.596\n",
- " tv 128 2 0.517 0.5 0.828 0.712\n",
- " laptop 128 3 1 0 0.592 0.422\n",
- " mouse 128 2 1 0 0.0768 0.023\n",
- " remote 128 8 0.843 0.5 0.512 0.439\n",
- " cell phone 128 8 0.254 0.0636 0.109 0.0757\n",
- " microwave 128 3 0.459 1 0.995 0.798\n",
- " oven 128 5 0.436 0.4 0.391 0.31\n",
- " sink 128 6 0.265 0.167 0.198 0.124\n",
- " refrigerator 128 5 0.654 0.4 0.61 0.468\n",
- " book 128 29 0.466 0.0619 0.394 0.178\n",
- " clock 128 9 0.653 0.778 0.778 0.595\n",
- " vase 128 2 0.18 1 0.695 0.695\n",
- " scissors 128 1 1 0 0.124 0.0224\n",
- " teddy bear 128 21 0.756 0.429 0.573 0.341\n",
- " toothbrush 128 5 1 0.37 0.803 0.533\n",
- "Speed: 2.6ms pre-process, 5.2ms inference, 0.0ms loss, 3.9ms post-process per image\n"
- ]
- }
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "ZY2VXXXu74w5"
- },
- "source": [
- "# 3. Train\n",
- "\n",
- "
\n",
- "\n",
- "Train YOLOv8 on detection, segmentation and classification datasets."
- ]
- },
- {
- "cell_type": "code",
- "metadata": {
- "id": "1NcFxRcFdJ_O",
- "colab": {
- "base_uri": "https://localhost:8080/"
- },
- "outputId": "a264b615-5f73-4b84-c708-61f15a7e5c03"
- },
- "source": [
- "# Train YOLOv8n on COCO128 for 3 epochs\n",
- "!yolo task=detect mode=train model=yolov8n.pt data=coco128.yaml epochs=3 imgsz=640"
- ],
- "execution_count": null,
- "outputs": [
- {
- "output_type": "stream",
- "name": "stdout",
- "text": [
- "\u001b[34m\u001b[1myolo/engine/trainer: \u001b[0mtask=detect, mode=train, model=yolov8n.pt, data=coco128.yaml, epochs=3, patience=50, batch=16, imgsz=640, save=True, cache=False, device=, workers=8, project=None, name=None, exist_ok=False, pretrained=False, optimizer=SGD, verbose=False, seed=0, deterministic=True, single_cls=False, image_weights=False, rect=False, cos_lr=False, close_mosaic=10, resume=False, overlap_mask=True, mask_ratio=4, dropout=False, val=True, save_json=False, save_hybrid=False, conf=0.001, iou=0.7, max_det=300, half=False, dnn=False, plots=True, source=ultralytics/assets, show=False, save_txt=False, save_conf=False, save_crop=False, hide_labels=False, hide_conf=False, vid_stride=1, line_thickness=3, visualize=False, augment=False, agnostic_nms=False, retina_masks=False, format=torchscript, keras=False, optimize=False, int8=False, dynamic=False, simplify=False, opset=17, workspace=4, nms=False, lr0=0.01, lrf=0.01, momentum=0.937, weight_decay=0.0005, warmup_epochs=3.0, warmup_momentum=0.8, warmup_bias_lr=0.1, box=7.5, cls=0.5, dfl=1.5, fl_gamma=0.0, label_smoothing=0.0, nbs=64, hsv_h=0.015, hsv_s=0.7, hsv_v=0.4, degrees=0.0, translate=0.1, scale=0.5, shear=0.0, perspective=0.0, flipud=0.0, fliplr=0.5, mosaic=1.0, mixup=0.0, copy_paste=0.0, hydra={'output_subdir': None, 'run': {'dir': '.'}}, v5loader=False, save_dir=runs/detect/train\n",
- "Ultralytics YOLO 🚀 0.0.59 Python-3.8.16 torch-1.13.0+cu116 CUDA:0 (Tesla T4, 15110MiB)\n",
- "\n",
- " from n params module arguments \n",
- " 0 -1 1 464 ultralytics.nn.modules.Conv [3, 16, 3, 2] \n",
- " 1 -1 1 4672 ultralytics.nn.modules.Conv [16, 32, 3, 2] \n",
- " 2 -1 1 7360 ultralytics.nn.modules.C2f [32, 32, 1, True] \n",
- " 3 -1 1 18560 ultralytics.nn.modules.Conv [32, 64, 3, 2] \n",
- " 4 -1 2 49664 ultralytics.nn.modules.C2f [64, 64, 2, True] \n",
- " 5 -1 1 73984 ultralytics.nn.modules.Conv [64, 128, 3, 2] \n",
- " 6 -1 2 197632 ultralytics.nn.modules.C2f [128, 128, 2, True] \n",
- " 7 -1 1 295424 ultralytics.nn.modules.Conv [128, 256, 3, 2] \n",
- " 8 -1 1 460288 ultralytics.nn.modules.C2f [256, 256, 1, True] \n",
- " 9 -1 1 164608 ultralytics.nn.modules.SPPF [256, 256, 5] \n",
- " 10 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest'] \n",
- " 11 [-1, 6] 1 0 ultralytics.nn.modules.Concat [1] \n",
- " 12 -1 1 148224 ultralytics.nn.modules.C2f [384, 128, 1] \n",
- " 13 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest'] \n",
- " 14 [-1, 4] 1 0 ultralytics.nn.modules.Concat [1] \n",
- " 15 -1 1 37248 ultralytics.nn.modules.C2f [192, 64, 1] \n",
- " 16 -1 1 36992 ultralytics.nn.modules.Conv [64, 64, 3, 2] \n",
- " 17 [-1, 12] 1 0 ultralytics.nn.modules.Concat [1] \n",
- " 18 -1 1 123648 ultralytics.nn.modules.C2f [192, 128, 1] \n",
- " 19 -1 1 147712 ultralytics.nn.modules.Conv [128, 128, 3, 2] \n",
- " 20 [-1, 9] 1 0 ultralytics.nn.modules.Concat [1] \n",
- " 21 -1 1 493056 ultralytics.nn.modules.C2f [384, 256, 1] \n",
- " 22 [15, 18, 21] 1 897664 ultralytics.nn.modules.Detect [80, [64, 128, 256]] \n",
- "Model summary: 225 layers, 3157200 parameters, 3157184 gradients, 8.9 GFLOPs\n",
- "\n",
- "Transferred 355/355 items from pretrained weights\n",
- "\u001b[34m\u001b[1moptimizer:\u001b[0m SGD(lr=0.01) with parameter groups 57 weight(decay=0.0), 64 weight(decay=0.0005), 63 bias\n",
- "\u001b[34m\u001b[1mtrain: \u001b[0mScanning /datasets/coco128/labels/train2017.cache... 126 images, 2 backgrounds, 0 corrupt: 100% 128/128 [00:00, ?it/s]\n",
- "\u001b[34m\u001b[1malbumentations: \u001b[0mBlur(p=0.01, blur_limit=(3, 7)), MedianBlur(p=0.01, blur_limit=(3, 7)), ToGray(p=0.01), CLAHE(p=0.01, clip_limit=(1, 4.0), tile_grid_size=(8, 8))\n",
- "\u001b[34m\u001b[1mval: \u001b[0mScanning /datasets/coco128/labels/train2017.cache... 126 images, 2 backgrounds, 0 corrupt: 100% 128/128 [00:00, ?it/s]\n",
- "Image sizes 640 train, 640 val\n",
- "Using 2 dataloader workers\n",
- "Logging results to \u001b[1mruns/detect/train\u001b[0m\n",
- "Starting training for 3 epochs...\n",
- "\n",
- " Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n",
- " 1/3 4.31G 1.221 1.429 1.241 196 640: 100% 8/8 [00:08<00:00, 1.04s/it]\n",
- " Class Images Instances Box(P R mAP50 mAP50-95): 100% 4/4 [00:02<00:00, 1.48it/s]\n",
- " all 128 929 0.645 0.539 0.617 0.454\n",
- "\n",
- " Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n",
- " 2/3 5.31G 1.186 1.306 1.255 287 640: 100% 8/8 [00:06<00:00, 1.17it/s]\n",
- " Class Images Instances Box(P R mAP50 mAP50-95): 100% 4/4 [00:02<00:00, 1.37it/s]\n",
- " all 128 929 0.654 0.601 0.643 0.474\n",
- "\n",
- " Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n",
- " 3/3 5.31G 1.17 1.408 1.267 189 640: 100% 8/8 [00:06<00:00, 1.18it/s]\n",
- " Class Images Instances Box(P R mAP50 mAP50-95): 100% 4/4 [00:04<00:00, 1.17s/it]\n",
- " all 128 929 0.636 0.619 0.648 0.479\n",
- "\n",
- "3 epochs completed in 0.013 hours.\n",
- "Optimizer stripped from runs/detect/train/weights/last.pt, 6.5MB\n",
- "Optimizer stripped from runs/detect/train/weights/best.pt, 6.5MB\n",
- "\n",
- "Validating runs/detect/train/weights/best.pt...\n",
- "Ultralytics YOLO 🚀 0.0.59 Python-3.8.16 torch-1.13.0+cu116 CUDA:0 (Tesla T4, 15110MiB)\n",
- "Fusing layers... \n",
- "Model summary: 168 layers, 3151904 parameters, 0 gradients, 8.7 GFLOPs\n",
- " Class Images Instances Box(P R mAP50 mAP50-95): 100% 4/4 [00:05<00:00, 1.42s/it]\n",
- " all 128 929 0.658 0.605 0.65 0.481\n",
- " person 128 254 0.764 0.717 0.777 0.547\n",
- " bicycle 128 6 0.4 0.167 0.333 0.192\n",
- " car 128 46 0.76 0.196 0.263 0.153\n",
- " motorcycle 128 5 0.711 0.987 0.938 0.786\n",
- " airplane 128 6 0.756 0.833 0.927 0.666\n",
- " bus 128 7 1 0.705 0.723 0.632\n",
- " train 128 3 0.708 1 0.913 0.742\n",
- " truck 128 12 0.733 0.417 0.452 0.308\n",
- " boat 128 6 0.453 0.421 0.502 0.317\n",
- " traffic light 128 14 0.528 0.143 0.164 0.137\n",
- " stop sign 128 2 0.597 0.5 0.828 0.663\n",
- " bench 128 9 0.953 0.556 0.627 0.371\n",
- " bird 128 16 0.697 0.875 0.948 0.622\n",
- " cat 128 4 0.856 1 0.995 0.834\n",
- " dog 128 9 0.641 0.889 0.855 0.624\n",
- " horse 128 2 0.732 1 0.995 0.597\n",
- " elephant 128 17 0.829 0.941 0.946 0.74\n",
- " bear 128 1 0.618 1 0.995 0.995\n",
- " zebra 128 4 0.843 1 0.995 0.972\n",
- " giraffe 128 9 0.879 1 0.995 0.642\n",
- " backpack 128 6 0.554 0.333 0.426 0.271\n",
- " umbrella 128 18 0.707 0.67 0.719 0.469\n",
- " handbag 128 19 0.892 0.158 0.262 0.101\n",
- " tie 128 7 0.682 0.714 0.665 0.447\n",
- " suitcase 128 4 0.505 1 0.995 0.594\n",
- " frisbee 128 5 0.629 0.8 0.732 0.672\n",
- " skis 128 1 0.876 1 0.995 0.497\n",
- " snowboard 128 7 0.504 0.571 0.68 0.511\n",
- " sports ball 128 6 0.576 0.5 0.514 0.263\n",
- " kite 128 10 0.657 0.5 0.603 0.24\n",
- " baseball bat 128 4 0.452 0.427 0.267 0.103\n",
- " baseball glove 128 7 0.531 0.429 0.43 0.327\n",
- " skateboard 128 5 0.869 0.6 0.6 0.415\n",
- " tennis racket 128 7 0.851 0.429 0.504 0.342\n",
- " bottle 128 18 0.574 0.389 0.395 0.236\n",
- " wine glass 128 16 0.892 0.517 0.664 0.402\n",
- " cup 128 36 0.719 0.361 0.446 0.326\n",
- " fork 128 6 0.542 0.167 0.183 0.179\n",
- " knife 128 16 0.837 0.562 0.698 0.386\n",
- " spoon 128 22 0.522 0.348 0.386 0.219\n",
- " bowl 128 28 0.681 0.685 0.676 0.55\n",
- " banana 128 1 0.0197 0.0985 0.199 0.039\n",
- " sandwich 128 2 0.457 1 0.995 0.995\n",
- " orange 128 4 0.75 0.752 0.845 0.627\n",
- " broccoli 128 11 0.274 0.182 0.262 0.209\n",
- " carrot 128 24 0.625 0.667 0.667 0.443\n",
- " hot dog 128 2 0.494 1 0.828 0.796\n",
- " pizza 128 5 0.737 1 0.995 0.866\n",
- " donut 128 14 0.599 1 0.95 0.891\n",
- " cake 128 4 0.781 1 0.995 0.877\n",
- " chair 128 35 0.385 0.571 0.488 0.264\n",
- " couch 128 6 0.661 0.652 0.798 0.624\n",
- " potted plant 128 14 0.819 0.571 0.682 0.506\n",
- " bed 128 3 0.866 1 0.995 0.611\n",
- " dining table 128 13 0.454 0.615 0.591 0.451\n",
- " toilet 128 2 0.524 0.5 0.62 0.608\n",
- " tv 128 2 0.545 0.634 0.828 0.762\n",
- " laptop 128 3 1 0 0.708 0.562\n",
- " mouse 128 2 1 0 0.0681 0.0272\n",
- " remote 128 8 0.849 0.5 0.525 0.432\n",
- " cell phone 128 8 0.491 0.125 0.118 0.0949\n",
- " microwave 128 3 0.379 1 0.913 0.729\n",
- " oven 128 5 0.5 0.6 0.462 0.361\n",
- " sink 128 6 0.285 0.167 0.226 0.14\n",
- " refrigerator 128 5 0.552 0.505 0.724 0.544\n",
- " book 128 29 0.651 0.258 0.436 0.212\n",
- " clock 128 9 0.666 0.778 0.886 0.72\n",
- " vase 128 2 0.241 1 0.695 0.695\n",
- " scissors 128 1 1 0 0.0995 0.00995\n",
- " teddy bear 128 21 0.631 0.619 0.629 0.379\n",
- " toothbrush 128 5 1 0.687 0.92 0.614\n",
- "Speed: 3.4ms pre-process, 4.6ms inference, 0.0ms loss, 3.6ms post-process per image\n",
- "Saving runs/detect/train/predictions.json...\n",
- "Results saved to \u001b[1mruns/detect/train\u001b[0m\n"
- ]
- }
- ]
- },
- {
- "cell_type": "markdown",
- "source": [
- "# 4. Export\n",
- "\n",
- "Export a YOLOv8 model to any format.\n",
- "\n",
- "Format | `format=...**bold text**` | Model\n",
- "--- | --- | ---\n",
- "PyTorch | - | yolov8n.pt\n",
- "TorchScript | `torchscript` | yolov8n.torchscript\n",
- "ONNX | `onnx` | yolov8n.onnx\n",
- "OpenVINO | `openvino` | yolov8n_openvino_model/\n",
- "TensorRT | `engine` | yolov8n.engine\n",
- "CoreML | `coreml` | yolov8n.mlmodel\n",
- "TensorFlow SavedModel | `saved_model` | yolov8n_saved_model/\n",
- "TensorFlow GraphDef | `pb` | yolov8n.pb\n",
- "TensorFlow Lite | `tflite` | yolov8n.tflite\n",
- "TensorFlow Edge TPU | `edgetpu` | yolov8n_edgetpu.tflite\n",
- "TensorFlow.js | `tfjs` | yolov8n_web_model/\n",
- "PaddlePaddle | `paddle` | yolov8n_paddle_model/"
- ],
- "metadata": {
- "id": "nPZZeNrLCQG6"
- }
- },
- {
- "cell_type": "code",
- "source": [
- "!yolo mode=export model=yolov8n.pt format=torchscript"
- ],
- "metadata": {
- "colab": {
- "base_uri": "https://localhost:8080/"
- },
- "id": "CYIjW4igCjqD",
- "outputId": "dd9e5aa6-8538-4403-c9d7-1548e8c4c39e"
- },
- "execution_count": null,
- "outputs": [
- {
- "output_type": "stream",
- "name": "stdout",
- "text": [
- "Fusing layers... \n",
- "YOLOv8n summary: 168 layers, 3151904 parameters, 0 gradients, 8.7 GFLOPs\n",
- "Ultralytics YOLO 🚀 0.0.59 Python-3.8.16 torch-1.13.0+cu116 CPU\n",
- "Fusing layers... \n",
- "YOLOv8n summary: 168 layers, 3151904 parameters, 0 gradients, 8.7 GFLOPs\n",
- "\n",
- "\u001b[34m\u001b[1mPyTorch:\u001b[0m starting from yolov8n.pt with output shape (1, 84, 8400) (6.2 MB)\n",
- "\n",
- "\u001b[34m\u001b[1mTorchScript:\u001b[0m starting export with torch 1.13.0+cu116...\n",
- "\u001b[34m\u001b[1mTorchScript:\u001b[0m export success ✅ 1.9s, saved as yolov8n.torchscript (12.4 MB)\n",
- "\n",
- "Export complete (3.2s)\n",
- "Results saved to \u001b[1m/content\u001b[0m\n",
- "Predict: yolo task=detect mode=predict model=yolov8n.torchscript -WARNING ⚠️ not yet supported for YOLOv8 exported models\n",
- "Validate: yolo task=detect mode=val model=yolov8n.torchscript -WARNING ⚠️ not yet supported for YOLOv8 exported models\n",
- "Visualize: https://netron.app\n"
- ]
- }
- ]
- },
- {
- "cell_type": "markdown",
- "source": [
- "# 5. Python Usage\n",
- "\n",
- "YOLOv8 was reimagined using python-first principles for the most seamless python YOLO experience ever."
- ],
- "metadata": {
- "id": "kUMOQ0OeDBJG"
- }
- },
- {
- "cell_type": "code",
- "source": [
- "from ultralytics import YOLO\n",
- "\n",
- "# Load a model\n",
- "model = YOLO('yolov8n.yaml') # build a new model from scratch\n",
- "model = YOLO('yolov8n.pt') # load a pretrained model (recommended for training)\n",
- "\n",
- "# Model usage\n",
- "results = model.train(data='coco128.yaml', epochs=3) # train the model\n",
- "results = model.val(data='coco128.yaml') # evaluate model performance on the validation set\n",
- "results = model.predict(source='https://ultralytics.com/images/bus.jpg') # predict on an image\n",
- "success = model.export(format='onnx') # export the model to ONNX format"
- ],
- "metadata": {
- "id": "bpF9-vS_DAaf"
- },
- "execution_count": null,
- "outputs": []
- },
- {
- "cell_type": "markdown",
- "source": [
- "# 6. Tasks\n",
- "\n",
- "YOLOv8 can train, val, predict and export models for the 3 primary tasks in vision AI: detection, segmentation and classification."
- ],
- "metadata": {
- "id": "Phm9ccmOKye5"
- }
- },
- {
- "cell_type": "markdown",
- "source": [
- "## 1. Detection\n",
- "\n",
- "Detection models have no suffix and are the default YOLOv8 models, i.e. `yolov8n.pt`"
- ],
- "metadata": {
- "id": "yq26lwpYK1lq"
- }
- },
- {
- "cell_type": "code",
- "source": [
- "# Load a pretraind YOLOv8n detection model, train it on COCO128 for 3 epochs and predict an image with it\n",
- "from ultralytics import YOLO\n",
- "\n",
- "model = YOLO('yolov8n.pt') # load a pretrained YOLOv8n detection model\n",
- "model.train(data='coco128.yaml', epochs=3) # train the model\n",
- "model.predict(source='https://ultralytics.com/images/bus.jpg') # predict on an image"
- ],
- "metadata": {
- "id": "8Go5qqS9LbC5"
- },
- "execution_count": null,
- "outputs": []
- },
- {
- "cell_type": "markdown",
- "source": [
- "## 2. Segmentation\n",
- "\n",
- "Segmentation models use the `-seg` suffix, i.e. `yolov8n-seg.pt`"
- ],
- "metadata": {
- "id": "7ZW58jUzK66B"
- }
- },
- {
- "cell_type": "code",
- "source": [
- "# Load a pretraind YOLOv8n segmentation model, train it on COCO128-seg for 3 epochs and predict an image with it\n",
- "from ultralytics import YOLO\n",
- "\n",
- "model = YOLO('yolov8n-seg.pt') # load a pretrained YOLOv8n segmentation model\n",
- "model.train(data='coco128-seg.yaml', epochs=3) # train the model\n",
- "model.predict(source='https://ultralytics.com/images/bus.jpg') # predict on an image"
- ],
- "metadata": {
- "id": "WFPJIQl_L5HT"
- },
- "execution_count": null,
- "outputs": []
- },
- {
- "cell_type": "markdown",
- "source": [
- "## 3. Classification\n",
- "\n",
- "Classification models use the `-cls` suffix, i.e. `yolov8n-cls.pt`"
- ],
- "metadata": {
- "id": "ax3p94VNK9zR"
- }
- },
- {
- "cell_type": "code",
- "source": [
- "# Load a pretraind YOLOv8n classification model, train it on imagenette160 for 3 epochs and predict an image with it\n",
- "from ultralytics import YOLO\n",
- "\n",
- "model = YOLO('yolov8n-cls.pt') # load a pretrained YOLOv8n classification model\n",
- "model.train(data='imagenette160', epochs=3) # train the model\n",
- "model.predict(source='https://ultralytics.com/images/bus.jpg') # predict on an image"
- ],
- "metadata": {
- "id": "5q9Zu6zlL5rS"
- },
- "execution_count": null,
- "outputs": []
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "IEijrePND_2I"
- },
- "source": [
- "# Appendix\n",
- "\n",
- "Additional content below."
- ]
- },
- {
- "cell_type": "code",
- "metadata": {
- "id": "GMusP4OAxFu6"
- },
- "source": [
- "# Run YOLOv8 tests (git clone install only)\n",
- "!pytest ultralytics/tests"
- ],
- "execution_count": null,
- "outputs": []
- }
- ]
-}
\ No newline at end of file
diff --git a/ultralytics/__init__.py b/ultralytics/__init__.py
index 46aaedc5..1e38860c 100644
--- a/ultralytics/__init__.py
+++ b/ultralytics/__init__.py
@@ -1,6 +1,9 @@
-__version__ = "8.0.0.dev0"
+# Ultralytics YOLO 🚀, GPL-3.0 license
+__version__ = "8.0.0"
+
+from ultralytics.hub import checks
from ultralytics.yolo.engine.model import YOLO
from ultralytics.yolo.utils import ops
-__all__ = ["__version__", "YOLO", "hub"] # allow simpler import
+__all__ = ["__version__", "YOLO", "hub", "checks"] # allow simpler import
diff --git a/ultralytics/hub/__init__.py b/ultralytics/hub/__init__.py
index 937c22d5..9c945d50 100644
--- a/ultralytics/hub/__init__.py
+++ b/ultralytics/hub/__init__.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
import os
import shutil
diff --git a/ultralytics/hub/auth.py b/ultralytics/hub/auth.py
index b7a81aff..e38f228b 100644
--- a/ultralytics/hub/auth.py
+++ b/ultralytics/hub/auth.py
@@ -1,7 +1,8 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
import requests
-from ultralytics.hub.config import HUB_API_ROOT
-from ultralytics.hub.utils import request_with_credentials
+from ultralytics.hub.utils import HUB_API_ROOT, request_with_credentials
from ultralytics.yolo.utils import is_colab
API_KEY_PATH = "https://hub.ultralytics.com/settings?tab=api+keys"
diff --git a/ultralytics/hub/config.py b/ultralytics/hub/config.py
deleted file mode 100644
index 0d219eb5..00000000
--- a/ultralytics/hub/config.py
+++ /dev/null
@@ -1,12 +0,0 @@
-import os
-
-# Global variables
-REPO_URL = "https://github.com/ultralytics/yolov5.git"
-REPO_BRANCH = "ultralytics/HUB" # "master"
-
-ENVIRONMENT = os.environ.get("ULTRALYTICS_ENV", "production")
-if ENVIRONMENT == 'production':
- HUB_API_ROOT = "https://api.ultralytics.com"
-else:
- HUB_API_ROOT = "http://127.0.0.1:8000"
- print(f'Connected to development server on {HUB_API_ROOT}')
diff --git a/ultralytics/hub/session.py b/ultralytics/hub/session.py
index cdad027a..58d268fe 100644
--- a/ultralytics/hub/session.py
+++ b/ultralytics/hub/session.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
import signal
import sys
from pathlib import Path
@@ -6,8 +8,7 @@ from time import sleep
import requests
from ultralytics import __version__
-from ultralytics.hub.config import HUB_API_ROOT
-from ultralytics.hub.utils import check_dataset_disk_space, smart_request
+from ultralytics.hub.utils import HUB_API_ROOT, check_dataset_disk_space, smart_request
from ultralytics.yolo.utils import LOGGER, is_colab, threaded
AGENT_NAME = f'python-{__version__}-colab' if is_colab() else f'python-{__version__}-local'
diff --git a/ultralytics/hub/utils.py b/ultralytics/hub/utils.py
index 49e72955..753afc7c 100644
--- a/ultralytics/hub/utils.py
+++ b/ultralytics/hub/utils.py
@@ -1,14 +1,17 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
+import os
import shutil
import threading
import time
import requests
-from ultralytics.hub.config import HUB_API_ROOT
-from ultralytics.yolo.utils import DEFAULT_CONFIG_DICT, LOGGER, RANK, SETTINGS, colorstr, emojis
+from ultralytics.yolo.utils import DEFAULT_CONFIG_DICT, LOGGER, RANK, SETTINGS, TryExcept, colorstr, emojis
PREFIX = colorstr('Ultralytics: ')
HELP_MSG = 'If this issue persists please visit https://github.com/ultralytics/hub/issues for assistance.'
+HUB_API_ROOT = os.environ.get("ULTRALYTICS_HUB_API", "https://api.ultralytics.com")
def check_dataset_disk_space(url='https://github.com/ultralytics/yolov5/releases/download/v1.0/coco128.zip', sf=2.0):
@@ -90,7 +93,6 @@ def smart_request(*args, retry=3, timeout=30, thread=True, code=-1, method="post
requests.Response: The HTTP response object. If the request is executed in a separate thread, returns None.
"""
retry_codes = (408, 500) # retry only these codes
- methods = {'post': requests.post, 'get': requests.get} # request methods
def func(*func_args, **func_kwargs):
r = None # response
@@ -98,7 +100,10 @@ def smart_request(*args, retry=3, timeout=30, thread=True, code=-1, method="post
for i in range(retry + 1):
if (time.time() - t0) > timeout:
break
- r = methods[method](*func_args, **func_kwargs) # i.e. post(url, data, json, files)
+ if method == 'post':
+ r = requests.post(*func_args, **func_kwargs) # i.e. post(url, data, json, files)
+ elif method == 'get':
+ r = requests.get(*func_args, **func_kwargs) # i.e. get(url, data, json, files)
if r.status_code == 200:
break
try:
@@ -125,7 +130,8 @@ def smart_request(*args, retry=3, timeout=30, thread=True, code=-1, method="post
return func(*args, **kwargs)
-def sync_analytics(cfg, all_keys=False, enabled=False):
+@TryExcept()
+def sync_analytics(cfg, all_keys=False, enabled=True):
"""
Sync analytics data if enabled in the global settings
@@ -137,8 +143,8 @@ def sync_analytics(cfg, all_keys=False, enabled=False):
if SETTINGS['sync'] and RANK in {-1, 0} and enabled:
cfg = dict(cfg) # convert type from DictConfig to dict
if not all_keys:
- cfg = {k: v for k, v in cfg.items() if v != DEFAULT_CONFIG_DICT[k]} # retain only non-default values
+ cfg = {k: v for k, v in cfg.items() if v != DEFAULT_CONFIG_DICT.get(k, None)} # retain non-default values
cfg['uuid'] = SETTINGS['uuid'] # add the device UUID to the configuration data
- # Send a request to the HUB API to sync the analytics data
- smart_request(f'{HUB_API_ROOT}/v1/usage/anonymous', data=cfg, headers=None, code=3, retry=0, verbose=False)
+ # Send a request to the HUB API to sync analytics
+ smart_request(f'{HUB_API_ROOT}/v1/usage/anonymous', json=cfg, headers=None, code=3, retry=0, verbose=False)
diff --git a/ultralytics/nn/autobackend.py b/ultralytics/nn/autobackend.py
index 0b50e524..937c0358 100644
--- a/ultralytics/nn/autobackend.py
+++ b/ultralytics/nn/autobackend.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
import json
import platform
from collections import OrderedDict, namedtuple
@@ -65,6 +67,7 @@ class AutoBackend(nn.Module):
names = model.module.names if hasattr(model, 'module') else model.names # get class names
model.half() if fp16 else model.float()
self.model = model # explicitly assign for to(), cpu(), cuda(), half()
+ pt = True
elif pt: # PyTorch
from ultralytics.nn.tasks import attempt_load_weights
model = attempt_load_weights(weights if isinstance(weights, list) else w,
diff --git a/ultralytics/nn/modules.py b/ultralytics/nn/modules.py
index ec753048..51ca310d 100644
--- a/ultralytics/nn/modules.py
+++ b/ultralytics/nn/modules.py
@@ -1,4 +1,4 @@
-# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
+# Ultralytics YOLO 🚀, GPL-3.0 license
"""
Common modules
"""
diff --git a/ultralytics/nn/tasks.py b/ultralytics/nn/tasks.py
index d24512af..f143c14a 100644
--- a/ultralytics/nn/tasks.py
+++ b/ultralytics/nn/tasks.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
import contextlib
from copy import deepcopy
diff --git a/ultralytics/yolo/__init__.py b/ultralytics/yolo/__init__.py
index 86ddd1b1..7dd9e46e 100644
--- a/ultralytics/yolo/__init__.py
+++ b/ultralytics/yolo/__init__.py
@@ -1 +1,3 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
from . import v8
diff --git a/ultralytics/yolo/cli.py b/ultralytics/yolo/cli.py
index 996d4cc2..ddcf7c9a 100644
--- a/ultralytics/yolo/cli.py
+++ b/ultralytics/yolo/cli.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
import shutil
from pathlib import Path
diff --git a/ultralytics/yolo/configs/__init__.py b/ultralytics/yolo/configs/__init__.py
index f0bb8ece..28093039 100644
--- a/ultralytics/yolo/configs/__init__.py
+++ b/ultralytics/yolo/configs/__init__.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
from pathlib import Path
from typing import Dict, Union
diff --git a/ultralytics/yolo/configs/default.yaml b/ultralytics/yolo/configs/default.yaml
index 154e18d5..a6c8ed1a 100644
--- a/ultralytics/yolo/configs/default.yaml
+++ b/ultralytics/yolo/configs/default.yaml
@@ -1,4 +1,4 @@
-# YOLO 🚀 by Ultralytics, GPL-3.0 license
+# Ultralytics YOLO 🚀, GPL-3.0 license
# Default training settings and hyperparameters for medium-augmentation COCO training
task: "detect" # choices=['detect', 'segment', 'classify', 'init'] # init is a special case. Specify task to run.
diff --git a/ultralytics/yolo/configs/hydra_patch.py b/ultralytics/yolo/configs/hydra_patch.py
index 18075a08..d68d7257 100644
--- a/ultralytics/yolo/configs/hydra_patch.py
+++ b/ultralytics/yolo/configs/hydra_patch.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
import sys
from difflib import get_close_matches
from textwrap import dedent
diff --git a/ultralytics/yolo/data/__init__.py b/ultralytics/yolo/data/__init__.py
index 7508102f..ebf4293a 100644
--- a/ultralytics/yolo/data/__init__.py
+++ b/ultralytics/yolo/data/__init__.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
from .base import BaseDataset
from .build import build_classification_dataloader, build_dataloader
from .dataset import ClassificationDataset, SemanticDataset, YOLODataset
diff --git a/ultralytics/yolo/data/augment.py b/ultralytics/yolo/data/augment.py
index bd8d7e90..d5414da6 100644
--- a/ultralytics/yolo/data/augment.py
+++ b/ultralytics/yolo/data/augment.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
import math
import random
from copy import deepcopy
diff --git a/ultralytics/yolo/data/base.py b/ultralytics/yolo/data/base.py
index 04740533..1745f8f6 100644
--- a/ultralytics/yolo/data/base.py
+++ b/ultralytics/yolo/data/base.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
import glob
import math
import os
diff --git a/ultralytics/yolo/data/build.py b/ultralytics/yolo/data/build.py
index 807d8ff4..144d01e2 100644
--- a/ultralytics/yolo/data/build.py
+++ b/ultralytics/yolo/data/build.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
import os
import random
diff --git a/ultralytics/yolo/data/dataloaders/stream_loaders.py b/ultralytics/yolo/data/dataloaders/stream_loaders.py
index 72b9ab46..6365cb0f 100644
--- a/ultralytics/yolo/data/dataloaders/stream_loaders.py
+++ b/ultralytics/yolo/data/dataloaders/stream_loaders.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
import glob
import math
import os
diff --git a/ultralytics/yolo/data/dataloaders/v5augmentations.py b/ultralytics/yolo/data/dataloaders/v5augmentations.py
index a85db1e0..0595d7a9 100644
--- a/ultralytics/yolo/data/dataloaders/v5augmentations.py
+++ b/ultralytics/yolo/data/dataloaders/v5augmentations.py
@@ -1,4 +1,4 @@
-# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
+# Ultralytics YOLO 🚀, GPL-3.0 license
"""
Image augmentation functions
"""
diff --git a/ultralytics/yolo/data/dataloaders/v5loader.py b/ultralytics/yolo/data/dataloaders/v5loader.py
index 1015eafc..54aa5e42 100644
--- a/ultralytics/yolo/data/dataloaders/v5loader.py
+++ b/ultralytics/yolo/data/dataloaders/v5loader.py
@@ -1,4 +1,4 @@
-# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
+# Ultralytics YOLO 🚀, GPL-3.0 license
"""
Dataloaders and dataset utils
"""
diff --git a/ultralytics/yolo/data/dataset.py b/ultralytics/yolo/data/dataset.py
index 72ed3b48..387271eb 100644
--- a/ultralytics/yolo/data/dataset.py
+++ b/ultralytics/yolo/data/dataset.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
from itertools import repeat
from multiprocessing.pool import Pool
from pathlib import Path
diff --git a/ultralytics/yolo/data/dataset_wrappers.py b/ultralytics/yolo/data/dataset_wrappers.py
index 2cd4e0b1..46a8eee0 100644
--- a/ultralytics/yolo/data/dataset_wrappers.py
+++ b/ultralytics/yolo/data/dataset_wrappers.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
import collections
from copy import deepcopy
diff --git a/ultralytics/yolo/data/datasets/coco.yaml b/ultralytics/yolo/data/datasets/coco.yaml
index 57aa9b9b..1498eac4 100644
--- a/ultralytics/yolo/data/datasets/coco.yaml
+++ b/ultralytics/yolo/data/datasets/coco.yaml
@@ -1,4 +1,4 @@
-# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
+# Ultralytics YOLO 🚀, GPL-3.0 license
# COCO 2017 dataset http://cocodataset.org by Microsoft
# Example usage: python train.py --data coco.yaml
# parent
diff --git a/ultralytics/yolo/data/datasets/coco128-seg.yaml b/ultralytics/yolo/data/datasets/coco128-seg.yaml
index acde4c14..6f9ddba4 100644
--- a/ultralytics/yolo/data/datasets/coco128-seg.yaml
+++ b/ultralytics/yolo/data/datasets/coco128-seg.yaml
@@ -1,4 +1,4 @@
-# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
+# Ultralytics YOLO 🚀, GPL-3.0 license
# COCO128-seg dataset https://www.kaggle.com/ultralytics/coco128 (first 128 images from COCO train2017) by Ultralytics
# Example usage: python train.py --data coco128.yaml
# parent
diff --git a/ultralytics/yolo/data/datasets/coco128.yaml b/ultralytics/yolo/data/datasets/coco128.yaml
index 6ab54250..3ef3b8bd 100644
--- a/ultralytics/yolo/data/datasets/coco128.yaml
+++ b/ultralytics/yolo/data/datasets/coco128.yaml
@@ -1,4 +1,4 @@
-# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
+# Ultralytics YOLO 🚀, GPL-3.0 license
# COCO128 dataset https://www.kaggle.com/ultralytics/coco128 (first 128 images from COCO train2017) by Ultralytics
# Example usage: python train.py --data coco128.yaml
# parent
diff --git a/ultralytics/yolo/data/scripts/download_weights.sh b/ultralytics/yolo/data/scripts/download_weights.sh
index 31e0a155..59d37fae 100755
--- a/ultralytics/yolo/data/scripts/download_weights.sh
+++ b/ultralytics/yolo/data/scripts/download_weights.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
+# Ultralytics YOLO 🚀, GPL-3.0 license
# Download latest models from https://github.com/ultralytics/yolov5/releases
# Example usage: bash data/scripts/download_weights.sh
# parent
diff --git a/ultralytics/yolo/data/scripts/get_coco.sh b/ultralytics/yolo/data/scripts/get_coco.sh
index a772e906..8648f7fa 100755
--- a/ultralytics/yolo/data/scripts/get_coco.sh
+++ b/ultralytics/yolo/data/scripts/get_coco.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
+# Ultralytics YOLO 🚀, GPL-3.0 license
# Download COCO 2017 dataset http://cocodataset.org
# Example usage: bash data/scripts/get_coco.sh
# parent
diff --git a/ultralytics/yolo/data/scripts/get_coco128.sh b/ultralytics/yolo/data/scripts/get_coco128.sh
index e7ddce89..be3ccaf0 100755
--- a/ultralytics/yolo/data/scripts/get_coco128.sh
+++ b/ultralytics/yolo/data/scripts/get_coco128.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
+# Ultralytics YOLO 🚀, 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/ultralytics/yolo/data/scripts/get_imagenet.sh b/ultralytics/yolo/data/scripts/get_imagenet.sh
index 6026d502..b0e4a6d8 100755
--- a/ultralytics/yolo/data/scripts/get_imagenet.sh
+++ b/ultralytics/yolo/data/scripts/get_imagenet.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
+# Ultralytics YOLO 🚀, GPL-3.0 license
# Download ILSVRC2012 ImageNet dataset https://image-net.org
# Example usage: bash data/scripts/get_imagenet.sh
# parent
diff --git a/ultralytics/yolo/data/utils.py b/ultralytics/yolo/data/utils.py
index bc9e84ea..311fdf85 100644
--- a/ultralytics/yolo/data/utils.py
+++ b/ultralytics/yolo/data/utils.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
import contextlib
import hashlib
import os
diff --git a/ultralytics/yolo/engine/exporter.py b/ultralytics/yolo/engine/exporter.py
index ababe0cc..be225e65 100644
--- a/ultralytics/yolo/engine/exporter.py
+++ b/ultralytics/yolo/engine/exporter.py
@@ -1,4 +1,4 @@
-# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
+# Ultralytics YOLO 🚀, GPL-3.0 license
"""
Export a YOLOv5 PyTorch model to other formats. TensorFlow exports authored by https://github.com/zldrobit
diff --git a/ultralytics/yolo/engine/model.py b/ultralytics/yolo/engine/model.py
index cc727ad3..72df1a79 100644
--- a/ultralytics/yolo/engine/model.py
+++ b/ultralytics/yolo/engine/model.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
from pathlib import Path
from ultralytics import yolo # noqa
diff --git a/ultralytics/yolo/engine/predictor.py b/ultralytics/yolo/engine/predictor.py
index 868a4933..15e683c8 100644
--- a/ultralytics/yolo/engine/predictor.py
+++ b/ultralytics/yolo/engine/predictor.py
@@ -1,4 +1,4 @@
-# predictor engine by Ultralytics
+# Ultralytics YOLO 🚀, GPL-3.0 license
"""
Run prediction on images, videos, directories, globs, YouTube, webcam, streams, etc.
Usage - sources:
diff --git a/ultralytics/yolo/engine/trainer.py b/ultralytics/yolo/engine/trainer.py
index 9f898045..f6be0470 100644
--- a/ultralytics/yolo/engine/trainer.py
+++ b/ultralytics/yolo/engine/trainer.py
@@ -1,3 +1,4 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
"""
Simple training loop; Boilerplate that could apply to any arbitrary neural network,
"""
diff --git a/ultralytics/yolo/engine/validator.py b/ultralytics/yolo/engine/validator.py
index 8e5210b8..91ba0092 100644
--- a/ultralytics/yolo/engine/validator.py
+++ b/ultralytics/yolo/engine/validator.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
import json
from collections import defaultdict
from pathlib import Path
@@ -86,6 +88,7 @@ class BaseValidator:
self.model = model
self.loss = torch.zeros_like(trainer.loss_items, device=trainer.device)
self.args.plots = trainer.epoch == trainer.epochs - 1 # always plot final epoch
+ model.eval()
else:
callbacks.add_integration_callbacks(self)
self.run_callbacks('on_val_start')
@@ -106,17 +109,17 @@ class BaseValidator:
f'Forcing --batch-size 1 square inference (1,3,{imgsz},{imgsz}) for non-PyTorch models')
if isinstance(self.args.data, str) and self.args.data.endswith(".yaml"):
- data = check_dataset_yaml(self.args.data)
+ self.data = check_dataset_yaml(self.args.data)
else:
- data = check_dataset(self.args.data)
+ self.data = check_dataset(self.args.data)
if self.device.type == 'cpu':
self.args.workers = 0 # faster CPU val as time dominated by inference, not dataloading
self.dataloader = self.dataloader or \
- self.get_dataloader(data.get("val") or data.set("test"), self.args.batch)
- self.data = data
+ self.get_dataloader(self.data.get("val") or self.data.set("test"), self.args.batch)
- model.eval()
+ model.eval()
+ model.warmup(imgsz=(1 if pt else self.args.batch, 3, imgsz, imgsz)) # warmup
dt = Profile(), Profile(), Profile(), Profile()
n_batches = len(self.dataloader)
diff --git a/ultralytics/yolo/utils/__init__.py b/ultralytics/yolo/utils/__init__.py
index 2661764e..33662228 100644
--- a/ultralytics/yolo/utils/__init__.py
+++ b/ultralytics/yolo/utils/__init__.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
import contextlib
import inspect
import logging.config
diff --git a/ultralytics/yolo/utils/autobatch.py b/ultralytics/yolo/utils/autobatch.py
index 7181cdba..cac167dc 100644
--- a/ultralytics/yolo/utils/autobatch.py
+++ b/ultralytics/yolo/utils/autobatch.py
@@ -1,4 +1,4 @@
-# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
+# Ultralytics YOLO 🚀, GPL-3.0 license
"""
Auto-batch utils
"""
diff --git a/ultralytics/yolo/utils/callbacks/base.py b/ultralytics/yolo/utils/callbacks/base.py
index f0389bfb..fedf0ea4 100644
--- a/ultralytics/yolo/utils/callbacks/base.py
+++ b/ultralytics/yolo/utils/callbacks/base.py
@@ -1,4 +1,7 @@
-# Ultralytics YOLO base callbacks
+# Ultralytics YOLO 🚀, GPL-3.0 license
+"""
+Base callbacks
+"""
# Trainer callbacks ----------------------------------------------------------------------------------------------------
diff --git a/ultralytics/yolo/utils/callbacks/clearml.py b/ultralytics/yolo/utils/callbacks/clearml.py
index defd3205..7a029799 100644
--- a/ultralytics/yolo/utils/callbacks/clearml.py
+++ b/ultralytics/yolo/utils/callbacks/clearml.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
from ultralytics.yolo.utils.torch_utils import get_flops, get_num_params
try:
diff --git a/ultralytics/yolo/utils/callbacks/comet.py b/ultralytics/yolo/utils/callbacks/comet.py
index 7cb5ce10..7133cbbe 100644
--- a/ultralytics/yolo/utils/callbacks/comet.py
+++ b/ultralytics/yolo/utils/callbacks/comet.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
from ultralytics.yolo.utils.torch_utils import get_flops, get_num_params
try:
diff --git a/ultralytics/yolo/utils/callbacks/hub.py b/ultralytics/yolo/utils/callbacks/hub.py
index 1fadcbc5..47a7e545 100644
--- a/ultralytics/yolo/utils/callbacks/hub.py
+++ b/ultralytics/yolo/utils/callbacks/hub.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
import json
from time import time
diff --git a/ultralytics/yolo/utils/callbacks/tensorboard.py b/ultralytics/yolo/utils/callbacks/tensorboard.py
index 1093c92f..86a230e2 100644
--- a/ultralytics/yolo/utils/callbacks/tensorboard.py
+++ b/ultralytics/yolo/utils/callbacks/tensorboard.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
from torch.utils.tensorboard import SummaryWriter
writer = None # TensorBoard SummaryWriter instance
diff --git a/ultralytics/yolo/utils/callbacks/wb.py b/ultralytics/yolo/utils/callbacks/wb.py
index 5ebea51c..ce4db815 100644
--- a/ultralytics/yolo/utils/callbacks/wb.py
+++ b/ultralytics/yolo/utils/callbacks/wb.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
from ultralytics.yolo.utils.torch_utils import get_flops, get_num_params
try:
diff --git a/ultralytics/yolo/utils/checks.py b/ultralytics/yolo/utils/checks.py
index 2d97d562..fc1da268 100644
--- a/ultralytics/yolo/utils/checks.py
+++ b/ultralytics/yolo/utils/checks.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
import glob
import inspect
import math
@@ -62,8 +64,7 @@ def check_imgsz(imgsz, stride=32, min_dim=1, floor=0):
LOGGER.warning(f'WARNING ⚠️ --img-size {imgsz} must be multiple of max stride {stride}, updating to {sz}')
# Add missing dimensions if necessary
- if min_dim == 2 and len(sz) == 1:
- sz = [sz[0], sz[0]]
+ sz = [sz[0], sz[0]] if min_dim == 2 and len(sz) == 1 else sz[0] if min_dim == 1 and len(sz) == 1 else sz
return sz
diff --git a/ultralytics/yolo/utils/dist.py b/ultralytics/yolo/utils/dist.py
index e99a7a59..c3b3bbba 100644
--- a/ultralytics/yolo/utils/dist.py
+++ b/ultralytics/yolo/utils/dist.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
import os
import shutil
import socket
diff --git a/ultralytics/yolo/utils/downloads.py b/ultralytics/yolo/utils/downloads.py
index 61f273b1..f2bfc532 100644
--- a/ultralytics/yolo/utils/downloads.py
+++ b/ultralytics/yolo/utils/downloads.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
import logging
import os
import subprocess
diff --git a/ultralytics/yolo/utils/files.py b/ultralytics/yolo/utils/files.py
index 96c6367f..7360ca77 100644
--- a/ultralytics/yolo/utils/files.py
+++ b/ultralytics/yolo/utils/files.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
import contextlib
import glob
import os
diff --git a/ultralytics/yolo/utils/instance.py b/ultralytics/yolo/utils/instance.py
index d2873fd5..965a616f 100644
--- a/ultralytics/yolo/utils/instance.py
+++ b/ultralytics/yolo/utils/instance.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
from collections import abc
from itertools import repeat
from numbers import Number
diff --git a/ultralytics/yolo/utils/loss.py b/ultralytics/yolo/utils/loss.py
index bb8505ce..60dd6b2e 100644
--- a/ultralytics/yolo/utils/loss.py
+++ b/ultralytics/yolo/utils/loss.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
import torch
import torch.nn as nn
import torch.nn.functional as F
diff --git a/ultralytics/yolo/utils/metrics.py b/ultralytics/yolo/utils/metrics.py
index e3a6d9a1..35a973a9 100644
--- a/ultralytics/yolo/utils/metrics.py
+++ b/ultralytics/yolo/utils/metrics.py
@@ -1,4 +1,4 @@
-# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
+# Ultralytics YOLO 🚀, GPL-3.0 license
"""
Model validation metrics
"""
diff --git a/ultralytics/yolo/utils/ops.py b/ultralytics/yolo/utils/ops.py
index edb32b0d..67e5d523 100644
--- a/ultralytics/yolo/utils/ops.py
+++ b/ultralytics/yolo/utils/ops.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
import contextlib
import math
import re
diff --git a/ultralytics/yolo/utils/plotting.py b/ultralytics/yolo/utils/plotting.py
index e9788065..f03a22a5 100644
--- a/ultralytics/yolo/utils/plotting.py
+++ b/ultralytics/yolo/utils/plotting.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
import contextlib
import math
from pathlib import Path
diff --git a/ultralytics/yolo/utils/tal.py b/ultralytics/yolo/utils/tal.py
index 32c621dc..98481ad5 100644
--- a/ultralytics/yolo/utils/tal.py
+++ b/ultralytics/yolo/utils/tal.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
import torch
import torch.nn as nn
import torch.nn.functional as F
diff --git a/ultralytics/yolo/utils/torch_utils.py b/ultralytics/yolo/utils/torch_utils.py
index 9c82b713..0e06224c 100644
--- a/ultralytics/yolo/utils/torch_utils.py
+++ b/ultralytics/yolo/utils/torch_utils.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
import math
import os
import platform
@@ -59,7 +61,7 @@ def DDP_model(model):
def select_device(device='', batch_size=0, newline=False):
# device = None or 'cpu' or 0 or '0' or '0,1,2,3'
ver = git_describe() or ultralytics.__version__ # git commit or pip package version
- s = f'Ultralytics YOLO 🚀 {ver} Python-{platform.python_version()} torch-{torch.__version__} '
+ s = f'Ultralytics YOLOv{ver} 🚀 Python-{platform.python_version()} torch-{torch.__version__} '
device = str(device).strip().lower().replace('cuda:', '').replace('none', '') # to string, 'cuda:0' to '0'
cpu = device == 'cpu'
mps = device == 'mps' # Apple Metal Performance Shaders (MPS)
diff --git a/ultralytics/yolo/v8/__init__.py b/ultralytics/yolo/v8/__init__.py
index e43e165f..17700b3a 100644
--- a/ultralytics/yolo/v8/__init__.py
+++ b/ultralytics/yolo/v8/__init__.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
from pathlib import Path
from ultralytics.yolo.v8 import classify, detect, segment
diff --git a/ultralytics/yolo/v8/classify/__init__.py b/ultralytics/yolo/v8/classify/__init__.py
index 1c67016a..89b00236 100644
--- a/ultralytics/yolo/v8/classify/__init__.py
+++ b/ultralytics/yolo/v8/classify/__init__.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
from ultralytics.yolo.v8.classify.predict import ClassificationPredictor, predict
from ultralytics.yolo.v8.classify.train import ClassificationTrainer, train
from ultralytics.yolo.v8.classify.val import ClassificationValidator, val
diff --git a/ultralytics/yolo/v8/classify/predict.py b/ultralytics/yolo/v8/classify/predict.py
index 04d617b3..d2293903 100644
--- a/ultralytics/yolo/v8/classify/predict.py
+++ b/ultralytics/yolo/v8/classify/predict.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
import hydra
import torch
diff --git a/ultralytics/yolo/v8/classify/train.py b/ultralytics/yolo/v8/classify/train.py
index 3cd94380..bb03ba18 100644
--- a/ultralytics/yolo/v8/classify/train.py
+++ b/ultralytics/yolo/v8/classify/train.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
import hydra
import torch
import torchvision
diff --git a/ultralytics/yolo/v8/classify/val.py b/ultralytics/yolo/v8/classify/val.py
index 1b9e4811..9ccd710d 100644
--- a/ultralytics/yolo/v8/classify/val.py
+++ b/ultralytics/yolo/v8/classify/val.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
import hydra
from ultralytics.yolo.data import build_classification_dataloader
diff --git a/ultralytics/yolo/v8/detect/__init__.py b/ultralytics/yolo/v8/detect/__init__.py
index a683006a..2aaa30d4 100644
--- a/ultralytics/yolo/v8/detect/__init__.py
+++ b/ultralytics/yolo/v8/detect/__init__.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
from .predict import DetectionPredictor, predict
from .train import DetectionTrainer, train
from .val import DetectionValidator, val
diff --git a/ultralytics/yolo/v8/detect/predict.py b/ultralytics/yolo/v8/detect/predict.py
index f7544b82..8b9ed3ac 100644
--- a/ultralytics/yolo/v8/detect/predict.py
+++ b/ultralytics/yolo/v8/detect/predict.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
import hydra
import torch
diff --git a/ultralytics/yolo/v8/detect/train.py b/ultralytics/yolo/v8/detect/train.py
index acf2b5ae..3d0a115a 100644
--- a/ultralytics/yolo/v8/detect/train.py
+++ b/ultralytics/yolo/v8/detect/train.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
from copy import copy
import hydra
diff --git a/ultralytics/yolo/v8/detect/val.py b/ultralytics/yolo/v8/detect/val.py
index ff653186..de62002e 100644
--- a/ultralytics/yolo/v8/detect/val.py
+++ b/ultralytics/yolo/v8/detect/val.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
import os
from pathlib import Path
diff --git a/ultralytics/yolo/v8/models/cls/yolov8l-cls.yaml b/ultralytics/yolo/v8/models/cls/yolov8l-cls.yaml
index f0351236..bf981a84 100644
--- a/ultralytics/yolo/v8/models/cls/yolov8l-cls.yaml
+++ b/ultralytics/yolo/v8/models/cls/yolov8l-cls.yaml
@@ -1,4 +1,4 @@
-# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
+# Ultralytics YOLO 🚀, GPL-3.0 license
# Parameters
nc: 1000 # number of classes
diff --git a/ultralytics/yolo/v8/models/cls/yolov8m-cls.yaml b/ultralytics/yolo/v8/models/cls/yolov8m-cls.yaml
index d14d1ce2..7e91894c 100644
--- a/ultralytics/yolo/v8/models/cls/yolov8m-cls.yaml
+++ b/ultralytics/yolo/v8/models/cls/yolov8m-cls.yaml
@@ -1,4 +1,4 @@
-# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
+# Ultralytics YOLO 🚀, GPL-3.0 license
# Parameters
nc: 1000 # number of classes
diff --git a/ultralytics/yolo/v8/models/cls/yolov8n-cls.yaml b/ultralytics/yolo/v8/models/cls/yolov8n-cls.yaml
index a3969ed7..29be2264 100644
--- a/ultralytics/yolo/v8/models/cls/yolov8n-cls.yaml
+++ b/ultralytics/yolo/v8/models/cls/yolov8n-cls.yaml
@@ -1,4 +1,4 @@
-# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
+# Ultralytics YOLO 🚀, GPL-3.0 license
# Parameters
nc: 1000 # number of classes
diff --git a/ultralytics/yolo/v8/models/cls/yolov8s-cls.yaml b/ultralytics/yolo/v8/models/cls/yolov8s-cls.yaml
index 040bc1f8..00ddc55a 100644
--- a/ultralytics/yolo/v8/models/cls/yolov8s-cls.yaml
+++ b/ultralytics/yolo/v8/models/cls/yolov8s-cls.yaml
@@ -1,4 +1,4 @@
-# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
+# Ultralytics YOLO 🚀, GPL-3.0 license
# Parameters
nc: 1000 # number of classes
diff --git a/ultralytics/yolo/v8/models/cls/yolov8x-cls.yaml b/ultralytics/yolo/v8/models/cls/yolov8x-cls.yaml
index 10a0325d..46c75d5a 100644
--- a/ultralytics/yolo/v8/models/cls/yolov8x-cls.yaml
+++ b/ultralytics/yolo/v8/models/cls/yolov8x-cls.yaml
@@ -1,4 +1,4 @@
-# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
+# Ultralytics YOLO 🚀, GPL-3.0 license
# Parameters
nc: 1000 # number of classes
diff --git a/ultralytics/yolo/v8/models/seg/yolov8l-seg.yaml b/ultralytics/yolo/v8/models/seg/yolov8l-seg.yaml
index e3bb7774..235dc761 100644
--- a/ultralytics/yolo/v8/models/seg/yolov8l-seg.yaml
+++ b/ultralytics/yolo/v8/models/seg/yolov8l-seg.yaml
@@ -1,4 +1,4 @@
-# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
+# Ultralytics YOLO 🚀, GPL-3.0 license
# Parameters
nc: 80 # number of classes
diff --git a/ultralytics/yolo/v8/models/seg/yolov8m-seg.yaml b/ultralytics/yolo/v8/models/seg/yolov8m-seg.yaml
index d91ca5bd..17c07f6b 100644
--- a/ultralytics/yolo/v8/models/seg/yolov8m-seg.yaml
+++ b/ultralytics/yolo/v8/models/seg/yolov8m-seg.yaml
@@ -1,4 +1,4 @@
-# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
+# Ultralytics YOLO 🚀, GPL-3.0 license
# Parameters
nc: 80 # number of classes
diff --git a/ultralytics/yolo/v8/models/seg/yolov8n-seg.yaml b/ultralytics/yolo/v8/models/seg/yolov8n-seg.yaml
index 3ac78db3..ffecc9d9 100644
--- a/ultralytics/yolo/v8/models/seg/yolov8n-seg.yaml
+++ b/ultralytics/yolo/v8/models/seg/yolov8n-seg.yaml
@@ -1,4 +1,4 @@
-# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
+# Ultralytics YOLO 🚀, GPL-3.0 license
# Parameters
nc: 80 # number of classes
diff --git a/ultralytics/yolo/v8/models/seg/yolov8s-seg.yaml b/ultralytics/yolo/v8/models/seg/yolov8s-seg.yaml
index 3b2ebe45..dc828a1c 100644
--- a/ultralytics/yolo/v8/models/seg/yolov8s-seg.yaml
+++ b/ultralytics/yolo/v8/models/seg/yolov8s-seg.yaml
@@ -1,4 +1,4 @@
-# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
+# Ultralytics YOLO 🚀, GPL-3.0 license
# Parameters
nc: 80 # number of classes
diff --git a/ultralytics/yolo/v8/models/seg/yolov8x-seg.yaml b/ultralytics/yolo/v8/models/seg/yolov8x-seg.yaml
index 646e1878..0572283c 100644
--- a/ultralytics/yolo/v8/models/seg/yolov8x-seg.yaml
+++ b/ultralytics/yolo/v8/models/seg/yolov8x-seg.yaml
@@ -1,4 +1,4 @@
-# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
+# Ultralytics YOLO 🚀, GPL-3.0 license
# Parameters
nc: 80 # number of classes
diff --git a/ultralytics/yolo/v8/models/yolov8l.yaml b/ultralytics/yolo/v8/models/yolov8l.yaml
index e8525f66..9ec170c3 100644
--- a/ultralytics/yolo/v8/models/yolov8l.yaml
+++ b/ultralytics/yolo/v8/models/yolov8l.yaml
@@ -1,4 +1,4 @@
-# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
+# Ultralytics YOLO 🚀, GPL-3.0 license
# Parameters
nc: 80 # number of classes
diff --git a/ultralytics/yolo/v8/models/yolov8m.yaml b/ultralytics/yolo/v8/models/yolov8m.yaml
index 2f7d3bb1..f97cf052 100644
--- a/ultralytics/yolo/v8/models/yolov8m.yaml
+++ b/ultralytics/yolo/v8/models/yolov8m.yaml
@@ -1,4 +1,4 @@
-# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
+# Ultralytics YOLO 🚀, GPL-3.0 license
# Parameters
nc: 80 # number of classes
diff --git a/ultralytics/yolo/v8/models/yolov8n.yaml b/ultralytics/yolo/v8/models/yolov8n.yaml
index f0f94816..83cf0801 100644
--- a/ultralytics/yolo/v8/models/yolov8n.yaml
+++ b/ultralytics/yolo/v8/models/yolov8n.yaml
@@ -1,4 +1,4 @@
-# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
+# Ultralytics YOLO 🚀, GPL-3.0 license
# Parameters
nc: 80 # number of classes
diff --git a/ultralytics/yolo/v8/models/yolov8s.yaml b/ultralytics/yolo/v8/models/yolov8s.yaml
index be621c9c..0c96d945 100644
--- a/ultralytics/yolo/v8/models/yolov8s.yaml
+++ b/ultralytics/yolo/v8/models/yolov8s.yaml
@@ -1,4 +1,4 @@
-# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
+# Ultralytics YOLO 🚀, GPL-3.0 license
# Parameters
nc: 80 # number of classes
diff --git a/ultralytics/yolo/v8/models/yolov8x.yaml b/ultralytics/yolo/v8/models/yolov8x.yaml
index 3732e2ee..20e4070d 100644
--- a/ultralytics/yolo/v8/models/yolov8x.yaml
+++ b/ultralytics/yolo/v8/models/yolov8x.yaml
@@ -1,4 +1,4 @@
-# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
+# Ultralytics YOLO 🚀, GPL-3.0 license
# Parameters
nc: 80 # number of classes
diff --git a/ultralytics/yolo/v8/models/yolov8x6.yaml b/ultralytics/yolo/v8/models/yolov8x6.yaml
index b2e72ed4..8ffcdeae 100644
--- a/ultralytics/yolo/v8/models/yolov8x6.yaml
+++ b/ultralytics/yolo/v8/models/yolov8x6.yaml
@@ -1,4 +1,4 @@
-# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
+# Ultralytics YOLO 🚀, GPL-3.0 license
# Parameters
nc: 80 # number of classes
diff --git a/ultralytics/yolo/v8/segment/__init__.py b/ultralytics/yolo/v8/segment/__init__.py
index f299f27c..e74ca22f 100644
--- a/ultralytics/yolo/v8/segment/__init__.py
+++ b/ultralytics/yolo/v8/segment/__init__.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
from .predict import SegmentationPredictor, predict
from .train import SegmentationTrainer, train
from .val import SegmentationValidator, val
diff --git a/ultralytics/yolo/v8/segment/predict.py b/ultralytics/yolo/v8/segment/predict.py
index 810cd07c..3d89d7fd 100644
--- a/ultralytics/yolo/v8/segment/predict.py
+++ b/ultralytics/yolo/v8/segment/predict.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
import hydra
import torch
diff --git a/ultralytics/yolo/v8/segment/train.py b/ultralytics/yolo/v8/segment/train.py
index 32421540..acfe8b18 100644
--- a/ultralytics/yolo/v8/segment/train.py
+++ b/ultralytics/yolo/v8/segment/train.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
from copy import copy
import hydra
diff --git a/ultralytics/yolo/v8/segment/val.py b/ultralytics/yolo/v8/segment/val.py
index 019da2f6..03c1b1ef 100644
--- a/ultralytics/yolo/v8/segment/val.py
+++ b/ultralytics/yolo/v8/segment/val.py
@@ -1,3 +1,5 @@
+# Ultralytics YOLO 🚀, GPL-3.0 license
+
import os
from multiprocessing.pool import ThreadPool
from pathlib import Path