ultralytics 8.2.93__py3-none-any.whl → 8.2.95__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of ultralytics might be problematic. Click here for more details.

tests/__init__.py CHANGED
@@ -1,13 +1,13 @@
1
1
  # Ultralytics YOLO 🚀, AGPL-3.0 license
2
2
 
3
- from ultralytics.utils import ASSETS, ROOT, WEIGHTS_DIR, checks, is_dir_writeable
3
+ from ultralytics.utils import ASSETS, ROOT, WEIGHTS_DIR, checks
4
4
 
5
5
  # Constants used in tests
6
6
  MODEL = WEIGHTS_DIR / "path with spaces" / "yolov8n.pt" # test spaces in path
7
7
  CFG = "yolov8n.yaml"
8
8
  SOURCE = ASSETS / "bus.jpg"
9
+ SOURCES_LIST = [ASSETS / "bus.jpg", ASSETS, ASSETS / "*", ASSETS / "**/*.jpg"]
9
10
  TMP = (ROOT / "../tests/tmp").resolve() # temp directory for test files
10
- IS_TMP_WRITEABLE = is_dir_writeable(TMP)
11
11
  CUDA_IS_AVAILABLE = checks.cuda_is_available()
12
12
  CUDA_DEVICE_COUNT = checks.cuda_device_count()
13
13
 
