ultralytics 8.2.62__tar.gz → 8.2.64__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 (236) hide show
  1. {ultralytics-8.2.62/ultralytics.egg-info → ultralytics-8.2.64}/PKG-INFO +1 -1
  2. {ultralytics-8.2.62 → ultralytics-8.2.64}/tests/test_python.py +1 -1
  3. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/__init__.py +1 -1
  4. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/data/augment.py +6 -5
  5. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/engine/exporter.py +2 -0
  6. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/engine/trainer.py +8 -2
  7. ultralytics-8.2.64/ultralytics/models/fastsam/predict.py +31 -0
  8. ultralytics-8.2.64/ultralytics/models/fastsam/utils.py +25 -0
  9. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/nas/model.py +14 -4
  10. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/utils/ops.py +1 -1
  11. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/yolo/classify/predict.py +1 -3
  12. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/yolo/detect/predict.py +1 -3
  13. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/yolo/pose/predict.py +1 -3
  14. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/yolo/segment/predict.py +1 -3
  15. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/nn/autobackend.py +10 -3
  16. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/solutions/streamlit_inference.py +1 -1
  17. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/utils/__init__.py +2 -1
  18. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/utils/autobatch.py +2 -2
  19. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/utils/benchmarks.py +4 -2
  20. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/utils/checks.py +3 -1
  21. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/utils/downloads.py +1 -1
  22. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/utils/loss.py +2 -1
  23. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/utils/patches.py +28 -2
  24. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/utils/torch_utils.py +31 -0
  25. {ultralytics-8.2.62 → ultralytics-8.2.64/ultralytics.egg-info}/PKG-INFO +1 -1
  26. ultralytics-8.2.62/ultralytics/models/fastsam/predict.py +0 -84
  27. ultralytics-8.2.62/ultralytics/models/fastsam/utils.py +0 -67
  28. {ultralytics-8.2.62 → ultralytics-8.2.64}/LICENSE +0 -0
  29. {ultralytics-8.2.62 → ultralytics-8.2.64}/README.md +0 -0
  30. {ultralytics-8.2.62 → ultralytics-8.2.64}/pyproject.toml +0 -0
  31. {ultralytics-8.2.62 → ultralytics-8.2.64}/setup.cfg +0 -0
  32. {ultralytics-8.2.62 → ultralytics-8.2.64}/tests/__init__.py +0 -0
  33. {ultralytics-8.2.62 → ultralytics-8.2.64}/tests/conftest.py +0 -0
  34. {ultralytics-8.2.62 → ultralytics-8.2.64}/tests/test_cli.py +0 -0
  35. {ultralytics-8.2.62 → ultralytics-8.2.64}/tests/test_cuda.py +0 -0
  36. {ultralytics-8.2.62 → ultralytics-8.2.64}/tests/test_engine.py +0 -0
  37. {ultralytics-8.2.62 → ultralytics-8.2.64}/tests/test_explorer.py +0 -0
  38. {ultralytics-8.2.62 → ultralytics-8.2.64}/tests/test_exports.py +0 -0
  39. {ultralytics-8.2.62 → ultralytics-8.2.64}/tests/test_integrations.py +0 -0
  40. {ultralytics-8.2.62 → ultralytics-8.2.64}/tests/test_solutions.py +0 -0
  41. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/assets/bus.jpg +0 -0
  42. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/assets/zidane.jpg +0 -0
  43. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/__init__.py +0 -0
  44. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/datasets/Argoverse.yaml +0 -0
  45. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/datasets/DOTAv1.5.yaml +0 -0
  46. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/datasets/DOTAv1.yaml +0 -0
  47. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/datasets/GlobalWheat2020.yaml +0 -0
  48. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/datasets/ImageNet.yaml +0 -0
  49. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/datasets/Objects365.yaml +0 -0
  50. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/datasets/SKU-110K.yaml +0 -0
  51. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/datasets/VOC.yaml +0 -0
  52. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/datasets/VisDrone.yaml +0 -0
  53. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/datasets/african-wildlife.yaml +0 -0
  54. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/datasets/brain-tumor.yaml +0 -0
  55. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/datasets/carparts-seg.yaml +0 -0
  56. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/datasets/coco-pose.yaml +0 -0
  57. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/datasets/coco.yaml +0 -0
  58. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/datasets/coco128-seg.yaml +0 -0
  59. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/datasets/coco128.yaml +0 -0
  60. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/datasets/coco8-pose.yaml +0 -0
  61. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/datasets/coco8-seg.yaml +0 -0
  62. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/datasets/coco8.yaml +0 -0
  63. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/datasets/crack-seg.yaml +0 -0
  64. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/datasets/dota8.yaml +0 -0
  65. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/datasets/lvis.yaml +0 -0
  66. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/datasets/open-images-v7.yaml +0 -0
  67. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/datasets/package-seg.yaml +0 -0
  68. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/datasets/signature.yaml +0 -0
  69. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/datasets/tiger-pose.yaml +0 -0
  70. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/datasets/xView.yaml +0 -0
  71. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/default.yaml +0 -0
  72. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/models/rt-detr/rtdetr-l.yaml +0 -0
  73. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/models/rt-detr/rtdetr-resnet101.yaml +0 -0
  74. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/models/rt-detr/rtdetr-resnet50.yaml +0 -0
  75. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/models/rt-detr/rtdetr-x.yaml +0 -0
  76. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/models/v10/yolov10b.yaml +0 -0
  77. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/models/v10/yolov10l.yaml +0 -0
  78. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/models/v10/yolov10m.yaml +0 -0
  79. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/models/v10/yolov10n.yaml +0 -0
  80. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/models/v10/yolov10s.yaml +0 -0
  81. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/models/v10/yolov10x.yaml +0 -0
  82. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/models/v3/yolov3-spp.yaml +0 -0
  83. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/models/v3/yolov3-tiny.yaml +0 -0
  84. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/models/v3/yolov3.yaml +0 -0
  85. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/models/v5/yolov5-p6.yaml +0 -0
  86. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/models/v5/yolov5.yaml +0 -0
  87. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/models/v6/yolov6.yaml +0 -0
  88. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/models/v8/yolov8-cls-resnet101.yaml +0 -0
  89. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/models/v8/yolov8-cls-resnet50.yaml +0 -0
  90. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/models/v8/yolov8-cls.yaml +0 -0
  91. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/models/v8/yolov8-ghost-p2.yaml +0 -0
  92. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/models/v8/yolov8-ghost-p6.yaml +0 -0
  93. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/models/v8/yolov8-ghost.yaml +0 -0
  94. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/models/v8/yolov8-obb.yaml +0 -0
  95. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/models/v8/yolov8-p2.yaml +0 -0
  96. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/models/v8/yolov8-p6.yaml +0 -0
  97. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/models/v8/yolov8-pose-p6.yaml +0 -0
  98. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/models/v8/yolov8-pose.yaml +0 -0
  99. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/models/v8/yolov8-rtdetr.yaml +0 -0
  100. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/models/v8/yolov8-seg-p6.yaml +0 -0
  101. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/models/v8/yolov8-seg.yaml +0 -0
  102. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/models/v8/yolov8-world.yaml +0 -0
  103. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/models/v8/yolov8-worldv2.yaml +0 -0
  104. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/models/v8/yolov8.yaml +0 -0
  105. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/models/v9/yolov9c-seg.yaml +0 -0
  106. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/models/v9/yolov9c.yaml +0 -0
  107. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/models/v9/yolov9e-seg.yaml +0 -0
  108. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/models/v9/yolov9e.yaml +0 -0
  109. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/models/v9/yolov9m.yaml +0 -0
  110. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/models/v9/yolov9s.yaml +0 -0
  111. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/models/v9/yolov9t.yaml +0 -0
  112. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/trackers/botsort.yaml +0 -0
  113. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/cfg/trackers/bytetrack.yaml +0 -0
  114. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/data/__init__.py +0 -0
  115. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/data/annotator.py +0 -0
  116. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/data/base.py +0 -0
  117. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/data/build.py +0 -0
  118. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/data/converter.py +0 -0
  119. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/data/dataset.py +0 -0
  120. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/data/explorer/__init__.py +0 -0
  121. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/data/explorer/explorer.py +0 -0
  122. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/data/explorer/gui/__init__.py +0 -0
  123. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/data/explorer/gui/dash.py +0 -0
  124. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/data/explorer/utils.py +0 -0
  125. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/data/loaders.py +0 -0
  126. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/data/split_dota.py +0 -0
  127. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/data/utils.py +0 -0
  128. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/engine/__init__.py +0 -0
  129. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/engine/model.py +0 -0
  130. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/engine/predictor.py +0 -0
  131. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/engine/results.py +0 -0
  132. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/engine/tuner.py +0 -0
  133. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/engine/validator.py +0 -0
  134. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/hub/__init__.py +0 -0
  135. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/hub/auth.py +0 -0
  136. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/hub/session.py +0 -0
  137. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/hub/utils.py +0 -0
  138. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/__init__.py +0 -0
  139. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/fastsam/__init__.py +0 -0
  140. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/fastsam/model.py +0 -0
  141. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/fastsam/prompt.py +0 -0
  142. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/fastsam/val.py +0 -0
  143. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/nas/__init__.py +0 -0
  144. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/nas/predict.py +0 -0
  145. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/nas/val.py +0 -0
  146. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/rtdetr/__init__.py +0 -0
  147. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/rtdetr/model.py +0 -0
  148. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/rtdetr/predict.py +0 -0
  149. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/rtdetr/train.py +0 -0
  150. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/rtdetr/val.py +0 -0
  151. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/sam/__init__.py +0 -0
  152. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/sam/amg.py +0 -0
  153. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/sam/build.py +0 -0
  154. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/sam/model.py +0 -0
  155. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/sam/modules/__init__.py +0 -0
  156. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/sam/modules/decoders.py +0 -0
  157. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/sam/modules/encoders.py +0 -0
  158. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/sam/modules/sam.py +0 -0
  159. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/sam/modules/tiny_encoder.py +0 -0
  160. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/sam/modules/transformer.py +0 -0
  161. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/sam/predict.py +0 -0
  162. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/utils/__init__.py +0 -0
  163. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/utils/loss.py +0 -0
  164. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/yolo/__init__.py +0 -0
  165. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/yolo/classify/__init__.py +0 -0
  166. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/yolo/classify/train.py +0 -0
  167. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/yolo/classify/val.py +0 -0
  168. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/yolo/detect/__init__.py +0 -0
  169. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/yolo/detect/train.py +0 -0
  170. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/yolo/detect/val.py +0 -0
  171. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/yolo/model.py +0 -0
  172. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/yolo/obb/__init__.py +0 -0
  173. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/yolo/obb/predict.py +0 -0
  174. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/yolo/obb/train.py +0 -0
  175. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/yolo/obb/val.py +0 -0
  176. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/yolo/pose/__init__.py +0 -0
  177. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/yolo/pose/train.py +0 -0
  178. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/yolo/pose/val.py +0 -0
  179. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/yolo/segment/__init__.py +0 -0
  180. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/yolo/segment/train.py +0 -0
  181. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/yolo/segment/val.py +0 -0
  182. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/yolo/world/__init__.py +0 -0
  183. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/yolo/world/train.py +0 -0
  184. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/models/yolo/world/train_world.py +0 -0
  185. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/nn/__init__.py +0 -0
  186. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/nn/modules/__init__.py +0 -0
  187. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/nn/modules/block.py +0 -0
  188. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/nn/modules/conv.py +0 -0
  189. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/nn/modules/head.py +0 -0
  190. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/nn/modules/transformer.py +0 -0
  191. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/nn/modules/utils.py +0 -0
  192. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/nn/tasks.py +0 -0
  193. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/solutions/__init__.py +0 -0
  194. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/solutions/ai_gym.py +0 -0
  195. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/solutions/analytics.py +0 -0
  196. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/solutions/distance_calculation.py +0 -0
  197. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/solutions/heatmap.py +0 -0
  198. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/solutions/object_counter.py +0 -0
  199. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/solutions/parking_management.py +0 -0
  200. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/solutions/queue_management.py +0 -0
  201. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/solutions/speed_estimation.py +0 -0
  202. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/trackers/__init__.py +0 -0
  203. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/trackers/basetrack.py +0 -0
  204. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/trackers/bot_sort.py +0 -0
  205. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/trackers/byte_tracker.py +0 -0
  206. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/trackers/track.py +0 -0
  207. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/trackers/utils/__init__.py +0 -0
  208. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/trackers/utils/gmc.py +0 -0
  209. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/trackers/utils/kalman_filter.py +0 -0
  210. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/trackers/utils/matching.py +0 -0
  211. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/utils/callbacks/__init__.py +0 -0
  212. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/utils/callbacks/base.py +0 -0
  213. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/utils/callbacks/clearml.py +0 -0
  214. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/utils/callbacks/comet.py +0 -0
  215. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/utils/callbacks/dvc.py +0 -0
  216. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/utils/callbacks/hub.py +0 -0
  217. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/utils/callbacks/mlflow.py +0 -0
  218. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/utils/callbacks/neptune.py +0 -0
  219. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/utils/callbacks/raytune.py +0 -0
  220. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/utils/callbacks/tensorboard.py +0 -0
  221. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/utils/callbacks/wb.py +0 -0
  222. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/utils/dist.py +0 -0
  223. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/utils/errors.py +0 -0
  224. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/utils/files.py +0 -0
  225. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/utils/instance.py +0 -0
  226. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/utils/metrics.py +0 -0
  227. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/utils/ops.py +0 -0
  228. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/utils/plotting.py +0 -0
  229. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/utils/tal.py +0 -0
  230. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/utils/triton.py +0 -0
  231. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics/utils/tuner.py +0 -0
  232. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics.egg-info/SOURCES.txt +0 -0
  233. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics.egg-info/dependency_links.txt +0 -0
  234. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics.egg-info/entry_points.txt +0 -0
  235. {ultralytics-8.2.62 → ultralytics-8.2.64}/ultralytics.egg-info/requires.txt +0 -0
  236. {ultralytics-8.2.62 → ultralytics-8.2.64}/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.2.62
