ultralytics 8.2.71__py3-none-any.whl → 8.2.72__py3-none-any.whl

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

Potentially problematic release.


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

tests/test_cli.py CHANGED
@@ -8,6 +8,7 @@ from PIL import Image
8
8
  from tests import CUDA_DEVICE_COUNT, CUDA_IS_AVAILABLE
9
9
  from ultralytics.cfg import TASK2DATA, TASK2MODEL, TASKS
10
10
  from ultralytics.utils import ASSETS, WEIGHTS_DIR, checks
11
+ from ultralytics.utils.torch_utils import TORCH_1_9
11
12
 
12
13
  # Constants
13
14
  TASK_MODEL_DATA = [(task, WEIGHTS_DIR / TASK2MODEL[task], TASK2DATA[task]) for task in TASKS]
@@ -57,6 +58,8 @@ def test_rtdetr(task="detect", model="yolov8n-rtdetr.yaml", data="coco8.yaml"):
57
58
  # Warning: must use imgsz=640 (note also add coma, spaces, fraction=0.25 args to test single-image training)
58
59
  run(f"yolo train {task} model={model} data={data} --imgsz= 160 epochs =1, cache = disk fraction=0.25")
59
60
  run(f"yolo predict {task} model={model} source={ASSETS / 'bus.jpg'} imgsz=160 save save_crop save_txt")
61
+ if TORCH_1_9:
62
+ run(f"yolo predict {task} model='rtdetr-l.pt' source={ASSETS / 'bus.jpg'} imgsz=160 save save_crop save_txt")
60
63
 
61
64
 
62
65
  @pytest.mark.skipif(checks.IS_PYTHON_3_12, reason="MobileSAM with CLIP is not supported in Python 3.12")
ultralytics/__init__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  # Ultralytics YOLO 🚀, AGPL-3.0 license
2
2
 
3
- __version__ = "8.2.71"
3
+ __version__ = "8.2.72"
4
4
 
5
5
  import os
6
6
 
@@ -102,28 +102,23 @@ class SAM2Predictor(Predictor):
102
102
  if bboxes is not None:
103
103
  bboxes = torch.as_tensor(bboxes, dtype=torch.float32, device=self.device)
104
104
  bboxes = bboxes[None] if bboxes.ndim == 1 else bboxes
105
- bboxes *= r
105
+ bboxes = bboxes.view(-1, 2, 2) * r
106
+ bbox_labels = torch.tensor([[2, 3]], dtype=torch.int32, device=bboxes.device).expand(len(bboxes), -1)
107
+ # NOTE: merge "boxes" and "points" into a single "points" input
108
+ # (where boxes are added at the beginning) to model.sam_prompt_encoder
109
+ if points is not None:
110
+ points = torch.cat([bboxes, points], dim=1)
111
+ labels = torch.cat([bbox_labels, labels], dim=1)
112
+ else:
113
+ points, labels = bboxes, bbox_labels
106
114
  if masks is not None:
107
115
  masks = torch.as_tensor(masks, dtype=torch.float32, device=self.device).unsqueeze(1)
108
116
 
109
117
  points = (points, labels) if points is not None else None
110
- # TODO: Embed prompts
111
- # if bboxes is not None:
112
- # box_coords = bboxes.reshape(-1, 2, 2)
113
- # box_labels = torch.tensor([[2, 3]], dtype=torch.int, device=bboxes.device)
114
- # box_labels = box_labels.repeat(bboxes.size(0), 1)
115
- # # we merge "boxes" and "points" into a single "concat_points" input (where
116
- # # boxes are added at the beginning) to sam_prompt_encoder
117
- # if concat_points is not None:
118
- # concat_coords = torch.cat([box_coords, concat_points[0]], dim=1)
119
- # concat_labels = torch.cat([box_labels, concat_points[1]], dim=1)
120
- # concat_points = (concat_coords, concat_labels)
121
- # else:
122
- # concat_points = (box_coords, box_labels)
123
118
 
