ultralytics 8.1.28__py3-none-any.whl → 8.1.30__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.
ultralytics/__init__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  # Ultralytics YOLO 🚀, AGPL-3.0 license
2
2
 
3
- __version__ = "8.1.28"
3
+ __version__ = "8.1.30"
4
4
 
5
5
  from ultralytics.data.explorer.explorer import Explorer
6
6
  from ultralytics.models import RTDETR, SAM, YOLO, YOLOWorld
@@ -0,0 +1,22 @@
1
+ # Ultralytics YOLO 🚀, AGPL-3.0 license
2
+ # Brain-tumor dataset by Ultralytics
3
+ # Documentation: https://docs.ultralytics.com/datasets/detect/brain-tumor/
4
+ # Example usage: yolo train data=brain-tumor.yaml
5
+ # parent
6
+ # ├── ultralytics
7
+ # └── datasets
8
+ # └── brain-tumor ← downloads here (4.05 MB)
9
+
10
+ # Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
11
+ path: ../datasets/brain-tumor # dataset root dir
12
+ train: train/images # train images (relative to 'path') 893 images
13
+ val: valid/images # val images (relative to 'path') 223 images
14
+ test: # test images (relative to 'path')
15
+
16
+ # Classes
17
+ names:
18
+ 0: negative
19
+ 1: positive
20
+
21
+ # Download script/URL (optional)
22
+ download: https://ultralytics.com/assets/brain-tumor.zip
@@ -124,7 +124,7 @@ class Model(nn.Module):
124
124
  # Check if Ultralytics HUB model from https://hub.ultralytics.com
125
125
  if self.is_hub_model(model):
126
126
  # Fetch model from HUB
127
- checks.check_requirements("hub-sdk>0.0.2")
127
+ checks.check_requirements("hub-sdk>=0.0.5")
128
128
  self.session = self._get_hub_session(model)
129
129
  model = self.session.model_file
130
130
 
@@ -170,10 +170,19 @@ class HUBTrainingSession:
170
170
 
171
171
  return api_key, model_id, filename
172
172
 
173
- def _set_train_args(self, **kwargs):
174
- """Initializes training arguments and creates a model entry on the Ultralytics HUB."""
173
+ def _set_train_args(self):
174
+ """
175
+ Initializes training arguments and creates a model entry on the Ultralytics HUB.
176
+
177
+ This method sets up training arguments based on the model's state and updates them with any additional
178
+ arguments provided. It handles different states of the model, such as whether it's resumable, pretrained,
179
+ or requires specific file setup.
180
+
181
+ Raises:
182
+ ValueError: If the model is already trained, if required dataset information is missing, or if there are
183
+ issues with the provided training arguments.
184
+ """
175
185
  if self.model.is_trained():
176
- # Model is already trained
177
186
  raise ValueError(emojis(f"Model is already trained and uploaded to {self.model_url} 🚀"))
178
187
 
179
188
  if self.model.is_resumable():
@@ -182,26 +191,16 @@ class HUBTrainingSession:
182
191
  self.model_file = self.model.get_weights_url("last")
183
192
  else:
184
193
  # Model has no saved weights
185
- def get_train_args(config):
186
- """Parses an identifier to extract API key, model ID, and filename if applicable."""
187
- return {
188
- "batch": config["batchSize"],
189
- "epochs": config["epochs"],
190
- "imgsz": config["imageSize"],
191
- "patience": config["patience"],
192
- "device": config["device"],
193
- "cache": config["cache"],
194
- "data": self.model.get_dataset_url(),
195
- }
196
-
197
- self.train_args = get_train_args(self.model.data.get("config"))
194
+ self.train_args = self.model.data.get("train_args") # new response
195
+
198
196
  # Set the model file as either a *.pt or *.yaml file
199
197
  self.model_file = (
200
198
  self.model.get_weights_url("parent") if self.model.is_pretrained() else self.model.get_architecture()
201
199
  )
202
200
 