3
+ Version: 8.2.64
4
4
  Summary: Ultralytics YOLOv8 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
@@ -95,7 +95,7 @@ def test_predict_img(model_name):
95
95
  Image.open(SOURCE), # PIL
96
96
  np.zeros((320, 640, 3), dtype=np.uint8), # numpy
97
97
  ]
98
- assert len(model(batch, imgsz=32, augment=True)) == len(batch) # multiple sources in a batch
98
+ assert len(model(batch, imgsz=32)) == len(batch) # multiple sources in a batch
99
99
 
100
100
 
101
101
  @pytest.mark.parametrize("model", MODELS)
@@ -1,6 +1,6 @@
1
1
  # Ultralytics YOLO 🚀, AGPL-3.0 license
2
2
 
3
- __version__ = "8.2.62"
3
+ __version__ = "8.2.64"
4
4
 
5
5
  import os
6
6
 
@@ -2322,7 +2322,7 @@ def classify_transforms(
2322
2322
  size=224,
2323
2323
  mean=DEFAULT_MEAN,
2324
2324
  std=DEFAULT_STD,
2325
- interpolation=Image.BILINEAR,
2325
+ interpolation="BILINEAR",
2326
2326
  crop_fraction: float = DEFAULT_CROP_FRACTION,
2327
2327
  ):
