dgenerate-ultralytics-headless 8.3.214__py3-none-any.whl → 8.3.248__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (236) hide show
  1. {dgenerate_ultralytics_headless-8.3.214.dist-info → dgenerate_ultralytics_headless-8.3.248.dist-info}/METADATA +13 -14
  2. dgenerate_ultralytics_headless-8.3.248.dist-info/RECORD +298 -0
  3. tests/__init__.py +5 -7
  4. tests/conftest.py +8 -15
  5. tests/test_cli.py +1 -1
  6. tests/test_cuda.py +5 -8
  7. tests/test_engine.py +1 -1
  8. tests/test_exports.py +57 -12
  9. tests/test_integrations.py +4 -4
  10. tests/test_python.py +84 -53
  11. tests/test_solutions.py +160 -151
  12. ultralytics/__init__.py +1 -1
  13. ultralytics/cfg/__init__.py +56 -62
  14. ultralytics/cfg/datasets/Argoverse.yaml +7 -6
  15. ultralytics/cfg/datasets/DOTAv1.5.yaml +1 -1
  16. ultralytics/cfg/datasets/DOTAv1.yaml +1 -1
  17. ultralytics/cfg/datasets/ImageNet.yaml +1 -1
  18. ultralytics/cfg/datasets/VOC.yaml +15 -16
  19. ultralytics/cfg/datasets/african-wildlife.yaml +1 -1
  20. ultralytics/cfg/datasets/coco-pose.yaml +21 -0
  21. ultralytics/cfg/datasets/coco128-seg.yaml +1 -1
  22. ultralytics/cfg/datasets/coco8-pose.yaml +21 -0
  23. ultralytics/cfg/datasets/dog-pose.yaml +28 -0
  24. ultralytics/cfg/datasets/dota8-multispectral.yaml +1 -1
  25. ultralytics/cfg/datasets/dota8.yaml +2 -2
  26. ultralytics/cfg/datasets/hand-keypoints.yaml +26 -2
  27. ultralytics/cfg/datasets/kitti.yaml +27 -0
  28. ultralytics/cfg/datasets/lvis.yaml +5 -5
  29. ultralytics/cfg/datasets/open-images-v7.yaml +1 -1
  30. ultralytics/cfg/datasets/tiger-pose.yaml +16 -0
  31. ultralytics/cfg/datasets/xView.yaml +16 -16
  32. ultralytics/cfg/default.yaml +1 -1
  33. ultralytics/cfg/models/11/yolo11-pose.yaml +1 -1
  34. ultralytics/cfg/models/11/yoloe-11-seg.yaml +2 -2
  35. ultralytics/cfg/models/11/yoloe-11.yaml +2 -2
  36. ultralytics/cfg/models/rt-detr/rtdetr-l.yaml +1 -1
  37. ultralytics/cfg/models/rt-detr/rtdetr-resnet101.yaml +1 -1
  38. ultralytics/cfg/models/rt-detr/rtdetr-resnet50.yaml +1 -1
  39. ultralytics/cfg/models/rt-detr/rtdetr-x.yaml +1 -1
  40. ultralytics/cfg/models/v10/yolov10b.yaml +2 -2
  41. ultralytics/cfg/models/v10/yolov10l.yaml +2 -2
  42. ultralytics/cfg/models/v10/yolov10m.yaml +2 -2
  43. ultralytics/cfg/models/v10/yolov10n.yaml +2 -2
  44. ultralytics/cfg/models/v10/yolov10s.yaml +2 -2
  45. ultralytics/cfg/models/v10/yolov10x.yaml +2 -2
  46. ultralytics/cfg/models/v3/yolov3-tiny.yaml +1 -1
  47. ultralytics/cfg/models/v6/yolov6.yaml +1 -1
  48. ultralytics/cfg/models/v8/yoloe-v8-seg.yaml +9 -6
  49. ultralytics/cfg/models/v8/yoloe-v8.yaml +9 -6
  50. ultralytics/cfg/models/v8/yolov8-cls-resnet101.yaml +1 -1
  51. ultralytics/cfg/models/v8/yolov8-cls-resnet50.yaml +1 -1
  52. ultralytics/cfg/models/v8/yolov8-ghost-p2.yaml +2 -2
  53. ultralytics/cfg/models/v8/yolov8-ghost-p6.yaml +2 -2
  54. ultralytics/cfg/models/v8/yolov8-ghost.yaml +2 -2
  55. ultralytics/cfg/models/v8/yolov8-obb.yaml +1 -1
  56. ultralytics/cfg/models/v8/yolov8-p2.yaml +1 -1
  57. ultralytics/cfg/models/v8/yolov8-pose-p6.yaml +1 -1
  58. ultralytics/cfg/models/v8/yolov8-rtdetr.yaml +1 -1
  59. ultralytics/cfg/models/v8/yolov8-seg-p6.yaml +1 -1
  60. ultralytics/cfg/models/v8/yolov8-world.yaml +1 -1
  61. ultralytics/cfg/models/v8/yolov8-worldv2.yaml +6 -6
  62. ultralytics/cfg/models/v9/yolov9s.yaml +1 -1
  63. ultralytics/data/__init__.py +4 -4
  64. ultralytics/data/annotator.py +3 -4
  65. ultralytics/data/augment.py +285 -475
  66. ultralytics/data/base.py +18 -26
  67. ultralytics/data/build.py +147 -25
  68. ultralytics/data/converter.py +36 -46
  69. ultralytics/data/dataset.py +46 -74
  70. ultralytics/data/loaders.py +42 -49
  71. ultralytics/data/split.py +5 -6
  72. ultralytics/data/split_dota.py +8 -15
  73. ultralytics/data/utils.py +34 -43
  74. ultralytics/engine/exporter.py +319 -237
  75. ultralytics/engine/model.py +148 -188
  76. ultralytics/engine/predictor.py +29 -38
  77. ultralytics/engine/results.py +177 -311
  78. ultralytics/engine/trainer.py +83 -59
  79. ultralytics/engine/tuner.py +23 -34
  80. ultralytics/engine/validator.py +39 -22
  81. ultralytics/hub/__init__.py +16 -19
  82. ultralytics/hub/auth.py +6 -12
  83. ultralytics/hub/google/__init__.py +7 -10
  84. ultralytics/hub/session.py +15 -25
  85. ultralytics/hub/utils.py +5 -8
  86. ultralytics/models/__init__.py +1 -1
  87. ultralytics/models/fastsam/__init__.py +1 -1
  88. ultralytics/models/fastsam/model.py +8 -10
  89. ultralytics/models/fastsam/predict.py +17 -29
  90. ultralytics/models/fastsam/utils.py +1 -2
  91. ultralytics/models/fastsam/val.py +5 -7
  92. ultralytics/models/nas/__init__.py +1 -1
  93. ultralytics/models/nas/model.py +5 -8
  94. ultralytics/models/nas/predict.py +7 -9
  95. ultralytics/models/nas/val.py +1 -2
  96. ultralytics/models/rtdetr/__init__.py +1 -1
  97. ultralytics/models/rtdetr/model.py +5 -8
  98. ultralytics/models/rtdetr/predict.py +15 -19
  99. ultralytics/models/rtdetr/train.py +10 -13
  100. ultralytics/models/rtdetr/val.py +21 -23
  101. ultralytics/models/sam/__init__.py +15 -2
  102. ultralytics/models/sam/amg.py +14 -20
  103. ultralytics/models/sam/build.py +26 -19
  104. ultralytics/models/sam/build_sam3.py +377 -0
  105. ultralytics/models/sam/model.py +29 -32
  106. ultralytics/models/sam/modules/blocks.py +83 -144
  107. ultralytics/models/sam/modules/decoders.py +19 -37
  108. ultralytics/models/sam/modules/encoders.py +44 -101
  109. ultralytics/models/sam/modules/memory_attention.py +16 -30
  110. ultralytics/models/sam/modules/sam.py +200 -73
  111. ultralytics/models/sam/modules/tiny_encoder.py +64 -83
  112. ultralytics/models/sam/modules/transformer.py +18 -28
  113. ultralytics/models/sam/modules/utils.py +174 -50
  114. ultralytics/models/sam/predict.py +2248 -350
  115. ultralytics/models/sam/sam3/__init__.py +3 -0
  116. ultralytics/models/sam/sam3/decoder.py +546 -0
  117. ultralytics/models/sam/sam3/encoder.py +529 -0
  118. ultralytics/models/sam/sam3/geometry_encoders.py +415 -0
  119. ultralytics/models/sam/sam3/maskformer_segmentation.py +286 -0
  120. ultralytics/models/sam/sam3/model_misc.py +199 -0
  121. ultralytics/models/sam/sam3/necks.py +129 -0
  122. ultralytics/models/sam/sam3/sam3_image.py +339 -0
  123. ultralytics/models/sam/sam3/text_encoder_ve.py +307 -0
  124. ultralytics/models/sam/sam3/vitdet.py +547 -0
  125. ultralytics/models/sam/sam3/vl_combiner.py +160 -0
  126. ultralytics/models/utils/loss.py +14 -26
  127. ultralytics/models/utils/ops.py +13 -17
  128. ultralytics/models/yolo/__init__.py +1 -1
  129. ultralytics/models/yolo/classify/predict.py +9 -12
  130. ultralytics/models/yolo/classify/train.py +11 -32
  131. ultralytics/models/yolo/classify/val.py +29 -28
  132. ultralytics/models/yolo/detect/predict.py +7 -10
  133. ultralytics/models/yolo/detect/train.py +11 -20
  134. ultralytics/models/yolo/detect/val.py +70 -58
  135. ultralytics/models/yolo/model.py +36 -53
  136. ultralytics/models/yolo/obb/predict.py +5 -14
  137. ultralytics/models/yolo/obb/train.py +11 -14
  138. ultralytics/models/yolo/obb/val.py +39 -36
  139. ultralytics/models/yolo/pose/__init__.py +1 -1
  140. ultralytics/models/yolo/pose/predict.py +6 -21
  141. ultralytics/models/yolo/pose/train.py +10 -15
  142. ultralytics/models/yolo/pose/val.py +38 -57
  143. ultralytics/models/yolo/segment/predict.py +14 -18
  144. ultralytics/models/yolo/segment/train.py +3 -6
  145. ultralytics/models/yolo/segment/val.py +93 -45
  146. ultralytics/models/yolo/world/train.py +8 -14
  147. ultralytics/models/yolo/world/train_world.py +11 -34
  148. ultralytics/models/yolo/yoloe/__init__.py +7 -7
  149. ultralytics/models/yolo/yoloe/predict.py +16 -23
  150. ultralytics/models/yolo/yoloe/train.py +30 -43
  151. ultralytics/models/yolo/yoloe/train_seg.py +5 -10
  152. ultralytics/models/yolo/yoloe/val.py +15 -20
  153. ultralytics/nn/__init__.py +7 -7
  154. ultralytics/nn/autobackend.py +145 -77
  155. ultralytics/nn/modules/__init__.py +60 -60
  156. ultralytics/nn/modules/activation.py +4 -6
  157. ultralytics/nn/modules/block.py +132 -216
  158. ultralytics/nn/modules/conv.py +52 -97
  159. ultralytics/nn/modules/head.py +50 -103
  160. ultralytics/nn/modules/transformer.py +76 -88
  161. ultralytics/nn/modules/utils.py +16 -21
  162. ultralytics/nn/tasks.py +94 -154
  163. ultralytics/nn/text_model.py +40 -67
  164. ultralytics/solutions/__init__.py +12 -12
  165. ultralytics/solutions/ai_gym.py +11 -17
  166. ultralytics/solutions/analytics.py +15 -16
  167. ultralytics/solutions/config.py +5 -6
  168. ultralytics/solutions/distance_calculation.py +10 -13
  169. ultralytics/solutions/heatmap.py +7 -13
  170. ultralytics/solutions/instance_segmentation.py +5 -8
  171. ultralytics/solutions/object_blurrer.py +7 -10
  172. ultralytics/solutions/object_counter.py +12 -19
  173. ultralytics/solutions/object_cropper.py +8 -14
  174. ultralytics/solutions/parking_management.py +33 -31
  175. ultralytics/solutions/queue_management.py +10 -12
  176. ultralytics/solutions/region_counter.py +9 -12
  177. ultralytics/solutions/security_alarm.py +15 -20
  178. ultralytics/solutions/similarity_search.py +10 -15
  179. ultralytics/solutions/solutions.py +75 -74
  180. ultralytics/solutions/speed_estimation.py +7 -10
  181. ultralytics/solutions/streamlit_inference.py +2 -4
  182. ultralytics/solutions/templates/similarity-search.html +7 -18
  183. ultralytics/solutions/trackzone.py +7 -10
  184. ultralytics/solutions/vision_eye.py +5 -8
  185. ultralytics/trackers/__init__.py +1 -1
  186. ultralytics/trackers/basetrack.py +3 -5
  187. ultralytics/trackers/bot_sort.py +10 -27
  188. ultralytics/trackers/byte_tracker.py +14 -30
  189. ultralytics/trackers/track.py +3 -6
  190. ultralytics/trackers/utils/gmc.py +11 -22
  191. ultralytics/trackers/utils/kalman_filter.py +37 -48
  192. ultralytics/trackers/utils/matching.py +12 -15
  193. ultralytics/utils/__init__.py +116 -116
  194. ultralytics/utils/autobatch.py +2 -4
  195. ultralytics/utils/autodevice.py +17 -18
  196. ultralytics/utils/benchmarks.py +32 -46
  197. ultralytics/utils/callbacks/base.py +8 -10
  198. ultralytics/utils/callbacks/clearml.py +5 -13
  199. ultralytics/utils/callbacks/comet.py +32 -46
  200. ultralytics/utils/callbacks/dvc.py +13 -18
  201. ultralytics/utils/callbacks/mlflow.py +4 -5
  202. ultralytics/utils/callbacks/neptune.py +7 -15
  203. ultralytics/utils/callbacks/platform.py +314 -38
  204. ultralytics/utils/callbacks/raytune.py +3 -4
  205. ultralytics/utils/callbacks/tensorboard.py +23 -31
  206. ultralytics/utils/callbacks/wb.py +10 -13
  207. ultralytics/utils/checks.py +99 -76
  208. ultralytics/utils/cpu.py +3 -8
  209. ultralytics/utils/dist.py +8 -12
  210. ultralytics/utils/downloads.py +20 -30
  211. ultralytics/utils/errors.py +6 -14
  212. ultralytics/utils/events.py +2 -4
  213. ultralytics/utils/export/__init__.py +4 -236
  214. ultralytics/utils/export/engine.py +237 -0
  215. ultralytics/utils/export/imx.py +91 -55
  216. ultralytics/utils/export/tensorflow.py +231 -0
  217. ultralytics/utils/files.py +24 -28
  218. ultralytics/utils/git.py +9 -11
  219. ultralytics/utils/instance.py +30 -51
  220. ultralytics/utils/logger.py +212 -114
  221. ultralytics/utils/loss.py +14 -22
  222. ultralytics/utils/metrics.py +126 -155
  223. ultralytics/utils/nms.py +13 -16
  224. ultralytics/utils/ops.py +107 -165
  225. ultralytics/utils/patches.py +33 -21
  226. ultralytics/utils/plotting.py +72 -80
  227. ultralytics/utils/tal.py +25 -39
  228. ultralytics/utils/torch_utils.py +52 -78
  229. ultralytics/utils/tqdm.py +20 -20
  230. ultralytics/utils/triton.py +13 -19
  231. ultralytics/utils/tuner.py +17 -5
  232. dgenerate_ultralytics_headless-8.3.214.dist-info/RECORD +0 -283
  233. {dgenerate_ultralytics_headless-8.3.214.dist-info → dgenerate_ultralytics_headless-8.3.248.dist-info}/WHEEL +0 -0
  234. {dgenerate_ultralytics_headless-8.3.214.dist-info → dgenerate_ultralytics_headless-8.3.248.dist-info}/entry_points.txt +0 -0
  235. {dgenerate_ultralytics_headless-8.3.214.dist-info → dgenerate_ultralytics_headless-8.3.248.dist-info}/licenses/LICENSE +0 -0
  236. {dgenerate_ultralytics_headless-8.3.214.dist-info → dgenerate_ultralytics_headless-8.3.248.dist-info}/top_level.txt +0 -0
