ultralytics 8.1.6__py3-none-any.whl → 8.1.12__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.

Files changed (43) hide show
  1. ultralytics/__init__.py +1 -1
  2. ultralytics/cfg/__init__.py +1 -1
  3. ultralytics/data/converter.py +5 -2
  4. ultralytics/data/dataset.py +9 -4
  5. ultralytics/data/explorer/explorer.py +5 -2
  6. ultralytics/engine/exporter.py +17 -3
  7. ultralytics/engine/model.py +355 -81
  8. ultralytics/engine/results.py +94 -43
  9. ultralytics/engine/trainer.py +7 -3
  10. ultralytics/hub/__init__.py +6 -3
  11. ultralytics/hub/auth.py +2 -2
  12. ultralytics/hub/session.py +2 -2
  13. ultralytics/models/sam/amg.py +4 -2
  14. ultralytics/models/sam/modules/decoders.py +1 -1
  15. ultralytics/models/sam/modules/tiny_encoder.py +1 -1
  16. ultralytics/models/yolo/segment/predict.py +1 -1
  17. ultralytics/models/yolo/segment/val.py +6 -2
  18. ultralytics/nn/autobackend.py +6 -6
  19. ultralytics/nn/modules/head.py +11 -10
  20. ultralytics/nn/tasks.py +11 -2
  21. ultralytics/solutions/distance_calculation.py +5 -17
  22. ultralytics/solutions/heatmap.py +2 -1
  23. ultralytics/solutions/object_counter.py +1 -2
  24. ultralytics/solutions/speed_estimation.py +1 -1
  25. ultralytics/trackers/utils/gmc.py +10 -12
  26. ultralytics/utils/__init__.py +78 -7
  27. ultralytics/utils/benchmarks.py +1 -2
  28. ultralytics/utils/callbacks/mlflow.py +6 -2
  29. ultralytics/utils/checks.py +2 -2
  30. ultralytics/utils/loss.py +7 -2
  31. ultralytics/utils/metrics.py +4 -4
  32. ultralytics/utils/ops.py +0 -1
  33. ultralytics/utils/plotting.py +63 -5
  34. ultralytics/utils/tal.py +2 -2
  35. ultralytics/utils/torch_utils.py +2 -2
  36. ultralytics/utils/triton.py +1 -1
  37. ultralytics/utils/tuner.py +1 -1
  38. {ultralytics-8.1.6.dist-info → ultralytics-8.1.12.dist-info}/METADATA +4 -4
  39. {ultralytics-8.1.6.dist-info → ultralytics-8.1.12.dist-info}/RECORD +43 -43
  40. {ultralytics-8.1.6.dist-info → ultralytics-8.1.12.dist-info}/LICENSE +0 -0
  41. {ultralytics-8.1.6.dist-info → ultralytics-8.1.12.dist-info}/WHEEL +0 -0
  42. {ultralytics-8.1.6.dist-info → ultralytics-8.1.12.dist-info}/entry_points.txt +0 -0
  43. {ultralytics-8.1.6.dist-info → ultralytics-8.1.12.dist-info}/top_level.txt +0 -0
ultralytics/__init__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  # Ultralytics YOLO 🚀, AGPL-3.0 license
2
2
 
3
- __version__ = "8.1.6"
3
+ __version__ = "8.1.12"
4
4
 
5
5
  from ultralytics.data.explorer.explorer import Explorer
6
6
  from ultralytics.models import RTDETR, SAM, YOLO
@@ -317,7 +317,7 @@ def merge_equals_args(args: List[str]) -> List[str]:
317
317
  args (List[str]): A list of strings where each element is an argument.
318
318
 
319
319
  Returns:
320
- List[str]: A list of strings where the arguments around isolated '=' are merged.
320
+ (List[str]): A list of strings where the arguments around isolated '=' are merged.
321
321
  """
322
322
  new_args = []
323
323
  for i, arg in enumerate(args):
@@ -336,6 +336,7 @@ def convert_dota_to_yolo_obb(dota_root_path: str):
336
336
 
337
337
  Notes:
338
338
  The directory structure assumed for the DOTA dataset:
339
+
339
340
  - DOTA
340
341
  ├─ images
341
342
  │ ├─ train
@@ -345,6 +346,7 @@ def convert_dota_to_yolo_obb(dota_root_path: str):
345
346
  └─ val_original
346
347
 
347
348
  After execution, the function will organize the labels into:
349
+
348
350
  - DOTA
349
351
  └─ labels
350
352
  ├─ train
@@ -489,14 +491,15 @@ def yolo_bbox2segment(im_dir, save_dir=None, sam_model="sam_b.pt"):
489
491
 
490
492
  Notes:
491
493
  The input directory structure assumed for dataset:
494
+
492
495
  - im_dir
493
496
  ├─ 001.jpg
494
497
  ├─ ..
495
- ├─ NNN.jpg
498
+ └─ NNN.jpg
496
499
  - labels
497
500
  ├─ 001.txt
498
501
  ├─ ..
499
- ├─ NNN.txt
502
+ └─ NNN.txt
500
503
  """