124
119
  sparse_embeddings, dense_embeddings = self.model.sam_prompt_encoder(
125
120
  points=points,
126
- boxes=bboxes,
121
+ boxes=None,
127
122
  masks=masks,
128
123
  )
129
124
  # Predict masks
@@ -186,8 +186,8 @@ class MLP(nn.Module):
186
186
  def forward(self, x):
187
187
  """Forward pass for the entire MLP."""
188
188
  for i, layer in enumerate(self.layers):
189
- x = self.act(layer(x)) if i < self.num_layers - 1 else layer(x)
190
- return x.sigmoid() if self.sigmoid else x
189
+ x = getattr(self, "act", nn.ReLU())(layer(x)) if i < self.num_layers - 1 else layer(x)
190
+ return x.sigmoid() if getattr(self, "sigmoid", False) else x
191
191
 
192
192
 
193
193
  class LayerNorm2d(nn.Module):
@@ -41,7 +41,7 @@ def is_url(url, check=False):
41
41
  Args:
42
42
  url (str): The string to be validated as a URL.
43
43
  check (bool, optional): If True, performs an additional check to see if the URL exists online.
44
- Defaults to True.
44
+ Defaults to False.
45
45
 
46
46
  Returns:
47
47
  (bool): Returns True for a valid URL. If 'check' is True, also returns True if the URL exists online.
