ultralytics 8.3.9__tar.gz → 8.3.11__tar.gz

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 (246) hide show
  1. {ultralytics-8.3.9/ultralytics.egg-info → ultralytics-8.3.11}/PKG-INFO +1 -1
  2. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/__init__.py +1 -1
  3. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/data/annotator.py +1 -1
  4. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/data/loaders.py +162 -81
  5. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/data/utils.py +1 -1
  6. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/engine/exporter.py +47 -50
  7. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/engine/model.py +33 -33
  8. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/engine/predictor.py +1 -1
  9. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/engine/results.py +1 -1
  10. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/engine/tuner.py +3 -3
  11. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/yolo/detect/predict.py +1 -1
  12. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/yolo/detect/train.py +1 -1
  13. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/yolo/detect/val.py +1 -1
  14. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/yolo/model.py +1 -1
  15. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/nn/autobackend.py +1 -1
  16. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/nn/modules/head.py +9 -9
  17. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/utils/benchmarks.py +2 -2
  18. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/utils/checks.py +10 -7
  19. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/utils/downloads.py +1 -1
  20. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/utils/files.py +2 -2
  21. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/utils/tuner.py +1 -1
  22. {ultralytics-8.3.9 → ultralytics-8.3.11/ultralytics.egg-info}/PKG-INFO +1 -1
  23. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics.egg-info/SOURCES.txt +0 -2
  24. ultralytics-8.3.9/tests/test_explorer.py +0 -66
  25. {ultralytics-8.3.9 → ultralytics-8.3.11}/LICENSE +0 -0
  26. {ultralytics-8.3.9 → ultralytics-8.3.11}/README.md +0 -0
  27. {ultralytics-8.3.9 → ultralytics-8.3.11}/pyproject.toml +0 -0
  28. {ultralytics-8.3.9 → ultralytics-8.3.11}/setup.cfg +0 -0
  29. {ultralytics-8.3.9 → ultralytics-8.3.11}/tests/__init__.py +0 -0
  30. {ultralytics-8.3.9 → ultralytics-8.3.11}/tests/conftest.py +0 -0
  31. {ultralytics-8.3.9 → ultralytics-8.3.11}/tests/test_cli.py +0 -0
  32. {ultralytics-8.3.9 → ultralytics-8.3.11}/tests/test_cuda.py +0 -0
  33. {ultralytics-8.3.9 → ultralytics-8.3.11}/tests/test_engine.py +0 -0
  34. {ultralytics-8.3.9 → ultralytics-8.3.11}/tests/test_exports.py +0 -0
  35. {ultralytics-8.3.9 → ultralytics-8.3.11}/tests/test_integrations.py +0 -0
  36. {ultralytics-8.3.9 → ultralytics-8.3.11}/tests/test_python.py +0 -0
  37. {ultralytics-8.3.9 → ultralytics-8.3.11}/tests/test_solutions.py +0 -0
  38. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/assets/bus.jpg +0 -0
  39. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/assets/zidane.jpg +0 -0
  40. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/__init__.py +0 -0
  41. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/datasets/Argoverse.yaml +0 -0
  42. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/datasets/DOTAv1.5.yaml +0 -0
  43. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/datasets/DOTAv1.yaml +0 -0
  44. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/datasets/GlobalWheat2020.yaml +0 -0
  45. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/datasets/ImageNet.yaml +0 -0
  46. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/datasets/Objects365.yaml +0 -0
  47. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/datasets/SKU-110K.yaml +0 -0
  48. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/datasets/VOC.yaml +0 -0
  49. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/datasets/VisDrone.yaml +0 -0
  50. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/datasets/african-wildlife.yaml +0 -0
  51. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/datasets/brain-tumor.yaml +0 -0
  52. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/datasets/carparts-seg.yaml +0 -0
  53. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/datasets/coco-pose.yaml +0 -0
  54. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/datasets/coco.yaml +0 -0
  55. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/datasets/coco128-seg.yaml +0 -0
  56. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/datasets/coco128.yaml +0 -0
  57. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/datasets/coco8-pose.yaml +0 -0
  58. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/datasets/coco8-seg.yaml +0 -0
  59. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/datasets/coco8.yaml +0 -0
  60. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/datasets/crack-seg.yaml +0 -0
  61. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/datasets/dota8.yaml +0 -0
  62. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/datasets/hand-keypoints.yaml +0 -0
  63. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/datasets/lvis.yaml +0 -0
  64. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/datasets/open-images-v7.yaml +0 -0
  65. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/datasets/package-seg.yaml +0 -0
  66. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/datasets/signature.yaml +0 -0
  67. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/datasets/tiger-pose.yaml +0 -0
  68. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/datasets/xView.yaml +0 -0
  69. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/default.yaml +0 -0
  70. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/11/yolo11-cls.yaml +0 -0
  71. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/11/yolo11-obb.yaml +0 -0
  72. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/11/yolo11-pose.yaml +0 -0
  73. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/11/yolo11-seg.yaml +0 -0
  74. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/11/yolo11.yaml +0 -0
  75. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/rt-detr/rtdetr-l.yaml +0 -0
  76. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/rt-detr/rtdetr-resnet101.yaml +0 -0
  77. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/rt-detr/rtdetr-resnet50.yaml +0 -0
  78. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/rt-detr/rtdetr-x.yaml +0 -0
  79. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/v10/yolov10b.yaml +0 -0
  80. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/v10/yolov10l.yaml +0 -0
  81. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/v10/yolov10m.yaml +0 -0
  82. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/v10/yolov10n.yaml +0 -0
  83. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/v10/yolov10s.yaml +0 -0
  84. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/v10/yolov10x.yaml +0 -0
  85. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/v3/yolov3-spp.yaml +0 -0
  86. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/v3/yolov3-tiny.yaml +0 -0
  87. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/v3/yolov3.yaml +0 -0
  88. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/v5/yolov5-p6.yaml +0 -0
  89. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/v5/yolov5.yaml +0 -0
  90. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/v6/yolov6.yaml +0 -0
  91. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/v8/yolov8-cls-resnet101.yaml +0 -0
  92. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/v8/yolov8-cls-resnet50.yaml +0 -0
  93. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/v8/yolov8-cls.yaml +0 -0
  94. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/v8/yolov8-ghost-p2.yaml +0 -0
  95. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/v8/yolov8-ghost-p6.yaml +0 -0
  96. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/v8/yolov8-ghost.yaml +0 -0
  97. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/v8/yolov8-obb.yaml +0 -0
  98. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/v8/yolov8-p2.yaml +0 -0
  99. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/v8/yolov8-p6.yaml +0 -0
  100. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/v8/yolov8-pose-p6.yaml +0 -0
  101. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/v8/yolov8-pose.yaml +0 -0
  102. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/v8/yolov8-rtdetr.yaml +0 -0
  103. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/v8/yolov8-seg-p6.yaml +0 -0
  104. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/v8/yolov8-seg.yaml +0 -0
  105. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/v8/yolov8-world.yaml +0 -0
  106. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/v8/yolov8-worldv2.yaml +0 -0
  107. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/v8/yolov8.yaml +0 -0
  108. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/v9/yolov9c-seg.yaml +0 -0
  109. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/v9/yolov9c.yaml +0 -0
  110. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/v9/yolov9e-seg.yaml +0 -0
  111. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/v9/yolov9e.yaml +0 -0
  112. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/v9/yolov9m.yaml +0 -0
  113. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/v9/yolov9s.yaml +0 -0
  114. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/models/v9/yolov9t.yaml +0 -0
  115. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/solutions/default.yaml +0 -0
  116. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/trackers/botsort.yaml +0 -0
  117. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/cfg/trackers/bytetrack.yaml +0 -0
  118. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/data/__init__.py +0 -0
  119. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/data/augment.py +0 -0
  120. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/data/base.py +0 -0
  121. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/data/build.py +0 -0
  122. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/data/converter.py +0 -0
  123. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/data/dataset.py +0 -0
  124. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/data/explorer/__init__.py +0 -0
  125. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/data/explorer/explorer.py +0 -0
  126. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/data/explorer/gui/__init__.py +0 -0
  127. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/data/explorer/gui/dash.py +0 -0
  128. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/data/explorer/utils.py +0 -0
  129. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/data/split_dota.py +0 -0
  130. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/engine/__init__.py +0 -0
  131. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/engine/trainer.py +0 -0
  132. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/engine/validator.py +0 -0
  133. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/hub/__init__.py +0 -0
  134. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/hub/auth.py +0 -0
  135. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/hub/google/__init__.py +0 -0
  136. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/hub/session.py +0 -0
  137. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/hub/utils.py +0 -0
  138. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/__init__.py +0 -0
  139. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/fastsam/__init__.py +0 -0
  140. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/fastsam/model.py +0 -0
  141. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/fastsam/predict.py +0 -0
  142. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/fastsam/utils.py +0 -0
  143. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/fastsam/val.py +0 -0
  144. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/nas/__init__.py +0 -0
  145. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/nas/model.py +0 -0
  146. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/nas/predict.py +0 -0
  147. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/nas/val.py +0 -0
  148. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/rtdetr/__init__.py +0 -0
  149. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/rtdetr/model.py +0 -0
  150. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/rtdetr/predict.py +0 -0
  151. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/rtdetr/train.py +0 -0
  152. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/rtdetr/val.py +0 -0
  153. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/sam/__init__.py +0 -0
  154. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/sam/amg.py +0 -0
  155. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/sam/build.py +0 -0
  156. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/sam/model.py +0 -0
  157. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/sam/modules/__init__.py +0 -0
  158. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/sam/modules/blocks.py +0 -0
  159. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/sam/modules/decoders.py +0 -0
  160. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/sam/modules/encoders.py +0 -0
  161. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/sam/modules/memory_attention.py +0 -0
  162. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/sam/modules/sam.py +0 -0
  163. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/sam/modules/tiny_encoder.py +0 -0
  164. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/sam/modules/transformer.py +0 -0
  165. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/sam/modules/utils.py +0 -0
  166. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/sam/predict.py +0 -0
  167. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/utils/__init__.py +0 -0
  168. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/utils/loss.py +0 -0
  169. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/utils/ops.py +0 -0
  170. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/yolo/__init__.py +0 -0
  171. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/yolo/classify/__init__.py +0 -0
  172. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/yolo/classify/predict.py +0 -0
  173. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/yolo/classify/train.py +0 -0
  174. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/yolo/classify/val.py +0 -0
  175. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/yolo/detect/__init__.py +0 -0
  176. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/yolo/obb/__init__.py +0 -0
  177. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/yolo/obb/predict.py +0 -0
  178. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/yolo/obb/train.py +0 -0
  179. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/yolo/obb/val.py +0 -0
  180. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/yolo/pose/__init__.py +0 -0
  181. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/yolo/pose/predict.py +0 -0
  182. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/yolo/pose/train.py +0 -0
  183. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/yolo/pose/val.py +0 -0
  184. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/yolo/segment/__init__.py +0 -0
  185. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/yolo/segment/predict.py +0 -0
  186. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/yolo/segment/train.py +0 -0
  187. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/yolo/segment/val.py +0 -0
  188. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/yolo/world/__init__.py +0 -0
  189. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/yolo/world/train.py +0 -0
  190. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/models/yolo/world/train_world.py +0 -0
  191. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/nn/__init__.py +0 -0
  192. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/nn/modules/__init__.py +0 -0
  193. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/nn/modules/activation.py +0 -0
  194. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/nn/modules/block.py +0 -0
  195. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/nn/modules/conv.py +0 -0
  196. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/nn/modules/transformer.py +0 -0
  197. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/nn/modules/utils.py +0 -0
  198. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/nn/tasks.py +0 -0
  199. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/solutions/__init__.py +0 -0
  200. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/solutions/ai_gym.py +0 -0
  201. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/solutions/analytics.py +0 -0
  202. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/solutions/distance_calculation.py +0 -0
  203. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/solutions/heatmap.py +0 -0
  204. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/solutions/object_counter.py +0 -0
  205. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/solutions/parking_management.py +0 -0
  206. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/solutions/queue_management.py +0 -0
  207. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/solutions/solutions.py +0 -0
  208. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/solutions/speed_estimation.py +0 -0
  209. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/solutions/streamlit_inference.py +0 -0
  210. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/trackers/__init__.py +0 -0
  211. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/trackers/basetrack.py +0 -0
  212. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/trackers/bot_sort.py +0 -0
  213. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/trackers/byte_tracker.py +0 -0
  214. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/trackers/track.py +0 -0
  215. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/trackers/utils/__init__.py +0 -0
  216. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/trackers/utils/gmc.py +0 -0
  217. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/trackers/utils/kalman_filter.py +0 -0
  218. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/trackers/utils/matching.py +0 -0
  219. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/utils/__init__.py +0 -0
  220. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/utils/autobatch.py +0 -0
  221. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/utils/callbacks/__init__.py +0 -0
  222. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/utils/callbacks/base.py +0 -0
  223. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/utils/callbacks/clearml.py +0 -0
  224. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/utils/callbacks/comet.py +0 -0
  225. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/utils/callbacks/dvc.py +0 -0
  226. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/utils/callbacks/hub.py +0 -0
  227. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/utils/callbacks/mlflow.py +0 -0
  228. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/utils/callbacks/neptune.py +0 -0
  229. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/utils/callbacks/raytune.py +0 -0
  230. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/utils/callbacks/tensorboard.py +0 -0
  231. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/utils/callbacks/wb.py +0 -0
  232. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/utils/dist.py +0 -0
  233. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/utils/errors.py +0 -0
  234. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/utils/instance.py +0 -0
  235. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/utils/loss.py +0 -0
  236. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/utils/metrics.py +0 -0
  237. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/utils/ops.py +0 -0
  238. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/utils/patches.py +0 -0
  239. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/utils/plotting.py +0 -0
  240. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/utils/tal.py +0 -0
  241. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/utils/torch_utils.py +0 -0
  242. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics/utils/triton.py +0 -0
  243. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics.egg-info/dependency_links.txt +0 -0
  244. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics.egg-info/entry_points.txt +0 -0
  245. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics.egg-info/requires.txt +0 -0
  246. {ultralytics-8.3.9 → ultralytics-8.3.11}/ultralytics.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ultralytics