501
504
  from ultralytics.data import YOLODataset
502
505
  from ultralytics.utils.ops import xywh2xyxy
@@ -46,7 +46,8 @@ class YOLODataset(BaseDataset):
46
46
  Cache dataset labels, check images and read shapes.
47
47
 
48
48
  Args:
49
- path (Path): path where to save the cache file (default: Path('./labels.cache')).
49
+ path (Path): Path where to save the cache file. Default is Path('./labels.cache').
50
+
50
51
  Returns:
51
52
  (dict): labels.
52
53
  """
@@ -178,9 +179,13 @@ class YOLODataset(BaseDataset):
178
179
  self.transforms = self.build_transforms(hyp)
179
180
 
180
181
  def update_labels_info(self, label):
181
- """Custom your label format here."""
182
- # NOTE: cls is not with bboxes now, classification and semantic segmentation need an independent cls label
183
- # We can make it also support classification and semantic segmentation by add or remove some dict keys there.
182
+ """
183
+ Custom your label format here.
184
+
185
+ Note:
186
+ cls is not with bboxes now, classification and semantic segmentation need an independent cls label
187
+ Can also support classification and semantic segmentation by adding or removing dict keys there.
188
+ """
184
189
  bboxes = label.pop("bboxes")
185
190
  segments = label.pop("segments", [])
186
191
  keypoints = label.pop("keypoints", None)
@@ -16,7 +16,7 @@ from ultralytics.data.augment import Format
16
16
  from ultralytics.data.dataset import YOLODataset
17
17
  from ultralytics.data.utils import check_det_dataset
18
18
  from ultralytics.models.yolo.model import YOLO
19
- from ultralytics.utils import LOGGER, IterableSimpleNamespace, checks
19
+ from ultralytics.utils import LOGGER, IterableSimpleNamespace, checks, USER_CONFIG_DIR
20
20
  from .utils import get_sim_index_schema, get_table_schema, plot_query_result, prompt_sql_query, sanitize_batch
21
21
 
22
22
 
@@ -54,7 +54,10 @@ class ExplorerDataset(YOLODataset):
54
54
 
55
55
  class Explorer:
56
56
  def __init__(
57
- self, data: Union[str, Path] = "coco128.yaml", model: str = "yolov8n.pt", uri: str = "~/ultralytics/explorer"
57
+ self,
58
+ data: Union[str, Path] = "coco128.yaml",
59
+ model: str = "yolov8n.pt",
60
+ uri: str = USER_CONFIG_DIR / "explorer",
58
61
  ) -> None:
59
62
  checks.check_requirements(["lancedb>=0.4.3", "duckdb"])
60
63
  import lancedb
@@ -227,7 +227,7 @@ class Exporter:
227
227
  y = None
228
228
  for _ in range(2):
229
229
  y = model(im) # dry runs
230
- if self.args.half and (engine or onnx) and self.device.type != "cpu":
230
+ if self.args.half and onnx and self.device.type != "cpu":
231
231
  im, model = im.half(), model.half() # to FP16
232
232
 
233
233
  # Filter warnings
@@ -454,7 +454,21 @@ class Exporter:
454
454
  if n < 300:
455
455
  LOGGER.warning(f"{prefix} WARNING ⚠️ >300 images recommended for INT8 calibration, found {n} images.")
456
456
  quantization_dataset = nncf.Dataset(dataset, transform_fn)
457
- ignored_scope = nncf.IgnoredScope(types=["Multiply", "Subtract", "Sigmoid"]) # ignore operation
457
+ ignored_scope = None
458
+ if isinstance(self.model.model[-1], (Detect, RTDETRDecoder)): # Segment and Pose use Detect base class
459
+ # get detection module name in onnx
460
+ head_module_name = ".".join(list(self.model.named_modules())[-1][0].split(".")[:2])
461
+
462
+ ignored_scope = nncf.IgnoredScope( # ignore operations
463
+ patterns=[
464
+ f"/{head_module_name}/Add",
465
+ f"/{head_module_name}/Sub",
466
+ f"/{head_module_name}/Mul",
467
+ f"/{head_module_name}/Div",
468
+ f"/{head_module_name}/dfl",
469
+ ],
470
+ names=[f"/{head_module_name}/Sigmoid"],
471
+ )
458
472
  quantized_ov_model = nncf.quantize(
459
473
  ov_model, quantization_dataset, preset=nncf.QuantizationPreset.MIXED, ignored_scope=ignored_scope
460
474
  )
@@ -483,7 +497,7 @@ class Exporter:
483
497
  """
484
498
  YOLOv8 ncnn export using PNNX https://github.com/pnnx/pnnx.
485
499
  """
486
- check_requirements("git+https://github.com/Tencent/ncnn.git" if ARM64 else "ncnn") # requires ncnn
500
+ check_requirements("ncnn")
487
501
  import ncnn # noqa
488
502
 
489
503
  LOGGER.info(f"\n{prefix} starting export with ncnn {ncnn.__version__}...")