@@ -201,7 +201,7 @@ def check_disk_space(url="https://ultralytics.com/assets/coco8.zip", path=Path.c
201
201
  Args:
202
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
- sf (float, optional): Safety factor, the multiplier for the required free space. Defaults to 2.0.
204
+ sf (float, optional): Safety factor, the multiplier for the required free space. Defaults to 1.5.
205
205
  hard (bool, optional): Whether to throw an error or not on insufficient disk space. Defaults to True.
206
206
 
207
207
  Returns:
ultralytics/utils/ops.py CHANGED
@@ -528,7 +528,7 @@ def ltwh2xywh(x):
528
528
  def xyxyxyxy2xywhr(x):
529
529
  """
530
530
  Convert batched Oriented Bounding Boxes (OBB) from [xy1, xy2, xy3, xy4] to [xywh, rotation]. Rotation values are
531
- expected in degrees from 0 to 90.
531
+ returned in radians from 0 to pi/2.
532
532
 
533
533
  Args:
534
534
  x (numpy.ndarray | torch.Tensor): Input box corners [xy1, xy2, xy3, xy4] of shape (n, 8).
@@ -551,7 +551,7 @@ def xyxyxyxy2xywhr(x):
551
551
  def xywhr2xyxyxyxy(x):
552
552
  """
553
553
  Convert batched Oriented Bounding Boxes (OBB) from [xywh, rotation] to [xy1, xy2, xy3, xy4]. Rotation values should
554
- be in degrees from 0 to 90.
554
+ be in radians from 0 to pi/2.
555
555
 
556
556
  Args:
557
557
  x (numpy.ndarray | torch.Tensor): Boxes in [cx, cy, w, h, rotation] format of shape (n, 5) or (b, n, 5).
@@ -195,12 +195,12 @@ class Annotator:
195
195
 
196
196
  def circle_label(self, box, label="", color=(128, 128, 128), txt_color=(255, 255, 255), margin=2):
197
197
  """
198
- Draws a label with a background rectangle centered within a given bounding box.
198
+ Draws a label with a background circle centered within a given bounding box.
199
199
 
200
200
  Args:
201
201
  box (tuple): The bounding box coordinates (x1, y1, x2, y2).
202
202
  label (str): The text label to be displayed.
203
- color (tuple, optional): The background color of the rectangle (R, G, B).
203
+ color (tuple, optional): The background color of the rectangle (B, G, R).
204
204
  txt_color (tuple, optional): The color of the text (R, G, B).
205
205
  margin (int, optional): The margin between the text and the rectangle border.
206
206
  """
@@ -242,7 +242,7 @@ class Annotator:
242
242
  Args:
243
243
  box (tuple): The bounding box coordinates (x1, y1, x2, y2).
244
244
  label (str): The text label to be displayed.
245
- color (tuple, optional): The background color of the rectangle (R, G, B).
245
+ color (tuple, optional): The background color of the rectangle (B, G, R).
246
246
  txt_color (tuple, optional): The color of the text (R, G, B).
247
247
  margin (int, optional): The margin between the text and the rectangle border.
248
248
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ultralytics
3
- Version: 8.2.71
3
+ Version: 8.2.72
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,6 +1,6 @@
1
1
  tests/__init__.py,sha256=9evx3lOdKZeY1iWXvH-FkMkgf8jLucWICoabzeD6aYg,626
2
2
  tests/conftest.py,sha256=3ZtD4VlMKK5jVJwIPCrNAcG63vywJzdLq7U2AfYR2VI,2919
3
- tests/test_cli.py,sha256=PqZVSKBjLeHwQzh_hVKucQibqTFtP-2ZS6ndZRpqUDI,4654
3
+ tests/test_cli.py,sha256=9NvLZhhy8er8A_OXZ1iVUAm0uvtT0phZFmUPO-YBZEs,4842
4
4
  tests/test_cuda.py,sha256=uD-ddNEcBMFQmQ9iE4fIGh0EIcGwEoDEUNVCEHicaWE,5133
5
5
  tests/test_engine.py,sha256=xW-UT9_9xZp-7-hSnbJgMw_ezTk6NqTOIiA59XZDmxA,4934
6
6
  tests/test_explorer.py,sha256=NcxSJeB6FxwkN09hQl7nnQL--HjfHB_WcZk0mEmBNHI,2215
@@ -8,7 +8,7 @@ tests/test_exports.py,sha256=Uezf3OatpPHlo5qoPw-2kqkZxuMCF9L4XF2riD4vmII,8225
8
8
  tests/test_integrations.py,sha256=xglcfMPjfVh346PV8WTpk6tBxraCXEFJEQyyJMr5tyU,6064
9
9
  tests/test_python.py,sha256=cLK8dyRf_4H_znFIm-krnOFMydwkxKlVZvHwl9vbck8,21780
10
10
  tests/test_solutions.py,sha256=EACnPXbeJe2aVTOKfqMk5jclKKCWCVgFEzjpR6y7Sh8,3304
11
- ultralytics/__init__.py,sha256=sV3uzVV5yg9sqZSe7JS8hxO873wlJUProzRIeVii45U,712
11
+ ultralytics/__init__.py,sha256=kF5QJe8JpLVYC89NNXSzMiIAAV8VUEy3d2bWGR6OQmA,712
12
12
  ultralytics/assets/bus.jpg,sha256=wCAZxJecGR63Od3ZRERe9Aja1Weayrb9Ug751DS_vGM,137419
13
13
  ultralytics/assets/zidane.jpg,sha256=Ftc4aeMmen1O0A3o6GCDO9FlfBslLpTAw0gnetx7bts,50427
14
14
  ultralytics/cfg/__init__.py,sha256=7ce3_bhi7pDw5ZAbSqYR6e3_IYD2JCLCy7fkl5d1WyI,33064
@@ -139,7 +139,7 @@ ultralytics/models/sam/modules/transformer.py,sha256=a2jsS_J76MvrIKIERb_0flliYFM
139
139
  ultralytics/models/sam2/__init__.py,sha256=_xqQHLZTLgEdK278YETYR-Fts2hsvXP5q9ddUbuuFvc,154
140
140
  ultralytics/models/sam2/build.py,sha256=m6hv82VKn3Lct_7nztUqdzJzCV9Nbr5mvqpI8nkReQM,5422
141
141
  ultralytics/models/sam2/model.py,sha256=PS-eV78DVNrGZmUq7L7gJHgrGjxnySM1TTHkwfrQM7E,3408
142
- ultralytics/models/sam2/predict.py,sha256=gvKf6qcStFiT9SLzo8Ol25suIh-QRVcOcdbyeuM2ORw,8894
142
+ ultralytics/models/sam2/predict.py,sha256=I_ZM3oA2-6Y2gjWGJWsDmQeLM51JSVRBZNGzNwRszY4,8636
143
143
  ultralytics/models/sam2/modules/__init__.py,sha256=mHtJuK4hwF8cuV-VHDc7tp6u6D1gHz2Z7JI8grmQDTs,42
144
144
  ultralytics/models/sam2/modules/decoders.py,sha256=t4SR-0g3HQstk-agiapCsVYTMZBFc2vz24zfgBwZUkw,15376
145
145
  ultralytics/models/sam2/modules/encoders.py,sha256=0VRK2wdl0vZzKA3528_j-Vyn4Iy8XlNHp2ftQRn-aGE,13313
@@ -183,7 +183,7 @@ ultralytics/nn/modules/activation.py,sha256=RS0DRDm9r56tojN79X8UBVtiktde9Wasw7GI
183
183
  ultralytics/nn/modules/block.py,sha256=jLXQerl4nXfr4MEGMp9S3YgdTqOJzas1GBxryyXyLV0,34582
184
184
  ultralytics/nn/modules/conv.py,sha256=Ywe87IhuaS22mR2JJ9xjnW8Sb-m7WTjxuqIxV_Dv8lI,12722
185
185
  ultralytics/nn/modules/head.py,sha256=vlp3rMa54kjiuPqP32_RdgOb9KrHItiJx0ih1SFzQec,26853
186
- ultralytics/nn/modules/transformer.py,sha256=8ux2-0ObrafMTYCLucLLVmqk9XWz74bwmWtJGDmgF6Q,18028
186
+ ultralytics/nn/modules/transformer.py,sha256=Lu4WAoIsb8ncM_1-04KSgxFf7oOlQU7RgNfSSmsehr0,18070
187
187
  ultralytics/nn/modules/utils.py,sha256=779QnnKp9v8jv251ESduTXJ0ol8HkIOLbGQWwEGQjhU,3196
188
188
  ultralytics/solutions/__init__.py,sha256=O_G9jh34NnFsHKSA8zcJH0CHtg1Q01JEiRWGwX3vGJY,631
189
189
  ultralytics/solutions/ai_gym.py,sha256=KQdx0RP9t9y1MqYMVlYUSn09SVJSUwKvgxPri_DhczM,4721
@@ -209,15 +209,15 @@ ultralytics/utils/autobatch.py,sha256=POJb9f8dioI7lPGnCc7bdxt0ncftXZa0bvOkip-XoW
209
209
  ultralytics/utils/benchmarks.py,sha256=6tdNcBLATllWpmAMUC6TW7DiCx1VKHhnQN4vkoqN3sE,23866
210
210
  ultralytics/utils/checks.py,sha256=hBkhOinWRzhpA5SbY1v-wCMdFeOemORRlmKBXgwoHYo,28498
211
211
  ultralytics/utils/dist.py,sha256=NDFga-uKxkBX2zLxFHSene_cCiGQJoyOeCXcN9JIOIk,2358
212
- ultralytics/utils/downloads.py,sha256=NB9UDas5f8Rzxt_PS1vDKkSgCxcJ0R_-pjNyZ8E3OUM,21897
212
+ ultralytics/utils/downloads.py,sha256=1ZO23RgotSRP-qo5RVlHkSMCNQnV7UZj0Gm1UqvjTcQ,21898
213
213
  ultralytics/utils/errors.py,sha256=GqP_Jgj_n0paxn8OMhn3DTCgoNkB2WjUcUaqs-M6SQk,816
214
214
  ultralytics/utils/files.py,sha256=TVfY0Wi5IsUc4YdsDzC0dAg-jAP5exYvwqB3VmXhDLY,6761
215
215
  ultralytics/utils/instance.py,sha256=5daM5nkxBv9hr5QzyII8zmuFj24hHuNtcr4EMCHAtpY,15654
216
216
  ultralytics/utils/loss.py,sha256=mDHGmF-gjggAUVhI1dkCm7TtfZHCwz25XKm4M2xJKLs,33916
217
217
  ultralytics/utils/metrics.py,sha256=UXMhBnTtMcpTANxmQqcYkVnj8NeAt39gZez0g6jbrW0,53786
218
- ultralytics/utils/ops.py,sha256=WJHyjyTH8xl5bRkBX0JB3K1sHAGONHx_joubUewE0A8,32709
218
+ ultralytics/utils/ops.py,sha256=hLXY4Nk-dckRvUwT5Jwmc_n5abQimYLuAunFZfuSpy8,32713
219
219
  ultralytics/utils/patches.py,sha256=Oo3DkP7MbXnNGvPfoFSocAkVvaPh9kwMT_9RQUfjVhI,3594
220
- ultralytics/utils/plotting.py,sha256=Bc-8SPs6R1BKMW1V8oVeD-ajMsWP0knAydsoFrB_doU,55522
220
+ ultralytics/utils/plotting.py,sha256=3yFC7uDp7NOPHiLT4TUN7JcsgkPQE71XvhMhbWAmTfo,55519
221
221
  ultralytics/utils/tal.py,sha256=hia39MhWPFpDWOTAXC_5vz-9cUdiRHZs-UcTnxD4Dlo,16112
222
222
  ultralytics/utils/torch_utils.py,sha256=fvt3J2Oh1SgUcjUGSFK8sCKhCp826y6S7NBEiDGZpbI,28985
223
223
  ultralytics/utils/triton.py,sha256=gg1finxno_tY2Ge9PMhmu7PI9wvoFZoiicdT4Bhqv3w,3936
@@ -233,9 +233,9 @@ ultralytics/utils/callbacks/neptune.py,sha256=5Z3ua5YBTUS56FH8VQKQG1aaIo9fH8GEyz
233
233
  ultralytics/utils/callbacks/raytune.py,sha256=ODVYzy-CoM4Uge0zjkh3Hnh9nF2M0vhDrSenXnvcizw,705
234
234
  ultralytics/utils/callbacks/tensorboard.py,sha256=QEgOVhUqY9akOs5TJIwz1Rvn6l32xWLpOxlwEyWF0B8,4136
235
235
  ultralytics/utils/callbacks/wb.py,sha256=9-fjQIdLjr3b73DTE3rHO171KvbH1VweJ-bmbv-rqTw,6747
236
- ultralytics-8.2.71.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
237
- ultralytics-8.2.71.dist-info/METADATA,sha256=neVOnXCAh1rp6O9ps9cdZbw_Pns6ZW0v8_Va4Prqy8k,41337
238
- ultralytics-8.2.71.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
239
- ultralytics-8.2.71.dist-info/entry_points.txt,sha256=YM_wiKyTe9yRrsEfqvYolNO5ngwfoL4-NwgKzc8_7sI,93
240
- ultralytics-8.2.71.dist-info/top_level.txt,sha256=XP49TwiMw4QGsvTLSYiJhz1xF_k7ev5mQ8jJXaXi45Q,12
241
- ultralytics-8.2.71.dist-info/RECORD,,
236
+ ultralytics-8.2.72.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
237
+ ultralytics-8.2.72.dist-info/METADATA,sha256=LGYZMqpyQuiT5ZBm8veVX1TFybGLIXFSDHXKzOjAfGw,41337
238
+ ultralytics-8.2.72.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
239
+ ultralytics-8.2.72.dist-info/entry_points.txt,sha256=YM_wiKyTe9yRrsEfqvYolNO5ngwfoL4-NwgKzc8_7sI,93
240
+ ultralytics-8.2.72.dist-info/top_level.txt,sha256=XP49TwiMw4QGsvTLSYiJhz1xF_k7ev5mQ8jJXaXi45Q,12
241
+ ultralytics-8.2.72.dist-info/RECORD,,