3
- Version: 8.3.9
3
+ Version: 8.3.11
4
4
  Summary: Ultralytics YOLO for SOTA object detection, multi-object tracking, instance segmentation, pose estimation and image classification.
5
5
  Author-email: Glenn Jocher <glenn.jocher@ultralytics.com>, Jing Qiu <jing.qiu@ultralytics.com>
6
6
  Maintainer-email: Ultralytics <hello@ultralytics.com>
@@ -1,6 +1,6 @@
1
1
  # Ultralytics YOLO 🚀, AGPL-3.0 license
2
2
 
3
- __version__ = "8.3.9"
3
+ __version__ = "8.3.11"
4
4
 
5
5
  import os
6
6
 
@@ -21,7 +21,7 @@ def auto_annotate(data, det_model="yolov8x.pt", sam_model="sam_b.pt", device="",
21
21
 
22
22
  Examples:
23
23
  >>> from ultralytics.data.annotator import auto_annotate
24
- >>> auto_annotate(data="ultralytics/assets", det_model="yolov8n.pt", sam_model="mobile_sam.pt")
24
+ >>> auto_annotate(data="ultralytics/assets", det_model="yolo11n.pt", sam_model="mobile_sam.pt")
25
25
 
26
26
  Notes:
27
27
  - The function creates a new directory for output if not specified.
@@ -18,11 +18,29 @@ from PIL import Image
18
18
  from ultralytics.data.utils import FORMATS_HELP_MSG, IMG_FORMATS, VID_FORMATS
19
19
  from ultralytics.utils import IS_COLAB, IS_KAGGLE, LOGGER, ops
20
20
  from ultralytics.utils.checks import check_requirements
21
+ from ultralytics.utils.patches import imread
21
22
 
22
23
 
23
24
  @dataclass
24
25
  class SourceTypes:
25
- """Class to represent various types of input sources for predictions."""
26
+ """
27
+ Class to represent various types of input sources for predictions.
28
+
29
+ This class uses dataclass to define boolean flags for different types of input sources that can be used for
30
+ making predictions with YOLO models.
31
+
32
+ Attributes:
33
+ stream (bool): Flag indicating if the input source is a video stream.
34
+ screenshot (bool): Flag indicating if the input source is a screenshot.
35
+ from_img (bool): Flag indicating if the input source is an image file.
36
+
37
+ Examples:
38
+ >>> source_types = SourceTypes(stream=True, screenshot=False, from_img=False)
39
+ >>> print(source_types.stream)
40
+ True
41
+ >>> print(source_types.from_img)
42
+ False
43
+ """
26
44
 
27
45
  stream: bool = False
28
46
  screenshot: bool = False
@@ -32,38 +50,47 @@ class SourceTypes:
32
50
 
33
51
  class LoadStreams:
34
52
  """
35
- Stream Loader for various types of video streams, Supports RTSP, RTMP, HTTP, and TCP streams.
53
+ Stream Loader for various types of video streams.
54
+
55
+ Supports RTSP, RTMP, HTTP, and TCP streams. This class handles the loading and processing of multiple video
56
+ streams simultaneously, making it suitable for real-time video analysis tasks.
36
57
 
37
58
  Attributes:
38
- sources (str): The source input paths or URLs for the video streams.
39
- vid_stride (int): Video frame-rate stride, defaults to 1.
40
- buffer (bool): Whether to buffer input streams, defaults to False.
59
+ sources (List[str]): The source input paths or URLs for the video streams.
60
+ vid_stride (int): Video frame-rate stride.
61
+ buffer (bool): Whether to buffer input streams.
41
62
  running (bool): Flag to indicate if the streaming thread is running.
42
63
  mode (str): Set to 'stream' indicating real-time capture.
43
- imgs (list): List of image frames for each stream.
44
- fps (list): List of FPS for each stream.
45
- frames (list): List of total frames for each stream.
46
- threads (list): List of threads for each stream.
47
- shape (list): List of shapes for each stream.
48
- caps (list): List of cv2.VideoCapture objects for each stream.
64
+ imgs (List[List[np.ndarray]]): List of image frames for each stream.
65
+ fps (List[float]): List of FPS for each stream.
66
+ frames (List[int]): List of total frames for each stream.
67
+ threads (List[Thread]): List of threads for each stream.
68
+ shape (List[Tuple[int, int, int]]): List of shapes for each stream.
69
+ caps (List[cv2.VideoCapture]): List of cv2.VideoCapture objects for each stream.
49
70
  bs (int): Batch size for processing.
50
71
 
51
72
  Methods:
52
- __init__: Initialize the stream loader.
53
73
  update: Read stream frames in daemon thread.
54
74
  close: Close stream loader and release resources.
55
75
  __iter__: Returns an iterator object for the class.
56
76
  __next__: Returns source paths, transformed, and original images for processing.
57
77
  __len__: Return the length of the sources object.
58
78
 
59
- Example:
60
- ```bash
61
- yolo predict source='rtsp://example.com/media.mp4'
62
- ```
79
+ Examples:
80
+ >>> stream_loader = LoadStreams("rtsp://example.com/stream1.mp4")
81
+ >>> for sources, imgs, _ in stream_loader:
82
+ ... # Process the images
83
+ ... pass
84
+ >>> stream_loader.close()
85
+
86
+ Notes:
87
+ - The class uses threading to efficiently load frames from multiple streams simultaneously.
88
+ - It automatically handles YouTube links, converting them to the best available stream URL.
89
+ - The class implements a buffer system to manage frame storage and retrieval.
63
90
  """
64
91
 
65
92
  def __init__(self, sources="file.streams", vid_stride=1, buffer=False):
66
- """Initialize instance variables and check for consistent input stream shapes."""
93
+ """Initialize stream loader for multiple video sources, supporting various stream types."""
67
94
  torch.backends.cudnn.benchmark = True # faster for fixed-size inference
68
95
  self.buffer = buffer # buffer input streams
69
96
  self.running = True # running flag for Thread
@@ -114,7 +141,7 @@ class LoadStreams:
114
141
  LOGGER.info("") # newline
115
142
 
116
143
  def update(self, i, cap, stream):
117
- """Read stream `i` frames in daemon thread."""
144
+ """Read stream frames in daemon thread and update image buffer."""
118
145
  n, f = 0, self.frames[i] # frame number, frame array
119
146
  while self.running and cap.isOpened() and n < (f - 1):
120
147
  if len(self.imgs[i]) < 30: # keep a <=30-image buffer
@@ -134,7 +161,7 @@ class LoadStreams:
134
161
  time.sleep(0.01) # wait until the buffer is empty
135
162
 
136
163
  def close(self):
137
- """Close stream loader and release resources."""
164
+ """Terminates stream loader, stops threads, and releases video capture resources."""
138
165
  self.running = False # stop flag for Thread
139
166
  for thread in self.threads:
140
167
  if thread.is_alive():
@@ -152,7 +179,7 @@ class LoadStreams:
152
179
  return self
153
180
 
154
181
  def __next__(self):
155
- """Returns source paths, transformed and original images for processing."""
182
+ """Returns the next batch of frames from multiple video streams for processing."""
156
183
  self.count += 1
157
184
 
158
185
  images = []
@@ -179,16 +206,16 @@ class LoadStreams:
179
206
  return self.sources, images, [""] * self.bs
180
207
 
181
208
  def __len__(self):
182
- """Return the length of the sources object."""
209
+ """Return the number of video streams in the LoadStreams object."""
183
210
  return self.bs # 1E12 frames = 32 streams at 30 FPS for 30 years
184
211
 
185
212
 
186
213
  class LoadScreenshots:
187
214
  """
188
- YOLOv8 screenshot dataloader.
215
+ Ultralytics screenshot dataloader for capturing and processing screen images.
189
216
 
190
- This class manages the loading of screenshot images for processing with YOLOv8.
191
- Suitable for use with `yolo predict source=screen`.
217
+ This class manages the loading of screenshot images for processing with YOLO. It is suitable for use with
218
+ `yolo predict source=screen`.
192
219
 
193
220
  Attributes:
194
221
  source (str): The source input indicating which screen to capture.
@@ -201,15 +228,21 @@ class LoadScreenshots:
201
228
  frame (int): Counter for captured frames.
202
229
  sct (mss.mss): Screen capture object from `mss` library.
203
230
  bs (int): Batch size, set to 1.
204
- monitor (dict): Monitor configuration details.
231
+ fps (int): Frames per second, set to 30.
232
+ monitor (Dict[str, int]): Monitor configuration details.
205
233
 
206
234
  Methods:
207
235
  __iter__: Returns an iterator object.
208
236
  __next__: Captures the next screenshot and returns it.
237
+
238
+ Examples:
239
+ >>> loader = LoadScreenshots("0 100 100 640 480") # screen 0, top-left (100,100), 640x480
240
+ >>> for source, im, im0s, vid_cap, s in loader:
241
+ ... print(f"Captured frame: {im.shape}")
209
242
  """
210
243
 
211
244
  def __init__(self, source):
212
- """Source = [screen_number left top width height] (pixels)."""
245
+ """Initialize screenshot capture with specified screen and region parameters."""
213
246
  check_requirements("mss")
214
247
  import mss # noqa
215
248
 
@@ -236,11 +269,11 @@ class LoadScreenshots:
236
269
  self.monitor = {"left": self.left, "top": self.top, "width": self.width, "height": self.height}
237
270
 
238
271
  def __iter__(self):
239
- """Returns an iterator of the object."""
272
+ """Yields the next screenshot image from the specified screen or region for processing."""
240
273
  return self
241
274
 
242
275
  def __next__(self):
243
- """Screen capture with 'mss' to get raw pixels from the screen as np array."""
276
+ """Captures and returns the next screenshot as a numpy array using the mss library."""
244
277
  im0 = np.asarray(self.sct.grab(self.monitor))[:, :, :3] # BGRA to BGR
245
278
  s = f"screen {self.screen} (LTWH): {self.left},{self.top},{self.width},{self.height}: "
246
279
 
@@ -250,29 +283,45 @@ class LoadScreenshots:
250
283
 
251
284
  class LoadImagesAndVideos:
252
285
  """
253
- YOLOv8 image/video dataloader.
286
+ A class for loading and processing images and videos for YOLO object detection.
254
287
 
255
- This class manages the loading and pre-processing of image and video data for YOLOv8. It supports loading from
256
- various formats, including single image files, video files, and lists of image and video paths.
288
+ This class manages the loading and pre-processing of image and video data from various sources, including
289
+ single image files, video files, and lists of image and video paths.
257
290
 
258
291
  Attributes:
259
- files (list): List of image and video file paths.
292
+ files (List[str]): List of image and video file paths.
260
293
  nf (int): Total number of files (images and videos).
261
- video_flag (list): Flags indicating whether a file is a video (True) or an image (False).
294
+ video_flag (List[bool]): Flags indicating whether a file is a video (True) or an image (False).
262
295
  mode (str): Current mode, 'image' or 'video'.
263
- vid_stride (int): Stride for video frame-rate, defaults to 1.
264
- bs (int): Batch size, set to 1 for this class.
296
+ vid_stride (int): Stride for video frame-rate.
297
+ bs (int): Batch size.
265
298
  cap (cv2.VideoCapture): Video capture object for OpenCV.
266
299
  frame (int): Frame counter for video.
267
300
  frames (int): Total number of frames in the video.
268
- count (int): Counter for iteration, initialized at 0 during `__iter__()`.
301
+ count (int): Counter for iteration, initialized at 0 during __iter__().
302
+ ni (int): Number of images.
269
303
 
270
304
  Methods:
271
- _new_video(path): Create a new cv2.VideoCapture object for a given video path.
305
+ __init__: Initialize the LoadImagesAndVideos object.
306
+ __iter__: Returns an iterator object for VideoStream or ImageFolder.
307
+ __next__: Returns the next batch of images or video frames along with their paths and metadata.
308
+ _new_video: Creates a new video capture object for the given path.
309
+ __len__: Returns the number of batches in the object.
310
+
311
+ Examples:
312
+ >>> loader = LoadImagesAndVideos("path/to/data", batch=32, vid_stride=1)
313
+ >>> for paths, imgs, info in loader:
314
+ ... # Process batch of images or video frames
315
+ ... pass
316
+
317
+ Notes:
318
+ - Supports various image formats including HEIC.
319
+ - Handles both local files and directories.
320
+ - Can read from a text file containing paths to images and videos.
272
321
  """
273
322
 
274
323
  def __init__(self, path, batch=1, vid_stride=1):
275
- """Initialize the Dataloader and raise FileNotFoundError if file not found."""
324
+ """Initialize dataloader for images and videos, supporting various input formats."""
276
325
  parent = None
277
326
  if isinstance(path, str) and Path(path).suffix == ".txt": # *.txt file with img/vid/dir on each line
278
327
  parent = Path(path).parent
@@ -316,12 +365,12 @@ class LoadImagesAndVideos:
316
365
  raise FileNotFoundError(f"No images or videos found in {p}. {FORMATS_HELP_MSG}")
317
366
 
318
367
  def __iter__(self):
319
- """Returns an iterator object for VideoStream or ImageFolder."""
368
+ """Iterates through image/video files, yielding source paths, images, and metadata."""
320
369
  self.count = 0
321
370
  return self
322
371
 
323
372
  def __next__(self):
324
- """Returns the next batch of images or video frames along with their paths and metadata."""
373
+ """Returns the next batch of images or video frames with their paths and metadata."""
325
374
  paths, imgs, info = [], [], []
326
375
  while len(imgs) < self.bs:
327
376
  if self.count >= self.nf: # end of file list
@@ -336,6 +385,7 @@ class LoadImagesAndVideos:
336
385
  if not self.cap or not self.cap.isOpened():
337
386
  self._new_video(path)
338
387
 
388
+ success = False
339
389
  for _ in range(self.vid_stride):
340
390
  success = self.cap.grab()
341
391
  if not success:
@@ -359,8 +409,19 @@ class LoadImagesAndVideos:
359
409
  if self.count < self.nf:
360
410
  self._new_video(self.files[self.count])
361
411
  else:
412
+ # Handle image files (including HEIC)
362
413
  self.mode = "image"
363
- im0 = cv2.imread(path) # BGR
414
+ if path.split(".")[-1].lower() == "heic":
415
+ # Load HEIC image using Pillow with pillow-heif
416
+ check_requirements("pillow-heif")
417
+
418
+ from pillow_heif import register_heif_opener
419
+
420
+ register_heif_opener() # Register HEIF opener with Pillow
421
+ with Image.open(path) as img:
422
+ im0 = cv2.cvtColor(np.asarray(img), cv2.COLOR_RGB2BGR) # convert image to BGR nparray
423
+ else:
424
+ im0 = imread(path) # BGR
364
425
  if im0 is None:
365
426
  LOGGER.warning(f"WARNING ⚠️ Image Read Error {path}")
366
427
  else:
@@ -374,7 +435,7 @@ class LoadImagesAndVideos:
374
435
  return paths, imgs, info
375
436
 
376
437
  def _new_video(self, path):
377
- """Creates a new video capture object for the given path."""
438
+ """Creates a new video capture object for the given path and initializes video-related attributes."""
378
439
  self.frame = 0
379
440
  self.cap = cv2.VideoCapture(path)
380
441
  self.fps = int(self.cap.get(cv2.CAP_PROP_FPS))
@@ -383,40 +444,50 @@ class LoadImagesAndVideos:
383
444
  self.frames = int(self.cap.get(cv2.CAP_PROP_FRAME_COUNT) / self.vid_stride)
384
445
 
385
446
  def __len__(self):
386
- """Returns the number of batches in the object."""
387
- return math.ceil(self.nf / self.bs) # number of files
447
+ """Returns the number of files (images and videos) in the dataset."""
448
+ return math.ceil(self.nf / self.bs) # number of batches
388
449
 
389
450
 
390
451
  class LoadPilAndNumpy:
391
452
  """
392
453
  Load images from PIL and Numpy arrays for batch processing.
393
454
 
394
- This class is designed to manage loading and pre-processing of image data from both PIL and Numpy formats.
395
- It performs basic validation and format conversion to ensure that the images are in the required format for
396
- downstream processing.
455
+ This class manages loading and pre-processing of image data from both PIL and Numpy formats. It performs basic
456
+ validation and format conversion to ensure that the images are in the required format for downstream processing.
397
457
 
398
458
  Attributes:
399
- paths (list): List of image paths or autogenerated filenames.
400
- im0 (list): List of images stored as Numpy arrays.
401
- mode (str): Type of data being processed, defaults to 'image'.
459
+ paths (List[str]): List of image paths or autogenerated filenames.
460
+ im0 (List[np.ndarray]): List of images stored as Numpy arrays.
461
+ mode (str): Type of data being processed, set to 'image'.
402
462
  bs (int): Batch size, equivalent to the length of `im0`.
403
463
 
404
464
  Methods:
405
- _single_check(im): Validate and format a single image to a Numpy array.
465
+ _single_check: Validate and format a single image to a Numpy array.
466
+
467
+ Examples:
468
+ >>> from PIL import Image
469
+ >>> import numpy as np
470
+ >>> pil_img = Image.new("RGB", (100, 100))
471
+ >>> np_img = np.random.randint(0, 255, (100, 100, 3), dtype=np.uint8)
472
+ >>> loader = LoadPilAndNumpy([pil_img, np_img])
473
+ >>> paths, images, _ = next(iter(loader))
474
+ >>> print(f"Loaded {len(images)} images")
475
+ Loaded 2 images
406
476
  """
407
477
 
408
478
  def __init__(self, im0):
409
- """Initialize PIL and Numpy Dataloader."""
479
+ """Initializes a loader for PIL and Numpy images, converting inputs to a standardized format."""
410
480
  if not isinstance(im0, list):
411
481
  im0 = [im0]
412
- self.paths = [getattr(im, "filename", f"image{i}.jpg") for i, im in enumerate(im0)]
482
+ # use `image{i}.jpg` when Image.filename returns an empty path.
483
+ self.paths = [getattr(im, "filename", "") or f"image{i}.jpg" for i, im in enumerate(im0)]
413
484
  self.im0 = [self._single_check(im) for im in im0]
414
485
  self.mode = "image"
415
486
  self.bs = len(self.im0)
416
487
 
417
488
  @staticmethod
418
489
  def _single_check(im):
419
- """Validate and format an image to numpy array."""
490
+ """Validate and format an image to numpy array, ensuring RGB order and contiguous memory."""
420
491
  assert isinstance(im, (Image.Image, np.ndarray)), f"Expected PIL/np.ndarray image type, but got {type(im)}"
421
492
  if isinstance(im, Image.Image):
422
493
  if im.mode != "RGB":
@@ -426,41 +497,48 @@ class LoadPilAndNumpy:
426
497
  return im
427
498
 
428
499
  def __len__(self):
429
- """Returns the length of the 'im0' attribute."""
500
+ """Returns the length of the 'im0' attribute, representing the number of loaded images."""
430
501
  return len(self.im0)
431
502
 
432
503
  def __next__(self):
433
- """Returns batch paths, images, processed images, None, ''."""
504
+ """Returns the next batch of images, paths, and metadata for processing."""
434
505
  if self.count == 1: # loop only once as it's batch inference
435
506
  raise StopIteration
436
507
  self.count += 1
437
508
  return self.paths, self.im0, [""] * self.bs
438
509
 
439
510
  def __iter__(self):
440
- """Enables iteration for class LoadPilAndNumpy."""
511
+ """Iterates through PIL/numpy images, yielding paths, raw images, and metadata for processing."""
441
512
  self.count = 0
442
513
  return self
443
514
 
444
515
 
445
516
  class LoadTensor:
446
517
  """
447
- Load images from torch.Tensor data.
518
+ A class for loading and processing tensor data for object detection tasks.
448
519
 
449
- This class manages the loading and pre-processing of image data from PyTorch tensors for further processing.
520
+ This class handles the loading and pre-processing of image data from PyTorch tensors, preparing them for
521
+ further processing in object detection pipelines.
450
522
 
451
523
  Attributes:
452
- im0 (torch.Tensor): The input tensor containing the image(s).
524
+ im0 (torch.Tensor): The input tensor containing the image(s) with shape (B, C, H, W).
453
525
  bs (int): Batch size, inferred from the shape of `im0`.
454
- mode (str): Current mode, set to 'image'.
455
- paths (list): List of image paths or filenames.
456
- count (int): Counter for iteration, initialized at 0 during `__iter__()`.
526
+ mode (str): Current processing mode, set to 'image'.
527
+ paths (List[str]): List of image paths or auto-generated filenames.
457
528
 
458
529
  Methods:
459
- _single_check(im, stride): Validate and possibly modify the input tensor.
530
+ _single_check: Validates and formats an input tensor.
531
+
532
+ Examples:
533
+ >>> import torch
534
+ >>> tensor = torch.rand(1, 3, 640, 640)
535
+ >>> loader = LoadTensor(tensor)
536
+ >>> paths, images, info = next(iter(loader))
537
+ >>> print(f"Processed {len(images)} images")
460
538
  """
461
539
 
462
540
  def __init__(self, im0) -> None:
463
- """Initialize Tensor Dataloader."""
541
+ """Initialize LoadTensor object for processing torch.Tensor image data."""
464
542
  self.im0 = self._single_check(im0)
465
543
  self.bs = self.im0.shape[0]
466
544
  self.mode = "image"
@@ -468,7 +546,7 @@ class LoadTensor:
468
546
 
469
547
  @staticmethod
470
548
  def _single_check(im, stride=32):
471
- """Validate and format an image to torch.Tensor."""
549
+ """Validates and formats a single image tensor, ensuring correct shape and normalization."""
472
550
  s = (
473
551
  f"WARNING ⚠️ torch.Tensor inputs should be BCHW i.e. shape(1, 3, 640, 640) "
474
552
  f"divisible by stride {stride}. Input shape{tuple(im.shape)} is incompatible."
@@ -490,24 +568,24 @@ class LoadTensor:
490
568
  return im
491
569
 
492
570
  def __iter__(self):
493
- """Returns an iterator object."""
571
+ """Yields an iterator object for iterating through tensor image data."""
494
572
  self.count = 0
495
573
  return self
496
574
 
497
575
  def __next__(self):
498
- """Return next item in the iterator."""
576
+ """Yields the next batch of tensor images and metadata for processing."""
499
577
  if self.count == 1:
500
578
  raise StopIteration
501
579
  self.count += 1
502
580
  return self.paths, self.im0, [""] * self.bs
503
581
 
504
582
  def __len__(self):
505
- """Returns the batch size."""
583
+ """Returns the batch size of the tensor input."""
506
584
  return self.bs
507
585
 
508
586
 
509
587
  def autocast_list(source):
510
- """Merges a list of source of different types into a list of numpy arrays or PIL images."""
588
+ """Merges a list of sources into a list of numpy arrays or PIL images for Ultralytics prediction."""
511
589
  files = []
512
590
  for im in source:
513
591
  if isinstance(im, (str, Path)): # filename or uri
@@ -527,21 +605,24 @@ def get_best_youtube_url(url, method="pytube"):
527
605
  """
528
606
  Retrieves the URL of the best quality MP4 video stream from a given YouTube video.
529
607
 
530
- This function uses the specified method to extract the video info from YouTube. It supports the following methods:
531
- - "pytube": Uses the pytube library to fetch the video streams.
532
- - "pafy": Uses the pafy library to fetch the video streams.
533
- - "yt-dlp": Uses the yt-dlp library to fetch the video streams.
534
-
535
- The function then finds the highest quality MP4 format that has a video codec but no audio codec, and returns the
536
- URL of this video stream.
537
-
538
608
  Args:
539
609
  url (str): The URL of the YouTube video.
540
- method (str): The method to use for extracting video info. Default is "pytube". Other options are "pafy" and
541
- "yt-dlp".
610
+ method (str): The method to use for extracting video info. Options are "pytube", "pafy", and "yt-dlp".
611
+ Defaults to "pytube".
542
612
 
543
613
  Returns:
544
- (str): The URL of the best quality MP4 video stream, or None if no suitable stream is found.
614
+ (str | None): The URL of the best quality MP4 video stream, or None if no suitable stream is found.
615
+
616
+ Examples:
617
+ >>> url = "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
618
+ >>> best_url = get_best_youtube_url(url)
619
+ >>> print(best_url)
620
+ https://rr4---sn-q4flrnek.googlevideo.com/videoplayback?expire=...
621
+
622
+ Notes:
623
+ - Requires additional libraries based on the chosen method: pytubefix, pafy, or yt-dlp.
624
+ - The function prioritizes streams with at least 1080p resolution when available.
625
+ - For the "yt-dlp" method, it looks for formats with video codec, no audio, and *.mp4 extension.
545
626
  """
546
627
  if method == "pytube":
547
628
  # Switched from pytube to pytubefix to resolve https://github.com/pytube/pytube/issues/1954
@@ -35,7 +35,7 @@ from ultralytics.utils.downloads import download, safe_download, unzip_file
35
35
  from ultralytics.utils.ops import segments2boxes
36
36
 
37
37
  HELP_URL = "See https://docs.ultralytics.com/datasets for dataset formatting guidance."
38
- IMG_FORMATS = {"bmp", "dng", "jpeg", "jpg", "mpo", "png", "tif", "tiff", "webp", "pfm"} # image suffixes
38
+ IMG_FORMATS = {"bmp", "dng", "jpeg", "jpg", "mpo", "png", "tif", "tiff", "webp", "pfm", "heic"} # image suffixes
39
39
  VID_FORMATS = {"asf", "avi", "gif", "m4v", "mkv", "mov", "mp4", "mpeg", "mpg", "ts", "wmv", "webm"} # video suffixes
40
40
  PIN_MEMORY = str(os.getenv("PIN_MEMORY", True)).lower() == "true" # global pin_memory for dataloaders
41
41
  FORMATS_HELP_MSG = f"Supported formats are:\nimages: {IMG_FORMATS}\nvideos: {VID_FORMATS}"