ultralytics/utils/git.py CHANGED
@@ -7,13 +7,12 @@ from pathlib import Path
7
7
 
8
8
 
9
9
  class GitRepo:
10
- """
11
- Represent a local Git repository and expose branch, commit, and remote metadata.
10
+ """Represent a local Git repository and expose branch, commit, and remote metadata.
12
11
 
13
12
  This class discovers the repository root by searching for a .git entry from the given path upward, resolves the
14
- actual .git directory (including worktrees), and reads Git metadata directly from on-disk files. It does not
15
- invoke the git binary and therefore works in restricted environments. All metadata properties are resolved
16
- lazily and cached; construct a new instance to refresh state.
13
+ actual .git directory (including worktrees), and reads Git metadata directly from on-disk files. It does not invoke
14
+ the git binary and therefore works in restricted environments. All metadata properties are resolved lazily and
15
+ cached; construct a new instance to refresh state.
17
16
 
18
17
  Attributes:
19
18
  root (Path | None): Repository root directory containing the .git entry; None if not in a repository.
@@ -39,8 +38,7 @@ class GitRepo:
39
38
  """
40
39
 
41
40
  def __init__(self, path: Path = Path(__file__).resolve()):
42
- """
43
- Initialize a Git repository context by discovering the repository root from a starting path.
41
+ """Initialize a Git repository context by discovering the repository root from a starting path.
44
42
 
45
43
  Args:
46
44
  path (Path, optional): File or directory path used as the starting point to locate the repository root.
@@ -51,7 +49,7 @@ class GitRepo:
51
49
  @staticmethod
52
50
  def _find_root(p: Path) -> Path | None:
53
51
  """Return repo root or None."""
54
- return next((d for d in [p] + list(p.parents) if (d / ".git").exists()), None)
52
+ return next((d for d in [p, *list(p.parents)] if (d / ".git").exists()), None)
55
53
 
56
54
  @staticmethod
57
55
  def _gitdir(root: Path) -> Path | None:
@@ -65,7 +63,8 @@ class GitRepo:
65
63
  return (root / t.split(":", 1)[1].strip()).resolve()
66
64
  return None
67
65
 
68
- def _read(self, p: Path | None) -> str | None:
66
+ @staticmethod
67
+ def _read(p: Path | None) -> str | None:
69
68
  """Read and strip file if exists."""
70
69
  return p.read_text(errors="ignore").strip() if p and p.exists() else None
71
70
 
@@ -77,8 +76,7 @@ class GitRepo:
77
76
  def _ref_commit(self, ref: str) -> str | None:
78
77
  """Commit for ref (handles packed-refs)."""
79
78
  rf = self.gitdir / ref
80
- s = self._read(rf)
81
- if s:
79
+ if s := self._read(rf):
82
80
  return s
83
81
  pf = self.gitdir / "packed-refs"
84
82
  b = pf.read_bytes().splitlines() if pf.exists() else []
@@ -33,8 +33,7 @@ __all__ = ("Bboxes", "Instances") # tuple or list
33
33
 
34
34
 
35
35
  class Bboxes:
36
- """
37
- A class for handling bounding boxes in multiple formats.
36
+ """A class for handling bounding boxes in multiple formats.
38
37
 
39
38
  The class supports various bounding box formats like 'xyxy', 'xywh', and 'ltwh' and provides methods for format
40
39
  conversion, scaling, and area calculation. Bounding box data should be provided as numpy arrays.
@@ -61,8 +60,7 @@ class Bboxes:
61
60
  """