2328
2328
  """
@@ -2337,7 +2337,7 @@ def classify_transforms(
2337
2337
  tuple, it defines (height, width).
2338
2338
  mean (tuple): Mean values for each RGB channel used in normalization.
2339
2339
  std (tuple): Standard deviation values for each RGB channel used in normalization.
2340
- interpolation (int): Interpolation method for resizing.
2340
+ interpolation (str): Interpolation method of either 'NEAREST', 'BILINEAR' or 'BICUBIC'.
2341
2341
  crop_fraction (float): Fraction of the image to be cropped.
2342
2342
 
2343
2343
  Returns:
@@ -2360,7 +2360,7 @@ def classify_transforms(
2360
2360
  # Aspect ratio is preserved, crops center within image, no borders are added, image is lost
2361
2361
  if scale_size[0] == scale_size[1]:
2362
2362
  # Simple case, use torchvision built-in Resize with the shortest edge mode (scalar size arg)
2363
- tfl = [T.Resize(scale_size[0], interpolation=interpolation)]
2363
+ tfl = [T.Resize(scale_size[0], interpolation=getattr(T.InterpolationMode, interpolation))]
2364
2364
  else:
2365
2365
  # Resize the shortest edge to matching target dim for non-square target
2366
2366
  tfl = [T.Resize(scale_size)]
@@ -2389,7 +2389,7 @@ def classify_augmentations(
2389
2389
  hsv_v=0.4, # image HSV-Value augmentation (fraction)
2390
2390
  force_color_jitter=False,
2391
2391
  erasing=0.0,
2392
- interpolation=Image.BILINEAR,
2392
+ interpolation="BILINEAR",
2393
2393
  ):
2394
2394
  """
