`ultralytics 8.0.116` NAS, DVC, YOLOv5u updates (#3124)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
single_channel
Glenn Jocher 1 year ago committed by GitHub
parent 095b856e75
commit f4e8b39fc2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -3,7 +3,7 @@ comments: true
description: Dive into YOLO-NAS, Deci's next-generation object detection model, offering breakthroughs in speed and accuracy. Learn how to utilize pre-trained models using the Ultralytics Python API for various tasks. description: Dive into YOLO-NAS, Deci's next-generation object detection model, offering breakthroughs in speed and accuracy. Learn how to utilize pre-trained models using the Ultralytics Python API for various tasks.
--- ---
# Deci's YOLO-NAS # YOLO-NAS
## Overview ## Overview

@ -33,7 +33,7 @@ YOLOv5u is an enhanced version of the [YOLOv5](https://github.com/ultralytics/yo
| Validation | :heavy_check_mark: | | Validation | :heavy_check_mark: |
| Training | :heavy_check_mark: | | Training | :heavy_check_mark: |
??? Performance !!! Performance
=== "Detection" === "Detection"
@ -45,11 +45,11 @@ YOLOv5u is an enhanced version of the [YOLOv5](https://github.com/ultralytics/yo
| [YOLOv5lu](https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov5lu.pt) | 640 | 52.2 | 408.4 | 2.50 | 53.2 | 135.0 | | [YOLOv5lu](https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov5lu.pt) | 640 | 52.2 | 408.4 | 2.50 | 53.2 | 135.0 |
| [YOLOv5xu](https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov5xu.pt) | 640 | 53.2 | 763.2 | 3.81 | 97.2 | 246.4 | | [YOLOv5xu](https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov5xu.pt) | 640 | 53.2 | 763.2 | 3.81 | 97.2 | 246.4 |
| | | | | | | | | | | | | | | |
| [YOLOv5n6u](https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov5n6u.pt) | 1280 | 42.1 | - | - | 4.3 | 7.8 | | [YOLOv5n6u](https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov5n6u.pt) | 1280 | 42.1 | 211.0 | 1.83 | 4.3 | 7.8 |
| [YOLOv5s6u](https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov5s6u.pt) | 1280 | 48.6 | - | - | 15.3 | 24.6 | | [YOLOv5s6u](https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov5s6u.pt) | 1280 | 48.6 | 422.6 | 2.34 | 15.3 | 24.6 |
| [YOLOv5m6u](https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov5m6u.pt) | 1280 | 53.6 | - | - | 41.2 | 65.7 | | [YOLOv5m6u](https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov5m6u.pt) | 1280 | 53.6 | 810.9 | 4.36 | 41.2 | 65.7 |
| [YOLOv5l6u](https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov5l6u.pt) | 1280 | 55.7 | - | - | 86.1 | 137.4 | | [YOLOv5l6u](https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov5l6u.pt) | 1280 | 55.7 | 1470.9 | 5.47 | 86.1 | 137.4 |
| [YOLOv5x6u](https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov5x6u.pt) | 1280 | 56.8 | - | - | 155.4 | 250.7 | | [YOLOv5x6u](https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov5x6u.pt) | 1280 | 56.8 | 2436.5 | 8.98 | 155.4 | 250.7 |
## Usage ## Usage

@ -35,7 +35,7 @@ YOLOv8 is the latest iteration in the YOLO series of real-time object detectors,
| Validation | :heavy_check_mark: | | Validation | :heavy_check_mark: |
| Training | :heavy_check_mark: | | Training | :heavy_check_mark: |
??? Performance !!! Performance
=== "Detection" === "Detection"

@ -3,7 +3,7 @@ comments: true
description: Explore YOLOv8n-based object tracking with Ultralytics' BoT-SORT and ByteTrack. Learn configuration, usage, and customization tips. description: Explore YOLOv8n-based object tracking with Ultralytics' BoT-SORT and ByteTrack. Learn configuration, usage, and customization tips.
--- ---
<img width="1024" src="https://github.com/ultralytics/assets/raw/main/yolov8/banner-integrations.png"> <img width="1024" src="https://user-images.githubusercontent.com/26833433/243418637-1d6250fd-1515-4c10-a844-a32818ae6d46.png">
Object tracking is a task that involves identifying the location and class of objects, then assigning a unique ID to Object tracking is a task that involves identifying the location and class of objects, then assigning a unique ID to
that detection in video streams. that detection in video streams.

@ -6,7 +6,11 @@ description: Use Roboflow to organize, label, prepare, version & host datasets f
# Roboflow Datasets # Roboflow Datasets
You can now use Roboflow to organize, label, prepare, version, and host your datasets for training YOLOv5 🚀 models. Roboflow is free to use with YOLOv5 if you make your workspace public. You can now use Roboflow to organize, label, prepare, version, and host your datasets for training YOLOv5 🚀 models. Roboflow is free to use with YOLOv5 if you make your workspace public.
UPDATED 30 September 2021. UPDATED 7 June 2023.
!!! warning
Roboflow users can use Ultralytics under the [AGPL license](https://github.com/ultralytics/ultralytics/blob/main/LICENSE) or procure an [Enterprise license](https://ultralytics.com/license) directly from Ultralytics. Be aware that Roboflow does **not** provide Ultralytics licenses, and it is the responsibility of the user to ensure appropriate licensing.
## Upload ## Upload

@ -4,7 +4,7 @@ description: Train your custom dataset with YOLOv5. Learn to collect, label and
--- ---
📚 This guide explains how to train your own **custom dataset** with [YOLOv5](https://github.com/ultralytics/yolov5) 🚀. 📚 This guide explains how to train your own **custom dataset** with [YOLOv5](https://github.com/ultralytics/yolov5) 🚀.
UPDATED 26 March 2023. UPDATED 7 June 2023.
## Before You Start ## Before You Start
@ -32,6 +32,10 @@ YOLOv5 models must be trained on labelled data in order to learn classes of obje
<details markdown> <details markdown>
<summary>Use <a href="https://roboflow.com/?ref=ultralytics">Roboflow</a> to create your dataset in YOLO format</summary> <summary>Use <a href="https://roboflow.com/?ref=ultralytics">Roboflow</a> to create your dataset in YOLO format</summary>
!!! warning
Roboflow users can use Ultralytics under the [AGPL license](https://github.com/ultralytics/ultralytics/blob/main/LICENSE) or procure an [Enterprise license](https://ultralytics.com/license) directly from Ultralytics. Be aware that Roboflow does **not** provide Ultralytics licenses, and it is the responsibility of the user to ensure appropriate licensing.
### 1.1 Collect Images ### 1.1 Collect Images
Your model will learn by example. Training on images similar to the ones it will see in the wild is of the utmost importance. Ideally, you will collect a wide variety of images from the same configuration (camera, angle, lighting, etc.) as you will ultimately deploy your project. Your model will learn by example. Training on images similar to the ones it will see in the wild is of the utmost importance. Ideally, you will collect a wide variety of images from the same configuration (camera, angle, lighting, etc.) as you will ultimately deploy your project.
@ -200,6 +204,7 @@ Results file `results.csv` is updated after each epoch, and then plotted as `res
```python ```python
from utils.plots import plot_results from utils.plots import plot_results
plot_results('path/to/results.csv') # plot 'results.csv' as 'results.png' plot_results('path/to/results.csv') # plot 'results.csv' as 'results.png'
``` ```

@ -1,6 +1,6 @@
# Ultralytics YOLO 🚀, AGPL-3.0 license # Ultralytics YOLO 🚀, AGPL-3.0 license
__version__ = '8.0.115' __version__ = '8.0.116'
from ultralytics.hub import start from ultralytics.hub import start
from ultralytics.vit.rtdetr import RTDETR from ultralytics.vit.rtdetr import RTDETR

@ -138,7 +138,7 @@ def polygon2mask(imgsz, polygons, color=1, downsample_ratio=1):
""" """
Args: Args:
imgsz (tuple): The image size. imgsz (tuple): The image size.
polygons (np.ndarray): [N, M], N is the number of polygons, M is the number of points(Be divided by 2). polygons (list[np.ndarray]): [N, M], N is the number of polygons, M is the number of points(Be divided by 2).
color (int): color color (int): color
downsample_ratio (int): downsample ratio downsample_ratio (int): downsample ratio
""" """

@ -224,6 +224,11 @@ def set_logging(name=LOGGING_NAME, verbose=True):
'propagate': False}}}) 'propagate': False}}})
def emojis(string=''):
"""Return platform-dependent emoji-safe version of string."""
return string.encode().decode('ascii', 'ignore') if WINDOWS else string
class EmojiFilter(logging.Filter): class EmojiFilter(logging.Filter):
""" """
A custom logging filter class for removing emojis in log messages. A custom logging filter class for removing emojis in log messages.
@ -533,6 +538,7 @@ def get_user_config_dir(sub_dir='Ultralytics'):
# GCP and AWS lambda fix, only /tmp is writeable # GCP and AWS lambda fix, only /tmp is writeable
if not is_dir_writeable(str(path.parent)): if not is_dir_writeable(str(path.parent)):
path = Path('/tmp') / sub_dir path = Path('/tmp') / sub_dir
LOGGER.warning(f"WARNING ⚠️ user config directory is not writeable, defaulting to '{path}'.")
# Create the subdirectory if it does not exist # Create the subdirectory if it does not exist
path.mkdir(parents=True, exist_ok=True) path.mkdir(parents=True, exist_ok=True)
@ -544,11 +550,6 @@ USER_CONFIG_DIR = Path(os.getenv('YOLO_CONFIG_DIR', get_user_config_dir())) # U
SETTINGS_YAML = USER_CONFIG_DIR / 'settings.yaml' SETTINGS_YAML = USER_CONFIG_DIR / 'settings.yaml'
def emojis(string=''):
"""Return platform-dependent emoji-safe version of string."""
return string.encode().decode('ascii', 'ignore') if WINDOWS else string
def colorstr(*input): def colorstr(*input):
"""Colors a string https://en.wikipedia.org/wiki/ANSI_escape_code, i.e. colorstr('blue', 'hello world').""" """Colors a string https://en.wikipedia.org/wiki/ANSI_escape_code, i.e. colorstr('blue', 'hello world')."""
*args, string = input if len(input) > 1 else ('blue', 'bold', input[0]) # color arguments, string *args, string = input if len(input) > 1 else ('blue', 'bold', input[0]) # color arguments, string

@ -90,7 +90,7 @@ def benchmark(model=Path(SETTINGS['weights_dir']) / 'yolov8n.pt',
filename = model.ckpt_path or model.cfg filename = model.ckpt_path or model.cfg
export = model # PyTorch format export = model # PyTorch format
else: else:
filename = model.export(imgsz=imgsz, format=format, half=half, int8=int8, device=device) # all others filename = model.export(imgsz=imgsz, format=format, half=half, int8=int8, device=device, verbose=False)
export = YOLO(filename, task=model.task) export = YOLO(filename, task=model.task)
assert suffix in str(filename), 'export failed' assert suffix in str(filename), 'export failed'
emoji = '' # indicates export succeeded emoji = '' # indicates export succeeded
@ -196,8 +196,17 @@ class ProfileModels:
model.fuse() # to report correct params and GFLOPs in model.info() model.fuse() # to report correct params and GFLOPs in model.info()
model_info = model.info() model_info = model.info()
if self.trt and self.device.type != 'cpu' and not engine_file.is_file(): if self.trt and self.device.type != 'cpu' and not engine_file.is_file():
engine_file = model.export(format='engine', half=True, imgsz=self.imgsz, device=self.device) engine_file = model.export(format='engine',
onnx_file = model.export(format='onnx', half=True, imgsz=self.imgsz, simplify=True, device=self.device) half=True,
imgsz=self.imgsz,
device=self.device,
verbose=False)
onnx_file = model.export(format='onnx',
half=True,
imgsz=self.imgsz,
simplify=True,
device=self.device,
verbose=False)
elif file.suffix == '.onnx': elif file.suffix == '.onnx':
model_info = self.get_onnx_model_info(file) model_info = self.get_onnx_model_info(file)
onnx_file = file onnx_file = file
@ -254,7 +263,7 @@ class ProfileModels:
for _ in range(3): for _ in range(3):
start_time = time.time() start_time = time.time()
for _ in range(self.num_warmup_runs): for _ in range(self.num_warmup_runs):
model(input_data, verbose=False) model(input_data, imgsz=self.imgsz, verbose=False)
elapsed = time.time() - start_time elapsed = time.time() - start_time
# Compute number of runs as higher of min_time or num_timed_runs # Compute number of runs as higher of min_time or num_timed_runs
@ -263,7 +272,7 @@ class ProfileModels:
# Timed runs # Timed runs
run_times = [] run_times = []
for _ in tqdm(range(num_runs), desc=engine_file): for _ in tqdm(range(num_runs), desc=engine_file):
results = model(input_data, verbose=False) results = model(input_data, imgsz=self.imgsz, verbose=False)
run_times.append(results[0].speed['inference']) # Convert to milliseconds run_times.append(results[0].speed['inference']) # Convert to milliseconds
run_times = self.iterative_sigma_clipping(np.array(run_times), sigma=2, max_iters=3) # sigma clipping run_times = self.iterative_sigma_clipping(np.array(run_times), sigma=2, max_iters=3) # sigma clipping

@ -42,7 +42,7 @@ def _log_images(image_path, prefix=''):
def _log_plots(plots, prefix=''): def _log_plots(plots, prefix=''):
for name, params in plots.items(): for name, params in plots.items():
timestamp = params['timestamp'] timestamp = params['timestamp']
if _processed_plots.get(name, None) != timestamp: if _processed_plots.get(name) != timestamp:
_log_images(name, prefix) _log_images(name, prefix)
_processed_plots[name] = timestamp _processed_plots[name] = timestamp

@ -19,9 +19,9 @@ import requests
import torch import torch
from matplotlib import font_manager from matplotlib import font_manager
from ultralytics.yolo.utils import (AUTOINSTALL, LOGGER, ONLINE, ROOT, USER_CONFIG_DIR, TryExcept, clean_url, colorstr, from ultralytics.yolo.utils import (AUTOINSTALL, LOGGER, ONLINE, RANK, ROOT, USER_CONFIG_DIR, TryExcept, clean_url,
downloads, emojis, is_colab, is_docker, is_kaggle, is_online, is_pip_package, colorstr, downloads, emojis, is_colab, is_docker, is_kaggle, is_online,
url2file) is_pip_package, url2file)
def is_ascii(s) -> bool: def is_ascii(s) -> bool:
@ -164,6 +164,9 @@ def check_font(font='Arial.ttf'):
Returns: Returns:
file (Path): Resolved font file path. file (Path): Resolved font file path.
""" """
from ultralytics.yolo.utils.torch_utils import torch_distributed_zero_first
with torch_distributed_zero_first(RANK):
name = Path(font).name name = Path(font).name
# Check USER_CONFIG_DIR # Check USER_CONFIG_DIR

Loading…
Cancel
Save