62
61
 
63
62
  def __init__(self, bboxes: np.ndarray, format: str = "xyxy") -> None:
64
- """
65
- Initialize the Bboxes class with bounding box data in a specified format.
63
+ """Initialize the Bboxes class with bounding box data in a specified format.
66
64
 
67
65
  Args:
68
66
  bboxes (np.ndarray): Array of bounding boxes with shape (N, 4) or (4,).
@@ -76,8 +74,7 @@ class Bboxes:
76
74
  self.format = format
77
75
 
78
76
  def convert(self, format: str) -> None:
79
- """
80
- Convert bounding box format from one type to another.
77
+ """Convert bounding box format from one type to another.
81
78
 
82
79
  Args:
83
80
  format (str): Target format for conversion, one of 'xyxy', 'xywh', or 'ltwh'.
@@ -103,12 +100,11 @@ class Bboxes:
103
100
  )
104
101
 
105
102
  def mul(self, scale: int | tuple | list) -> None:
106
- """
107
- Multiply bounding box coordinates by scale factor(s).
103
+ """Multiply bounding box coordinates by scale factor(s).
108
104
 
109
105
  Args:
110
- scale (int | tuple | list): Scale factor(s) for four coordinates. If int, the same scale is applied to
111
- all coordinates.
106
+ scale (int | tuple | list): Scale factor(s) for four coordinates. If int, the same scale is applied to all
107
+ coordinates.
112
108
  """
113
109
  if isinstance(scale, Number):
114
110
  scale = to_4tuple(scale)
@@ -120,12 +116,11 @@ class Bboxes:
120
116
  self.bboxes[:, 3] *= scale[3]
121
117
 
122
118
  def add(self, offset: int | tuple | list) -> None:
123
- """
124
- Add offset to bounding box coordinates.
119
+ """Add offset to bounding box coordinates.
125
120
 
126
121
  Args:
127
- offset (int | tuple | list): Offset(s) for four coordinates. If int, the same offset is applied to
128
- all coordinates.
122
+ offset (int | tuple | list): Offset(s) for four coordinates. If int, the same offset is applied to all
123
+ coordinates.
129
124
  """