2395
2395
  Creates a composition of image augmentation transforms for classification tasks.
@@ -2411,7 +2411,7 @@ def classify_augmentations(
2411
2411
  hsv_v (float): Image HSV-Value augmentation factor.
2412
2412
  force_color_jitter (bool): Whether to apply color jitter even if auto augment is enabled.
2413
2413
  erasing (float): Probability of random erasing.
2414
- interpolation (int): Interpolation method.
2414
+ interpolation (str): Interpolation method of either 'NEAREST', 'BILINEAR' or 'BICUBIC'.
2415
2415
 
2416
2416
  Returns:
2417
2417
  (torchvision.transforms.Compose): A composition of image augmentation transforms.
@@ -2427,6 +2427,7 @@ def classify_augmentations(
2427
2427
  raise TypeError(f"classify_transforms() size {size} must be integer, not (list, tuple)")
2428
2428
  scale = tuple(scale or (0.08, 1.0)) # default imagenet scale range
2429
2429
  ratio = tuple(ratio or (3.0 / 4.0, 4.0 / 3.0)) # default imagenet ratio range
2430
+ interpolation = getattr(T.InterpolationMode, interpolation)
2430
2431
  primary_tfl = [T.RandomResizedCrop(size, scale=scale, ratio=ratio, interpolation=interpolation)]
2431
2432
  if hflip > 0.0:
2432
2433
  primary_tfl.append(T.RandomHorizontalFlip(p=hflip))
@@ -885,6 +885,8 @@ class Exporter:
885
885
  output_integer_quantized_tflite=self.args.int8,
886
886
  quant_type="per-tensor", # "per-tensor" (faster) or "per-channel" (slower but more accurate)
887
887
  custom_input_op_name_np_data_path=np_data,
888
+ disable_group_convolution=True, # for end-to-end model compatibility
889
+ enable_batchmatmul_unfold=True, # for end-to-end model compatibility
888
890
  )
889
891
  yaml_save(f / "metadata.yaml", self.metadata) # add metadata.yaml
890
892
 
@@ -41,8 +41,10 @@ from ultralytics.utils.checks import check_amp, check_file, check_imgsz, check_m
41
41
  from ultralytics.utils.dist import ddp_cleanup, generate_ddp_command
42
42
  from ultralytics.utils.files import get_latest_run
43
43
  from ultralytics.utils.torch_utils import (
44
+ TORCH_1_13,
44
45
  EarlyStopping,
45
46
  ModelEMA,
47
+ autocast,
46
48
  convert_optimizer_state_dict_to_fp16,
47
49
  init_seeds,
48
50
  one_cycle,
@@ -264,7 +266,11 @@ class BaseTrainer:
264
266
  if RANK > -1 and world_size > 1: # DDP
265
267
  dist.broadcast(self.amp, src=0) # broadcast the tensor from rank 0 to all other ranks (returns None)
266
268
  self.amp = bool(self.amp) # as boolean
267
- self.scaler = torch.cuda.amp.GradScaler(enabled=self.amp)
269
+ self.scaler = (
270
+ torch.amp.GradScaler("cuda", enabled=self.amp)
271
+ if TORCH_1_13
272
+ else torch.cuda.amp.GradScaler(enabled=self.amp)
273
+ )
268
274
  if world_size > 1:
269
275
  self.model = nn.parallel.DistributedDataParallel(self.model, device_ids=[RANK], find_unused_parameters=True)
270
276
 
@@ -376,7 +382,7 @@ class BaseTrainer:
376
382
  x["momentum"] = np.interp(ni, xi, [self.args.warmup_momentum, self.args.momentum])
377
383
 
378
384
  # Forward
379
- with torch.cuda.amp.autocast(self.amp):
385
+ with autocast(self.amp):
380
386
  batch = self.preprocess_batch(batch)
381
387
  self.loss, self.loss_items = self.model(batch)
382
388
  if RANK != -1:
@@ -0,0 +1,31 @@
1
+ # Ultralytics YOLO 🚀, AGPL-3.0 license
2
+ import torch
3
+
4
+ from ultralytics.models.yolo.segment import SegmentationPredictor
5
+ from ultralytics.utils.metrics import box_iou
6
+
7
+ from .utils import adjust_bboxes_to_image_border
8
+
9
+
10
+ class FastSAMPredictor(SegmentationPredictor):
11
+ """
12
+ FastSAMPredictor is specialized for fast SAM (Segment Anything Model) segmentation prediction tasks in Ultralytics
13
+ YOLO framework.
14
+
15
+ This class extends the SegmentationPredictor, customizing the prediction pipeline specifically for fast SAM. It
16
+ adjusts post-processing steps to incorporate mask prediction and non-max suppression while optimizing for single-
17
+ class segmentation.
18
+ """
19
+
20
+ def postprocess(self, preds, img, orig_imgs):
21
+ """Applies box postprocess for FastSAM predictions."""
22
+ results = super().postprocess(preds, img, orig_imgs)
23
+ for result in results:
24
+ full_box = torch.tensor(
25
+ [0, 0, result.orig_shape[1], result.orig_shape[0]], device=preds[0].device, dtype=torch.float32
26
+ )
27
+ boxes = adjust_bboxes_to_image_border(result.boxes.xyxy, result.orig_shape)
28
+ idx = torch.nonzero(box_iou(full_box[None], boxes) > 0.9).flatten()
29
+ if idx.numel() != 0:
30
+ result.boxes.xyxy[idx] = full_box
31
+ return results
@@ -0,0 +1,25 @@
1
+ # Ultralytics YOLO 🚀, AGPL-3.0 license
2
+
3
+
4
+ def adjust_bboxes_to_image_border(boxes, image_shape, threshold=20):
5
+ """
6
+ Adjust bounding boxes to stick to image border if they are within a certain threshold.
7
+
8
+ Args:
9
+ boxes (torch.Tensor): (n, 4)
10
+ image_shape (tuple): (height, width)
11
+ threshold (int): pixel threshold
12
+
13
+ Returns:
14
+ adjusted_boxes (torch.Tensor): adjusted bounding boxes
15
+ """
16
+
17
+ # Image dimensions
18
+ h, w = image_shape
19
+
20
+ # Adjust boxes
21
+ boxes[boxes[:, 0] < threshold, 0] = 0 # x1
22
+ boxes[boxes[:, 1] < threshold, 1] = 0 # y1
23
+ boxes[boxes[:, 2] > w - threshold, 2] = w # x2
24
+ boxes[boxes[:, 3] > h - threshold, 3] = h # y2
25
+ return boxes
@@ -16,7 +16,8 @@ from pathlib import Path
16
16
  import torch
17
17
 
18
18
  from ultralytics.engine.model import Model
19
- from ultralytics.utils.torch_utils import model_info, smart_inference_mode
19
+ from ultralytics.utils.downloads import attempt_download_asset
20
+ from ultralytics.utils.torch_utils import model_info
20
21
 
21
22
  from .predict import NASPredictor
22
23
  from .val import NASValidator
@@ -49,16 +50,25 @@ class NAS(Model):
49
50
  assert Path(model).suffix not in {".yaml", ".yml"}, "YOLO-NAS models only support pre-trained models."
50
51
  super().__init__(model, task="detect")
51
52
 
52
- @smart_inference_mode()
53
- def _load(self, weights: str, task: str):
53
+ def _load(self, weights: str, task=None) -> None:
54
54
  """Loads an existing NAS model weights or creates a new NAS model with pretrained weights if not provided."""
55
55
  import super_gradients
56
56
 
57
57
  suffix = Path(weights).suffix
58
58
  if suffix == ".pt":
59
- self.model = torch.load(weights)
59
+ self.model = torch.load(attempt_download_asset(weights))
60
+
60
61
  elif suffix == "":
61
62
  self.model = super_gradients.training.models.get(weights, pretrained_weights="coco")
63
+
64
+ # Override the forward method to ignore additional arguments
65
+ def new_forward(x, *args, **kwargs):
66
+ """Ignore additional __call__ arguments."""
67
+ return self.model._original_forward(x)
68
+
69
+ self.model._original_forward = self.model.forward
70
+ self.model.forward = new_forward
71
+
62
72
  # Standardize model
63
73
  self.model.fuse = lambda verbose=True: self.model
64
74
  self.model.stride = torch.tensor([32])
@@ -133,7 +133,7 @@ class HungarianMatcher(nn.Module):
133
133
  # sample_points = torch.cat([a.repeat(b, 1, 1, 1) for a, b in zip(sample_points, num_gts) if b > 0])
134
134
  # tgt_mask = F.grid_sample(tgt_mask, sample_points, align_corners=False).squeeze([1, 2])
135
135
  #
136
- # with torch.cuda.amp.autocast(False):
136
+ # with torch.amp.autocast("cuda", enabled=False):
137
137
  # # binary cross entropy cost
138
138
  # pos_cost_mask = F.binary_cross_entropy_with_logits(out_mask, torch.ones_like(out_mask), reduction='none')
139
139
  # neg_cost_mask = F.binary_cross_entropy_with_logits(out_mask, torch.zeros_like(out_mask), reduction='none')
@@ -54,8 +54,6 @@ class ClassificationPredictor(BasePredictor):
54
54
  orig_imgs = ops.convert_torch2numpy_batch(orig_imgs)
55
55
 
56
56
  results = []
57
- for i, pred in enumerate(preds):
58
- orig_img = orig_imgs[i]
59
- img_path = self.batch[0][i]
57
+ for pred, orig_img, img_path in zip(preds, orig_imgs, self.batch[0]):
60
58
  results.append(Results(orig_img, path=img_path, names=self.model.names, probs=pred))
61
59
  return results
@@ -35,9 +35,7 @@ class DetectionPredictor(BasePredictor):
35
35
  orig_imgs = ops.convert_torch2numpy_batch(orig_imgs)
36
36
 
37
37
  results = []
38
- for i, pred in enumerate(preds):
39
- orig_img = orig_imgs[i]
38
+ for pred, orig_img, img_path in zip(preds, orig_imgs, self.batch[0]):
40
39
  pred[:, :4] = ops.scale_boxes(img.shape[2:], pred[:, :4], orig_img.shape)
41
- img_path = self.batch[0][i]
42
40
  results.append(Results(orig_img, path=img_path, names=self.model.names, boxes=pred))
43
41
  return results
@@ -46,12 +46,10 @@ class PosePredictor(DetectionPredictor):
46
46
  orig_imgs = ops.convert_torch2numpy_batch(orig_imgs)
47
47
 
48
48
  results = []
49
- for i, pred in enumerate(preds):
50
- orig_img = orig_imgs[i]
49
+ for pred, orig_img, img_path in zip(preds, orig_imgs, self.batch[0]):
51
50
  pred[:, :4] = ops.scale_boxes(img.shape[2:], pred[:, :4], orig_img.shape).round()
52
51
  pred_kpts = pred[:, 6:].view(len(pred), *self.model.kpt_shape) if len(pred) else pred[:, 6:]
53
52
  pred_kpts = ops.scale_coords(img.shape[2:], pred_kpts, orig_img.shape)
54
- img_path = self.batch[0][i]
55
53
  results.append(
56
54
  Results(orig_img, path=img_path, names=self.model.names, boxes=pred[:, :6], keypoints=pred_kpts)
57
55
  )
@@ -42,9 +42,7 @@ class SegmentationPredictor(DetectionPredictor):
42
42
 
43
43
  results = []
44
44
  proto = preds[1][-1] if isinstance(preds[1], tuple) else preds[1] # tuple if PyTorch model or array if exported
45
- for i, pred in enumerate(p):
46
- orig_img = orig_imgs[i]
47
- img_path = self.batch[0][i]
45
+ for i, (pred, orig_img, img_path) in enumerate(zip(p, orig_imgs, self.batch[0])):
48
46
  if not len(pred): # save empty boxes
49
47
  masks = None
50
48
  elif self.args.retina_masks:
@@ -587,14 +587,21 @@ class AutoBackend(nn.Module):
587
587
  if x.ndim == 3: # if task is not classification, excluding masks (ndim=4) as well
588
588
  # Denormalize xywh by image size. See https://github.com/ultralytics/ultralytics/pull/1695
589
589
  # xywh are normalized in TFLite/EdgeTPU to mitigate quantization error of integer models
590
- x[:, [0, 2]] *= w
591
- x[:, [1, 3]] *= h
590
+ if x.shape[-1] == 6: # end-to-end model
591
+ x[:, :, [0, 2]] *= w
592
+ x[:, :, [1, 3]] *= h
593
+ else:
594
+ x[:, [0, 2]] *= w
595
+ x[:, [1, 3]] *= h
592
596
  y.append(x)
593
597
  # TF segment fixes: export is reversed vs ONNX export and protos are transposed
594
598
  if len(y) == 2: # segment with (det, proto) output order reversed
595
599
  if len(y[1].shape) != 4:
596
600
  y = list(reversed(y)) # should be y = (1, 116, 8400), (1, 160, 160, 32)
597
- y[1] = np.transpose(y[1], (0, 3, 1, 2)) # should be y = (1, 116, 8400), (1, 32, 160, 160)
601
+ if y[1].shape[-1] == 6: # end-to-end model
602
+ y = [y[1]]
603
+ else:
604
+ y[1] = np.transpose(y[1], (0, 3, 1, 2)) # should be y = (1, 116, 8400), (1, 32, 160, 160)
598
605
  y = [x if isinstance(x, np.ndarray) else x.numpy() for x in y]
599
606
 
600
607
  # for x in y:
@@ -69,7 +69,7 @@ def inference(model=None):
69
69
  # Add dropdown menu for model selection
70
70
  available_models = [x.replace("yolo", "YOLO") for x in GITHUB_ASSETS_STEMS if x.startswith("yolov8")]
71
71
  if model:
72
- available_models.insert(0, model)
72
+ available_models.insert(0, model.split(".pt")[0]) # insert model without suffix as *.pt is added later
73
73
 
74
74
  selected_model = st.sidebar.selectbox("Model", available_models)
75
75
  with st.spinner("Model is downloading..."):
@@ -1066,8 +1066,9 @@ TESTS_RUNNING = is_pytest_running() or is_github_action_running()
1066
1066
  set_sentry()
1067
1067
 
1068
1068
  # Apply monkey patches
1069
- from ultralytics.utils.patches import imread, imshow, imwrite, torch_save
1069
+ from ultralytics.utils.patches import imread, imshow, imwrite, torch_load, torch_save
1070
1070
 
1071
+ torch.load = torch_load
1071
1072
  torch.save = torch_save
1072
1073
  if WINDOWS:
1073
1074
  # Apply cv2 patches for non-ASCII and non-UTF characters in image paths
@@ -7,7 +7,7 @@ import numpy as np
7
7
  import torch
8
8
 
9
9
  from ultralytics.utils import DEFAULT_CFG, LOGGER, colorstr
10
- from ultralytics.utils.torch_utils import profile
10
+ from ultralytics.utils.torch_utils import autocast, profile
11
11
 
12
12
 
13
13
  def check_train_batch_size(model, imgsz=640, amp=True, batch=-1):
@@ -23,7 +23,7 @@ def check_train_batch_size(model, imgsz=640, amp=True, batch=-1):
23
23
  (int): Optimal batch size computed using the autobatch() function.
24
24
  """
25
25
 
26
- with torch.cuda.amp.autocast(amp):
26
+ with autocast(enabled=amp):
27
27
  return autobatch(deepcopy(model).train(), imgsz, fraction=batch if 0.0 < batch < 1.0 else 0.6)
28
28
 
29
29
 
@@ -100,9 +100,11 @@ def benchmark(
100
100
  assert not is_end2end, "End-to-end models not supported by CoreML and TF.js yet"
101
101
  if i in {3, 5}: # CoreML and OpenVINO
102
102
  assert not IS_PYTHON_3_12, "CoreML and OpenVINO not supported on Python 3.12"
103
- if i in {6, 7, 8, 9, 10}: # All TF formats
103
+ if i in {6, 7, 8}: # TF SavedModel, TF GraphDef, and TFLite
104
104
  assert not isinstance(model, YOLOWorld), "YOLOWorldv2 TensorFlow exports not supported by onnx2tf yet"
105
- assert not is_end2end, "End-to-end models not supported by onnx2tf yet"
105
+ if i in {9, 10}: # TF EdgeTPU and TF.js
106
+ assert not isinstance(model, YOLOWorld), "YOLOWorldv2 TensorFlow exports not supported by onnx2tf yet"
107
+ assert not is_end2end, "End-to-end models not supported by TF EdgeTPU and TF.js yet"
106
108
  if i in {11}: # Paddle
107
109
  assert not isinstance(model, YOLOWorld), "YOLOWorldv2 Paddle exports not supported yet"
108
110
  assert not is_end2end, "End-to-end models not supported by PaddlePaddle yet"
@@ -641,6 +641,8 @@ def check_amp(model):
641
641
  Returns:
642
642
  (bool): Returns True if the AMP functionality works correctly with YOLOv8 model, else False.
643
643
  """
644
+ from ultralytics.utils.torch_utils import autocast
645
+
644
646
  device = next(model.parameters()).device # get model device
645
647
  if device.type in {"cpu", "mps"}:
646
648
  return False # AMP only used on CUDA devices
@@ -648,7 +650,7 @@ def check_amp(model):
648
650
  def amp_allclose(m, im):
649
651
  """All close FP32 vs AMP results."""
650
652
  a = m(im, device=device, verbose=False)[0].boxes.data # FP32 inference
651
- with torch.cuda.amp.autocast(True):
653
+ with autocast(enabled=True):
652
654
  b = m(im, device=device, verbose=False)[0].boxes.data # AMP inference
653
655
  del m
654
656
  return a.shape == b.shape and torch.allclose(a, b.float(), atol=0.5) # close to 0.5 absolute tolerance
@@ -199,7 +199,7 @@ def check_disk_space(url="https://ultralytics.com/assets/coco8.zip", path=Path.c
199
199
  Check if there is sufficient disk space to download and store a file.
200
200
 
201
201
  Args:
202
- url (str, optional): The URL to the file. Defaults to 'https://github.com/ultralytics/assets/releases/download/v0.0.0/coco8.zip'.
202
+ url (str, optional): The URL to the file. Defaults to 'https://ultralytics.com/assets/coco8.zip'.
203
203
  path (str | Path, optional): The path or drive to check the available free space on.
204
204
  sf (float, optional): Safety factor, the multiplier for the required free space. Defaults to 2.0.
205
205
  hard (bool, optional): Whether to throw an error or not on insufficient disk space. Defaults to True.
@@ -7,6 +7,7 @@ import torch.nn.functional as F
7
7
  from ultralytics.utils.metrics import OKS_SIGMA
8
8
  from ultralytics.utils.ops import crop_mask, xywh2xyxy, xyxy2xywh
9
9
  from ultralytics.utils.tal import RotatedTaskAlignedAssigner, TaskAlignedAssigner, dist2bbox, dist2rbox, make_anchors
10
+ from ultralytics.utils.torch_utils import autocast
10
11
 
11
12
  from .metrics import bbox_iou, probiou
12
13
  from .tal import bbox2dist
@@ -27,7 +28,7 @@ class VarifocalLoss(nn.Module):
27
28
  def forward(pred_score, gt_score, label, alpha=0.75, gamma=2.0):
28
29
  """Computes varfocal loss."""
29
30
  weight = alpha * pred_score.sigmoid().pow(gamma) * (1 - label) + gt_score * label
30
- with torch.cuda.amp.autocast(enabled=False):
31
+ with autocast(enabled=False):
31
32
  loss = (
32
33
  (F.binary_cross_entropy_with_logits(pred_score.float(), gt_score.float(), reduction="none") * weight)
33
34
  .mean(1)
@@ -57,7 +57,33 @@ def imshow(winname: str, mat: np.ndarray):
57
57
 
58
58
 
59
59
  # PyTorch functions ----------------------------------------------------------------------------------------------------
60
- _torch_save = torch.save # copy to avoid recursion errors
60
+ _torch_load = torch.load # copy to avoid recursion errors
61
+ _torch_save = torch.save
62
+
63
+
64
+ def torch_load(*args, **kwargs):
65
+ """
66
+ Load a PyTorch model with updated arguments to avoid warnings.
67
+
68
+ This function wraps torch.load and adds the 'weights_only' argument for PyTorch 1.13.0+ to prevent warnings.
69
+
70
+ Args:
71
+ *args (Any): Variable length argument list to pass to torch.load.
72
+ **kwargs (Any): Arbitrary keyword arguments to pass to torch.load.
73
+
74
+ Returns:
75
+ (Any): The loaded PyTorch object.
76
+
77
+ Note:
78
+ For PyTorch versions 2.0 and above, this function automatically sets 'weights_only=False'
79
+ if the argument is not provided, to avoid deprecation warnings.
80
+ """
81
+ from ultralytics.utils.torch_utils import TORCH_1_13
82
+
83
+ if TORCH_1_13 and "weights_only" not in kwargs:
84
+ kwargs["weights_only"] = False
85
+
86
+ return _torch_load(*args, **kwargs)
61
87
 
62
88
 
63
89
  def torch_save(*args, use_dill=True, **kwargs):
@@ -68,7 +94,7 @@ def torch_save(*args, use_dill=True, **kwargs):
68
94
  Args:
69
95
  *args (tuple): Positional arguments to pass to torch.save.
70
96
  use_dill (bool): Whether to try using dill for serialization if available. Defaults to True.
71
- **kwargs (any): Keyword arguments to pass to torch.save.
97
+ **kwargs (Any): Keyword arguments to pass to torch.save.
72
98
  """
73
99
  try:
74
100
  assert use_dill
@@ -68,6 +68,37 @@ def smart_inference_mode():
68
68
  return decorate
69
69
 
70
70
 
71
+ def autocast(enabled: bool, device: str = "cuda"):
72
+ """
73
+ Get the appropriate autocast context manager based on PyTorch version and AMP setting.
74
+
75
+ This function returns a context manager for automatic mixed precision (AMP) training that is compatible with both
76
+ older and newer versions of PyTorch. It handles the differences in the autocast API between PyTorch versions.
77
+
78
+ Args:
79
+ enabled (bool): Whether to enable automatic mixed precision.
80
+ device (str, optional): The device to use for autocast. Defaults to 'cuda'.
81
+
82
+ Returns:
83
+ (torch.amp.autocast): The appropriate autocast context manager.
84
+
85
+ Note:
86
+ - For PyTorch versions 1.13 and newer, it uses `torch.amp.autocast`.
87
+ - For older versions, it uses `torch.cuda.autocast`.
88
+
89
+ Example:
90
+ ```python
91
+ with autocast(amp=True):
92
+ # Your mixed precision operations here
93
+ pass
94
+ ```
95
+ """
96
+ if TORCH_1_13:
97
+ return torch.amp.autocast(device, enabled=enabled)
98
+ else:
99
+ return torch.cuda.amp.autocast(enabled)
100
+
101
+
71
102
  def get_cpu_info():
72
103
  """Return a string with system CPU information, i.e. 'Apple M2'."""
73
104
  import cpuinfo # pip install py-cpuinfo
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ultralytics
3
- Version: 8.2.62
3
+ Version: 8.2.64
4
4
  Summary: Ultralytics YOLOv8 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
@@ -1,84 +0,0 @@
1
- # Ultralytics YOLO 🚀, AGPL-3.0 license
2
-
3
- import torch
4
-
5
- from ultralytics.engine.results import Results
6
- from ultralytics.models.fastsam.utils import bbox_iou
7
- from ultralytics.models.yolo.detect.predict import DetectionPredictor
8
- from ultralytics.utils import DEFAULT_CFG, ops
9
-
10
-
11
- class FastSAMPredictor(DetectionPredictor):
12
- """
13
- FastSAMPredictor is specialized for fast SAM (Segment Anything Model) segmentation prediction tasks in Ultralytics
14
- YOLO framework.
15
-
16
- This class extends the DetectionPredictor, customizing the prediction pipeline specifically for fast SAM.
17
- It adjusts post-processing steps to incorporate mask prediction and non-max suppression while optimizing
18
- for single-class segmentation.
19
-
20
- Attributes:
21
- cfg (dict): Configuration parameters for prediction.
22
- overrides (dict, optional): Optional parameter overrides for custom behavior.
23
- _callbacks (dict, optional): Optional list of callback functions to be invoked during prediction.
24
- """
25
-
26
- def __init__(self, cfg=DEFAULT_CFG, overrides=None, _callbacks=None):
27
- """
28
- Initializes the FastSAMPredictor class, inheriting from DetectionPredictor and setting the task to 'segment'.
29
-
30
- Args:
31
- cfg (dict): Configuration parameters for prediction.
32
- overrides (dict, optional): Optional parameter overrides for custom behavior.
33
- _callbacks (dict, optional): Optional list of callback functions to be invoked during prediction.
34
- """
35
- super().__init__(cfg, overrides, _callbacks)
36
- self.args.task = "segment"
37
-
38
- def postprocess(self, preds, img, orig_imgs):
39
- """
40
- Perform post-processing steps on predictions, including non-max suppression and scaling boxes to original image
41
- size, and returns the final results.
42
-
43
- Args:
44
- preds (list): The raw output predictions from the model.
45
- img (torch.Tensor): The processed image tensor.
46
- orig_imgs (list | torch.Tensor): The original image or list of images.
47
-
48
- Returns:
49
- (list): A list of Results objects, each containing processed boxes, masks, and other metadata.
50
- """
51
- p = ops.non_max_suppression(
52
- preds[0],
53
- self.args.conf,
54
- self.args.iou,
55
- agnostic=self.args.agnostic_nms,
56
- max_det=self.args.max_det,
57
- nc=1, # set to 1 class since SAM has no class predictions
58
- classes=self.args.classes,
59
- )
60
- full_box = torch.zeros(p[0].shape[1], device=p[0].device)
61
- full_box[2], full_box[3], full_box[4], full_box[6:] = img.shape[3], img.shape[2], 1.0, 1.0
62
- full_box = full_box.view(1, -1)
63
- critical_iou_index = bbox_iou(full_box[0][:4], p[0][:, :4], iou_thres=0.9, image_shape=img.shape[2:])
64
- if critical_iou_index.numel() != 0:
65
- full_box[0][4] = p[0][critical_iou_index][:, 4]
66
- full_box[0][6:] = p[0][critical_iou_index][:, 6:]
67
- p[0][critical_iou_index] = full_box
68
-
69
- if not isinstance(orig_imgs, list): # input images are a torch.Tensor, not a list
70
- orig_imgs = ops.convert_torch2numpy_batch(orig_imgs)
71
-
72
- results = []
73
- proto = preds[1][-1] if len(preds[1]) == 3 else preds[1] # second output is len 3 if pt, but only 1 if exported
74
- for i, (pred, orig_img, img_path) in enumerate(zip(p, orig_imgs, self.batch[0])):
75
- if not len(pred): # save empty boxes
76
- masks = None
77
- elif self.args.retina_masks:
78
- pred[:, :4] = ops.scale_boxes(img.shape[2:], pred[:, :4], orig_img.shape)
79
- masks = ops.process_mask_native(proto[i], pred[:, 6:], pred[:, :4], orig_img.shape[:2]) # HWC
80
- else:
81
- masks = ops.process_mask(proto[i], pred[:, 6:], pred[:, :4], img.shape[2:], upsample=True) # HWC
82
- pred[:, :4] = ops.scale_boxes(img.shape[2:], pred[:, :4], orig_img.shape)
83
- results.append(Results(orig_img, path=img_path, names=self.model.names, boxes=pred[:, :6], masks=masks))
84
- return results