dgenerate-ultralytics-headless 8.3.240__py3-none-any.whl → 8.3.242__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.240.dist-info → dgenerate_ultralytics_headless-8.3.242.dist-info}/METADATA +2 -2
- {dgenerate_ultralytics_headless-8.3.240.dist-info → dgenerate_ultralytics_headless-8.3.242.dist-info}/RECORD +29 -29
- tests/test_exports.py +1 -2
- ultralytics/__init__.py +1 -1
- ultralytics/cfg/__init__.py +1 -1
- ultralytics/data/augment.py +3 -2
- ultralytics/engine/exporter.py +18 -23
- ultralytics/engine/tuner.py +2 -1
- ultralytics/models/sam/predict.py +9 -6
- ultralytics/models/sam/sam3/encoder.py +0 -6
- ultralytics/models/sam/sam3/model_misc.py +2 -1
- ultralytics/models/sam/sam3/vitdet.py +2 -1
- ultralytics/models/yolo/detect/predict.py +2 -1
- ultralytics/nn/autobackend.py +47 -43
- ultralytics/nn/modules/block.py +7 -5
- ultralytics/nn/modules/head.py +3 -2
- ultralytics/trackers/utils/matching.py +1 -1
- ultralytics/utils/__init__.py +1 -0
- ultralytics/utils/export/imx.py +2 -2
- ultralytics/utils/git.py +2 -1
- ultralytics/utils/loss.py +4 -6
- ultralytics/utils/metrics.py +2 -1
- ultralytics/utils/ops.py +4 -3
- ultralytics/utils/plotting.py +2 -0
- ultralytics/utils/tqdm.py +2 -1
- {dgenerate_ultralytics_headless-8.3.240.dist-info → dgenerate_ultralytics_headless-8.3.242.dist-info}/WHEEL +0 -0
- {dgenerate_ultralytics_headless-8.3.240.dist-info → dgenerate_ultralytics_headless-8.3.242.dist-info}/entry_points.txt +0 -0
- {dgenerate_ultralytics_headless-8.3.240.dist-info → dgenerate_ultralytics_headless-8.3.242.dist-info}/licenses/LICENSE +0 -0
- {dgenerate_ultralytics_headless-8.3.240.dist-info → dgenerate_ultralytics_headless-8.3.242.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.242
|
|
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>
|
|
@@ -51,7 +51,7 @@ Requires-Dist: pytest; extra == "dev"
|
|
|
51
51
|
Requires-Dist: pytest-cov; extra == "dev"
|
|
52
52
|
Requires-Dist: coverage[toml]; extra == "dev"
|
|
53
53
|
Requires-Dist: zensical>=0.0.9; python_version >= "3.10" and extra == "dev"
|
|
54
|
-
Requires-Dist: mkdocs-ultralytics-plugin>=0.2.
|
|
54
|
+
Requires-Dist: mkdocs-ultralytics-plugin>=0.2.4; extra == "dev"
|
|
55
55
|
Requires-Dist: minijinja>=2.0.0; extra == "dev"
|
|
56
56
|
Provides-Extra: export
|
|
57
57
|
Requires-Dist: numpy<2.0.0; extra == "export"
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
dgenerate_ultralytics_headless-8.3.
|
|
1
|
+
dgenerate_ultralytics_headless-8.3.242.dist-info/licenses/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
|
|
2
2
|
tests/__init__.py,sha256=bCox_hLdGRFYGLb2kd722VdNP2zEXNYNuLLYtqZSrbw,804
|
|
3
3
|
tests/conftest.py,sha256=mOy9lGpNp7lk1hHl6_pVE0f9cU-72gnkoSm4TO-CNZU,2318
|
|
4
4
|
tests/test_cli.py,sha256=GhIFHi-_WIJpDgoGNRi0DnjbfwP1wHbklBMnkCM-P_4,5464
|
|
5
5
|
tests/test_cuda.py,sha256=eQew1rNwU3VViQCG6HZj5SWcYmWYop9gJ0jv9U1bGDE,8203
|
|
6
6
|
tests/test_engine.py,sha256=ER2DsHM0GfUG99AH1Q-Lpm4x36qxkfOzxmH6uYM75ds,5722
|
|
7
|
-
tests/test_exports.py,sha256=
|
|
7
|
+
tests/test_exports.py,sha256=UCLbjUnK8ZNldnJodrAxftUrwzO6ZNQxr7j64nDl9io,14137
|
|
8
8
|
tests/test_integrations.py,sha256=6QgSh9n0J04RdUYz08VeVOnKmf4S5MDEQ0chzS7jo_c,6220
|
|
9
9
|
tests/test_python.py,sha256=viMvRajIbDZdm64hRRg9i8qZ1sU9frwB69e56mxwEXk,29266
|
|
10
10
|
tests/test_solutions.py,sha256=CIaphpmOXgz9AE9xcm1RWODKrwGfZLCc84IggGXArNM,14122
|
|
11
|
-
ultralytics/__init__.py,sha256=
|
|
11
|
+
ultralytics/__init__.py,sha256=oh5fizpewk5bLr7va83-trIOFOSneeHfFNRuV8zsHBw,1302
|
|
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
|
|
15
|
-
ultralytics/cfg/__init__.py,sha256=
|
|
15
|
+
ultralytics/cfg/__init__.py,sha256=msy7NE7le831rv5-eRdLFkHRkf8o7m07HRkY4810n9s,40208
|
|
16
16
|
ultralytics/cfg/default.yaml,sha256=KKENSHolDSto1HJVGjBvTXvz9ae-XMcYRzKrjU3QfZc,8912
|
|
17
17
|
ultralytics/cfg/datasets/Argoverse.yaml,sha256=QGpdh3Hj5dFrvbsaE_8rAVj9BO4XpKTB7uhXaTTnE-o,3364
|
|
18
18
|
ultralytics/cfg/datasets/DOTAv1.5.yaml,sha256=KE7VC-ZMDSei1pLPm-pdk_ZAMRU_gLwGgtIQNbwp6dA,1212
|
|
@@ -109,7 +109,7 @@ ultralytics/cfg/trackers/botsort.yaml,sha256=tRxC-qT4Wz0mLn5x7ZEwrqgGKrmTDVY7gMg
|
|
|
109
109
|
ultralytics/cfg/trackers/bytetrack.yaml,sha256=7LS1ObP5u7BUFcmeY6L2m3bRuPUktnpJspFKd_ElVWc,908
|
|
110
110
|
ultralytics/data/__init__.py,sha256=ToR8zl0JhBHy42ZvV7zIwO_F3lbi5oNlGQNPK3dlddU,644
|
|
111
111
|
ultralytics/data/annotator.py,sha256=kbfSPBesKEVK6ys3dilTdMh7rCKyp0xV7tGQeEDbpWI,2985
|
|
112
|
-
ultralytics/data/augment.py,sha256=
|
|
112
|
+
ultralytics/data/augment.py,sha256=ahqEe2ZBLeMZbK44Z-QihfCVCArOqtHjSSD-41_NlA8,127503
|
|
113
113
|
ultralytics/data/base.py,sha256=pMs8yJOmAFPXdgfLCDtUemSvkPNDzxReP-fWzkNtonc,19723
|
|
114
114
|
ultralytics/data/build.py,sha256=s-tkSZPf3OfQyfXPXB9XxdW_gIcU6Xy_u21ekSgTnRo,17205
|
|
115
115
|
ultralytics/data/converter.py,sha256=_54Xw78TLRswJ9nUVCd2lfEP5riQ82rM0_g_Gad4PAI,31893
|
|
@@ -123,12 +123,12 @@ ultralytics/data/scripts/get_coco.sh,sha256=UuJpJeo3qQpTHVINeOpmP0NYmg8PhEFE3A8J
|
|
|
123
123
|
ultralytics/data/scripts/get_coco128.sh,sha256=qmRQl_hOKrsdHrTrnyQuFIH01oDz3lfaz138OgGfLt8,650
|
|
124
124
|
ultralytics/data/scripts/get_imagenet.sh,sha256=hr42H16bM47iT27rgS7MpEo-GeOZAYUQXgr0B2cwn48,1705
|
|
125
125
|
ultralytics/engine/__init__.py,sha256=lm6MckFYCPTbqIoX7w0s_daxdjNeBeKW6DXppv1-QUM,70
|
|
126
|
-
ultralytics/engine/exporter.py,sha256=
|
|
126
|
+
ultralytics/engine/exporter.py,sha256=yO2ARLy-tQXKYa5ek62jqoZXcXGm7ThanRUj2X3rIHk,72643
|
|
127
127
|
ultralytics/engine/model.py,sha256=RkjMWXkyGmYjmMYIG8mPX8Cf1cJvn0ccOsXt03g7tIk,52999
|
|
128
128
|
ultralytics/engine/predictor.py,sha256=neYmNDX27Vv3ggk9xqaKlH6XzB2vlFIghU5o7ZC0zFo,22838
|
|
129
129
|
ultralytics/engine/results.py,sha256=LHX0AaVOv3CEjYjw8i4LThXqihxmahWCxpH20b4s9dM,68030
|
|
130
130
|
ultralytics/engine/trainer.py,sha256=mqVrhL8xnJwwKJVjxDEiiwu0WH48Ne5dB4SXxlxyHh4,45479
|
|
131
|
-
ultralytics/engine/tuner.py,sha256=
|
|
131
|
+
ultralytics/engine/tuner.py,sha256=qiozSxYC-Hk1TQgyftrYTKkqLrrwFzjjkT6mOYR3Vjc,21460
|
|
132
132
|
ultralytics/engine/validator.py,sha256=DRoqyPYhH5rBEMLo-Y94CdiLtxQTYaJHP04fP9e-NJM,17528
|
|
133
133
|
ultralytics/hub/__init__.py,sha256=Z0K_E00jzQh90b18q3IDChwVmTvyIYp6C00sCV-n2F8,6709
|
|
134
134
|
ultralytics/hub/auth.py,sha256=ANzCeZA7lUzTWc_sFHbDuuyBh1jLl2sTpHkoUbIkFYE,6254
|
|
@@ -155,7 +155,7 @@ ultralytics/models/sam/amg.py,sha256=aYvJ7jQMkTR3X9KV7SHi3qP3yNchQggWNUurTRZwxQg
|
|
|
155
155
|
ultralytics/models/sam/build.py,sha256=rEaFXA4R1nyutSonIenRKcuNtO1FgEojnkcayo0FTP4,12867
|
|
156
156
|
ultralytics/models/sam/build_sam3.py,sha256=Gg_LiqNrCDTYaDWrob05vj-ln2AhkfMa5KkKhyk5wdE,11976
|
|
157
157
|
ultralytics/models/sam/model.py,sha256=cOawDSkFqJPbt3455aTZ8tjaoWshFWFHQGGqxzsL_QQ,7372
|
|
158
|
-
ultralytics/models/sam/predict.py,sha256=
|
|
158
|
+
ultralytics/models/sam/predict.py,sha256=Y6JEP3WGAF1gzTg8Z4eCgdtPFFbexSEA75F7zd8Cp_c,203689
|
|
159
159
|
ultralytics/models/sam/modules/__init__.py,sha256=lm6MckFYCPTbqIoX7w0s_daxdjNeBeKW6DXppv1-QUM,70
|
|
160
160
|
ultralytics/models/sam/modules/blocks.py,sha256=ZU2aY4h6fmosj5pZ5EOEuO1O8Cl8UYeH11eOxkqCt8M,44570
|
|
161
161
|
ultralytics/models/sam/modules/decoders.py,sha256=G4li37ahUe5rTTNTKibWMsAoz6G3R18rI8OPvfunVX8,25045
|
|
@@ -167,14 +167,14 @@ ultralytics/models/sam/modules/transformer.py,sha256=NmTuyxS9PNsg66tKY9_Q2af4I09
|
|
|
167
167
|
ultralytics/models/sam/modules/utils.py,sha256=Re09hcKe9LJpFzKHxpbwEmoMpPImnJaoNw7pe62_ui0,21129
|
|
168
168
|
ultralytics/models/sam/sam3/__init__.py,sha256=aM4-KimnYgIFe-e5ctLT8e6k9PagvuvKFaHaagDZM7E,144
|
|
169
169
|
ultralytics/models/sam/sam3/decoder.py,sha256=kXgPOjOh63ttJPFwMF90arK9AKZwPmhxOiexnPijiTE,22872
|
|
170
|
-
ultralytics/models/sam/sam3/encoder.py,sha256=
|
|
170
|
+
ultralytics/models/sam/sam3/encoder.py,sha256=IFUIJkWrVW1MmkeA142Sxhgnx5Tssq2Bgi9T3iIppU4,21543
|
|
171
171
|
ultralytics/models/sam/sam3/geometry_encoders.py,sha256=EAxeVvZgz4Y0q2VYX-4OP_1YuWWG21WilUt_IMBzE_0,17375
|
|
172
172
|
ultralytics/models/sam/sam3/maskformer_segmentation.py,sha256=jf9qJj7xyTVGp7OZ5uJQF0EUD468EOnBm1PsjiTO2ug,10735
|
|
173
|
-
ultralytics/models/sam/sam3/model_misc.py,sha256=
|
|
173
|
+
ultralytics/models/sam/sam3/model_misc.py,sha256=4t2ee9hFZRkCV2SLaBpW8cZf2KD2riJ6Xw9vTyYrPAQ,7921
|
|
174
174
|
ultralytics/models/sam/sam3/necks.py,sha256=geWVSSheOwXSy_LiNKkOqQhK13DEe_fDOTgse_W68qU,4553
|
|
175
175
|
ultralytics/models/sam/sam3/sam3_image.py,sha256=MZZXObriPP5VPMKTxJ7rPTWFATAgYng7jeMzchYP8YE,13336
|
|
176
176
|
ultralytics/models/sam/sam3/text_encoder_ve.py,sha256=iv8-6VA3t4yJ1M42RPjHDlFuH9P_nNRSNyaoFn2sjMw,12283
|
|
177
|
-
ultralytics/models/sam/sam3/vitdet.py,sha256=
|
|
177
|
+
ultralytics/models/sam/sam3/vitdet.py,sha256=6kvVQUnbjzo3WFww-rrkgSf3wNcNRvreTaKZ7XGiOOk,21834
|
|
178
178
|
ultralytics/models/sam/sam3/vl_combiner.py,sha256=HpFpNj3pXsWIc_aTov-EpW5j1fOj_m0j4yuXmCfWNg4,6476
|
|
179
179
|
ultralytics/models/utils/__init__.py,sha256=lm6MckFYCPTbqIoX7w0s_daxdjNeBeKW6DXppv1-QUM,70
|
|
180
180
|
ultralytics/models/utils/loss.py,sha256=9CcqRXDj5-I-7eZuenInvyoLcPf22Ynf3rUFA5V22bI,21131
|
|
@@ -186,7 +186,7 @@ ultralytics/models/yolo/classify/predict.py,sha256=wKICjwofH7-7QLJhX2vYSNJXWu2-5
|
|
|
186
186
|
ultralytics/models/yolo/classify/train.py,sha256=oODDfPwjgKzsbpO7NCYnOp_uwkWD7HNLhvsHxAJTA4g,8958
|
|
187
187
|
ultralytics/models/yolo/classify/val.py,sha256=gtoUJN5_-56EbiYp5Ur-shfdBNMJOqToWmup_-1wW7I,10503
|
|
188
188
|
ultralytics/models/yolo/detect/__init__.py,sha256=GIRsLYR-kT4JJx7lh4ZZAFGBZj0aebokuU0A7JbjDVA,257
|
|
189
|
-
ultralytics/models/yolo/detect/predict.py,sha256=
|
|
189
|
+
ultralytics/models/yolo/detect/predict.py,sha256=Sct-UwkDe54ZmVtTYl0-fKgx_0BOlPBUsr4NodFd-eU,5385
|
|
190
190
|
ultralytics/models/yolo/detect/train.py,sha256=-PHH6i767_XKCPsBeAOi7AxfHpoq451GfjY4TRMuo7c,10469
|
|
191
191
|
ultralytics/models/yolo/detect/val.py,sha256=O8TkCHnEvuxV2Hyqw_CuVZMWzHWBjCM48fqtdf8T8dQ,22379
|
|
192
192
|
ultralytics/models/yolo/obb/__init__.py,sha256=tQmpG8wVHsajWkZdmD6cjGohJ4ki64iSXQT8JY_dydo,221
|
|
@@ -210,14 +210,14 @@ ultralytics/models/yolo/yoloe/train.py,sha256=giX6zDu5Z3z48PCaBHzu7v9NH3BrpUaGAY
|
|
|
210
210
|
ultralytics/models/yolo/yoloe/train_seg.py,sha256=0hRByMXsEJA-J2B1wXDMVhiW9f9MOTj3LlrGTibN6Ww,4919
|
|
211
211
|
ultralytics/models/yolo/yoloe/val.py,sha256=utUFWeFKRFWZrPr1y3A8ztbTwdoWMYqzlwBN7CQ0tCA,9418
|
|
212
212
|
ultralytics/nn/__init__.py,sha256=538LZPUKKvc3JCMgiQ4VLGqRN2ZAaVLFcQbeNNHFkEA,545
|
|
213
|
-
ultralytics/nn/autobackend.py,sha256=
|
|
213
|
+
ultralytics/nn/autobackend.py,sha256=RkHTt8nBZaeupfshPpze8Wy7vw08FiJWctvzU3SEaro,44578
|
|
214
214
|
ultralytics/nn/tasks.py,sha256=636MN27VvlupIaHPpV4r0J705RUdV-giNKjIeJbRkxI,70448
|
|
215
215
|
ultralytics/nn/text_model.py,sha256=novnuosqXnW1NmlOzWOk7dEKuN6Vq40CTksr6hI3Knc,15109
|
|
216
216
|
ultralytics/nn/modules/__init__.py,sha256=5Sg_28MDfKwdu14Ty_WCaiIXZyjBSQ-xCNCwnoz_w-w,3198
|
|
217
217
|
ultralytics/nn/modules/activation.py,sha256=J6n-CJKFK0YbhwcRDqm9zEJM9pSAEycj5quQss_3x6E,2219
|
|
218
|
-
ultralytics/nn/modules/block.py,sha256=
|
|
218
|
+
ultralytics/nn/modules/block.py,sha256=YRALZHImSMdLpmF0qIf8uF3yENz0EK63SFp7gzylo5g,69885
|
|
219
219
|
ultralytics/nn/modules/conv.py,sha256=9WUlBzHD-wLgz0riLyttzASLIqBtXPK6Jk5EdyIiGCM,21100
|
|
220
|
-
ultralytics/nn/modules/head.py,sha256=
|
|
220
|
+
ultralytics/nn/modules/head.py,sha256=OD8slnnJbVG9WvbRJqhx0tHwbtgrci3Ynj9dxHcszfY,51875
|
|
221
221
|
ultralytics/nn/modules/transformer.py,sha256=oasUhhIm03kY0QtWrpvSSLnQa9q3eW2ksx82MgpPmsE,31972
|
|
222
222
|
ultralytics/nn/modules/utils.py,sha256=tkUDhTXjmW-YMvTGvM4RFUVtzh5k2c33i3TWmzaWWtI,6067
|
|
223
223
|
ultralytics/solutions/__init__.py,sha256=Jj7OcRiYjHH-e104H4xTgjjR5W6aPB4mBRndbaSPmgU,1209
|
|
@@ -249,8 +249,8 @@ ultralytics/trackers/track.py,sha256=RHgPvx9FNVBL5pUalX2l-jcWrei1UiAXszjeL3V5d-M
|
|
|
249
249
|
ultralytics/trackers/utils/__init__.py,sha256=lm6MckFYCPTbqIoX7w0s_daxdjNeBeKW6DXppv1-QUM,70
|
|
250
250
|
ultralytics/trackers/utils/gmc.py,sha256=cvvhNXOhylVQti4pJQSNPx4yPqhhhw1k2yzY0JFl7Zo,13760
|
|
251
251
|
ultralytics/trackers/utils/kalman_filter.py,sha256=crgysL2bo0v1eTljOlP2YqIJDLBcHjl75MRpbxfaR_M,21514
|
|
252
|
-
ultralytics/trackers/utils/matching.py,sha256=
|
|
253
|
-
ultralytics/utils/__init__.py,sha256=
|
|
252
|
+
ultralytics/trackers/utils/matching.py,sha256=x6uZOIx0O9oVmAcfY6tYMTJQE2cDTUlRR690Y5UkHLs,7129
|
|
253
|
+
ultralytics/utils/__init__.py,sha256=JfvODTB4mG_JOhTeCiPtq0iCEgiCh14hJf195rnOhLQ,55145
|
|
254
254
|
ultralytics/utils/autobatch.py,sha256=jiE4m_--H9UkXFDm_FqzcZk_hSTCGpS72XdVEKgZwAo,5114
|
|
255
255
|
ultralytics/utils/autodevice.py,sha256=rXlPuo-iX-vZ4BabmMGEGh9Uxpau4R7Zlt1KCo9Xfyc,8892
|
|
256
256
|
ultralytics/utils/benchmarks.py,sha256=S_W4S4pe2ktSRdSuWb6m09UEFQmZhmjl943bbo67hOI,32277
|
|
@@ -261,18 +261,18 @@ ultralytics/utils/downloads.py,sha256=IyiGjjXqOyf1B0qLMk7vE6sSQ8s232OhKS8aj9XbTg
|
|
|
261
261
|
ultralytics/utils/errors.py,sha256=dUZcTWpbJJHqEuWHM6IbeoJJ4TzA_yHBP8E7tEEpBVs,1388
|
|
262
262
|
ultralytics/utils/events.py,sha256=6vqs_iSxoXIhQ804sOjApNZmXwNW9FUFtjaHPY8ta10,4665
|
|
263
263
|
ultralytics/utils/files.py,sha256=BdaRwEKqzle4glSj8n_jq6bDjTCAs_H1SN06ZOQ9qFU,8190
|
|
264
|
-
ultralytics/utils/git.py,sha256=
|
|
264
|
+
ultralytics/utils/git.py,sha256=UdqeIiiEzg1qkerAZrg5YtTYPuJYwrpxW9N_6Pq6s8U,5501
|
|
265
265
|
ultralytics/utils/instance.py,sha256=11mhefvTI9ftMqSirXuiViAi0Fxlo6v84qvNxfRNUoE,18862
|
|
266
266
|
ultralytics/utils/logger.py,sha256=2G7_wAteN26SWaqm3VJgDc2XYcotz5uWolQllvMcLoI,16821
|
|
267
|
-
ultralytics/utils/loss.py,sha256=
|
|
268
|
-
ultralytics/utils/metrics.py,sha256=
|
|
267
|
+
ultralytics/utils/loss.py,sha256=JWkxM6IsJQwmlCsTc0bUQWPBH80UIDoItyUlSgF9Ukw,39579
|
|
268
|
+
ultralytics/utils/metrics.py,sha256=apVQLSML4TKwreFwRtWPQ1R5_fpp7vPDuI1q3cTY24w,68674
|
|
269
269
|
ultralytics/utils/nms.py,sha256=zv1rOzMF6WU8Kdk41VzNf1H1EMt_vZHcbDFbg3mnN2o,14248
|
|
270
|
-
ultralytics/utils/ops.py,sha256=
|
|
270
|
+
ultralytics/utils/ops.py,sha256=mbrqv36ovUp9FMIqClTHikOOViYEJ058CH-qDLkWbSw,25797
|
|
271
271
|
ultralytics/utils/patches.py,sha256=mD3slAMAhcezzP42_fOWmacNMU6zXB68Br4_EBCyIjs,7117
|
|
272
|
-
ultralytics/utils/plotting.py,sha256=
|
|
272
|
+
ultralytics/utils/plotting.py,sha256=nLProk2U3xYBwV4CdkeBx1mrPnrPA550cNSQRGbcLsg,48368
|
|
273
273
|
ultralytics/utils/tal.py,sha256=w7oi6fp0NmL6hHh-yvCCX1cBuuB4JuX7w1wiR4_SMZs,20678
|
|
274
274
|
ultralytics/utils/torch_utils.py,sha256=zOPUQlorTiEPSkqlSEPyaQhpmzmgOIKF7f3xJb0UjdQ,40268
|
|
275
|
-
ultralytics/utils/tqdm.py,sha256=
|
|
275
|
+
ultralytics/utils/tqdm.py,sha256=4kL_nczykHu6VxRzRSbvUSJknrCZydoS_ZegZkFXpsg,16197
|
|
276
276
|
ultralytics/utils/triton.py,sha256=BQu3CD3OlT76d1OtmnX5slQU37VC1kzRvEtfI2saIQA,5211
|
|
277
277
|
ultralytics/utils/tuner.py,sha256=RY0SLmGsFDj7RgqAj-XXRDKZ3asWbdwakAAKWmDTQv4,6867
|
|
278
278
|
ultralytics/utils/callbacks/__init__.py,sha256=hzL63Rce6VkZhP4Lcim9LKjadixaQG86nKqPhk7IkS0,242
|
|
@@ -289,10 +289,10 @@ ultralytics/utils/callbacks/tensorboard.py,sha256=PTJYvD2gqRUN8xw5VoTjvKnu2adukL
|
|
|
289
289
|
ultralytics/utils/callbacks/wb.py,sha256=ghmL3gigOa-z_F54-TzMraKw9MAaYX-Wk4H8dLoRvX8,7705
|
|
290
290
|
ultralytics/utils/export/__init__.py,sha256=Cfh-PwVfTF_lwPp-Ss4wiX4z8Sm1XRPklsqdFfmTZ30,333
|
|
291
291
|
ultralytics/utils/export/engine.py,sha256=23-lC6dNsmz5vprSJzaN7UGNXrFlVedNcqhlOH_IXes,9956
|
|
292
|
-
ultralytics/utils/export/imx.py,sha256=
|
|
292
|
+
ultralytics/utils/export/imx.py,sha256=F3b334IZdwjF8PdP1s6QI3Ndd82_2e77clj8aGLzIDo,12856
|
|
293
293
|
ultralytics/utils/export/tensorflow.py,sha256=igYzwbdblb9YgfV4Jgl5lMvynuVRcF51dAzI7j-BBI0,9966
|
|
294
|
-
dgenerate_ultralytics_headless-8.3.
|
|
295
|
-
dgenerate_ultralytics_headless-8.3.
|
|
296
|
-
dgenerate_ultralytics_headless-8.3.
|
|
297
|
-
dgenerate_ultralytics_headless-8.3.
|
|
298
|
-
dgenerate_ultralytics_headless-8.3.
|
|
294
|
+
dgenerate_ultralytics_headless-8.3.242.dist-info/METADATA,sha256=wnKuuyVhvPwKkTBQIjfDNWO5aCY8kAFUK1ijt1MtEfY,38798
|
|
295
|
+
dgenerate_ultralytics_headless-8.3.242.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
296
|
+
dgenerate_ultralytics_headless-8.3.242.dist-info/entry_points.txt,sha256=YM_wiKyTe9yRrsEfqvYolNO5ngwfoL4-NwgKzc8_7sI,93
|
|
297
|
+
dgenerate_ultralytics_headless-8.3.242.dist-info/top_level.txt,sha256=XP49TwiMw4QGsvTLSYiJhz1xF_k7ev5mQ8jJXaXi45Q,12
|
|
298
|
+
dgenerate_ultralytics_headless-8.3.242.dist-info/RECORD,,
|
tests/test_exports.py
CHANGED
|
@@ -267,10 +267,9 @@ def test_export_imx():
|
|
|
267
267
|
@pytest.mark.skipif(not checks.IS_PYTHON_3_10, reason="Axelera export requires Python 3.10")
|
|
268
268
|
def test_export_axelera():
|
|
269
269
|
"""Test YOLO export to Axelera format."""
|
|
270
|
-
model = YOLO(MODEL)
|
|
271
270
|
# For faster testing, use a smaller calibration dataset
|
|
272
271
|
# 32 image size crashes axelera export, so use 64
|
|
273
|
-
file =
|
|
272
|
+
file = YOLO(MODEL).export(format="axelera", imgsz=64, data="coco8.yaml")
|
|
274
273
|
assert Path(file).exists(), f"Axelera export failed, directory not found: {file}"
|
|
275
274
|
shutil.rmtree(file, ignore_errors=True) # cleanup
|
|
276
275
|
|
ultralytics/__init__.py
CHANGED
ultralytics/cfg/__init__.py
CHANGED
|
@@ -715,7 +715,7 @@ def handle_yolo_solutions(args: list[str]) -> None:
|
|
|
715
715
|
|
|
716
716
|
from ultralytics import solutions
|
|
717
717
|
|
|
718
|
-
solution = getattr(solutions, SOLUTION_MAP[solution_name])(is_cli=True, **overrides) # class i.e ObjectCounter
|
|
718
|
+
solution = getattr(solutions, SOLUTION_MAP[solution_name])(is_cli=True, **overrides) # class i.e. ObjectCounter
|
|
719
719
|
|
|
720
720
|
cap = cv2.VideoCapture(solution.CFG["source"]) # read the video file
|
|
721
721
|
if solution_name != "crop":
|
ultralytics/data/augment.py
CHANGED
|
@@ -2114,7 +2114,7 @@ class Format:
|
|
|
2114
2114
|
torch.Size([3, 100, 100])
|
|
2115
2115
|
"""
|
|
2116
2116
|
if len(img.shape) < 3:
|
|
2117
|
-
img =
|
|
2117
|
+
img = img[..., None]
|
|
2118
2118
|
img = img.transpose(2, 0, 1)
|
|
2119
2119
|
img = np.ascontiguousarray(img[::-1] if random.uniform(0, 1) > self.bgr and img.shape[0] == 3 else img)
|
|
2120
2120
|
img = torch.from_numpy(img)
|
|
@@ -2164,7 +2164,8 @@ class LoadVisualPrompt:
|
|
|
2164
2164
|
"""
|
|
2165
2165
|
self.scale_factor = scale_factor
|
|
2166
2166
|
|
|
2167
|
-
|
|
2167
|
+
@staticmethod
|
|
2168
|
+
def make_mask(boxes: torch.Tensor, h: int, w: int) -> torch.Tensor:
|
|
2168
2169
|
"""Create binary masks from bounding boxes.
|
|
2169
2170
|
|
|
2170
2171
|
Args:
|
ultralytics/engine/exporter.py
CHANGED
|
@@ -172,7 +172,7 @@ def export_formats():
|
|
|
172
172
|
["IMX", "imx", "_imx_model", True, True, ["int8", "fraction", "nms"]],
|
|
173
173
|
["RKNN", "rknn", "_rknn_model", False, False, ["batch", "name"]],
|
|
174
174
|
["ExecuTorch", "executorch", "_executorch_model", True, False, ["batch"]],
|
|
175
|
-
["Axelera", "axelera", "_axelera_model", False, False, ["batch", "int8"]],
|
|
175
|
+
["Axelera", "axelera", "_axelera_model", False, False, ["batch", "int8", "fraction"]],
|
|
176
176
|
]
|
|
177
177
|
return dict(zip(["Format", "Argument", "Suffix", "CPU", "GPU", "Arguments"], zip(*x)))
|
|
178
178
|
|
|
@@ -387,6 +387,8 @@ class Exporter:
|
|
|
387
387
|
self.args.int8 = True
|
|
388
388
|
if model.task not in {"detect"}:
|
|
389
389
|
raise ValueError("Axelera export only supported for detection models.")
|
|
390
|
+
if not self.args.data:
|
|
391
|
+
self.args.data = "coco128.yaml" # Axelera default to coco128.yaml
|
|
390
392
|
if imx:
|
|
391
393
|
if not self.args.int8:
|
|
392
394
|
LOGGER.warning("IMX export requires int8=True, setting int8=True.")
|
|
@@ -454,10 +456,7 @@ class Exporter:
|
|
|
454
456
|
)
|
|
455
457
|
model.clip_model = None # openvino int8 export error: https://github.com/ultralytics/ultralytics/pull/18445
|
|
456
458
|
if self.args.int8 and not self.args.data:
|
|
457
|
-
|
|
458
|
-
self.args.data = "coco128.yaml" # Axelera default to coco128.yaml
|
|
459
|
-
else:
|
|
460
|
-
self.args.data = DEFAULT_CFG.data or TASK2DATA[getattr(model, "task", "detect")] # assign default data
|
|
459
|
+
self.args.data = DEFAULT_CFG.data or TASK2DATA[getattr(model, "task", "detect")] # assign default data
|
|
461
460
|
LOGGER.warning(
|
|
462
461
|
f"INT8 export requires a missing 'data' arg for calibration. Using default 'data={self.args.data}'."
|
|
463
462
|
)
|
|
@@ -775,13 +774,6 @@ class Exporter:
|
|
|
775
774
|
check_requirements("nncf>=2.14.0")
|
|
776
775
|
import nncf
|
|
777
776
|
|
|
778
|
-
def transform_fn(data_item) -> np.ndarray:
|
|
779
|
-
"""Quantization transform function."""
|
|
780
|
-
data_item: torch.Tensor = data_item["img"] if isinstance(data_item, dict) else data_item
|
|
781
|
-
assert data_item.dtype == torch.uint8, "Input image must be uint8 for the quantization preprocessing"
|
|
782
|
-
im = data_item.numpy().astype(np.float32) / 255.0 # uint8 to fp16/32 and 0-255 to 0.0-1.0
|
|
783
|
-
return np.expand_dims(im, 0) if im.ndim == 3 else im
|
|
784
|
-
|
|
785
777
|
# Generate calibration data for integer quantization
|
|
786
778
|
ignored_scope = None
|
|
787
779
|
if isinstance(self.model.model[-1], Detect):
|
|
@@ -800,7 +792,7 @@ class Exporter:
|
|
|
800
792
|
|
|
801
793
|
quantized_ov_model = nncf.quantize(
|
|
802
794
|
model=ov_model,
|
|
803
|
-
calibration_dataset=nncf.Dataset(self.get_int8_calibration_dataloader(prefix),
|
|
795
|
+
calibration_dataset=nncf.Dataset(self.get_int8_calibration_dataloader(prefix), self._transform_fn),
|
|
804
796
|
preset=nncf.QuantizationPreset.MIXED,
|
|
805
797
|
ignored_scope=ignored_scope,
|
|
806
798
|
)
|
|
@@ -1141,18 +1133,12 @@ class Exporter:
|
|
|
1141
1133
|
from axelera import compiler
|
|
1142
1134
|
from axelera.compiler import CompilerConfig
|
|
1143
1135
|
|
|
1144
|
-
self.args.opset = 17
|
|
1136
|
+
self.args.opset = 17 # hardcode opset for Axelera
|
|
1145
1137
|
onnx_path = self.export_onnx()
|
|
1146
|
-
model_name =
|
|
1138
|
+
model_name = Path(onnx_path).stem
|
|
1147
1139
|
export_path = Path(f"{model_name}_axelera_model")
|
|
1148
1140
|
export_path.mkdir(exist_ok=True)
|
|
1149
1141
|
|
|
1150
|
-
def transform_fn(data_item) -> np.ndarray:
|
|
1151
|
-
data_item: torch.Tensor = data_item["img"] if isinstance(data_item, dict) else data_item
|
|
1152
|
-
assert data_item.dtype == torch.uint8, "Input image must be uint8 for the quantization preprocessing"
|
|
1153
|
-
im = data_item.numpy().astype(np.float32) / 255.0 # uint8 to fp16/32 and 0 - 255 to 0.0 - 1.0
|
|
1154
|
-
return np.expand_dims(im, 0) if im.ndim == 3 else im
|
|
1155
|
-
|
|
1156
1142
|
if "C2PSA" in self.model.__str__(): # YOLO11
|
|
1157
1143
|
config = CompilerConfig(
|
|
1158
1144
|
quantization_scheme="per_tensor_min_max",
|
|
@@ -1178,7 +1164,7 @@ class Exporter:
|
|
|
1178
1164
|
model=onnx_path,
|
|
1179
1165
|
calibration_dataset=self.get_int8_calibration_dataloader(prefix),
|
|
1180
1166
|
config=config,
|
|
1181
|
-
transform_fn=
|
|
1167
|
+
transform_fn=self._transform_fn,
|
|
1182
1168
|
)
|
|
1183
1169
|
|
|
1184
1170
|
compiler.compile(model=qmodel, config=config, output_dir=export_path)
|
|
@@ -1205,8 +1191,9 @@ class Exporter:
|
|
|
1205
1191
|
# Setuptools bug: https://github.com/pypa/setuptools/issues/4483
|
|
1206
1192
|
check_requirements("setuptools<71.0.0") # Setuptools bug: https://github.com/pypa/setuptools/issues/4483
|
|
1207
1193
|
check_requirements(("executorch==1.0.1", "flatbuffers"))
|
|
1194
|
+
# Pin numpy to avoid coremltools errors with numpy>=2.4.0, must be separate
|
|
1195
|
+
check_requirements("numpy<=2.3.5")
|
|
1208
1196
|
|
|
1209
|
-
import torch
|
|
1210
1197
|
from executorch.backends.xnnpack.partition.xnnpack_partitioner import XnnpackPartitioner
|
|
1211
1198
|
from executorch.exir import to_edge_transform_and_lower
|
|
1212
1199
|
|
|
@@ -1440,6 +1427,14 @@ class Exporter:
|
|
|
1440
1427
|
LOGGER.info(f"{prefix} pipeline success")
|
|
1441
1428
|
return model
|
|
1442
1429
|
|
|
1430
|
+
@staticmethod
|
|
1431
|
+
def _transform_fn(data_item) -> np.ndarray:
|
|
1432
|
+
"""The transformation function for Axelera/OpenVINO quantization preprocessing."""
|
|
1433
|
+
data_item: torch.Tensor = data_item["img"] if isinstance(data_item, dict) else data_item
|
|
1434
|
+
assert data_item.dtype == torch.uint8, "Input image must be uint8 for the quantization preprocessing"
|
|
1435
|
+
im = data_item.numpy().astype(np.float32) / 255.0 # uint8 to fp16/32 and 0 - 255 to 0.0 - 1.0
|
|
1436
|
+
return im[None] if im.ndim == 3 else im
|
|
1437
|
+
|
|
1443
1438
|
def add_callback(self, event: str, callback):
|
|
1444
1439
|
"""Append the given callback to the specified event."""
|
|
1445
1440
|
self.callbacks[event].append(callback)
|
ultralytics/engine/tuner.py
CHANGED
|
@@ -261,7 +261,8 @@ class Tuner:
|
|
|
261
261
|
except Exception as e:
|
|
262
262
|
LOGGER.warning(f"{self.prefix}MongoDB to CSV sync failed: {e}")
|
|
263
263
|
|
|
264
|
-
|
|
264
|
+
@staticmethod
|
|
265
|
+
def _crossover(x: np.ndarray, alpha: float = 0.2, k: int = 9) -> np.ndarray:
|
|
265
266
|
"""BLX-α crossover from up to top-k parents (x[:,0]=fitness, rest=genes)."""
|
|
266
267
|
k = min(k, len(x))
|
|
267
268
|
# fitness weights (shifted to >0); fallback to uniform if degenerate
|
|
@@ -1812,7 +1812,8 @@ class SAM2VideoPredictor(SAM2Predictor):
|
|
|
1812
1812
|
inference_state["output_dict_per_obj"].clear()
|
|
1813
1813
|
inference_state["temp_output_dict_per_obj"].clear()
|
|
1814
1814
|
|
|
1815
|
-
|
|
1815
|
+
@staticmethod
|
|
1816
|
+
def _reset_tracking_results(inference_state):
|
|
1816
1817
|
"""Reset all tracking inputs and results across the videos."""
|
|
1817
1818
|
for v in inference_state["point_inputs_per_obj"].values():
|
|
1818
1819
|
v.clear()
|
|
@@ -2598,9 +2599,9 @@ class SAM3VideoSemanticPredictor(SAM3SemanticPredictor):
|
|
|
2598
2599
|
"num_frames": num_frames,
|
|
2599
2600
|
"tracker_inference_states": [],
|
|
2600
2601
|
"tracker_metadata": {},
|
|
2602
|
+
"text_prompt": None,
|
|
2603
|
+
"per_frame_geometric_prompt": [None] * num_frames,
|
|
2601
2604
|
}
|
|
2602
|
-
inference_state["text_prompt"] = None
|
|
2603
|
-
inference_state["per_frame_geometric_prompt"] = [None] * num_frames
|
|
2604
2605
|
predictor.inference_state = inference_state
|
|
2605
2606
|
|
|
2606
2607
|
def inference(self, im, bboxes=None, labels=None, text: list[str] | None = None, *args, **kwargs):
|
|
@@ -2880,7 +2881,8 @@ class SAM3VideoSemanticPredictor(SAM3SemanticPredictor):
|
|
|
2880
2881
|
tracker_obj_scores_global, # a dict: obj_id --> tracker frame-level scores
|
|
2881
2882
|
)
|
|
2882
2883
|
|
|
2883
|
-
|
|
2884
|
+
@staticmethod
|
|
2885
|
+
def _suppress_detections_close_to_boundary(boxes, margin=0.025):
|
|
2884
2886
|
"""Suppress detections too close to image edges (for normalized boxes).
|
|
2885
2887
|
|
|
2886
2888
|
boxes: (N, 4) in xyxy format, normalized [0,1]
|
|
@@ -3327,8 +3329,8 @@ class SAM3VideoSemanticPredictor(SAM3SemanticPredictor):
|
|
|
3327
3329
|
|
|
3328
3330
|
return tracker_states_local
|
|
3329
3331
|
|
|
3332
|
+
@staticmethod
|
|
3330
3333
|
def build_outputs(
|
|
3331
|
-
self,
|
|
3332
3334
|
det_out: dict[str, torch.Tensor],
|
|
3333
3335
|
tracker_low_res_masks_global: torch.Tensor,
|
|
3334
3336
|
tracker_metadata_prev: dict[str, np.ndarray],
|
|
@@ -3921,7 +3923,8 @@ class SAM3VideoSemanticPredictor(SAM3SemanticPredictor):
|
|
|
3921
3923
|
def _encode_prompt(self, **kwargs):
|
|
3922
3924
|
return self.model._encode_prompt(**kwargs)
|
|
3923
3925
|
|
|
3924
|
-
|
|
3926
|
+
@staticmethod
|
|
3927
|
+
def _drop_new_det_with_obj_limit(new_det_fa_inds, det_scores_np, num_to_keep):
|
|
3925
3928
|
"""Drop a few new detections based on the maximum number of objects. We drop new objects based on their
|
|
3926
3929
|
detection scores, keeping the high-scoring ones and dropping the low-scoring ones.
|
|
3927
3930
|
"""
|
|
@@ -144,7 +144,6 @@ class TransformerEncoderLayer(nn.Module):
|
|
|
144
144
|
memory_key_padding_mask: torch.Tensor = None,
|
|
145
145
|
pos: torch.Tensor = None,
|
|
146
146
|
query_pos: torch.Tensor = None,
|
|
147
|
-
# **kwargs,
|
|
148
147
|
) -> torch.Tensor:
|
|
149
148
|
"""Forward pass for pre-norm architecture.
|
|
150
149
|
|
|
@@ -160,8 +159,6 @@ class TransformerEncoderLayer(nn.Module):
|
|
|
160
159
|
memory_key_padding_mask: Key padding mask for cross-attention
|
|
161
160
|
pos: Positional encoding for memory
|
|
162
161
|
query_pos: Positional encoding for query
|
|
163
|
-
attn_bias: Optional attention bias tensor
|
|
164
|
-
**kwargs: Additional keyword arguments
|
|
165
162
|
|
|
166
163
|
Returns:
|
|
167
164
|
Processed tensor
|
|
@@ -204,7 +201,6 @@ class TransformerEncoderLayer(nn.Module):
|
|
|
204
201
|
memory_key_padding_mask: torch.Tensor = None,
|
|
205
202
|
pos: torch.Tensor = None,
|
|
206
203
|
query_pos: torch.Tensor = None,
|
|
207
|
-
# **kwds: Any,
|
|
208
204
|
) -> torch.Tensor:
|
|
209
205
|
"""Forward pass for the transformer encoder layer.
|
|
210
206
|
|
|
@@ -218,8 +214,6 @@ class TransformerEncoderLayer(nn.Module):
|
|
|
218
214
|
memory_key_padding_mask: Key padding mask for cross-attention
|
|
219
215
|
pos: Positional encoding for memory
|
|
220
216
|
query_pos: Positional encoding for query
|
|
221
|
-
attn_bias: Optional attention bias tensor
|
|
222
|
-
**kwds: Additional keyword arguments
|
|
223
217
|
|
|
224
218
|
Returns:
|
|
225
219
|
Processed tensor after self-attention, cross-attention, and feedforward network
|
|
@@ -36,7 +36,8 @@ class DotProductScoring(torch.nn.Module):
|
|
|
36
36
|
if self.clamp_logits:
|
|
37
37
|
self.clamp_max_val = clamp_max_val
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
@staticmethod
|
|
40
|
+
def mean_pool_text(prompt, prompt_mask):
|
|
40
41
|
"""Mean-pool the prompt embeddings over the valid tokens only."""
|
|
41
42
|
# is_valid has shape (seq, bs, 1), where 1 is valid and 0 is padding
|
|
42
43
|
is_valid = (~prompt_mask).to(prompt.dtype).permute(1, 0)[..., None]
|
|
@@ -482,7 +482,8 @@ class ViT(nn.Module):
|
|
|
482
482
|
if self.use_act_checkpoint and self.training:
|
|
483
483
|
torch._dynamo.config.optimize_ddp = False
|
|
484
484
|
|
|
485
|
-
|
|
485
|
+
@staticmethod
|
|
486
|
+
def _init_weights(m: nn.Module) -> None:
|
|
486
487
|
"""Initialize the weights."""
|
|
487
488
|
if isinstance(m, nn.Linear):
|
|
488
489
|
nn.init.trunc_normal_(m.weight, std=0.02)
|
ultralytics/nn/autobackend.py
CHANGED
|
@@ -245,15 +245,20 @@ class AutoBackend(nn.Module):
|
|
|
245
245
|
check_requirements(("onnx", "onnxruntime-gpu" if cuda else "onnxruntime"))
|
|
246
246
|
import onnxruntime
|
|
247
247
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
248
|
+
# Select execution provider: CUDA > CoreML (mps) > CPU
|
|
249
|
+
available = onnxruntime.get_available_providers()
|
|
250
|
+
if cuda and "CUDAExecutionProvider" in available:
|
|
251
|
+
providers = [("CUDAExecutionProvider", {"device_id": device.index}), "CPUExecutionProvider"]
|
|
252
|
+
elif device.type == "mps" and "CoreMLExecutionProvider" in available:
|
|
253
|
+
providers = ["CoreMLExecutionProvider", "CPUExecutionProvider"]
|
|
254
|
+
else:
|
|
255
|
+
providers = ["CPUExecutionProvider"]
|
|
256
|
+
if cuda:
|
|
257
|
+
LOGGER.warning("CUDA requested but CUDAExecutionProvider not available. Using CPU...")
|
|
258
|
+
device, cuda = torch.device("cpu"), False
|
|
259
|
+
LOGGER.info(
|
|
260
|
+
f"Using ONNX Runtime {onnxruntime.__version__} with {providers[0] if isinstance(providers[0], str) else providers[0][0]}"
|
|
261
|
+
)
|
|
257
262
|
if onnx:
|
|
258
263
|
session = onnxruntime.InferenceSession(w, providers=providers)
|
|
259
264
|
else:
|
|
@@ -271,7 +276,10 @@ class AutoBackend(nn.Module):
|
|
|
271
276
|
metadata = session.get_modelmeta().custom_metadata_map
|
|
272
277
|
dynamic = isinstance(session.get_outputs()[0].shape[0], str)
|
|
273
278
|
fp16 = "float16" in session.get_inputs()[0].type
|
|
274
|
-
|
|
279
|
+
|
|
280
|
+
# Setup IO binding for optimized inference (CUDA only, not supported for CoreML)
|
|
281
|
+
use_io_binding = not dynamic and cuda
|
|
282
|
+
if use_io_binding:
|
|
275
283
|
io = session.io_binding()
|
|
276
284
|
bindings = []
|
|
277
285
|
for output in session.get_outputs():
|
|
@@ -371,32 +379,33 @@ class AutoBackend(nn.Module):
|
|
|
371
379
|
is_trt10 = not hasattr(model, "num_bindings")
|
|
372
380
|
num = range(model.num_io_tensors) if is_trt10 else range(model.num_bindings)
|
|
373
381
|
for i in num:
|
|
382
|
+
# Get tensor info using TRT10+ or legacy API
|
|
374
383
|
if is_trt10:
|
|
375
384
|
name = model.get_tensor_name(i)
|
|
376
385
|
dtype = trt.nptype(model.get_tensor_dtype(name))
|
|
377
386
|
is_input = model.get_tensor_mode(name) == trt.TensorIOMode.INPUT
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
context.set_input_shape(name, tuple(model.get_tensor_profile_shape(name, 0)[2]))
|
|
382
|
-
if dtype == np.float16:
|
|
383
|
-
fp16 = True
|
|
384
|
-
else:
|
|
385
|
-
output_names.append(name)
|
|
386
|
-
shape = tuple(context.get_tensor_shape(name))
|
|
387
|
-
else: # TensorRT < 10.0
|
|
387
|
+
shape = tuple(model.get_tensor_shape(name))
|
|
388
|
+
profile_shape = tuple(model.get_tensor_profile_shape(name, 0)[2]) if is_input else None
|
|
389
|
+
else:
|
|
388
390
|
name = model.get_binding_name(i)
|
|
389
391
|
dtype = trt.nptype(model.get_binding_dtype(i))
|
|
390
392
|
is_input = model.binding_is_input(i)
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
393
|
+
shape = tuple(model.get_binding_shape(i))
|
|
394
|
+
profile_shape = tuple(model.get_profile_shape(0, i)[1]) if is_input else None
|
|
395
|
+
|
|
396
|
+
# Process input/output tensors
|
|
397
|
+
if is_input:
|
|
398
|
+
if -1 in shape:
|
|
399
|
+
dynamic = True
|
|
400
|
+
if is_trt10:
|
|
401
|
+
context.set_input_shape(name, profile_shape)
|
|
402
|
+
else:
|
|
403
|
+
context.set_binding_shape(i, profile_shape)
|
|
404
|
+
if dtype == np.float16:
|
|
405
|
+
fp16 = True
|
|
406
|
+
else:
|
|
407
|
+
output_names.append(name)
|
|
408
|
+
shape = tuple(context.get_tensor_shape(name)) if is_trt10 else tuple(context.get_binding_shape(i))
|
|
400
409
|
im = torch.from_numpy(np.empty(shape, dtype=dtype)).to(device)
|
|
401
410
|
bindings[name] = Binding(name, dtype, shape, im, int(im.data_ptr()))
|
|
402
411
|
binding_addrs = OrderedDict((n, d.ptr) for n, d in bindings.items())
|
|
@@ -418,8 +427,7 @@ class AutoBackend(nn.Module):
|
|
|
418
427
|
LOGGER.info(f"Loading {w} for TensorFlow SavedModel inference...")
|
|
419
428
|
import tensorflow as tf
|
|
420
429
|
|
|
421
|
-
|
|
422
|
-
model = tf.keras.models.load_model(w) if keras else tf.saved_model.load(w)
|
|
430
|
+
model = tf.saved_model.load(w)
|
|
423
431
|
metadata = Path(w) / "metadata.yaml"
|
|
424
432
|
|
|
425
433
|
# TF GraphDef
|
|
@@ -595,10 +603,9 @@ class AutoBackend(nn.Module):
|
|
|
595
603
|
w = Path(w)
|
|
596
604
|
if (found := next(w.rglob("*.axm"), None)) is None:
|
|
597
605
|
raise FileNotFoundError(f"No .axm file found in: {w}")
|
|
598
|
-
w = found
|
|
599
606
|
|
|
600
|
-
ax_model = op.load(str(
|
|
601
|
-
metadata =
|
|
607
|
+
ax_model = op.load(str(found))
|
|
608
|
+
metadata = found.parent / "metadata.yaml"
|
|
602
609
|
|
|
603
610
|
# ExecuTorch
|
|
604
611
|
elif pte:
|
|
@@ -699,10 +706,7 @@ class AutoBackend(nn.Module):
|
|
|
699
706
|
|
|
700
707
|
# ONNX Runtime
|
|
701
708
|
elif self.onnx or self.imx:
|
|
702
|
-
if self.
|
|
703
|
-
im = im.cpu().numpy() # torch to numpy
|
|
704
|
-
y = self.session.run(self.output_names, {self.session.get_inputs()[0].name: im})
|
|
705
|
-
else:
|
|
709
|
+
if self.use_io_binding:
|
|
706
710
|
if not self.cuda:
|
|
707
711
|
im = im.cpu()
|
|
708
712
|
self.io.bind_input(
|
|
@@ -715,6 +719,9 @@ class AutoBackend(nn.Module):
|
|
|
715
719
|
)
|
|
716
720
|
self.session.run_with_iobinding(self.io)
|
|
717
721
|
y = self.bindings
|
|
722
|
+
else:
|
|
723
|
+
im = im.cpu().numpy() # torch to numpy
|
|
724
|
+
y = self.session.run(self.output_names, {self.session.get_inputs()[0].name: im})
|
|
718
725
|
if self.imx:
|
|
719
726
|
if self.task == "detect":
|
|
720
727
|
# boxes, conf, cls
|
|
@@ -828,8 +835,7 @@ class AutoBackend(nn.Module):
|
|
|
828
835
|
|
|
829
836
|
# Axelera
|
|
830
837
|
elif self.axelera:
|
|
831
|
-
|
|
832
|
-
y = self.ax_model(im)
|
|
838
|
+
y = self.ax_model(im.cpu())
|
|
833
839
|
|
|
834
840
|
# ExecuTorch
|
|
835
841
|
elif self.pte:
|
|
@@ -839,7 +845,7 @@ class AutoBackend(nn.Module):
|
|
|
839
845
|
else:
|
|
840
846
|
im = im.cpu().numpy()
|
|
841
847
|
if self.saved_model: # SavedModel
|
|
842
|
-
y = self.model
|
|
848
|
+
y = self.model.serving_default(im)
|
|
843
849
|
if not isinstance(y, list):
|
|
844
850
|
y = [y]
|
|
845
851
|
elif self.pb: # GraphDef
|
|
@@ -884,8 +890,6 @@ class AutoBackend(nn.Module):
|
|
|
884
890
|
y[1] = np.transpose(y[1], (0, 3, 1, 2)) # should be y = (1, 116, 8400), (1, 32, 160, 160)
|
|
885
891
|
y = [x if isinstance(x, np.ndarray) else x.numpy() for x in y]
|
|
886
892
|
|
|
887
|
-
# for x in y:
|
|
888
|
-
# print(type(x), len(x)) if isinstance(x, (list, tuple)) else print(type(x), x.shape) # debug shapes
|
|
889
893
|
if isinstance(y, (list, tuple)):
|
|
890
894
|
if len(self.names) == 999 and (self.task == "segment" or len(y) == 2): # segments and names not defined
|
|
891
895
|
nc = y[0].shape[1] - y[1].shape[1] - 4 # y = (1, 32, 160, 160), (1, 116, 8400)
|
ultralytics/nn/modules/block.py
CHANGED
|
@@ -798,7 +798,8 @@ class BNContrastiveHead(nn.Module):
|
|
|
798
798
|
del self.logit_scale
|
|
799
799
|
self.forward = self.forward_fuse
|
|
800
800
|
|
|
801
|
-
|
|
801
|
+
@staticmethod
|
|
802
|
+
def forward_fuse(x: torch.Tensor, w: torch.Tensor) -> torch.Tensor:
|
|
802
803
|
"""Passes input out unchanged."""
|
|
803
804
|
return x
|
|
804
805
|
|
|
@@ -1168,7 +1169,7 @@ class RepVGGDW(torch.nn.Module):
|
|
|
1168
1169
|
|
|
1169
1170
|
|
|
1170
1171
|
class CIB(nn.Module):
|
|
1171
|
-
"""
|
|
1172
|
+
"""Compact Inverted Block (CIB) module.
|
|
1172
1173
|
|
|
1173
1174
|
Args:
|
|
1174
1175
|
c1 (int): Number of input channels.
|
|
@@ -1220,7 +1221,7 @@ class C2fCIB(C2f):
|
|
|
1220
1221
|
c2 (int): Number of output channels.
|
|
1221
1222
|
n (int, optional): Number of CIB modules to stack. Defaults to 1.
|
|
1222
1223
|
shortcut (bool, optional): Whether to use shortcut connection. Defaults to False.
|
|
1223
|
-
lk (bool, optional): Whether to use
|
|
1224
|
+
lk (bool, optional): Whether to use large kernel. Defaults to False.
|
|
1224
1225
|
g (int, optional): Number of groups for grouped convolution. Defaults to 1.
|
|
1225
1226
|
e (float, optional): Expansion ratio for CIB modules. Defaults to 0.5.
|
|
1226
1227
|
"""
|
|
@@ -1235,7 +1236,7 @@ class C2fCIB(C2f):
|
|
|
1235
1236
|
c2 (int): Output channels.
|
|
1236
1237
|
n (int): Number of CIB modules.
|
|
1237
1238
|
shortcut (bool): Whether to use shortcut connection.
|
|
1238
|
-
lk (bool): Whether to use
|
|
1239
|
+
lk (bool): Whether to use large kernel.
|
|
1239
1240
|
g (int): Groups for convolutions.
|
|
1240
1241
|
e (float): Expansion ratio.
|
|
1241
1242
|
"""
|
|
@@ -1736,7 +1737,8 @@ class ABlock(nn.Module):
|
|
|
1736
1737
|
|
|
1737
1738
|
self.apply(self._init_weights)
|
|
1738
1739
|
|
|
1739
|
-
|
|
1740
|
+
@staticmethod
|
|
1741
|
+
def _init_weights(m: nn.Module):
|
|
1740
1742
|
"""Initialize weights using a truncated normal distribution.
|
|
1741
1743
|
|
|
1742
1744
|
Args:
|
ultralytics/nn/modules/head.py
CHANGED
|
@@ -532,7 +532,8 @@ class LRPCHead(nn.Module):
|
|
|
532
532
|
self.loc = loc
|
|
533
533
|
self.enabled = enabled
|
|
534
534
|
|
|
535
|
-
|
|
535
|
+
@staticmethod
|
|
536
|
+
def conv2linear(conv: nn.Conv2d) -> nn.Linear:
|
|
536
537
|
"""Convert a 1x1 convolutional layer to a linear layer."""
|
|
537
538
|
assert isinstance(conv, nn.Conv2d) and conv.kernel_size == (1, 1)
|
|
538
539
|
linear = nn.Linear(conv.in_channels, conv.out_channels)
|
|
@@ -981,8 +982,8 @@ class RTDETRDecoder(nn.Module):
|
|
|
981
982
|
y = torch.cat((dec_bboxes.squeeze(0), dec_scores.squeeze(0).sigmoid()), -1)
|
|
982
983
|
return y if self.export else (y, x)
|
|
983
984
|
|
|
985
|
+
@staticmethod
|
|
984
986
|
def _generate_anchors(
|
|
985
|
-
self,
|
|
986
987
|
shapes: list[list[int]],
|
|
987
988
|
grid_size: float = 0.05,
|
|
988
989
|
dtype: torch.dtype = torch.float32,
|
|
@@ -149,6 +149,6 @@ def fuse_score(cost_matrix: np.ndarray, detections: list) -> np.ndarray:
|
|
|
149
149
|
return cost_matrix
|
|
150
150
|
iou_sim = 1 - cost_matrix
|
|
151
151
|
det_scores = np.array([det.score for det in detections])
|
|
152
|
-
det_scores =
|
|
152
|
+
det_scores = det_scores[None].repeat(cost_matrix.shape[0], axis=0)
|
|
153
153
|
fuse_sim = iou_sim * det_scores
|
|
154
154
|
return 1 - fuse_sim # fuse_cost
|
ultralytics/utils/__init__.py
CHANGED
ultralytics/utils/export/imx.py
CHANGED
|
@@ -116,7 +116,7 @@ def pose_forward(self, x: list[torch.Tensor]) -> tuple[torch.Tensor, torch.Tenso
|
|
|
116
116
|
kpt = torch.cat([self.cv4[i](x[i]).view(bs, self.nk, -1) for i in range(self.nl)], -1) # (bs, 17*3, h*w)
|
|
117
117
|
x = Detect.forward(self, x)
|
|
118
118
|
pred_kpt = self.kpts_decode(bs, kpt)
|
|
119
|
-
return
|
|
119
|
+
return *x, pred_kpt.permute(0, 2, 1)
|
|
120
120
|
|
|
121
121
|
|
|
122
122
|
def segment_forward(self, x: list[torch.Tensor]) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor]:
|
|
@@ -125,7 +125,7 @@ def segment_forward(self, x: list[torch.Tensor]) -> tuple[torch.Tensor, torch.Te
|
|
|
125
125
|
bs = p.shape[0] # batch size
|
|
126
126
|
mc = torch.cat([self.cv4[i](x[i]).view(bs, self.nm, -1) for i in range(self.nl)], 2) # mask coefficients
|
|
127
127
|
x = Detect.forward(self, x)
|
|
128
|
-
return
|
|
128
|
+
return *x, mc.transpose(1, 2), p
|
|
129
129
|
|
|
130
130
|
|
|
131
131
|
class NMSWrapper(torch.nn.Module):
|
ultralytics/utils/git.py
CHANGED
|
@@ -63,7 +63,8 @@ class GitRepo:
|
|
|
63
63
|
return (root / t.split(":", 1)[1].strip()).resolve()
|
|
64
64
|
return None
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
@staticmethod
|
|
67
|
+
def _read(p: Path | None) -> str | None:
|
|
67
68
|
"""Read and strip file if exists."""
|
|
68
69
|
return p.read_text(errors="ignore").strip() if p and p.exists() else None
|
|
69
70
|
|
ultralytics/utils/loss.py
CHANGED
|
@@ -684,7 +684,7 @@ class v8OBBLoss(v8DetectionLoss):
|
|
|
684
684
|
"""Calculate and return the loss for oriented bounding box detection."""
|
|
685
685
|
loss = torch.zeros(3, device=self.device) # box, cls, dfl
|
|
686
686
|
feats, pred_angle = preds if isinstance(preds[0], list) else preds[1]
|
|
687
|
-
batch_size = pred_angle.shape[0] # batch size
|
|
687
|
+
batch_size = pred_angle.shape[0] # batch size
|
|
688
688
|
pred_distri, pred_scores = torch.cat([xi.view(feats[0].shape[0], self.no, -1) for xi in feats], 2).split(
|
|
689
689
|
(self.reg_max * 4, self.nc), 1
|
|
690
690
|
)
|
|
@@ -702,7 +702,7 @@ class v8OBBLoss(v8DetectionLoss):
|
|
|
702
702
|
try:
|
|
703
703
|
batch_idx = batch["batch_idx"].view(-1, 1)
|
|
704
704
|
targets = torch.cat((batch_idx, batch["cls"].view(-1, 1), batch["bboxes"].view(-1, 5)), 1)
|
|
705
|
-
rw, rh = targets[:, 4] * imgsz[
|
|
705
|
+
rw, rh = targets[:, 4] * float(imgsz[1]), targets[:, 5] * float(imgsz[0])
|
|
706
706
|
targets = targets[(rw >= 2) & (rh >= 2)] # filter rboxes of tiny size to stabilize training
|
|
707
707
|
targets = self.preprocess(targets, batch_size, scale_tensor=imgsz[[1, 0, 1, 0]])
|
|
708
708
|
gt_labels, gt_bboxes = targets.split((1, 5), 2) # cls, xywhr
|
|
@@ -803,7 +803,6 @@ class TVPDetectLoss:
|
|
|
803
803
|
def __call__(self, preds: Any, batch: dict[str, torch.Tensor]) -> tuple[torch.Tensor, torch.Tensor]:
|
|
804
804
|
"""Calculate the loss for text-visual prompt detection."""
|
|
805
805
|
feats = preds[1] if isinstance(preds, tuple) else preds
|
|
806
|
-
assert self.ori_reg_max == self.vp_criterion.reg_max # TODO: remove it
|
|
807
806
|
|
|
808
807
|
if self.ori_reg_max * 4 + self.ori_nc == feats[0].shape[1]:
|
|
809
808
|
loss = torch.zeros(3, device=self.vp_criterion.device, requires_grad=True)
|
|
@@ -811,8 +810,8 @@ class TVPDetectLoss:
|
|
|
811
810
|
|
|
812
811
|
vp_feats = self._get_vp_features(feats)
|
|
813
812
|
vp_loss = self.vp_criterion(vp_feats, batch)
|
|
814
|
-
|
|
815
|
-
return
|
|
813
|
+
cls_loss = vp_loss[0][1]
|
|
814
|
+
return cls_loss, vp_loss[1]
|
|
816
815
|
|
|
817
816
|
def _get_vp_features(self, feats: list[torch.Tensor]) -> list[torch.Tensor]:
|
|
818
817
|
"""Extract visual-prompt features from the model output."""
|
|
@@ -839,7 +838,6 @@ class TVPSegmentLoss(TVPDetectLoss):
|
|
|
839
838
|
def __call__(self, preds: Any, batch: dict[str, torch.Tensor]) -> tuple[torch.Tensor, torch.Tensor]:
|
|
840
839
|
"""Calculate the loss for text-visual prompt segmentation."""
|
|
841
840
|
feats, pred_masks, proto = preds if len(preds) == 3 else preds[1]
|
|
842
|
-
assert self.ori_reg_max == self.vp_criterion.reg_max # TODO: remove it
|
|
843
841
|
|
|
844
842
|
if self.ori_reg_max * 4 + self.ori_nc == feats[0].shape[1]:
|
|
845
843
|
loss = torch.zeros(4, device=self.vp_criterion.device, requires_grad=True)
|
ultralytics/utils/metrics.py
CHANGED
|
@@ -194,7 +194,8 @@ def _get_covariance_matrix(boxes: torch.Tensor) -> tuple[torch.Tensor, torch.Ten
|
|
|
194
194
|
boxes (torch.Tensor): A tensor of shape (N, 5) representing rotated bounding boxes, with xywhr format.
|
|
195
195
|
|
|
196
196
|
Returns:
|
|
197
|
-
(torch.Tensor): Covariance
|
|
197
|
+
(tuple[torch.Tensor, torch.Tensor, torch.Tensor]): Covariance matrix components (a, b, c) where the covariance
|
|
198
|
+
matrix is [[a, c], [c, b]], each of shape (N, 1).
|
|
198
199
|
"""
|
|
199
200
|
# Gaussian bounding boxes, ignore the center points (the first two columns) because they are not needed here.
|
|
200
201
|
gbbs = torch.cat((boxes[:, 2:4].pow(2) / 12, boxes[:, 4:]), dim=-1)
|
ultralytics/utils/ops.py
CHANGED
|
@@ -604,11 +604,11 @@ def regularize_rboxes(rboxes):
|
|
|
604
604
|
return torch.stack([x, y, w_, h_, t], dim=-1) # regularized boxes
|
|
605
605
|
|
|
606
606
|
|
|
607
|
-
def masks2segments(masks, strategy: str = "all"):
|
|
607
|
+
def masks2segments(masks: np.ndarray | torch.Tensor, strategy: str = "all") -> list[np.ndarray]:
|
|
608
608
|
"""Convert masks to segments using contour detection.
|
|
609
609
|
|
|
610
610
|
Args:
|
|
611
|
-
masks (torch.Tensor): Binary masks with shape (batch_size, 160, 160).
|
|
611
|
+
masks (np.ndarray | torch.Tensor): Binary masks with shape (batch_size, 160, 160).
|
|
612
612
|
strategy (str): Segmentation strategy, either 'all' or 'largest'.
|
|
613
613
|
|
|
614
614
|
Returns:
|
|
@@ -616,8 +616,9 @@ def masks2segments(masks, strategy: str = "all"):
|
|
|
616
616
|
"""
|
|
617
617
|
from ultralytics.data.converter import merge_multi_segment
|
|
618
618
|
|
|
619
|
+
masks = masks.astype("uint8") if isinstance(masks, np.ndarray) else masks.byte().cpu().numpy()
|
|
619
620
|
segments = []
|
|
620
|
-
for x in
|
|
621
|
+
for x in np.ascontiguousarray(masks):
|
|
621
622
|
c = cv2.findContours(x, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)[0]
|
|
622
623
|
if c:
|
|
623
624
|
if strategy == "all": # merge and concatenate all segments
|
ultralytics/utils/plotting.py
CHANGED
|
@@ -203,6 +203,8 @@ class Annotator:
|
|
|
203
203
|
if not input_is_pil:
|
|
204
204
|
if im.shape[2] == 1: # handle grayscale
|
|
205
205
|
im = cv2.cvtColor(im, cv2.COLOR_GRAY2BGR)
|
|
206
|
+
elif im.shape[2] == 2: # handle 2-channel images
|
|
207
|
+
im = np.ascontiguousarray(np.dstack((im, np.zeros_like(im[..., :1]))))
|
|
206
208
|
elif im.shape[2] > 3: # multispectral
|
|
207
209
|
im = np.ascontiguousarray(im[..., :3])
|
|
208
210
|
if self.pil: # use PIL
|
ultralytics/utils/tqdm.py
CHANGED
|
@@ -179,7 +179,8 @@ class TQDM:
|
|
|
179
179
|
num /= self.unit_divisor
|
|
180
180
|
return f"{num:.1f}PB"
|
|
181
181
|
|
|
182
|
-
|
|
182
|
+
@staticmethod
|
|
183
|
+
def _format_time(seconds: float) -> str:
|
|
183
184
|
"""Format time duration."""
|
|
184
185
|
if seconds < 60:
|
|
185
186
|
return f"{seconds:.1f}s"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|