203
- if not self.train_args.get("data"):
204
- raise ValueError("Dataset may still be processing. Please wait a minute and try again.") # RF fix
201
+ if "data" not in self.train_args:
202
+ # RF bug - datasets are sometimes not exported
203
+ raise ValueError("Dataset may still be processing. Please wait a minute and try again.")
205
204
 
206
205
  self.model_file = checks.check_yolov5u_filename(self.model_file, verbose=False) # YOLOv5->YOLOv5u
207
206
  self.model_id = self.model.id
@@ -57,7 +57,7 @@ class DFL(nn.Module):
57
57
 
58
58
  def forward(self, x):
59
59
  """Applies a transformer layer on input tensor 'x' and returns a tensor."""
60
- b, c, a = x.shape # batch, channels, anchors
60
+ b, _, a = x.shape # batch, channels, anchors
61
61
  return self.conv(x.view(b, 4, self.c1, a).transpose(2, 1).softmax(1)).view(b, 4, a)
62
62
  # return self.conv(x.view(b, self.c1, 4, a).softmax(1)).view(b, 4, a)
63
63
 
@@ -43,7 +43,7 @@ def is_url(url, check=True):
43
43
  Defaults to True.
44
44
 
45
45
  Returns:
46
- (bool): Returns True if the string is a valid URL. If 'check' is True, also returns True if the URL exists online.
46
+ (bool): Returns True for a valid URL. If 'check' is True, also returns True if the URL exists online.
47
47
  Returns False otherwise.
48
48
 
49
49
  Example:
@@ -191,12 +191,13 @@ def unzip_file(file, path=None, exclude=(".DS_Store", "__MACOSX"), exist_ok=Fals
191
191
  return path # return unzip dir
192
192
 
193
193
 
194
- def check_disk_space(url="https://ultralytics.com/assets/coco128.zip", sf=1.5, hard=True):
194
+ def check_disk_space(url="https://ultralytics.com/assets/coco128.zip", path=Path.cwd(), sf=1.5, hard=True):
195
195
  """
196
196
  Check if there is sufficient disk space to download and store a file.
197
197
 
198
198
  Args:
199
199
  url (str, optional): The URL to the file. Defaults to 'https://ultralytics.com/assets/coco128.zip'.
200
+ path (str | Path, optional): The path or drive to check the available free space on.
200
201
  sf (float, optional): Safety factor, the multiplier for the required free space. Defaults to 2.0.
201
202
  hard (bool, optional): Whether to throw an error or not on insufficient disk space. Defaults to True.
202
203
 
@@ -212,7 +213,7 @@ def check_disk_space(url="https://ultralytics.com/assets/coco128.zip", sf=1.5, h
212
213
  # Check file size
213
214
  gib = 1 << 30 # bytes per GiB
214
215
  data = int(r.headers.get("Content-Length", 0)) / gib # file size (GB)
215
- total, used, free = (x / gib for x in shutil.disk_usage(Path.cwd())) # bytes
216
+ total, used, free = (x / gib for x in shutil.disk_usage(path)) # bytes
216
217
 
217
218
  if data * sf < free:
218
219
  return True # sufficient space
@@ -319,7 +320,7 @@ def safe_download(
319
320
  desc = f"Downloading {url if gdrive else clean_url(url)} to '{f}'"
320
321
  LOGGER.info(f"{desc}...")
321
322
  f.parent.mkdir(parents=True, exist_ok=True) # make directory if missing
322
- check_disk_space(url)
323
+ check_disk_space(url, path=f.parent)
323
324
  for i in range(retry + 1):
324
325
  try:
325
326
  if curl or i > 0: # curl download with retry, continue
ultralytics/utils/loss.py CHANGED
@@ -140,7 +140,7 @@ class KeypointLoss(nn.Module):
140
140
  d = (pred_kpts[..., 0] - gt_kpts[..., 0]).pow(2) + (pred_kpts[..., 1] - gt_kpts[..., 1]).pow(2)
141
141
  kpt_loss_factor = kpt_mask.shape[1] / (torch.sum(kpt_mask != 0, dim=1) + 1e-9)
142
142
  # e = d / (2 * (area * self.sigmas) ** 2 + 1e-9) # from formula
143
- e = d / (2 * self.sigmas).pow(2) / (area + 1e-9) / 2 # from cocoeval
143
+ e = d / ((2 * self.sigmas).pow(2) * (area + 1e-9) * 2) # from cocoeval
144
144
  return (kpt_loss_factor.view(-1, 1) * ((1 - torch.exp(-e)) * kpt_mask)).mean()
145
145
 
146
146
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ultralytics
3
- Version: 8.1.28
3
+ Version: 8.1.30
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,4 +1,4 @@
1
- ultralytics/__init__.py,sha256=N_MN1oEZmRRJfw3IZEbRfucDpkFS1ka6ZAsZK9MGL4k,625
1
+ ultralytics/__init__.py,sha256=y3rrZQyZ7nf8yoKZN7enFZlfdqblvoOfLg-fRMhep5Q,625
2
2
  ultralytics/assets/bus.jpg,sha256=wCAZxJecGR63Od3ZRERe9Aja1Weayrb9Ug751DS_vGM,137419
3
3
  ultralytics/assets/zidane.jpg,sha256=Ftc4aeMmen1O0A3o6GCDO9FlfBslLpTAw0gnetx7bts,50427
4
4
  ultralytics/cfg/__init__.py,sha256=Dk0UPabXlPX5iCDzqf8MIxCNtY7HMhVRcd_B2tZw9_w,20767
@@ -12,6 +12,7 @@ ultralytics/cfg/datasets/Objects365.yaml,sha256=kiiV4KLMH2mcPPRrg6cQGygnbiTrHxwt
12
12
  ultralytics/cfg/datasets/SKU-110K.yaml,sha256=geRkccBRl2eKgfNYTOPYwD9mTfqktTBGiMJoE3PZEnA,2493
13
13
  ultralytics/cfg/datasets/VOC.yaml,sha256=3-CDpjIq_s5pkbsJ9TjrYIeV24rYGuJGu4Qg6uktEZE,3655
14
14
  ultralytics/cfg/datasets/VisDrone.yaml,sha256=NfrbjVnE48E7TPbxtF7rtQHvVBO0DchFJFEuGrG1VRU,3073
15
+ ultralytics/cfg/datasets/brain-tumor.yaml,sha256=o1rX1_iw97HjiG904l4u42x13jyHOGvfmWEzz0BpOZg,795
15
16
  ultralytics/cfg/datasets/carparts-seg.yaml,sha256=pvTi3EH2j6UuG0LHoQJ7JjQv_cJoO8UKSXPptUTnl8U,1207
16
17
  ultralytics/cfg/datasets/coco-pose.yaml,sha256=w7H-J2e87GIV_PZdRDgqEFa75ObScpBK_l85U4ZMsMo,1603
17
18
  ultralytics/cfg/datasets/coco.yaml,sha256=xbim-GcWpvF_uwlStjbPjxXFhVfL0U_WNQI99b5gjdY,2584
@@ -74,7 +75,7 @@ ultralytics/data/explorer/gui/__init__.py,sha256=mHtJuK4hwF8cuV-VHDc7tp6u6D1gHz2
74
75
  ultralytics/data/explorer/gui/dash.py,sha256=a2s8oJKI8kqnWEcIyqCCzvIyvM_uZmfMaxrOdwmiq7k,10044
75
76
  ultralytics/engine/__init__.py,sha256=mHtJuK4hwF8cuV-VHDc7tp6u6D1gHz2Z7JI8grmQDTs,42
76
77
  ultralytics/engine/exporter.py,sha256=pwTQCo88Sd41NqYKx5Jp15fSqhFgaY3Z5gfLm8uzLR0,53882
77
- ultralytics/engine/model.py,sha256=Kh5Bs3Rq6xJnpwCBtKFonNBLXYScg81uhj6zXx16bBw,39193
78
+ ultralytics/engine/model.py,sha256=SD9bLH30PGqnIxXT1uxgHu5xlrgca8jV2luErK9Fh8w,39194
78
79
  ultralytics/engine/predictor.py,sha256=wQRKdWGDTP5A6CS0gTC6U3RPDMhP3QkEzWSPm6eqCkU,17022
79
80
  ultralytics/engine/results.py,sha256=SY3sn2OBMfAFaPoaDKo0Wu-jSi7avISYohjtR_bur9M,30120
80
81
  ultralytics/engine/trainer.py,sha256=C04cEN9v-kvR2dIIjgAN8dBAx8XSTChlQkDxAxfwTlU,34527
@@ -82,7 +83,7 @@ ultralytics/engine/tuner.py,sha256=DzgTH3uk-VUUVoJ0K3tM4N5TJ6A3fMNlcDYr5g2I9lA,1
82
83
  ultralytics/engine/validator.py,sha256=rcmJSGrsAfj-ryQktv6-fe0hAT7Z8CLNhUUUf0VsPYI,14645
83
84
  ultralytics/hub/__init__.py,sha256=hNKAjBFZAi8_ZYasurDpDMlEOmFw0GrXCV7kLb2A-zE,5068
84
85
  ultralytics/hub/auth.py,sha256=hc97pJ01OfI8oQ7uw3ubKbiVCDSGxSGJHoo9W6hrrNw,5403
85
- ultralytics/hub/session.py,sha256=DXPQcPHFS84DlSbXnsfwUfCgjv5W4F3ioA7ADMWzm7w,14703
86
+ ultralytics/hub/session.py,sha256=kFwufDIY7TeV79DdEQBKYrU5883WxgCrpJoTr1S5QuE,14649
86
87
  ultralytics/hub/utils.py,sha256=BoqNvi7yLUGrTNVEugFALhJkmpobW87gMVZ2dzDckRk,9734
87
88
  ultralytics/models/__init__.py,sha256=xrzn2dcLBG6Ujxll8LtlTIblPar2gjNhAwjAQg7u8sk,197
88
89
  ultralytics/models/fastsam/__init__.py,sha256=0dt65jZ_5b7Q-mdXN8MSEkgnFRA0FIwlel_LS2RaOlU,254
@@ -140,7 +141,7 @@ ultralytics/nn/__init__.py,sha256=4BPLHY89xEM_al5uK0aOmFgiML6CMGEZbezxOvTjOEs,58
140
141
  ultralytics/nn/autobackend.py,sha256=guDUpClKObK2Bwl4NH0C3EDVl3UEOvqRn1mr3c3j9Gs,29021
141
142
  ultralytics/nn/tasks.py,sha256=JuXiYgnZBDC51MNTsaeSjz8H1ohio1Mx58l0EjdTm8c,42674
142
143
  ultralytics/nn/modules/__init__.py,sha256=Ga3MDpwX6DeI7VSH8joti5uleP4mgkQGolbe8RLZ2T8,2326
143
- ultralytics/nn/modules/block.py,sha256=yCHgCQTs2pIzCr7zqMJs8UF-3DM0-8X99k9vkEjv1ZA,25589
144
+ ultralytics/nn/modules/block.py,sha256=n0ilrK3Vjdoc9-OwvY_Bp8Hw5N2BMHwgt-jfH4CzxFQ,25589
144
145
  ultralytics/nn/modules/conv.py,sha256=ndUYNL2f9DK41y1vVbtEusMByXy-LMMsBKlcWjRQ9Z8,12722
145
146
  ultralytics/nn/modules/head.py,sha256=LonV2b7TrLx-zKhHQ2fCpKg7BfC-tUBtPlS5NNcfT_w,21728
146
147
  ultralytics/nn/modules/transformer.py,sha256=AxD9uURpCl-EqvXe3DiG6JW-pBzB16G-AahLdZ7yayo,17909
@@ -165,11 +166,11 @@ ultralytics/utils/autobatch.py,sha256=ygZ3f2ByIkcujB89ENcTnGWWnAQw5Pbg6nBuShg-5t
165
166
  ultralytics/utils/benchmarks.py,sha256=cj_sztcI-hzfvRX8vzfXo4wmQe2CuQUcDHBO9THBbco,18285
166
167
  ultralytics/utils/checks.py,sha256=eTgj9HBxo677iehOrkIaiCRfeERRJhWAHHGmIPYntvQ,27815
167
168
  ultralytics/utils/dist.py,sha256=3HeNbY2gp7vYhcvVhsrvTrQXpQmgT8tpmnzApf3eQRA,2267
168
- ultralytics/utils/downloads.py,sha256=Ii___evL54nXxwGdp_n4J8T-OVhQ4_xOavbDb-rdC5U,21389
169
+ ultralytics/utils/downloads.py,sha256=KfGCmL1lwetMOZTYqvz-NkIdIA8fxFYxBGxF3-leZQ0,21495
169
170
  ultralytics/utils/errors.py,sha256=GqP_Jgj_n0paxn8OMhn3DTCgoNkB2WjUcUaqs-M6SQk,816
170
171
  ultralytics/utils/files.py,sha256=TVfY0Wi5IsUc4YdsDzC0dAg-jAP5exYvwqB3VmXhDLY,6761
171
172
  ultralytics/utils/instance.py,sha256=fPClvPPtTk8VeXWiRv90DrFk1j1lTUKdYJtpZKUDDtA,15575
172
- ultralytics/utils/loss.py,sha256=gcy-GzSSslYNpsddVtLahcSRMVmcXyz_MsOWXQYqIx0,32698
173
+ ultralytics/utils/loss.py,sha256=po6fmQzz1JxfGpte6hHkwOC7ECynsceqtgbUWLXVfxw,32700
173
174
  ultralytics/utils/metrics.py,sha256=_9ZxwK0H6pm_LsZXyC3tY1Dm_57YGDdP3sKSMZStqU0,53465
174
175
  ultralytics/utils/ops.py,sha256=GFe_tx8MVKT56xelbAuQjiJ28ohpzARpD6BzGyJ1yMk,33264
175
176
  ultralytics/utils/patches.py,sha256=SgMqeMsq2K6JoBJP1NplXMl9C6rK0JeJUChjBrJOneo,2750
@@ -189,9 +190,9 @@ ultralytics/utils/callbacks/neptune.py,sha256=5Z3ua5YBTUS56FH8VQKQG1aaIo9fH8GEyz
189
190
  ultralytics/utils/callbacks/raytune.py,sha256=6OgGNuC35F29lw8Dl_d0lue4-iBR6dqrBVQnIRQDx4E,632
190
191
  ultralytics/utils/callbacks/tensorboard.py,sha256=hRmWjbqdA4RNaLuSZznuDcpOBW-_-_Ga0u-B8UU-7ZI,4134
191
192
  ultralytics/utils/callbacks/wb.py,sha256=4QI81nHdzgwhXHlmTiRxLqunvkKakLXYUhHTUY1ZeHA,6635
192
- ultralytics-8.1.28.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
193
- ultralytics-8.1.28.dist-info/METADATA,sha256=z5ZtAppwngXhq_KIKb8DQ0b3Pp7v-OyHgqdLF2e2Rak,40330
194
- ultralytics-8.1.28.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
195
- ultralytics-8.1.28.dist-info/entry_points.txt,sha256=YM_wiKyTe9yRrsEfqvYolNO5ngwfoL4-NwgKzc8_7sI,93
196
- ultralytics-8.1.28.dist-info/top_level.txt,sha256=XP49TwiMw4QGsvTLSYiJhz1xF_k7ev5mQ8jJXaXi45Q,12
197
- ultralytics-8.1.28.dist-info/RECORD,,
193
+ ultralytics-8.1.30.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
194
+ ultralytics-8.1.30.dist-info/METADATA,sha256=jcr1FoTfvyZJje_RUgRa9cLOykDJET_PeiwWrYg70Ys,40330
195
+ ultralytics-8.1.30.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
196
+ ultralytics-8.1.30.dist-info/entry_points.txt,sha256=YM_wiKyTe9yRrsEfqvYolNO5ngwfoL4-NwgKzc8_7sI,93
197
+ ultralytics-8.1.30.dist-info/top_level.txt,sha256=XP49TwiMw4QGsvTLSYiJhz1xF_k7ev5mQ8jJXaXi45Q,12
198
+ ultralytics-8.1.30.dist-info/RECORD,,