130
125
  if isinstance(offset, Number):
131
126
  offset = to_4tuple(offset)
@@ -142,8 +137,7 @@ class Bboxes:
142
137
 
143
138
  @classmethod
144
139
  def concatenate(cls, boxes_list: list[Bboxes], axis: int = 0) -> Bboxes:
145
- """
146
- Concatenate a list of Bboxes objects into a single Bboxes object.
140
+ """Concatenate a list of Bboxes objects into a single Bboxes object.
147
141
 
148
142
  Args:
149
143
  boxes_list (list[Bboxes]): A list of Bboxes objects to concatenate.
@@ -165,8 +159,7 @@ class Bboxes:
165
159
  return cls(np.concatenate([b.bboxes for b in boxes_list], axis=axis))
166
160
 
167
161
  def __getitem__(self, index: int | np.ndarray | slice) -> Bboxes:
168
- """
169
- Retrieve a specific bounding box or a set of bounding boxes using indexing.
162
+ """Retrieve a specific bounding box or a set of bounding boxes using indexing.
170
163
 
171
164
  Args:
172
165
  index (int | slice | np.ndarray): The index, slice, or boolean array to select the desired bounding boxes.
@@ -186,12 +179,11 @@ class Bboxes:
186
179
 
187
180
 
188
181
  class Instances:
189
- """
190
- Container for bounding boxes, segments, and keypoints of detected objects in an image.
182
+ """Container for bounding boxes, segments, and keypoints of detected objects in an image.
191
183
 
192
- This class provides a unified interface for handling different types of object annotations including bounding
193
- boxes, segmentation masks, and keypoints. It supports various operations like scaling, normalization, clipping,
194
- and format conversion.
184
+ This class provides a unified interface for handling different types of object annotations including bounding boxes,
185
+ segmentation masks, and keypoints. It supports various operations like scaling, normalization, clipping, and format
186
+ conversion.
195
187
 
196
188
  Attributes:
197
189
  _bboxes (Bboxes): Internal object for handling bounding box operations.
@@ -229,8 +221,7 @@ class Instances:
229
221
  bbox_format: str = "xywh",
230
222
  normalized: bool = True,
231
223
  ) -> None:
232
- """
233
- Initialize the Instances object with bounding boxes, segments, and keypoints.
224
+ """Initialize the Instances object with bounding boxes, segments, and keypoints.
234
225
 
235
226
  Args:
236
227
  bboxes (np.ndarray): Bounding boxes with shape (N, 4).
@@ -245,8 +236,7 @@ class Instances:
245
236
  self.segments = segments
246
237
 
247
238
  def convert_bbox(self, format: str) -> None:
248
- """
249
- Convert bounding box format.
239
+ """Convert bounding box format.
250
240
 
251
241
  Args:
252
242
  format (str): Target format for conversion, one of 'xyxy', 'xywh', or 'ltwh'.
@@ -259,8 +249,7 @@ class Instances:
259
249
  return self._bboxes.areas()
260
250
 
261
251
  def scale(self, scale_w: float, scale_h: float, bbox_only: bool = False):
262
- """
263
- Scale coordinates by given factors.
252
+ """Scale coordinates by given factors.
264
253
 
265
254
  Args:
266
255
  scale_w (float): Scale factor for width.
@@ -277,8 +266,7 @@ class Instances:
277
266
  self.keypoints[..., 1] *= scale_h
278
267
 
279
268
  def denormalize(self, w: int, h: int) -> None:
280
- """
281
- Convert normalized coordinates to absolute coordinates.
269
+ """Convert normalized coordinates to absolute coordinates.
282
270
 
283
271
  Args:
284
272
  w (int): Image width.
@@ -295,8 +283,7 @@ class Instances:
295
283
  self.normalized = False
296
284
 
297
285
  def normalize(self, w: int, h: int) -> None:
298
- """
299
- Convert absolute coordinates to normalized coordinates.
286
+ """Convert absolute coordinates to normalized coordinates.
300
287
 