@@ -15,6 +15,7 @@ __all__ = (
15
15
  "MODEL",
16
16
  "CFG",
17
17
  "SOURCE",
18
+ "SOURCES_LIST",
18
19
  "TMP",
19
20
  "IS_TMP_WRITEABLE",
20
21
  "CUDA_IS_AVAILABLE",
tests/test_cli.py CHANGED
@@ -101,7 +101,7 @@ def test_mobilesam():
101
101
  model.predict(source, points=[900, 370], labels=[1])
102
102
 
103
103
  # Predict a segment based on a box prompt
104
- model.predict(source, bboxes=[439, 437, 524, 709])
104
+ model.predict(source, bboxes=[439, 437, 524, 709], save=True)
105
105
 
106
106
  # Predict all
107
107
  # model(source)
tests/test_python.py CHANGED
@@ -1,6 +1,7 @@
1
1
  # Ultralytics YOLO 🚀, AGPL-3.0 license
2
2
 
3
3
  import contextlib
4
+ import csv
4
5
  import urllib
5
6
  from copy import copy
6
7
  from pathlib import Path
@@ -12,7 +13,7 @@ import torch
12
13
  import yaml
13
14
  from PIL import Image
14
15
 
15
- from tests import CFG, IS_TMP_WRITEABLE, MODEL, SOURCE, TMP
16
+ from tests import CFG, MODEL, SOURCE, SOURCES_LIST, TMP
16
17
  from ultralytics import RTDETR, YOLO
17
18
  from ultralytics.cfg import MODELS, TASK2DATA, TASKS
18
19
  from ultralytics.data.build import load_inference_source
@@ -26,11 +27,14 @@ from ultralytics.utils import (
26
27
  WEIGHTS_DIR,
27
28
  WINDOWS,
28
29
  checks,
30
+ is_dir_writeable,
29
31
  is_github_action_running,
30
32
  )
31
33
  from ultralytics.utils.downloads import download
32
34
  from ultralytics.utils.torch_utils import TORCH_1_9
33
35
 
36
+ IS_TMP_WRITEABLE = is_dir_writeable(TMP) # WARNING: must be run once tests start as TMP does not exist on tests/init
37
+
34
38
 
35
39
  def test_model_forward():
36
40
  """Test the forward pass of the YOLO model."""
@@ -70,11 +74,37 @@ def test_model_profile():
70
74
  @pytest.mark.skipif(not IS_TMP_WRITEABLE, reason="directory is not writeable")
71
75
  def test_predict_txt():
72
76
  """Tests YOLO predictions with file, directory, and pattern sources listed in a text file."""
73
- txt_file = TMP / "sources.txt"
74
- with open(txt_file, "w") as f:
75
- for x in [ASSETS / "bus.jpg", ASSETS, ASSETS / "*", ASSETS / "**/*.jpg"]:
76
- f.write(f"{x}\n")
77
- _ = YOLO(MODEL)(source=txt_file, imgsz=32)
77
+ file = TMP / "sources_multi_row.txt"
78
+ with open(file, "w") as f:
79
+ for src in SOURCES_LIST:
80
+ f.write(f"{src}\n")
81
+ results = YOLO(MODEL)(source=file, imgsz=32)
82
+ assert len(results) == 7 # 1 + 2 + 2 + 2 = 7 images
83
+
84
+
85
+ @pytest.mark.skipif(True, reason="disabled for testing")
86
+ @pytest.mark.skipif(not IS_TMP_WRITEABLE, reason="directory is not writeable")
87
+ def test_predict_csv_multi_row():
88
+ """Tests YOLO predictions with sources listed in multiple rows of a CSV file."""
89
+ file = TMP / "sources_multi_row.csv"
90
+ with open(file, "w", newline="") as f:
91
+ writer = csv.writer(f)
92
+ writer.writerow(["source"])
93
+ writer.writerows([[src] for src in SOURCES_LIST])
94
+ results = YOLO(MODEL)(source=file, imgsz=32)
95
+ assert len(results) == 7 # 1 + 2 + 2 + 2 = 7 images
96
+
97
+
98
+ @pytest.mark.skipif(True, reason="disabled for testing")
99
+ @pytest.mark.skipif(not IS_TMP_WRITEABLE, reason="directory is not writeable")
100
+ def test_predict_csv_single_row():
101
+ """Tests YOLO predictions with sources listed in a single row of a CSV file."""
102
+ file = TMP / "sources_single_row.csv"
103
+ with open(file, "w", newline="") as f:
104
+ writer = csv.writer(f)
105
+ writer.writerow(SOURCES_LIST)
106
+ results = YOLO(MODEL)(source=file, imgsz=32)
107
+ assert len(results) == 7 # 1 + 2 + 2 + 2 = 7 images
78
108
 
79
109
 
80
110
  @pytest.mark.parametrize("model_name", MODELS)
ultralytics/__init__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  # Ultralytics YOLO 🚀, AGPL-3.0 license
2
2
 
3
- __version__ = "8.2.93"
3
+ __version__ = "8.2.95"
4
4
 
5
5
 
6
6
  import os
@@ -28,7 +28,6 @@ from ultralytics.utils import (
28
28
  DEFAULT_CFG,
29
29
  LOCAL_RANK,
30
30
  LOGGER,
31
- MACOS,
32
31
  RANK,
33
32
  TQDM,
34
33
  __version__,
@@ -409,13 +408,17 @@ class BaseTrainer:
409
408
  break
410
409
 
411
410
  # Log
412
- mem = f"{torch.cuda.memory_reserved() / 1E9 if torch.cuda.is_available() else 0:.3g}G" # (GB)
413
- loss_len = self.tloss.shape[0] if len(self.tloss.shape) else 1
414
- losses = self.tloss if loss_len > 1 else torch.unsqueeze(self.tloss, 0)
415
411
  if RANK in {-1, 0}:
412
+ loss_length = self.tloss.shape[0] if len(self.tloss.shape) else 1
416
413
  pbar.set_description(
417
- ("%11s" * 2 + "%11.4g" * (2 + loss_len))
418
- % (f"{epoch + 1}/{self.epochs}", mem, *losses, batch["cls"].shape[0], batch["img"].shape[-1])
414
+ ("%11s" * 2 + "%11.4g" * (2 + loss_length))
415
+ % (
416
+ f"{epoch + 1}/{self.epochs}",
417
+ f"{self._get_memory():.3g}G", # (GB) GPU memory util
418
+ *(self.tloss if loss_length > 1 else torch.unsqueeze(self.tloss, 0)), # losses
419
+ batch["cls"].shape[0], # batch size, i.e. 8
420
+ batch["img"].shape[-1], # imgsz, i.e 640
421
+ )
419
422
  )
420
423
  self.run_callbacks("on_batch_end")
421
424
  if self.args.plots and ni in self.plot_idx:
@@ -453,11 +456,7 @@ class BaseTrainer:
453
456
  self.scheduler.last_epoch = self.epoch # do not move
454
457
  self.stop |= epoch >= self.epochs # stop if exceeded epochs
455
458
  self.run_callbacks("on_fit_epoch_end")
456
- gc.collect()
457
- if MACOS:
458
- torch.mps.empty_cache() # clear unified memory at end of epoch, may help MPS' management of 'unlimited' virtual memoy
459
- else:
460
- torch.cuda.empty_cache() # clear GPU memory at end of epoch, may help reduce CUDA out of memory errors
459
+ self._clear_memory()
461
460
 
462
461
  # Early Stopping
463
462
  if RANK != -1: # if DDP training
@@ -478,14 +477,29 @@ class BaseTrainer:
478
477
  if self.args.plots:
479
478
  self.plot_metrics()
480
479
  self.run_callbacks("on_train_end")
480
+ self._clear_memory()
481
+ self.run_callbacks("teardown")
482
+
483
+ def _get_memory(self):
484
+ """Get accelerator memory utilization in GB."""
485
+ if self.device.type == "mps":
486
+ memory = torch.mps.driver_allocated_memory()
487
+ elif self.device.type == "cpu":
488
+ memory = 0
489
+ else:
490
+ memory = torch.cuda.memory_reserved()
491
+ return memory / 1e9
492
+
493
+ def _clear_memory(self):
494
+ """Clear accelerator memory on different platforms."""
481
495
  gc.collect()
482
- if MACOS:
496
+ if self.device.type == "mps":
483
497
  torch.mps.empty_cache()
498
+ elif self.device.type == "cpu":
499
+ return
484
500
  else:
485
501
  torch.cuda.empty_cache()
486
502
 
487
- self.run_callbacks("teardown")
488
-
489
503
  def read_results_csv(self):
490
504
  """Read results.csv into a dict using pandas."""
491
505
  import pandas as pd # scope for faster 'import ultralytics'
@@ -654,13 +668,14 @@ class BaseTrainer:
654
668
 
655
669
  def final_eval(self):
656
670
  """Performs final evaluation and validation for object detection YOLO model."""
671
+ ckpt = {}
657
672
  for f in self.last, self.best:
658
673
  if f.exists():
659
- strip_optimizer(f) # strip optimizers
660
- if f is self.best:
661
- if self.last.is_file(): # update best.pt train_metrics from last.pt
662
- k = "train_results"
663
- torch.save({**torch.load(self.best), **{k: torch.load(self.last)[k]}}, self.best)
674
+ if f is self.last:
675
+ ckpt = strip_optimizer(f)
676
+ elif f is self.best:
677
+ k = "train_results" # update best.pt train_metrics from last.pt
678
+ strip_optimizer(f, updates={k: ckpt[k]} if k in ckpt else None)
664
679
  LOGGER.info(f"\nValidating {f}...")
665
680
  self.validator.args.plots = self.args.plots
666
681
  self.metrics = self.validator(model=f)
@@ -450,16 +450,18 @@ class Predictor(BasePredictor):
450
450
 
451
451
  results = []
452
452
  for masks, orig_img, img_path in zip([pred_masks], orig_imgs, self.batch[0]):
453
- if pred_bboxes is not None:
454
- pred_bboxes = ops.scale_boxes(img.shape[2:], pred_bboxes.float(), orig_img.shape, padding=False)
455
- cls = torch.arange(len(pred_masks), dtype=torch.int32, device=pred_masks.device)
456
- pred_bboxes = torch.cat([pred_bboxes, pred_scores[:, None], cls[:, None]], dim=-1)
457
-
458
453
  if len(masks) == 0:
459
454
  masks = None
460
455
  else:
461
456
  masks = ops.scale_masks(masks[None].float(), orig_img.shape[:2], padding=False)[0]
462
457
  masks = masks > self.model.mask_threshold # to bool
458
+ if pred_bboxes is not None:
459
+ pred_bboxes = ops.scale_boxes(img.shape[2:], pred_bboxes.float(), orig_img.shape, padding=False)
460
+ else:
461
+ pred_bboxes = batched_mask_to_box(masks)
462
+ # NOTE: SAM models do not return cls info. This `cls` here is just a placeholder for consistency.
463
+ cls = torch.arange(len(pred_masks), dtype=torch.int32, device=pred_masks.device)
464
+ pred_bboxes = torch.cat([pred_bboxes, pred_scores[:, None], cls[:, None]], dim=-1)
463
465
  results.append(Results(orig_img, path=img_path, names=names, masks=masks, boxes=pred_bboxes))
464
466
  # Reset segment-all mode.
465
467
  self.segment_all = False
ultralytics/nn/tasks.py CHANGED
@@ -759,6 +759,10 @@ class SafeClass:
759
759
  """Initialize SafeClass instance, ignoring all arguments."""
760
760
  pass
761
761
 
762
+ def __call__(self, *args, **kwargs):
763
+ """Run SafeClass instance, ignoring all arguments."""
764
+ pass
765
+
762
766
 
763
767
  class SafeUnpickler(pickle.Unpickler):
764
768
  """Custom Unpickler that replaces unknown classes with SafeClass."""
@@ -20,7 +20,7 @@ from ultralytics.utils.files import increment_path
20
20
 
21
21
  class Colors:
22
22
  """
23
- Ultralytics default color palette https://ultralytics.com/.
23
+ Ultralytics color palette https://docs.ultralytics.com/reference/utils/plotting/#ultralytics.utils.plotting.Colors.
24
24
 
25
25
  This class provides methods to work with the Ultralytics color palette, including converting hex color codes to
26
26
  RGB values.
@@ -29,6 +29,60 @@ class Colors:
29
29
  palette (list of tuple): List of RGB color values.
30
30
  n (int): The number of colors in the palette.
31
31
  pose_palette (np.ndarray): A specific color palette array with dtype np.uint8.
32
+
33
+ ## Ultralytics Color Palette
34
+
35
+ | Index | Color | HEX | RGB |
36
+ |-------|-------------------------------------------------------------------|-----------|-------------------|
37
+ | 0 | <i class="fa-solid fa-square fa-2xl" style="color: #042aff;"></i> | `#042aff` | (4, 42, 255) |
38
+ | 1 | <i class="fa-solid fa-square fa-2xl" style="color: #0bdbeb;"></i> | `#0bdbeb` | (11, 219, 235) |
39
+ | 2 | <i class="fa-solid fa-square fa-2xl" style="color: #f3f3f3;"></i> | `#f3f3f3` | (243, 243, 243) |
40
+ | 3 | <i class="fa-solid fa-square fa-2xl" style="color: #00dfb7;"></i> | `#00dfb7` | (0, 223, 183) |
41
+ | 4 | <i class="fa-solid fa-square fa-2xl" style="color: #111f68;"></i> | `#111f68` | (17, 31, 104) |
42
+ | 5 | <i class="fa-solid fa-square fa-2xl" style="color: #ff6fdd;"></i> | `#ff6fdd` | (255, 111, 221) |
43
+ | 6 | <i class="fa-solid fa-square fa-2xl" style="color: #ff444f;"></i> | `#ff444f` | (255, 68, 79) |
44
+ | 7 | <i class="fa-solid fa-square fa-2xl" style="color: #cced00;"></i> | `#cced00` | (204, 237, 0) |
45
+ | 8 | <i class="fa-solid fa-square fa-2xl" style="color: #00f344;"></i> | `#00f344` | (0, 243, 68) |
46
+ | 9 | <i class="fa-solid fa-square fa-2xl" style="color: #bd00ff;"></i> | `#bd00ff` | (189, 0, 255) |
47
+ | 10 | <i class="fa-solid fa-square fa-2xl" style="color: #00b4ff;"></i> | `#00b4ff` | (0, 180, 255) |
48
+ | 11 | <i class="fa-solid fa-square fa-2xl" style="color: #dd00ba;"></i> | `#dd00ba` | (221, 0, 186) |
49
+ | 12 | <i class="fa-solid fa-square fa-2xl" style="color: #00ffff;"></i> | `#00ffff` | (0, 255, 255) |
50
+ | 13 | <i class="fa-solid fa-square fa-2xl" style="color: #26c000;"></i> | `#26c000` | (38, 192, 0) |
51
+ | 14 | <i class="fa-solid fa-square fa-2xl" style="color: #01ffb3;"></i> | `#01ffb3` | (1, 255, 179) |
52
+ | 15 | <i class="fa-solid fa-square fa-2xl" style="color: #7d24ff;"></i> | `#7d24ff` | (125, 36, 255) |
53
+ | 16 | <i class="fa-solid fa-square fa-2xl" style="color: #7b0068;"></i> | `#7b0068` | (123, 0, 104) |
54
+ | 17 | <i class="fa-solid fa-square fa-2xl" style="color: #ff1b6c;"></i> | `#ff1b6c` | (255, 27, 108) |
55
+ | 18 | <i class="fa-solid fa-square fa-2xl" style="color: #fc6d2f;"></i> | `#fc6d2f` | (252, 109, 47) |
56
+ | 19 | <i class="fa-solid fa-square fa-2xl" style="color: #a2ff0b;"></i> | `#a2ff0b` | (162, 255, 11) |
57
+
58
+ ## Pose Color Palette
59
+
60
+ | Index | Color | HEX | RGB |
61
+ |-------|-------------------------------------------------------------------|-----------|-------------------|
62
+ | 0 | <i class="fa-solid fa-square fa-2xl" style="color: #ff8000;"></i> | `#ff8000` | (255, 128, 0) |
63
+ | 1 | <i class="fa-solid fa-square fa-2xl" style="color: #ff9933;"></i> | `#ff9933` | (255, 153, 51) |
64
+ | 2 | <i class="fa-solid fa-square fa-2xl" style="color: #ffb266;"></i> | `#ffb266` | (255, 178, 102) |
65
+ | 3 | <i class="fa-solid fa-square fa-2xl" style="color: #e6e600;"></i> | `#e6e600` | (230, 230, 0) |
66
+ | 4 | <i class="fa-solid fa-square fa-2xl" style="color: #ff99ff;"></i> | `#ff99ff` | (255, 153, 255) |
67
+ | 5 | <i class="fa-solid fa-square fa-2xl" style="color: #99ccff;"></i> | `#99ccff` | (153, 204, 255) |
68
+ | 6 | <i class="fa-solid fa-square fa-2xl" style="color: #ff66ff;"></i> | `#ff66ff` | (255, 102, 255) |
69
+ | 7 | <i class="fa-solid fa-square fa-2xl" style="color: #ff33ff;"></i> | `#ff33ff` | (255, 51, 255) |
70
+ | 8 | <i class="fa-solid fa-square fa-2xl" style="color: #66b2ff;"></i> | `#66b2ff` | (102, 178, 255) |
71
+ | 9 | <i class="fa-solid fa-square fa-2xl" style="color: #3399ff;"></i> | `#3399ff` | (51, 153, 255) |
72
+ | 10 | <i class="fa-solid fa-square fa-2xl" style="color: #ff9999;"></i> | `#ff9999` | (255, 153, 153) |
73
+ | 11 | <i class="fa-solid fa-square fa-2xl" style="color: #ff6666;"></i> | `#ff6666` | (255, 102, 102) |
74
+ | 12 | <i class="fa-solid fa-square fa-2xl" style="color: #ff3333;"></i> | `#ff3333` | (255, 51, 51) |
75
+ | 13 | <i class="fa-solid fa-square fa-2xl" style="color: #99ff99;"></i> | `#99ff99` | (153, 255, 153) |
76
+ | 14 | <i class="fa-solid fa-square fa-2xl" style="color: #66ff66;"></i> | `#66ff66` | (102, 255, 102) |
77
+ | 15 | <i class="fa-solid fa-square fa-2xl" style="color: #33ff33;"></i> | `#33ff33` | (51, 255, 51) |
78
+ | 16 | <i class="fa-solid fa-square fa-2xl" style="color: #00ff00;"></i> | `#00ff00` | (0, 255, 0) |
79
+ | 17 | <i class="fa-solid fa-square fa-2xl" style="color: #0000ff;"></i> | `#0000ff` | (0, 0, 255) |
80
+ | 18 | <i class="fa-solid fa-square fa-2xl" style="color: #ff0000;"></i> | `#ff0000` | (255, 0, 0) |
81
+ | 19 | <i class="fa-solid fa-square fa-2xl" style="color: #ffffff;"></i> | `#ffffff` | (255, 255, 255) |
82
+
83
+ !!! note "Ultralytics Brand Colors"
84
+
85
+ For Ultralytics brand colors see [https://www.ultralytics.com/brand](https://www.ultralytics.com/brand). Please use the official Ultralytics colors for all marketing materials.
32
86
  """
33
87
 
34
88
  def __init__(self):
@@ -533,16 +533,17 @@ class ModelEMA:
533
533
  copy_attr(self.ema, model, include, exclude)
534
534
 
535
535
 
536
- def strip_optimizer(f: Union[str, Path] = "best.pt", s: str = "") -> None:
536
+ def strip_optimizer(f: Union[str, Path] = "best.pt", s: str = "", updates: dict = None) -> dict:
537
537
  """
538
538
  Strip optimizer from 'f' to finalize training, optionally save as 's'.
539
539
 
540
540
  Args:
541
541
  f (str): file path to model to strip the optimizer from. Default is 'best.pt'.
542
542
  s (str): file path to save the model with stripped optimizer to. If not provided, 'f' will be overwritten.
543
+ updates (dict): a dictionary of updates to overlay onto the checkpoint before saving.
543
544
 
544
545
  Returns:
545
- None
546
+ (dict): The combined checkpoint dictionary.
546
547
 
547
548
  Example:
548
549
  ```python
@@ -562,9 +563,9 @@ def strip_optimizer(f: Union[str, Path] = "best.pt", s: str = "") -> None:
562
563
  assert "model" in x, "'model' missing from checkpoint"
563
564
  except Exception as e:
564
565
  LOGGER.warning(f"WARNING ⚠️ Skipping {f}, not a valid Ultralytics model: {e}")
565
- return
566
+ return {}
566
567
 
567
- updates = {
568
+ metadata = {
568
569
  "date": datetime.now().isoformat(),
569
570
  "version": __version__,
570
571
  "license": "AGPL-3.0 License (https://ultralytics.com/license)",
@@ -591,9 +592,11 @@ def strip_optimizer(f: Union[str, Path] = "best.pt", s: str = "") -> None:
591
592
  # x['model'].args = x['train_args']
592
593
 
593
594
  # Save
594
- torch.save({**updates, **x}, s or f, use_dill=False) # combine dicts (prefer to the right)
595
+ combined = {**metadata, **x, **(updates or {})}
596
+ torch.save(combined, s or f, use_dill=False) # combine dicts (prefer to the right)
595
597
  mb = os.path.getsize(s or f) / 1e6 # file size
596
598
  LOGGER.info(f"Optimizer stripped from {f},{f' saved as {s},' if s else ''} {mb:.1f}MB")
599
+ return combined
597
600
 
598
601
 
599
602
  def convert_optimizer_state_dict_to_fp16(state_dict):
@@ -1,14 +1,14 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ultralytics
3
- Version: 8.2.93
4
- Summary: Ultralytics YOLOv8 for SOTA object detection, multi-object tracking, instance segmentation, pose estimation and image classification.
3
+ Version: 8.2.95
4
+ Summary: Ultralytics YOLO for SOTA object detection, multi-object tracking, instance segmentation, pose estimation and image classification.
5
5
  Author: Glenn Jocher, Ayush Chaurasia, Jing Qiu
6
6
  Maintainer: Glenn Jocher, Ayush Chaurasia, Jing Qiu
7
7
  License: AGPL-3.0
8
8
  Project-URL: Bug Reports, https://github.com/ultralytics/ultralytics/issues
9
9
  Project-URL: Funding, https://ultralytics.com
10
10
  Project-URL: Source, https://github.com/ultralytics/ultralytics/
11
- Keywords: machine-learning,deep-learning,computer-vision,ML,DL,AI,YOLO,YOLOv3,YOLOv5,YOLOv8,HUB,Ultralytics
11
+ Keywords: machine-learning,deep-learning,computer-vision,ML,DL,AI,YOLO,YOLOv3,YOLOv5,YOLOv8,YOLOv9,YOLOv10,HUB,Ultralytics
12
12
  Classifier: Development Status :: 4 - Beta
13
13
  Classifier: Intended Audience :: Developers
14
14
  Classifier: Intended Audience :: Education
@@ -132,7 +132,7 @@ To request an Enterprise License please complete the form at [Ultralytics Licens
132
132
 
133
133
  ## <div align="center">Documentation</div>
134
134
 
135
- See below for a quickstart installation and usage example, and see the [YOLOv8 Docs](https://docs.ultralytics.com) for full documentation on training, validation, prediction and deployment.
135
+ See below for a quickstart installation and usage example, and see the [YOLOv8 Docs](https://docs.ultralytics.com/) for full documentation on training, validation, prediction and deployment.
136
136
 
137
137
  <details open>
138
138
  <summary>Install</summary>
@@ -145,7 +145,7 @@ Pip install the ultralytics package including all [requirements](https://github.
145
145
  pip install ultralytics
146
146
  ```
147
147
 
148
- For alternative installation methods including [Conda](https://anaconda.org/conda-forge/ultralytics), [Docker](https://hub.docker.com/r/ultralytics/ultralytics), and Git, please refer to the [Quickstart Guide](https://docs.ultralytics.com/quickstart).
148
+ For alternative installation methods including [Conda](https://anaconda.org/conda-forge/ultralytics), [Docker](https://hub.docker.com/r/ultralytics/ultralytics), and Git, please refer to the [Quickstart Guide](https://docs.ultralytics.com/quickstart/).
149
149
 
150
150
  [![Conda Version](https://img.shields.io/conda/vn/conda-forge/ultralytics?logo=condaforge)](https://anaconda.org/conda-forge/ultralytics) [![Docker Image Version](https://img.shields.io/docker/v/ultralytics/ultralytics?sort=semver&logo=docker)](https://hub.docker.com/r/ultralytics/ultralytics)
151
151
 
@@ -162,7 +162,7 @@ YOLOv8 may be used directly in the Command Line Interface (CLI) with a `yolo` co
162
162
  yolo predict model=yolov8n.pt source='https://ultralytics.com/images/bus.jpg'
163
163
  ```
164
164
 
165
- `yolo` can be used for a variety of tasks and modes and accepts additional arguments, i.e. `imgsz=640`. See the YOLOv8 [CLI Docs](https://docs.ultralytics.com/usage/cli) for examples.
165
+ `yolo` can be used for a variety of tasks and modes and accepts additional arguments, i.e. `imgsz=640`. See the YOLOv8 [CLI Docs](https://docs.ultralytics.com/usage/cli/) for examples.
166
166
 
167
167
  ### Python
168
168
 
@@ -172,17 +172,28 @@ YOLOv8 may also be used directly in a Python environment, and accepts the same [
172
172
  from ultralytics import YOLO
173
173
 
174
174
  # Load a model
175
- model = YOLO("yolov8n.yaml") # build a new model from scratch
176
- model = YOLO("yolov8n.pt") # load a pretrained model (recommended for training)
177
-
178
- # Use the model
179
- model.train(data="coco8.yaml", epochs=3) # train the model
180
- metrics = model.val() # evaluate model performance on the validation set
181
- results = model("https://ultralytics.com/images/bus.jpg") # predict on an image
182
- path = model.export(format="onnx") # export the model to ONNX format
175
+ model = YOLO("yolov8n.pt")
176
+
177
+ # Train the model
178
+ train_results = model.train(
179
+ data="coco8.yaml", # path to dataset YAML
180
+ epochs=100, # number of training epochs
181
+ imgsz=640, # training image size
182
+ device="cpu", # device to run on, i.e. device=0 or device=0,1,2,3 or device=cpu
183
+ )
184
+
185
+ # Evaluate model performance on the validation set
186
+ metrics = model.val()
187
+
188
+ # Perform object detection on an image
189
+ results = model("path/to/image.jpg")
190
+ results[0].show()
191
+
192
+ # Export the model to ONNX format
193
+ path = model.export(format="onnx") # return path to exported model
183
194
  ```
184
195
 
185
- See YOLOv8 [Python Docs](https://docs.ultralytics.com/usage/python) for more examples.
196
+ See YOLOv8 [Python Docs](https://docs.ultralytics.com/usage/python/) for more examples.
186
197
 
187
198
  </details>
188
199
 
@@ -201,7 +212,7 @@ Ultralytics provides interactive notebooks for YOLOv8, covering training, valida
201
212
 
202
213
  ## <div align="center">Models</div>
203
214
 
204
- YOLOv8 [Detect](https://docs.ultralytics.com/tasks/detect), [Segment](https://docs.ultralytics.com/tasks/segment) and [Pose](https://docs.ultralytics.com/tasks/pose) models pretrained on the [COCO](https://docs.ultralytics.com/datasets/detect/coco) dataset are available here, as well as YOLOv8 [Classify](https://docs.ultralytics.com/tasks/classify) models pretrained on the [ImageNet](https://docs.ultralytics.com/datasets/classify/imagenet) dataset. [Track](https://docs.ultralytics.com/modes/track) mode is available for all Detect, Segment and Pose models.
215
+ YOLOv8 [Detect](https://docs.ultralytics.com/tasks/detect/), [Segment](https://docs.ultralytics.com/tasks/segment/) and [Pose](https://docs.ultralytics.com/tasks/pose/) models pretrained on the [COCO](https://docs.ultralytics.com/datasets/detect/coco/) dataset are available here, as well as YOLOv8 [Classify](https://docs.ultralytics.com/tasks/classify/) models pretrained on the [ImageNet](https://docs.ultralytics.com/datasets/classify/imagenet/) dataset. [Track](https://docs.ultralytics.com/modes/track/) mode is available for all Detect, Segment and Pose models.
205
216
 
206
217
  <img width="1024" src="https://raw.githubusercontent.com/ultralytics/assets/main/im/banner-tasks.png" alt="Ultralytics YOLO supported tasks">
207
218
 
@@ -224,23 +235,6 @@ See [Detection Docs](https://docs.ultralytics.com/tasks/detect/) for usage examp
224
235
 
225
236
  </details>
226
237
 
227
- <details><summary>Detection (Open Image V7)</summary>
228
-
229
- See [Detection Docs](https://docs.ultralytics.com/tasks/detect/) for usage examples with these models trained on [Open Image V7](https://docs.ultralytics.com/datasets/detect/open-images-v7/), which include 600 pre-trained classes.
230
-
231
- | Model | size<br><sup>(pixels) | mAP<sup>val<br>50-95 | Speed<br><sup>CPU ONNX<br>(ms) | Speed<br><sup>A100 TensorRT<br>(ms) | params<br><sup>(M) | FLOPs<br><sup>(B) |
232
- | ----------------------------------------------------------------------------------------- | --------------------- | -------------------- | ------------------------------ | ----------------------------------- | ------------------ | ----------------- |
233
- | [YOLOv8n](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8n-oiv7.pt) | 640 | 18.4 | 142.4 | 1.21 | 3.5 | 10.5 |
234
- | [YOLOv8s](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8s-oiv7.pt) | 640 | 27.7 | 183.1 | 1.40 | 11.4 | 29.7 |
235
- | [YOLOv8m](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8m-oiv7.pt) | 640 | 33.6 | 408.5 | 2.26 | 26.2 | 80.6 |
236
- | [YOLOv8l](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8l-oiv7.pt) | 640 | 34.9 | 596.9 | 2.43 | 44.1 | 167.4 |
237
- | [YOLOv8x](https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8x-oiv7.pt) | 640 | 36.3 | 860.6 | 3.56 | 68.7 | 260.6 |
238
-
239
- - **mAP<sup>val</sup>** values are for single-model single-scale on [Open Image V7](https://docs.ultralytics.com/datasets/detect/open-images-v7/) dataset. <br>Reproduce by `yolo val detect data=open-images-v7.yaml device=0`
240
- - **Speed** averaged over Open Image V7 val images using an [Amazon EC2 P4d](https://aws.amazon.com/ec2/instance-types/p4/) instance. <br>Reproduce by `yolo val detect data=open-images-v7.yaml batch=1 device=0|cpu`
241
-
242
- </details>
243
-
244
238
  <details><summary>Segmentation (COCO)</summary>
245
239
 
246
240
  See [Segmentation Docs](https://docs.ultralytics.com/tasks/segment/) for usage examples with these models trained on [COCO-Seg](https://docs.ultralytics.com/datasets/segment/coco/), which include 80 pre-trained classes.
@@ -312,7 +306,7 @@ See [Classification Docs](https://docs.ultralytics.com/tasks/classify/) for usag
312
306
 
313
307
  ## <div align="center">Integrations</div>
314
308
 
315
- Our key integrations with leading AI platforms extend the functionality of Ultralytics' offerings, enhancing tasks like dataset labeling, training, visualization, and model management. Discover how Ultralytics, in collaboration with [Roboflow](https://roboflow.com/?ref=ultralytics), ClearML, [Comet](https://bit.ly/yolov8-readme-comet), Neural Magic and [OpenVINO](https://docs.ultralytics.com/integrations/openvino), can optimize your AI workflow.
309
+ Our key integrations with leading AI platforms extend the functionality of Ultralytics' offerings, enhancing tasks like dataset labeling, training, visualization, and model management. Discover how Ultralytics, in collaboration with [Roboflow](https://roboflow.com/?ref=ultralytics), ClearML, [Comet](https://bit.ly/yolov8-readme-comet), Neural Magic and [OpenVINO](https://docs.ultralytics.com/integrations/openvino/), can optimize your AI workflow.
316
310
 
317
311
  <br>
318
312
  <a href="https://ultralytics.com/hub" target="_blank">
@@ -347,7 +341,7 @@ Experience seamless AI with [Ultralytics HUB](https://www.ultralytics.com/hub)
347
341
 
348
342
  ## <div align="center">Contribute</div>
349
343
 
350
- We love your input! YOLOv5 and YOLOv8 would not be possible without help from our community. Please see our [Contributing Guide](https://docs.ultralytics.com/help/contributing) to get started, and fill out our [Survey](https://www.ultralytics.com/survey?utm_source=github&utm_medium=social&utm_campaign=Survey) to send us feedback on your experience. Thank you 🙏 to all our contributors!
344
+ We love your input! YOLOv5 and YOLOv8 would not be possible without help from our community. Please see our [Contributing Guide](https://docs.ultralytics.com/help/contributing/) to get started, and fill out our [Survey](https://www.ultralytics.com/survey?utm_source=github&utm_medium=social&utm_campaign=Survey) to send us feedback on your experience. Thank you 🙏 to all our contributors!
351
345
 
352
346
  <!-- SVG image from https://opencollective.com/ultralytics/contributors.svg?width=990 -->
353
347
 
@@ -1,14 +1,14 @@
1
- tests/__init__.py,sha256=9evx3lOdKZeY1iWXvH-FkMkgf8jLucWICoabzeD6aYg,626
1
+ tests/__init__.py,sha256=JMahSIGmWc9B303_FBqQu6FKhxN3deI3a-q4Ftc-3Pw,666
2
2
  tests/conftest.py,sha256=3ZtD4VlMKK5jVJwIPCrNAcG63vywJzdLq7U2AfYR2VI,2919
3
- tests/test_cli.py,sha256=as6cuNdDF2s_h3DxVXKmy45V3DXWB6y40xect93TKHc,4810
3
+ tests/test_cli.py,sha256=E4lMt49TGo12Lb5CgQfpk1bwyFUZuFxF0V9j_ykV7xM,4821
4
4
  tests/test_cuda.py,sha256=uD-ddNEcBMFQmQ9iE4fIGh0EIcGwEoDEUNVCEHicaWE,5133
5
5
  tests/test_engine.py,sha256=xW-UT9_9xZp-7-hSnbJgMw_ezTk6NqTOIiA59XZDmxA,4934
6
6
  tests/test_explorer.py,sha256=IMFvZ9uMoEXVC5FwdaVh0821wBgs7muVF6aw1F-auAI,2572
7
7
  tests/test_exports.py,sha256=Uezf3OatpPHlo5qoPw-2kqkZxuMCF9L4XF2riD4vmII,8225
8
8
  tests/test_integrations.py,sha256=xglcfMPjfVh346PV8WTpk6tBxraCXEFJEQyyJMr5tyU,6064
9
- tests/test_python.py,sha256=08fg47DuJflumuUBto480-9VCqtEGAhQjNnQdcHs9_c,22242
9
+ tests/test_python.py,sha256=A26gwwdoIBXABxH3lBxaLcTi2QQ1KFSz5fZPbAy2uCc,23493
10
10
  tests/test_solutions.py,sha256=p_2edhl96Ty3jwzSf02Q2m2mTu9skc0Z-eMcUuuXfLg,3300
11
- ultralytics/__init__.py,sha256=Q72ivw5La5ht_Ky1pTUaxg2X6CaMBSSncTAiqLD-wPM,695
11
+ ultralytics/__init__.py,sha256=5oU02HAdvUjQ0lXUrbl1c97giPJZZfVE_bt735cUxjM,695
12
12
  ultralytics/assets/bus.jpg,sha256=wCAZxJecGR63Od3ZRERe9Aja1Weayrb9Ug751DS_vGM,137419
13
13
  ultralytics/assets/zidane.jpg,sha256=Ftc4aeMmen1O0A3o6GCDO9FlfBslLpTAw0gnetx7bts,50427
14
14
  ultralytics/cfg/__init__.py,sha256=pkB7wk0pHOA3xzKzMbS-hA0iJoPOWVNnwZJh0LuWh-w,33089
@@ -102,7 +102,7 @@ ultralytics/engine/exporter.py,sha256=MtBFbJp3ifhn9sQXuQb7vxxOmtS_SOw7lnQhrq4H42
102
102
  ultralytics/engine/model.py,sha256=AB9tu7kJW-QiTAp0F_J8KQJ4FijsHXcYBTaVHb7aMrg,52281
103
103
  ultralytics/engine/predictor.py,sha256=MgMWHUJdRcVCaVmOyvdy2Gjk_EyRHv-ar0SSGxQe8F4,17471
104
104
  ultralytics/engine/results.py,sha256=x5Ptr5uGjEz63_N1DnfDg2ktNhLqT93oPyIPruuWp6w,70986
105
- ultralytics/engine/trainer.py,sha256=7QPWrOwfw2hUNzNKtvTnAM2ui8vdIEDbMn9JTLkmQ9o,36307
105
+ ultralytics/engine/trainer.py,sha256=VOuR9WpDgYILevpWnWAtKLEIcJ4iFG41HxOCSbOy0YA,36657
106
106
  ultralytics/engine/tuner.py,sha256=gPqDTHH7vRB2O3YyH26m1BjVKbXxuA2XAlPRzTKFZsc,11838
107
107
  ultralytics/engine/validator.py,sha256=yaUMb5efBvgFg8M24IFlmv3J-acbbSgtqLCk-mM07Wo,14623
108
108
  ultralytics/hub/__init__.py,sha256=AM_twjV9ouUmyxh3opoPgTqDpMOd8xIOHsAKdWS2L18,5663
@@ -129,7 +129,7 @@ ultralytics/models/sam/__init__.py,sha256=o4_D6y8YJlOXIK7Lwo9RHnIJJ9xoFNi4zK99QS
129
129
  ultralytics/models/sam/amg.py,sha256=GrmO_8YfIDt_QkPEMF_WFjPZkhwhf7iwx7ig8JgOUnE,8709
130
130
  ultralytics/models/sam/build.py,sha256=zNQbrgSHUgz1gyXQwLKGTpa6CSEjeaevcP3w1Z1l3mo,12233
131
131
  ultralytics/models/sam/model.py,sha256=2KFUp8SHiqOgwUjkdqdau0oduJwKQxm4N9GHWjdhUFo,7382
132
- ultralytics/models/sam/predict.py,sha256=4HOvBp27MvO8ef3gD64wVooNT1P5eMy3Bk8W7ysU57o,38352
132
+ ultralytics/models/sam/predict.py,sha256=unsoNrEx6pexKD28-HTpALa02PtNtE4e2ERdzs9qbYw,38556
133
133
  ultralytics/models/sam/modules/__init__.py,sha256=mHtJuK4hwF8cuV-VHDc7tp6u6D1gHz2Z7JI8grmQDTs,42
134
134
  ultralytics/models/sam/modules/blocks.py,sha256=Q-KwhFbdyZhl1tjG_kP2LcQkZbzoNt618i-NRrKNx2Y,45919
135
135
  ultralytics/models/sam/modules/decoders.py,sha256=mODsqnTN_CjE3H0Sh9cd8PfTnHANPjGB1bjqHxfezSg,25830
@@ -169,7 +169,7 @@ ultralytics/models/yolo/world/train.py,sha256=gaDrAmLJpg9qDtmL5evA5HsV2yb4RTRSfk
169
169
  ultralytics/models/yolo/world/train_world.py,sha256=IsnCEVt6DcM9lUskCKmIN-M8MM79xLpwTRqRoAHUnZ4,4857
170
170
  ultralytics/nn/__init__.py,sha256=4BPLHY89xEM_al5uK0aOmFgiML6CMGEZbezxOvTjOEs,587
171
171
  ultralytics/nn/autobackend.py,sha256=DZTIHsp2PLs8H2-oQR9LqA-uPj8DARGonCXzRv2Pkdc,31546
172
- ultralytics/nn/tasks.py,sha256=GbRUqOmLS6wTB2U6Z3IojXE96jCrs33vrCwVGxmD_34,47777
172
+ ultralytics/nn/tasks.py,sha256=5ESFTm1CYt7uSCyWkW7rsLAdMLPHSBla95GWj439SrA,47894
173
173
  ultralytics/nn/modules/__init__.py,sha256=m8x-XRHVLWMECPeysVlv1TQenV-n8oAbK1gxnoXzLpk,2553
174
174
  ultralytics/nn/modules/activation.py,sha256=chhn469wnRHEs5BMGNBYXwPYZc_7-urspTT8fnBd-xA,895
175
175
  ultralytics/nn/modules/block.py,sha256=n6Xhevz8_n05UCt_vmZ7eVRiDbA_zV_TvWNBbpZe-qA,34352
@@ -209,9 +209,9 @@ ultralytics/utils/loss.py,sha256=mDHGmF-gjggAUVhI1dkCm7TtfZHCwz25XKm4M2xJKLs,339
209
209
  ultralytics/utils/metrics.py,sha256=UgLGudWp57uXDMlMUJy4gsz6cfVjcq7tYmHeto3TqvM,53927
210
210
  ultralytics/utils/ops.py,sha256=dsXNdyrYx_p6io6zezig9p84dxS7U-10vceHNVu2IL0,32888
211
211
  ultralytics/utils/patches.py,sha256=Oo3DkP7MbXnNGvPfoFSocAkVvaPh9kwMT_9RQUfjVhI,3594
212
- ultralytics/utils/plotting.py,sha256=Tp1vjSrzbtQc1ILlT1Frw9YzvGtOHlf8bdLAvZg7TBU,56181
212
+ ultralytics/utils/plotting.py,sha256=bud5mAvFxQ2JD29dReaO4c7Z00k6jIaPJJCznIoyy2w,61543
213
213
  ultralytics/utils/tal.py,sha256=ECsu95xEqOItmxMDN4YTD3FsUiIsQNWy0pZC3TfvFfk,16877
214
- ultralytics/utils/torch_utils.py,sha256=NgZtDgjQkAVCAqCdFrFMSU9Fl_x3pYqaYa1mhAvOb_8,29312
214
+ ultralytics/utils/torch_utils.py,sha256=lTTbFD8SlnXT11O9E8NKTQnrXEOsRmayywQP6niUZMc,29535
215
215
  ultralytics/utils/triton.py,sha256=gg1finxno_tY2Ge9PMhmu7PI9wvoFZoiicdT4Bhqv3w,3936
216
216
  ultralytics/utils/tuner.py,sha256=AtEtK6pOt9xVTyx864OpNRVxNdAxz5aKHzveiXwkD1A,6250
217
217
  ultralytics/utils/callbacks/__init__.py,sha256=YrWqC3BVVaTLob4iCPR6I36mUxIUOpPJW7B_LjT78Qw,214
@@ -225,9 +225,9 @@ ultralytics/utils/callbacks/neptune.py,sha256=5Z3ua5YBTUS56FH8VQKQG1aaIo9fH8GEyz
225
225
  ultralytics/utils/callbacks/raytune.py,sha256=ODVYzy-CoM4Uge0zjkh3Hnh9nF2M0vhDrSenXnvcizw,705
226
226
  ultralytics/utils/callbacks/tensorboard.py,sha256=0kn4IR10no99UCIheojWRujgybmUHSx5fPI6Vsq6l_g,4135
227
227
  ultralytics/utils/callbacks/wb.py,sha256=9-fjQIdLjr3b73DTE3rHO171KvbH1VweJ-bmbv-rqTw,6747
228
- ultralytics-8.2.93.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
229
- ultralytics-8.2.93.dist-info/METADATA,sha256=dZ7rJ_R_Hwgk3PxcoHgfxNG5ACT4HBbUPp5yCGNvl2I,41871
230
- ultralytics-8.2.93.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
231
- ultralytics-8.2.93.dist-info/entry_points.txt,sha256=YM_wiKyTe9yRrsEfqvYolNO5ngwfoL4-NwgKzc8_7sI,93
232
- ultralytics-8.2.93.dist-info/top_level.txt,sha256=XP49TwiMw4QGsvTLSYiJhz1xF_k7ev5mQ8jJXaXi45Q,12
233
- ultralytics-8.2.93.dist-info/RECORD,,
228
+ ultralytics-8.2.95.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
229
+ ultralytics-8.2.95.dist-info/METADATA,sha256=q8F9Y4cjZoDo4lbelf2a4LE6Qu5wGAQy3MrzVw9b3ac,39504
230
+ ultralytics-8.2.95.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
231
+ ultralytics-8.2.95.dist-info/entry_points.txt,sha256=YM_wiKyTe9yRrsEfqvYolNO5ngwfoL4-NwgKzc8_7sI,93
232
+ ultralytics-8.2.95.dist-info/top_level.txt,sha256=XP49TwiMw4QGsvTLSYiJhz1xF_k7ev5mQ8jJXaXi45Q,12
233
+ ultralytics-8.2.95.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (74.1.2)
2
+ Generator: setuptools (75.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5