dgenerate-ultralytics-headless 8.3.196__py3-none-any.whl → 8.3.197__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.
- {dgenerate_ultralytics_headless-8.3.196.dist-info → dgenerate_ultralytics_headless-8.3.197.dist-info}/METADATA +1 -1
- {dgenerate_ultralytics_headless-8.3.196.dist-info → dgenerate_ultralytics_headless-8.3.197.dist-info}/RECORD +19 -18
- ultralytics/__init__.py +1 -1
- ultralytics/cfg/datasets/construction-ppe.yaml +32 -0
- ultralytics/engine/exporter.py +1 -0
- ultralytics/engine/model.py +1 -2
- ultralytics/engine/trainer.py +4 -6
- ultralytics/models/yolo/detect/train.py +0 -5
- ultralytics/models/yolo/pose/train.py +0 -1
- ultralytics/models/yolo/segment/train.py +0 -1
- ultralytics/models/yolo/segment/val.py +4 -4
- ultralytics/nn/modules/head.py +1 -2
- ultralytics/utils/loss.py +1 -2
- ultralytics/utils/nms.py +3 -1
- ultralytics/utils/torch_utils.py +0 -22
- {dgenerate_ultralytics_headless-8.3.196.dist-info → dgenerate_ultralytics_headless-8.3.197.dist-info}/WHEEL +0 -0
- {dgenerate_ultralytics_headless-8.3.196.dist-info → dgenerate_ultralytics_headless-8.3.197.dist-info}/entry_points.txt +0 -0
- {dgenerate_ultralytics_headless-8.3.196.dist-info → dgenerate_ultralytics_headless-8.3.197.dist-info}/licenses/LICENSE +0 -0
- {dgenerate_ultralytics_headless-8.3.196.dist-info → dgenerate_ultralytics_headless-8.3.197.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: dgenerate-ultralytics-headless
|
3
|
-
Version: 8.3.
|
3
|
+
Version: 8.3.197
|
4
4
|
Summary: Automatically built Ultralytics package with python-opencv-headless dependency instead of python-opencv
|
5
5
|
Author-email: Glenn Jocher <glenn.jocher@ultralytics.com>, Jing Qiu <jing.qiu@ultralytics.com>
|
6
6
|
Maintainer-email: Ultralytics <hello@ultralytics.com>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
dgenerate_ultralytics_headless-8.3.
|
1
|
+
dgenerate_ultralytics_headless-8.3.197.dist-info/licenses/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
|
2
2
|
tests/__init__.py,sha256=b4KP5_q-2IO8Br8YHOSLYnn7IwZS81l_vfEF2YPa2lM,894
|
3
3
|
tests/conftest.py,sha256=LXtQJcFNWPGuzauTGkiXgsvVC3llJKfg22WcmhRzuQc,2593
|
4
4
|
tests/test_cli.py,sha256=EMf5gTAopOnIz8VvzaM-Qb044o7D0flnUHYQ-2ffOM4,5670
|
@@ -8,7 +8,7 @@ tests/test_exports.py,sha256=dWuroSyqXnrc0lE-RNTf7pZoXXXEkOs31u7nhOiEHS0,10994
|
|
8
8
|
tests/test_integrations.py,sha256=kl_AKmE_Qs1GB0_91iVwbzNxofm_hFTt0zzU6JF-pg4,6323
|
9
9
|
tests/test_python.py,sha256=2V23f2-JQsO-K4p1kj0IkCRxHykGwgd0edKJzRsBgdI,27911
|
10
10
|
tests/test_solutions.py,sha256=6wJ9-lhyWSAm7zaR4D9L_DrUA3iJU1NgqmbQO6PIuvo,13211
|
11
|
-
ultralytics/__init__.py,sha256=
|
11
|
+
ultralytics/__init__.py,sha256=z_P4EQKfcjM3hGCrxHHRLjWiIR1SU0oCaCjU9htTGDE,730
|
12
12
|
ultralytics/py.typed,sha256=la67KBlbjXN-_-DfGNcdOcjYumVpKG_Tkw-8n5dnGB4,8
|
13
13
|
ultralytics/assets/bus.jpg,sha256=wCAZxJecGR63Od3ZRERe9Aja1Weayrb9Ug751DS_vGM,137419
|
14
14
|
ultralytics/assets/zidane.jpg,sha256=Ftc4aeMmen1O0A3o6GCDO9FlfBslLpTAw0gnetx7bts,50427
|
@@ -36,6 +36,7 @@ ultralytics/cfg/datasets/coco8-multispectral.yaml,sha256=nlU4W0d8rl1cVChthOk0NIm
|
|
36
36
|
ultralytics/cfg/datasets/coco8-pose.yaml,sha256=GfSONSl-Oh4QErto91E_ws3im9ZTEYmDMaPOaSLLdV8,1009
|
37
37
|
ultralytics/cfg/datasets/coco8-seg.yaml,sha256=Ez42ZE6xHlj8lcjtMBJJP2Y460q2BuiwRfk090XnBgE,1913
|
38
38
|
ultralytics/cfg/datasets/coco8.yaml,sha256=tzrDY1KW82AHsgpCxte_yPkgMIIpNY6Pb4F46TDPxkk,1888
|
39
|
+
ultralytics/cfg/datasets/construction-ppe.yaml,sha256=pSU9yaAXV369EYQJymNtFQbS_XH4V369gPKKjDrb4ho,1008
|
39
40
|
ultralytics/cfg/datasets/crack-seg.yaml,sha256=fqvSIq1fRXO55V_g2T92hcYAVoKBHZsSZQR7CokoPUI,837
|
40
41
|
ultralytics/cfg/datasets/dog-pose.yaml,sha256=sRU1JDtEC4nLVf2vkn7lxbp4ILWNcgE-ok96rxZv2lc,908
|
41
42
|
ultralytics/cfg/datasets/dota8-multispectral.yaml,sha256=2lMBi1Q3_pc0auK00yX80oF7oUMo0bUlwjkOrp33hvs,1216
|
@@ -121,11 +122,11 @@ ultralytics/data/scripts/get_coco.sh,sha256=UuJpJeo3qQpTHVINeOpmP0NYmg8PhEFE3A8J
|
|
121
122
|
ultralytics/data/scripts/get_coco128.sh,sha256=qmRQl_hOKrsdHrTrnyQuFIH01oDz3lfaz138OgGfLt8,650
|
122
123
|
ultralytics/data/scripts/get_imagenet.sh,sha256=hr42H16bM47iT27rgS7MpEo-GeOZAYUQXgr0B2cwn48,1705
|
123
124
|
ultralytics/engine/__init__.py,sha256=lm6MckFYCPTbqIoX7w0s_daxdjNeBeKW6DXppv1-QUM,70
|
124
|
-
ultralytics/engine/exporter.py,sha256=
|
125
|
-
ultralytics/engine/model.py,sha256=
|
125
|
+
ultralytics/engine/exporter.py,sha256=K4Ga3CSt7mFEgbnOAIe0fvztfJDkDOFrROC21WqMGN8,75004
|
126
|
+
ultralytics/engine/model.py,sha256=iwwaL2NR5NSwQ7R3juHzS3ds9W-CfhC_CjUcwMvcgsk,53426
|
126
127
|
ultralytics/engine/predictor.py,sha256=510VPYcYmEYPJmBiApQLGaFFAL4gd79rVzPCwisH7LE,22745
|
127
128
|
ultralytics/engine/results.py,sha256=BmhePCaaTBfYrJT12t6bywZuZ_7h3tIc4IsRFuyNTdk,71499
|
128
|
-
ultralytics/engine/trainer.py,sha256=
|
129
|
+
ultralytics/engine/trainer.py,sha256=4DFtGOS6II6vD7tUPNgSK45DgzFjUSkPRvpnXijs4Ew,40914
|
129
130
|
ultralytics/engine/tuner.py,sha256=XuqcjyGpD79pUVn-PXlJJGKXgH1yblPdYBH_R2kHWSU,20586
|
130
131
|
ultralytics/engine/validator.py,sha256=7tADPOXRZz0Yi7F-Z5SxcUnwytaa2MfbtuSdO8pp_l4,16966
|
131
132
|
ultralytics/hub/__init__.py,sha256=xCF02lzlPKbdmGfO3NxLuXl5Kb0MaBZp_-fAWDHZ8zw,6698
|
@@ -173,7 +174,7 @@ ultralytics/models/yolo/classify/train.py,sha256=CXi8ZrVqYtqlzRbg3UP5kOyMYXAM4We
|
|
173
174
|
ultralytics/models/yolo/classify/val.py,sha256=6_-pbnb0skASJCqsar6_i3FyvfKNJwZ7Y8AK7wzySIU,10039
|
174
175
|
ultralytics/models/yolo/detect/__init__.py,sha256=GIRsLYR-kT4JJx7lh4ZZAFGBZj0aebokuU0A7JbjDVA,257
|
175
176
|
ultralytics/models/yolo/detect/predict.py,sha256=v4u3azp2zQxJKJ4L198gGIgkL7CN-6qGg1B7ypBxxbM,5390
|
176
|
-
ultralytics/models/yolo/detect/train.py,sha256=
|
177
|
+
ultralytics/models/yolo/detect/train.py,sha256=8t_dou6LKE_Td71cDdRUzEVaXMipOYUv1mcnfspDqyI,10749
|
177
178
|
ultralytics/models/yolo/detect/val.py,sha256=OG38-x3LyCAeH3UY9jOG4axK7mfnVnTwaKpjMzQi07I,21309
|
178
179
|
ultralytics/models/yolo/obb/__init__.py,sha256=tQmpG8wVHsajWkZdmD6cjGohJ4ki64iSXQT8JY_dydo,221
|
179
180
|
ultralytics/models/yolo/obb/predict.py,sha256=4r1eSld6TNJlk9JG56e-DX6oPL8uBBqiuztyBpxWlHE,2888
|
@@ -181,12 +182,12 @@ ultralytics/models/yolo/obb/train.py,sha256=BbehrsKP0lHRV3v7rrw8wAeiDdc-szbhHAmD
|
|
181
182
|
ultralytics/models/yolo/obb/val.py,sha256=ZNjdI5dF-igZCqJadAUb5VPTevI5i47G-bPTG8wV-CY,14171
|
182
183
|
ultralytics/models/yolo/pose/__init__.py,sha256=63xmuHZLNzV8I76HhVXAq4f2W0KTk8Oi9eL-Y204LyQ,227
|
183
184
|
ultralytics/models/yolo/pose/predict.py,sha256=M0C7ZfVXx4QXgv-szjnaXYEPas76ZLGAgDNNh1GG0vI,3743
|
184
|
-
ultralytics/models/yolo/pose/train.py,sha256=
|
185
|
+
ultralytics/models/yolo/pose/train.py,sha256=WdCEgbdxKvPEH-81tF-pNjrXHck7uTlqUONyKVxq_n4,5004
|
185
186
|
ultralytics/models/yolo/pose/val.py,sha256=U4tMWbHpCjspJ6i5DbNUav05RFCvwvfD1mjejqJIJ1c,12638
|
186
187
|
ultralytics/models/yolo/segment/__init__.py,sha256=3IThhZ1wlkY9FvmWm9cE-5-ZyE6F1FgzAtQ6jOOFzzw,275
|
187
188
|
ultralytics/models/yolo/segment/predict.py,sha256=zxMc1QvsQoJxm6VSbbZQ3pChvq1VbYSf7p8RX3RbPNg,5377
|
188
|
-
ultralytics/models/yolo/segment/train.py,sha256=
|
189
|
-
ultralytics/models/yolo/segment/val.py,sha256=
|
189
|
+
ultralytics/models/yolo/segment/train.py,sha256=Om8snA0fOvddFVZNHrUYfu4admJXxmsVlMQAKOnkwpk,3253
|
190
|
+
ultralytics/models/yolo/segment/val.py,sha256=oyiscSgMWdfmbdNJrumnPoSX6-gZXMx4XnfbX5Hc-RY,11158
|
190
191
|
ultralytics/models/yolo/world/__init__.py,sha256=nlh8I6t8hMGz_vZg8QSlsUW1R-2eKvn9CGUoPPQEGhA,131
|
191
192
|
ultralytics/models/yolo/world/train.py,sha256=zVPtVoBedberGkth3tPuIH665HjGNJvTMLw_wLZQM84,7870
|
192
193
|
ultralytics/models/yolo/world/train_world.py,sha256=9p9YIckrATaJjGOrpmuC8MbZX9qdoCPCEV9EGZ0sExg,9553
|
@@ -203,7 +204,7 @@ ultralytics/nn/modules/__init__.py,sha256=BPMbEm1daI7Tuds3zph2_afAX7Gq1uAqK8BfiC
|
|
203
204
|
ultralytics/nn/modules/activation.py,sha256=75JcIMH2Cu9GTC2Uf55r_5YLpxcrXQDaVoeGQ0hlUAU,2233
|
204
205
|
ultralytics/nn/modules/block.py,sha256=nIIOTEuikiVWELuOt2VyfXPpvof9p4qNSdaQzq5WlCg,70618
|
205
206
|
ultralytics/nn/modules/conv.py,sha256=U6P1ZuzQmIf09noKwp7syuWn-M98Tly2wMWOsDT3kOI,21457
|
206
|
-
ultralytics/nn/modules/head.py,sha256=
|
207
|
+
ultralytics/nn/modules/head.py,sha256=7-WuatR32jpuqR5IhwHuheAwAn_izX7e7cPOHEg7MmI,53556
|
207
208
|
ultralytics/nn/modules/transformer.py,sha256=l6NuuFF7j_bogcNULHBBdj5l6sf7MwiVEGz8XcRyTUM,31366
|
208
209
|
ultralytics/nn/modules/utils.py,sha256=rn8yTObZGkQoqVzjbZWLaHiytppG4ffjMME4Lw60glM,6092
|
209
210
|
ultralytics/solutions/__init__.py,sha256=ZoeAQavTLp8aClnhZ9tbl6lxy86GxofyGvZWTx2aWkI,1209
|
@@ -251,14 +252,14 @@ ultralytics/utils/files.py,sha256=kxE2rkBuZL288nSN7jxLljmDnBgc16rekEXeRjhbUoo,82
|
|
251
252
|
ultralytics/utils/git.py,sha256=DcaxKNQfCiG3cxdzuw7M6l_VXgaSVqkERQt_vl8UyXM,5512
|
252
253
|
ultralytics/utils/instance.py,sha256=_b_jMTECWJGzncCiTg7FtTDSSeXGnbiAhaJhIsqbn9k,19043
|
253
254
|
ultralytics/utils/logger.py,sha256=o_vH4CCgQat6_Sbmwm1sUAJ4muAgVcsUed-WqpGNQZw,15129
|
254
|
-
ultralytics/utils/loss.py,sha256=
|
255
|
+
ultralytics/utils/loss.py,sha256=wJ0F2DpRTI9-e9adxIm2io0zcXRa0RTWFTOc7WmS1-A,39827
|
255
256
|
ultralytics/utils/metrics.py,sha256=xFlSqx_su96LAUpxfGP7ShEG50Qo5p5OtwR3hx4_Llc,68809
|
256
|
-
ultralytics/utils/nms.py,sha256=
|
257
|
+
ultralytics/utils/nms.py,sha256=4EdGNSkl8-AjMkghnuPQZR0lsZOW416bYfVsA9ZUOeU,14323
|
257
258
|
ultralytics/utils/ops.py,sha256=PW3fgw1d18CA2ZNQZVJqUy054cJ_9tIcxd1XnA0FPgU,26905
|
258
259
|
ultralytics/utils/patches.py,sha256=0-2G4jXCIPnMonlft-cPcjfFcOXQS6ODwUDNUwanfg4,6541
|
259
260
|
ultralytics/utils/plotting.py,sha256=rumZLvfLX1bE9xQS7Gk13kVM7AmIxQOmQ5CAmhsdxCE,47531
|
260
261
|
ultralytics/utils/tal.py,sha256=LrziY_ZHz4wln3oOnqAzgyPaXKoup17Sa103BpuaQFU,20935
|
261
|
-
ultralytics/utils/torch_utils.py,sha256=
|
262
|
+
ultralytics/utils/torch_utils.py,sha256=tEhRGVPaKKtVeDpN1K171up585DNe19un8y1ri70Zn8,42869
|
262
263
|
ultralytics/utils/tqdm.py,sha256=ny5RIg2OTkWQ7gdaXfYaoIgR0Xn2_hNGB6tUpO2Unns,16137
|
263
264
|
ultralytics/utils/triton.py,sha256=fbMfTAUyoGiyslWtySzLZw53XmZJa7rF31CYFot0Wjs,5422
|
264
265
|
ultralytics/utils/tuner.py,sha256=9D4dSIvwwxcNSJcH2QJ92qiIVi9zu-1L7_PBZ8okDyE,6816
|
@@ -274,8 +275,8 @@ ultralytics/utils/callbacks/platform.py,sha256=a7T_8htoBB0uX1WIc392UJnhDjxkRyQMv
|
|
274
275
|
ultralytics/utils/callbacks/raytune.py,sha256=S6Bq16oQDQ8BQgnZzA0zJHGN_BBr8iAM_WtGoLiEcwg,1283
|
275
276
|
ultralytics/utils/callbacks/tensorboard.py,sha256=_4nfGK1dDLn6ijpvphBDhc-AS8qhS3jjY2CAWB7SNF0,5283
|
276
277
|
ultralytics/utils/callbacks/wb.py,sha256=ngQO8EJ1kxJDF1YajScVtzBbm26jGuejA0uWeOyvf5A,7685
|
277
|
-
dgenerate_ultralytics_headless-8.3.
|
278
|
-
dgenerate_ultralytics_headless-8.3.
|
279
|
-
dgenerate_ultralytics_headless-8.3.
|
280
|
-
dgenerate_ultralytics_headless-8.3.
|
281
|
-
dgenerate_ultralytics_headless-8.3.
|
278
|
+
dgenerate_ultralytics_headless-8.3.197.dist-info/METADATA,sha256=LO-Iy0jayzeS_fMEpyLds-iEYrajoYgxFYJasvkoOAc,38763
|
279
|
+
dgenerate_ultralytics_headless-8.3.197.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
280
|
+
dgenerate_ultralytics_headless-8.3.197.dist-info/entry_points.txt,sha256=YM_wiKyTe9yRrsEfqvYolNO5ngwfoL4-NwgKzc8_7sI,93
|
281
|
+
dgenerate_ultralytics_headless-8.3.197.dist-info/top_level.txt,sha256=XP49TwiMw4QGsvTLSYiJhz1xF_k7ev5mQ8jJXaXi45Q,12
|
282
|
+
dgenerate_ultralytics_headless-8.3.197.dist-info/RECORD,,
|
ultralytics/__init__.py
CHANGED
@@ -0,0 +1,32 @@
|
|
1
|
+
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
|
2
|
+
|
3
|
+
# Construction-PPE dataset by Ultralytics
|
4
|
+
# Documentation: https://docs.ultralytics.com/datasets/detect/construction-ppe/
|
5
|
+
# Example usage: yolo train data=construction-ppe.yaml
|
6
|
+
# parent
|
7
|
+
# ├── ultralytics
|
8
|
+
# └── datasets
|
9
|
+
# └── construction-ppe ← downloads here (178.4 MB)
|
10
|
+
|
11
|
+
# 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, ..]
|
12
|
+
path: construction-ppe # dataset root dir
|
13
|
+
train: images/train # train images (relative to 'path') 1132 images
|
14
|
+
val: images/val # val images (relative to 'path') 143 images
|
15
|
+
test: images/test # test images (relative to 'path') 141 images
|
16
|
+
|
17
|
+
# Classes
|
18
|
+
names:
|
19
|
+
0: helmet
|
20
|
+
1: gloves
|
21
|
+
2: vest
|
22
|
+
3: boots
|
23
|
+
4: goggles
|
24
|
+
5: none
|
25
|
+
6: Person
|
26
|
+
7: no_helmet
|
27
|
+
8: no_goggle
|
28
|
+
9: no_gloves
|
29
|
+
10: no_boots
|
30
|
+
|
31
|
+
# Download script/URL (optional)
|
32
|
+
download: https://github.com/ultralytics/assets/releases/download/v0.0.0/construction-ppe.zip
|
ultralytics/engine/exporter.py
CHANGED
ultralytics/engine/model.py
CHANGED
@@ -788,7 +788,7 @@ class Model(torch.nn.Module):
|
|
788
788
|
"model": self.overrides["model"],
|
789
789
|
"task": self.task,
|
790
790
|
} # method defaults
|
791
|
-
args = {**overrides, **custom, **kwargs, "mode": "train"} #
|
791
|
+
args = {**overrides, **custom, **kwargs, "mode": "train", "session": self.session} # prioritizes rightmost args
|
792
792
|
if args.get("resume"):
|
793
793
|
args["resume"] = self.ckpt_path
|
794
794
|
|
@@ -797,7 +797,6 @@ class Model(torch.nn.Module):
|
|
797
797
|
self.trainer.model = self.trainer.get_model(weights=self.model if self.ckpt else None, cfg=self.model.yaml)
|
798
798
|
self.model = self.trainer.model
|
799
799
|
|
800
|
-
self.trainer.hub_session = self.session # attach optional HUB session
|
801
800
|
self.trainer.train()
|
802
801
|
# Update model and cfg after training
|
803
802
|
if RANK in {-1, 0}:
|
ultralytics/engine/trainer.py
CHANGED
@@ -119,6 +119,7 @@ class BaseTrainer:
|
|
119
119
|
overrides (dict, optional): Configuration overrides.
|
120
120
|
_callbacks (list, optional): List of callback functions.
|
121
121
|
"""
|
122
|
+
self.hub_session = overrides.pop("session", None) # HUB
|
122
123
|
self.args = get_cfg(cfg, overrides)
|
123
124
|
self.check_resume(overrides)
|
124
125
|
self.device = select_device(self.args.device, self.args.batch)
|
@@ -170,9 +171,6 @@ class BaseTrainer:
|
|
170
171
|
self.csv = self.save_dir / "results.csv"
|
171
172
|
self.plot_idx = [0, 1, 2]
|
172
173
|
|
173
|
-
# HUB
|
174
|
-
self.hub_session = None
|
175
|
-
|
176
174
|
# Callbacks
|
177
175
|
self.callbacks = _callbacks or callbacks.get_default_callbacks()
|
178
176
|
if RANK in {-1, 0}:
|
@@ -414,8 +412,9 @@ class BaseTrainer:
|
|
414
412
|
# Forward
|
415
413
|
with autocast(self.amp):
|
416
414
|
batch = self.preprocess_batch(batch)
|
417
|
-
|
418
|
-
|
415
|
+
# decouple inference and loss calculations for torch.compile convenience
|
416
|
+
preds = self.model(batch["img"])
|
417
|
+
loss, self.loss_items = self.model.loss(batch, preds)
|
419
418
|
self.loss = loss.sum()
|
420
419
|
if RANK != -1:
|
421
420
|
self.loss *= world_size
|
@@ -456,7 +455,6 @@ class BaseTrainer:
|
|
456
455
|
)
|
457
456
|
self.run_callbacks("on_batch_end")
|
458
457
|
if self.args.plots and ni in self.plot_idx:
|
459
|
-
batch = {**batch, **metadata}
|
460
458
|
self.plot_training_samples(batch, ni)
|
461
459
|
|
462
460
|
self.run_callbacks("on_train_batch_end")
|
@@ -64,7 +64,6 @@ class DetectionTrainer(BaseTrainer):
|
|
64
64
|
_callbacks (list, optional): List of callback functions to be executed during training.
|
65
65
|
"""
|
66
66
|
super().__init__(cfg, overrides, _callbacks)
|
67
|
-
self.dynamic_tensors = ["batch_idx", "cls", "bboxes"]
|
68
67
|
|
69
68
|
def build_dataset(self, img_path: str, mode: str = "train", batch: int | None = None):
|
70
69
|
"""
|
@@ -138,10 +137,6 @@ class DetectionTrainer(BaseTrainer):
|
|
138
137
|
] # new shape (stretched to gs-multiple)
|
139
138
|
imgs = nn.functional.interpolate(imgs, size=ns, mode="bilinear", align_corners=False)
|
140
139
|
batch["img"] = imgs
|
141
|
-
|
142
|
-
if self.args.compile:
|
143
|
-
for k in self.dynamic_tensors:
|
144
|
-
torch._dynamo.maybe_mark_dynamic(batch[k], 0)
|
145
140
|
return batch
|
146
141
|
|
147
142
|
def set_model_attributes(self):
|
@@ -57,7 +57,6 @@ class PoseTrainer(yolo.detect.DetectionTrainer):
|
|
57
57
|
overrides = {}
|
58
58
|
overrides["task"] = "pose"
|
59
59
|
super().__init__(cfg, overrides, _callbacks)
|
60
|
-
self.dynamic_tensors = ["batch_idx", "cls", "bboxes", "keypoints"]
|
61
60
|
|
62
61
|
if isinstance(self.args.device, str) and self.args.device.lower() == "mps":
|
63
62
|
LOGGER.warning(
|
@@ -41,7 +41,6 @@ class SegmentationTrainer(yolo.detect.DetectionTrainer):
|
|
41
41
|
overrides = {}
|
42
42
|
overrides["task"] = "segment"
|
43
43
|
super().__init__(cfg, overrides, _callbacks)
|
44
|
-
self.dynamic_tensors = ["batch_idx", "cls", "bboxes", "masks"]
|
45
44
|
|
46
45
|
def get_model(self, cfg: dict | str | None = None, weights: str | Path | None = None, verbose: bool = True):
|
47
46
|
"""
|
@@ -187,10 +187,10 @@ class SegmentationValidator(DetectionValidator):
|
|
187
187
|
"""
|
188
188
|
for p in preds:
|
189
189
|
masks = p["masks"]
|
190
|
-
if masks.shape[0] >
|
191
|
-
LOGGER.warning("Limiting validation plots to
|
192
|
-
p["masks"] = torch.as_tensor(masks[:
|
193
|
-
super().plot_predictions(batch, preds, ni, max_det=
|
190
|
+
if masks.shape[0] > self.args.max_det:
|
191
|
+
LOGGER.warning(f"Limiting validation plots to 'max_det={self.args.max_det}' items.")
|
192
|
+
p["masks"] = torch.as_tensor(masks[: self.args.max_det], dtype=torch.uint8).cpu()
|
193
|
+
super().plot_predictions(batch, preds, ni, max_det=self.args.max_det) # plot bboxes
|
194
194
|
|
195
195
|
def save_one_txt(self, predn: torch.Tensor, save_conf: bool, shape: tuple[int, int], file: Path) -> None:
|
196
196
|
"""
|
ultralytics/nn/modules/head.py
CHANGED
@@ -13,7 +13,7 @@ from torch.nn.init import constant_, xavier_uniform_
|
|
13
13
|
|
14
14
|
from ultralytics.utils import NOT_MACOS14
|
15
15
|
from ultralytics.utils.tal import TORCH_1_10, dist2bbox, dist2rbox, make_anchors
|
16
|
-
from ultralytics.utils.torch_utils import
|
16
|
+
from ultralytics.utils.torch_utils import fuse_conv_and_bn, smart_inference_mode
|
17
17
|
|
18
18
|
from .block import DFL, SAVPE, BNContrastiveHead, ContrastiveHead, Proto, Residual, SwiGLUFFN
|
19
19
|
from .conv import Conv, DWConv
|
@@ -149,7 +149,6 @@ class Detect(nn.Module):
|
|
149
149
|
y = self.postprocess(y.permute(0, 2, 1), self.max_det, self.nc)
|
150
150
|
return y if self.export else (y, {"one2many": x, "one2one": one2one})
|
151
151
|
|
152
|
-
@disable_dynamo
|
153
152
|
def _inference(self, x: list[torch.Tensor]) -> torch.Tensor:
|
154
153
|
"""
|
155
154
|
Decode predicted bounding boxes and class probabilities based on multiple-level feature maps.
|
ultralytics/utils/loss.py
CHANGED
@@ -11,7 +11,7 @@ import torch.nn.functional as F
|
|
11
11
|
from ultralytics.utils.metrics import OKS_SIGMA
|
12
12
|
from ultralytics.utils.ops import crop_mask, xywh2xyxy, xyxy2xywh
|
13
13
|
from ultralytics.utils.tal import RotatedTaskAlignedAssigner, TaskAlignedAssigner, dist2bbox, dist2rbox, make_anchors
|
14
|
-
from ultralytics.utils.torch_utils import autocast
|
14
|
+
from ultralytics.utils.torch_utils import autocast
|
15
15
|
|
16
16
|
from .metrics import bbox_iou, probiou
|
17
17
|
from .tal import bbox2dist
|
@@ -215,7 +215,6 @@ class v8DetectionLoss:
|
|
215
215
|
self.assigner = TaskAlignedAssigner(topk=tal_topk, num_classes=self.nc, alpha=0.5, beta=6.0)
|
216
216
|
self.bbox_loss = BboxLoss(m.reg_max).to(device)
|
217
217
|
self.proj = torch.arange(m.reg_max, dtype=torch.float, device=device)
|
218
|
-
disable_dynamo(self.__class__) # exclude from compile
|
219
218
|
|
220
219
|
def preprocess(self, targets: torch.Tensor, batch_size: int, scale_tensor: torch.Tensor) -> torch.Tensor:
|
221
220
|
"""Preprocess targets by converting to tensor format and scaling coordinates."""
|
ultralytics/utils/nms.py
CHANGED
@@ -192,6 +192,7 @@ class TorchNMS:
|
|
192
192
|
iou_threshold: float,
|
193
193
|
use_triu: bool = True,
|
194
194
|
iou_func=box_iou,
|
195
|
+
exit_early: bool = True,
|
195
196
|
) -> torch.Tensor:
|
196
197
|
"""
|
197
198
|
Fast-NMS implementation from https://arxiv.org/pdf/1904.02689 using upper triangular matrix operations.
|
@@ -202,6 +203,7 @@ class TorchNMS:
|
|
202
203
|
iou_threshold (float): IoU threshold for suppression.
|
203
204
|
use_triu (bool): Whether to use torch.triu operator for upper triangular matrix operations.
|
204
205
|
iou_func (callable): Function to compute IoU between boxes.
|
206
|
+
exit_early (bool): Whether to exit early if there are no boxes.
|
205
207
|
|
206
208
|
Returns:
|
207
209
|
(torch.Tensor): Indices of boxes to keep after NMS.
|
@@ -212,7 +214,7 @@ class TorchNMS:
|
|
212
214
|
>>> scores = torch.tensor([0.9, 0.8])
|
213
215
|
>>> keep = TorchNMS.nms(boxes, scores, 0.5)
|
214
216
|
"""
|
215
|
-
if boxes.numel() == 0:
|
217
|
+
if boxes.numel() == 0 and exit_early:
|
216
218
|
return torch.empty((0,), dtype=torch.int64, device=boxes.device)
|
217
219
|
|
218
220
|
sorted_idx = torch.argsort(scores, descending=True)
|
ultralytics/utils/torch_utils.py
CHANGED
@@ -1006,28 +1006,6 @@ class FXModel(nn.Module):
|
|
1006
1006
|
return x
|
1007
1007
|
|
1008
1008
|
|
1009
|
-
def disable_dynamo(func: Any) -> Any:
|
1010
|
-
"""
|
1011
|
-
Disable torch.compile/dynamo for a callable when available.
|
1012
|
-
|
1013
|
-
Args:
|
1014
|
-
func (Any): Callable object to wrap. Could be a function, method, or class.
|
1015
|
-
|
1016
|
-
Returns:
|
1017
|
-
func (Any): Same callable, wrapped by torch._dynamo.disable when available, otherwise unchanged.
|
1018
|
-
|
1019
|
-
Examples:
|
1020
|
-
>>> @disable_dynamo
|
1021
|
-
... def fn(x):
|
1022
|
-
... return x + 1
|
1023
|
-
>>> # Works even if torch._dynamo is not available
|
1024
|
-
>>> _ = fn(1)
|
1025
|
-
"""
|
1026
|
-
if hasattr(torch, "_dynamo"):
|
1027
|
-
return torch._dynamo.disable(func)
|
1028
|
-
return func
|
1029
|
-
|
1030
|
-
|
1031
1009
|
def attempt_compile(
|
1032
1010
|
model: torch.nn.Module,
|
1033
1011
|
device: torch.device,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|