301
288
  Args:
302
289
  w (int): Image width.
@@ -313,8 +300,7 @@ class Instances:
313
300
  self.normalized = True
314
301
 
315
302
  def add_padding(self, padw: int, padh: int) -> None:
316
- """
317
- Add padding to coordinates.
303
+ """Add padding to coordinates.
318
304
 
319
305
  Args:
320
306
  padw (int): Padding width.
@@ -329,8 +315,7 @@ class Instances:
329
315
  self.keypoints[..., 1] += padh
330
316
 
331
317
  def __getitem__(self, index: int | np.ndarray | slice) -> Instances:
332
- """
333
- Retrieve a specific instance or a set of instances using indexing.
318
+ """Retrieve a specific instance or a set of instances using indexing.
334
319
 
335
320
  Args:
336
321
  index (int | slice | np.ndarray): The index, slice, or boolean array to select the desired instances.
@@ -355,8 +340,7 @@ class Instances:
355
340
  )
356
341
 
357
342
  def flipud(self, h: int) -> None:
358
- """
359
- Flip coordinates vertically.
343
+ """Flip coordinates vertically.
360
344
 
361
345
  Args:
362
346
  h (int): Image height.
@@ -373,8 +357,7 @@ class Instances:
373
357
  self.keypoints[..., 1] = h - self.keypoints[..., 1]
374
358
 
375
359
  def fliplr(self, w: int) -> None:
376
- """
377
- Flip coordinates horizontally.
360
+ """Flip coordinates horizontally.
378
361
 
379
362
  Args:
380
363
  w (int): Image width.
@@ -391,8 +374,7 @@ class Instances:
391
374
  self.keypoints[..., 0] = w - self.keypoints[..., 0]
392
375
 
393
376
  def clip(self, w: int, h: int) -> None:
394
- """
395
- Clip coordinates to stay within image boundaries.
377
+ """Clip coordinates to stay within image boundaries.
396
378
 
397
379
  Args:
398
380
  w (int): Image width.
@@ -418,8 +400,7 @@ class Instances:
418
400
  self.keypoints[..., 1] = self.keypoints[..., 1].clip(0, h)
419
401
 
420
402
  def remove_zero_area_boxes(self) -> np.ndarray:
421
- """
422
- Remove zero-area boxes, i.e. after clipping some boxes may have zero width or height.
403
+ """Remove zero-area boxes, i.e. after clipping some boxes may have zero width or height.
423
404
 
424
405
  Returns:
425
406
  (np.ndarray): Boolean array indicating which boxes were kept.
@@ -434,8 +415,7 @@ class Instances:
434
415
  return good
435
416
 
436
417
  def update(self, bboxes: np.ndarray, segments: np.ndarray = None, keypoints: np.ndarray = None):
437
- """
438
- Update instance variables.
418
+ """Update instance variables.
439
419
 
440
420
  Args:
441
421
  bboxes (np.ndarray): New bounding boxes.
@@ -454,16 +434,15 @@ class Instances:
454
434
 
455
435
  @classmethod
456
436
  def concatenate(cls, instances_list: list[Instances], axis=0) -> Instances:
457
- """
458
- Concatenate a list of Instances objects into a single Instances object.
437
+ """Concatenate a list of Instances objects into a single Instances object.
459
438
 
460
439
  Args:
461
440
  instances_list (list[Instances]): A list of Instances objects to concatenate.
462
441
  axis (int, optional): The axis along which the arrays will be concatenated.
463
442
 
464
443
  Returns:
465
- (Instances): A new Instances object containing the concatenated bounding boxes, segments, and keypoints
466
- if present.
444
+ (Instances): A new Instances object containing the concatenated bounding boxes, segments, and keypoints if
445
+ present.
467
446
 
468
447
  Notes:
469
448
  The `Instances` objects in the list should have the same properties, such as the format of the bounding