ultralytics 8.2.72__py3-none-any.whl → 8.2.74__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.
- ultralytics/__init__.py +2 -3
- ultralytics/cfg/trackers/botsort.yaml +1 -1
- ultralytics/cfg/trackers/bytetrack.yaml +1 -1
- ultralytics/models/__init__.py +1 -2
- ultralytics/models/sam/__init__.py +2 -2
- ultralytics/models/sam/amg.py +27 -21
- ultralytics/models/sam/build.py +200 -9
- ultralytics/models/sam/model.py +86 -34
- ultralytics/models/sam/modules/blocks.py +1131 -0
- ultralytics/models/sam/modules/decoders.py +390 -23
- ultralytics/models/sam/modules/encoders.py +508 -323
- ultralytics/models/{sam2 → sam}/modules/memory_attention.py +73 -6
- ultralytics/models/sam/modules/sam.py +887 -16
- ultralytics/models/sam/modules/tiny_encoder.py +376 -126
- ultralytics/models/sam/modules/transformer.py +155 -54
- ultralytics/models/{sam2 → sam}/modules/utils.py +105 -3
- ultralytics/models/sam/predict.py +382 -92
- ultralytics/trackers/bot_sort.py +2 -3
- ultralytics/trackers/byte_tracker.py +2 -3
- {ultralytics-8.2.72.dist-info → ultralytics-8.2.74.dist-info}/METADATA +44 -44
- {ultralytics-8.2.72.dist-info → ultralytics-8.2.74.dist-info}/RECORD +25 -33
- ultralytics/models/sam2/__init__.py +0 -6
- ultralytics/models/sam2/build.py +0 -156
- ultralytics/models/sam2/model.py +0 -97
- ultralytics/models/sam2/modules/__init__.py +0 -1
- ultralytics/models/sam2/modules/decoders.py +0 -305
- ultralytics/models/sam2/modules/encoders.py +0 -332
- ultralytics/models/sam2/modules/sam2.py +0 -804
- ultralytics/models/sam2/modules/sam2_blocks.py +0 -715
- ultralytics/models/sam2/predict.py +0 -177
- {ultralytics-8.2.72.dist-info → ultralytics-8.2.74.dist-info}/LICENSE +0 -0
- {ultralytics-8.2.72.dist-info → ultralytics-8.2.74.dist-info}/WHEEL +0 -0
- {ultralytics-8.2.72.dist-info → ultralytics-8.2.74.dist-info}/entry_points.txt +0 -0
- {ultralytics-8.2.72.dist-info → ultralytics-8.2.74.dist-info}/top_level.txt +0 -0
|
@@ -375,9 +375,8 @@ class BYTETracker:
|
|
|
375
375
|
def get_dists(self, tracks, detections):
|
|
376
376
|
"""Calculates the distance between tracks and detections using IoU and fuses scores."""
|
|
377
377
|
dists = matching.iou_distance(tracks, detections)
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
dists = matching.fuse_score(dists, detections)
|
|
378
|
+
if self.args.fuse_score:
|
|
379
|
+
dists = matching.fuse_score(dists, detections)
|
|
381
380
|
return dists
|
|
382
381
|
|
|
383
382
|
def multi_predict(self, tracks):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ultralytics
|
|
3
|
-
Version: 8.2.
|
|
3
|
+
Version: 8.2.74
|
|
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
|
|
@@ -30,56 +30,56 @@ Classifier: Operating System :: Microsoft :: Windows
|
|
|
30
30
|
Requires-Python: >=3.8
|
|
31
31
|
Description-Content-Type: text/markdown
|
|
32
32
|
License-File: LICENSE
|
|
33
|
-
Requires-Dist: numpy
|
|
34
|
-
Requires-Dist: matplotlib
|
|
35
|
-
Requires-Dist: opencv-python
|
|
36
|
-
Requires-Dist: pillow
|
|
37
|
-
Requires-Dist: pyyaml
|
|
38
|
-
Requires-Dist: requests
|
|
39
|
-
Requires-Dist: scipy
|
|
40
|
-
Requires-Dist: torch
|
|
41
|
-
Requires-Dist: torchvision
|
|
42
|
-
Requires-Dist: tqdm
|
|
33
|
+
Requires-Dist: numpy<2.0.0,>=1.23.0
|
|
34
|
+
Requires-Dist: matplotlib>=3.3.0
|
|
35
|
+
Requires-Dist: opencv-python>=4.6.0
|
|
36
|
+
Requires-Dist: pillow>=7.1.2
|
|
37
|
+
Requires-Dist: pyyaml>=5.3.1
|
|
38
|
+
Requires-Dist: requests>=2.23.0
|
|
39
|
+
Requires-Dist: scipy>=1.4.1
|
|
40
|
+
Requires-Dist: torch>=1.8.0
|
|
41
|
+
Requires-Dist: torchvision>=0.9.0
|
|
42
|
+
Requires-Dist: tqdm>=4.64.0
|
|
43
43
|
Requires-Dist: psutil
|
|
44
44
|
Requires-Dist: py-cpuinfo
|
|
45
|
-
Requires-Dist: pandas
|
|
46
|
-
Requires-Dist: seaborn
|
|
47
|
-
Requires-Dist: ultralytics-thop
|
|
45
|
+
Requires-Dist: pandas>=1.1.4
|
|
46
|
+
Requires-Dist: seaborn>=0.11.0
|
|
47
|
+
Requires-Dist: ultralytics-thop>=2.0.0
|
|
48
48
|
Provides-Extra: dev
|
|
49
|
-
Requires-Dist: ipython
|
|
50
|
-
Requires-Dist: pytest
|
|
51
|
-
Requires-Dist: pytest-cov
|
|
52
|
-
Requires-Dist: coverage[toml]
|
|
53
|
-
Requires-Dist: mkdocs
|
|
54
|
-
Requires-Dist: mkdocs-material
|
|
55
|
-
Requires-Dist: mkdocstrings[python]
|
|
56
|
-
Requires-Dist: mkdocs-jupyter
|
|
57
|
-
Requires-Dist: mkdocs-redirects
|
|
58
|
-
Requires-Dist: mkdocs-ultralytics-plugin
|
|
49
|
+
Requires-Dist: ipython; extra == "dev"
|
|
50
|
+
Requires-Dist: pytest; extra == "dev"
|
|
51
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
52
|
+
Requires-Dist: coverage[toml]; extra == "dev"
|
|
53
|
+
Requires-Dist: mkdocs>=1.6.0; extra == "dev"
|
|
54
|
+
Requires-Dist: mkdocs-material>=9.5.9; extra == "dev"
|
|
55
|
+
Requires-Dist: mkdocstrings[python]; extra == "dev"
|
|
56
|
+
Requires-Dist: mkdocs-jupyter; extra == "dev"
|
|
57
|
+
Requires-Dist: mkdocs-redirects; extra == "dev"
|
|
58
|
+
Requires-Dist: mkdocs-ultralytics-plugin>=0.0.49; extra == "dev"
|
|
59
59
|
Provides-Extra: explorer
|
|
60
|
-
Requires-Dist: lancedb
|
|
61
|
-
Requires-Dist: duckdb
|
|
62
|
-
Requires-Dist: streamlit
|
|
60
|
+
Requires-Dist: lancedb; extra == "explorer"
|
|
61
|
+
Requires-Dist: duckdb<=0.9.2; extra == "explorer"
|
|
62
|
+
Requires-Dist: streamlit; extra == "explorer"
|
|
63
63
|
Provides-Extra: export
|
|
64
|
-
Requires-Dist: onnx
|
|
65
|
-
Requires-Dist: openvino
|
|
66
|
-
Requires-Dist: tensorflow
|
|
67
|
-
Requires-Dist: tensorflowjs
|
|
68
|
-
Requires-Dist: keras
|
|
69
|
-
Requires-Dist: flatbuffers
|
|
70
|
-
Requires-Dist: numpy
|
|
71
|
-
Requires-Dist: h5py
|
|
72
|
-
Requires-Dist: tensorstore
|
|
73
|
-
Requires-Dist: coremltools
|
|
64
|
+
Requires-Dist: onnx>=1.12.0; extra == "export"
|
|
65
|
+
Requires-Dist: openvino>=2024.0.0; extra == "export"
|
|
66
|
+
Requires-Dist: tensorflow>=2.0.0; extra == "export"
|
|
67
|
+
Requires-Dist: tensorflowjs>=3.9.0; extra == "export"
|
|
68
|
+
Requires-Dist: keras; extra == "export"
|
|
69
|
+
Requires-Dist: flatbuffers<100,>=23.5.26; platform_machine == "aarch64" and extra == "export"
|
|
70
|
+
Requires-Dist: numpy==1.23.5; platform_machine == "aarch64" and extra == "export"
|
|
71
|
+
Requires-Dist: h5py!=3.11.0; platform_machine == "aarch64" and extra == "export"
|
|
72
|
+
Requires-Dist: tensorstore>=0.1.63; (platform_machine == "aarch64" and python_version >= "3.9") and extra == "export"
|
|
73
|
+
Requires-Dist: coremltools>=7.0; (platform_system != "Windows" and python_version <= "3.11") and extra == "export"
|
|
74
74
|
Provides-Extra: extra
|
|
75
|
-
Requires-Dist: hub-sdk
|
|
76
|
-
Requires-Dist: ipython
|
|
77
|
-
Requires-Dist: albumentations
|
|
78
|
-
Requires-Dist: pycocotools
|
|
75
|
+
Requires-Dist: hub-sdk>=0.0.8; extra == "extra"
|
|
76
|
+
Requires-Dist: ipython; extra == "extra"
|
|
77
|
+
Requires-Dist: albumentations>=1.4.6; extra == "extra"
|
|
78
|
+
Requires-Dist: pycocotools>=2.0.7; extra == "extra"
|
|
79
79
|
Provides-Extra: logging
|
|
80
|
-
Requires-Dist: comet
|
|
81
|
-
Requires-Dist: tensorboard
|
|
82
|
-
Requires-Dist: dvclive
|
|
80
|
+
Requires-Dist: comet; extra == "logging"
|
|
81
|
+
Requires-Dist: tensorboard>=2.13.0; extra == "logging"
|
|
82
|
+
Requires-Dist: dvclive>=2.12.0; extra == "logging"
|
|
83
83
|
|
|
84
84
|
<div align="center">
|
|
85
85
|
<p>
|
|
@@ -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=
|
|
11
|
+
ultralytics/__init__.py,sha256=0mePJ1OrsmtoXd_P7bhGJ4w9rk7MWbBmC-mt2qqq-zM,694
|
|
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
|
|
@@ -80,8 +80,8 @@ ultralytics/cfg/models/v9/yolov9e.yaml,sha256=dhaR47WxuLOrZWDCceS4bQG00sQdrMc8FQ
|
|
|
80
80
|
ultralytics/cfg/models/v9/yolov9m.yaml,sha256=l6CmivzNu44sRVmkQXk4-tXflbV1nWnk5MSc8su2vhs,1311
|
|
81
81
|
ultralytics/cfg/models/v9/yolov9s.yaml,sha256=lPWcu-6ub1kCBD6zIDFwthYZ3RvdJfODWKy3vEQWRjo,1291
|
|
82
82
|
ultralytics/cfg/models/v9/yolov9t.yaml,sha256=qL__kr6GoefpQWP4jV0jdzwTp46bdFUcqtPRnfDbkY8,1275
|
|
83
|
-
ultralytics/cfg/trackers/botsort.yaml,sha256=
|
|
84
|
-
ultralytics/cfg/trackers/bytetrack.yaml,sha256=
|
|
83
|
+
ultralytics/cfg/trackers/botsort.yaml,sha256=8B0xNbnG_E-9DCUpap72PWkUgBb1AjuApEn7gHiVngE,916
|
|
84
|
+
ultralytics/cfg/trackers/bytetrack.yaml,sha256=8vpTZ2x9mhRXJymoJvs1G8kTXo_HxbSwHup2FQALT3A,721
|
|
85
85
|
ultralytics/data/__init__.py,sha256=VGe-ATG7j35F4A4r8Jmzffjlhve4JAJPgRa5ahKTU18,616
|
|
86
86
|
ultralytics/data/annotator.py,sha256=1Hyu6ubrBL8KmRrt1keGn-K4XTqQdAVyIwTsQiBtzLU,2489
|
|
87
87
|
ultralytics/data/augment.py,sha256=ExU4khJfJ_TeczkJRLNUDscN57SJvAjnm-reouJcxGI,119309
|
|
@@ -110,7 +110,7 @@ ultralytics/hub/auth.py,sha256=FID58NE6fh7Op_B45QOpWBw1qoBN0ponL16uvyb2dZ8,5399
|
|
|
110
110
|
ultralytics/hub/session.py,sha256=UF_aVwyxnbP-OzpzKXGGhi4i6KGWjjhoj5Qsn46dFpE,16257
|
|
111
111
|
ultralytics/hub/utils.py,sha256=tXfM3QbXBcf4Y6StgHI1pktT4OM7Ic9eF3xiBFHGlhY,9721
|
|
112
112
|
ultralytics/hub/google/__init__.py,sha256=qyvvpGP-4NAtrn7GLqfqxP_aWuRP1T0OvJYafWKvL2Q,7512
|
|
113
|
-
ultralytics/models/__init__.py,sha256=
|
|
113
|
+
ultralytics/models/__init__.py,sha256=TT9iLCL_n9Y80dcUq0Fo-p-GRZCSU2vrWXM3CoMwqqE,265
|
|
114
114
|
ultralytics/models/fastsam/__init__.py,sha256=W0rRSJM3vdxcsneuiN6_ajkUw86k6-opUKdLxVhKOoQ,203
|
|
115
115
|
ultralytics/models/fastsam/model.py,sha256=r5VZj-KLKaqZtEKTZxQik8vQI2N9uOF4xpV_gA-P8h0,2101
|
|
116
116
|
ultralytics/models/fastsam/predict.py,sha256=z5j2IMwf4MURuROKeqNXW1WvOSj91UdJa7dLRqN_OFc,7370
|
|
@@ -125,28 +125,20 @@ ultralytics/models/rtdetr/model.py,sha256=2VkppF1_581XmQ0UI7lo8fX7MqhAJPXVMr2jyM
|
|
|
125
125
|
ultralytics/models/rtdetr/predict.py,sha256=GmeNiFszDajq9YNPi0jW89CqP0MRD5Gtmokh9z0JAQc,3568
|
|
126
126
|
ultralytics/models/rtdetr/train.py,sha256=20AFYVW9NPxw0-cp-sRdIovWidFL0IIhJRv2oZjkPlM,3685
|
|
127
127
|
ultralytics/models/rtdetr/val.py,sha256=4QQArdaGEY8rJsJuvyJ032f8GGVGdV2jURHK2EdMxyk,5566
|
|
128
|
-
ultralytics/models/sam/__init__.py,sha256=
|
|
129
|
-
ultralytics/models/sam/amg.py,sha256=
|
|
130
|
-
ultralytics/models/sam/build.py,sha256=
|
|
131
|
-
ultralytics/models/sam/model.py,sha256=
|
|
132
|
-
ultralytics/models/sam/predict.py,sha256=
|
|
128
|
+
ultralytics/models/sam/__init__.py,sha256=o4_D6y8YJlOXIK7Lwo9RHnIJJ9xoFNi4zK99QSc1kdM,176
|
|
129
|
+
ultralytics/models/sam/amg.py,sha256=GrmO_8YfIDt_QkPEMF_WFjPZkhwhf7iwx7ig8JgOUnE,8709
|
|
130
|
+
ultralytics/models/sam/build.py,sha256=zNQbrgSHUgz1gyXQwLKGTpa6CSEjeaevcP3w1Z1l3mo,12233
|
|
131
|
+
ultralytics/models/sam/model.py,sha256=uOm5xEPX9PJYu6ag5T5iHzl4Uq8huwPyoaYo9imf9HQ,7374
|
|
132
|
+
ultralytics/models/sam/predict.py,sha256=ILPx2O4pj4hmMG1KGwHjMYBM3pD-4mZLPNqIczk6_S0,37744
|
|
133
133
|
ultralytics/models/sam/modules/__init__.py,sha256=mHtJuK4hwF8cuV-VHDc7tp6u6D1gHz2Z7JI8grmQDTs,42
|
|
134
|
-
ultralytics/models/sam/modules/
|
|
135
|
-
ultralytics/models/sam/modules/
|
|
136
|
-
ultralytics/models/sam/modules/
|
|
137
|
-
ultralytics/models/sam/modules/
|
|
138
|
-
ultralytics/models/sam/modules/
|
|
139
|
-
ultralytics/models/
|
|
140
|
-
ultralytics/models/
|
|
141
|
-
ultralytics/models/
|
|
142
|
-
ultralytics/models/sam2/predict.py,sha256=I_ZM3oA2-6Y2gjWGJWsDmQeLM51JSVRBZNGzNwRszY4,8636
|
|
143
|
-
ultralytics/models/sam2/modules/__init__.py,sha256=mHtJuK4hwF8cuV-VHDc7tp6u6D1gHz2Z7JI8grmQDTs,42
|
|
144
|
-
ultralytics/models/sam2/modules/decoders.py,sha256=t4SR-0g3HQstk-agiapCsVYTMZBFc2vz24zfgBwZUkw,15376
|
|
145
|
-
ultralytics/models/sam2/modules/encoders.py,sha256=0VRK2wdl0vZzKA3528_j-Vyn4Iy8XlNHp2ftQRn-aGE,13313
|
|
146
|
-
ultralytics/models/sam2/modules/memory_attention.py,sha256=4zdvm8_ANM0r8QSN_xBGi9l-9Ugjt3gxBsHv2cHczjc,6214
|
|
147
|
-
ultralytics/models/sam2/modules/sam2.py,sha256=CgCBrfjhKDHI2n8iM6AIJmXeCEgf2_qUz7rzZT31fB0,44255
|
|
148
|
-
ultralytics/models/sam2/modules/sam2_blocks.py,sha256=7HmuZTFw8VVdAVDsIStWByxyUHBqytnfgvQMaCNr1GU,28379
|
|
149
|
-
ultralytics/models/sam2/modules/utils.py,sha256=2H5C3sjBnYoPuoJqflH3AmGeBJoKrhHea136jgwIq_I,8320
|
|
134
|
+
ultralytics/models/sam/modules/blocks.py,sha256=qXCXMqkQG0fpAvCkA9TrtimfOLDtyJfCx3bDfh3bJUs,45974
|
|
135
|
+
ultralytics/models/sam/modules/decoders.py,sha256=d02t-55eTUBXEUtaDbcLm4VLgfqsW478CpJouMkMK-g,25874
|
|
136
|
+
ultralytics/models/sam/modules/encoders.py,sha256=KvQFAtqfGvCAr4kcMXxnJvjwIhaQ0a3Wwp0KhSSG_oA,34615
|
|
137
|
+
ultralytics/models/sam/modules/memory_attention.py,sha256=XilWBnRfH8wZxIoL2-yEk-dRypCsS0Jf_9t8WJxXKg0,9722
|
|
138
|
+
ultralytics/models/sam/modules/sam.py,sha256=1U2XGskHymvhZ8OFKYzTEfAI9zJuqWn-d1qonC57dfQ,49397
|
|
139
|
+
ultralytics/models/sam/modules/tiny_encoder.py,sha256=yFbrPMuFuA9LIMFVhA2VvkhwE-JOKdrg5euTkgilPIk,40437
|
|
140
|
+
ultralytics/models/sam/modules/transformer.py,sha256=cUxCPOBfsl3GNhuhC1b9l4j5FuJTb3_e7jD4td5TFhU,16156
|
|
141
|
+
ultralytics/models/sam/modules/utils.py,sha256=HVQiV5P_a1JH_9hZ71Cc0yAkCjw2iML20b_CPErahlE,12315
|
|
150
142
|
ultralytics/models/utils/__init__.py,sha256=mHtJuK4hwF8cuV-VHDc7tp6u6D1gHz2Z7JI8grmQDTs,42
|
|
151
143
|
ultralytics/models/utils/loss.py,sha256=PmlKDe4xQTiYkPSCdNUabxJC7bh43zGxiKVIxsXBVGE,15135
|
|
152
144
|
ultralytics/models/utils/ops.py,sha256=sAeD_koytXDzHibIvQLLAx3vOpGdhdAiQhMiNFUnn5U,13255
|
|
@@ -197,8 +189,8 @@ ultralytics/solutions/speed_estimation.py,sha256=kjqMSHGTHMZaNgTKNKWULxnJQNsvhq4
|
|
|
197
189
|
ultralytics/solutions/streamlit_inference.py,sha256=MKf5P3O5oJwIKu2h_URvzaQjMWoSEMDMBwordplfRxo,5703
|
|
198
190
|
ultralytics/trackers/__init__.py,sha256=j72IgH2dZHQArMPK4YwcV5ieIw94fYvlGdQjB9cOQKw,227
|
|
199
191
|
ultralytics/trackers/basetrack.py,sha256=-vBDD-Q9lsxfTMK2w9kuqWGrYbRMmaBCCEbGGyR53gE,3675
|
|
200
|
-
ultralytics/trackers/bot_sort.py,sha256=
|
|
201
|
-
ultralytics/trackers/byte_tracker.py,sha256=
|
|
192
|
+
ultralytics/trackers/bot_sort.py,sha256=7wuuQpsMSfJ9m-fzkxpx0mDjh_7Wkhv9lheNpfsuyDs,8582
|
|
193
|
+
ultralytics/trackers/byte_tracker.py,sha256=0KPnGAKyCXGHb6G7EPhio8mFdJTiB_WC2oqTI0pys6U,18838
|
|
202
194
|
ultralytics/trackers/track.py,sha256=NnCA99jXVOvj7XpL_RvMm01DGdixKqAMFz6Sdds30kQ,3436
|
|
203
195
|
ultralytics/trackers/utils/__init__.py,sha256=mHtJuK4hwF8cuV-VHDc7tp6u6D1gHz2Z7JI8grmQDTs,42
|
|
204
196
|
ultralytics/trackers/utils/gmc.py,sha256=-1oBNFRB-9EawJmUOT566AygLCVxJw-jsPSIOl5j_Hk,13683
|
|
@@ -233,9 +225,9 @@ ultralytics/utils/callbacks/neptune.py,sha256=5Z3ua5YBTUS56FH8VQKQG1aaIo9fH8GEyz
|
|
|
233
225
|
ultralytics/utils/callbacks/raytune.py,sha256=ODVYzy-CoM4Uge0zjkh3Hnh9nF2M0vhDrSenXnvcizw,705
|
|
234
226
|
ultralytics/utils/callbacks/tensorboard.py,sha256=QEgOVhUqY9akOs5TJIwz1Rvn6l32xWLpOxlwEyWF0B8,4136
|
|
235
227
|
ultralytics/utils/callbacks/wb.py,sha256=9-fjQIdLjr3b73DTE3rHO171KvbH1VweJ-bmbv-rqTw,6747
|
|
236
|
-
ultralytics-8.2.
|
|
237
|
-
ultralytics-8.2.
|
|
238
|
-
ultralytics-8.2.
|
|
239
|
-
ultralytics-8.2.
|
|
240
|
-
ultralytics-8.2.
|
|
241
|
-
ultralytics-8.2.
|
|
228
|
+
ultralytics-8.2.74.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
|
|
229
|
+
ultralytics-8.2.74.dist-info/METADATA,sha256=b5wD8pNfYLoERi_TndgKk2c76llIAvwz2eB47WP9WKA,41270
|
|
230
|
+
ultralytics-8.2.74.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
|
|
231
|
+
ultralytics-8.2.74.dist-info/entry_points.txt,sha256=YM_wiKyTe9yRrsEfqvYolNO5ngwfoL4-NwgKzc8_7sI,93
|
|
232
|
+
ultralytics-8.2.74.dist-info/top_level.txt,sha256=XP49TwiMw4QGsvTLSYiJhz1xF_k7ev5mQ8jJXaXi45Q,12
|
|
233
|
+
ultralytics-8.2.74.dist-info/RECORD,,
|
ultralytics/models/sam2/build.py
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
# Ultralytics YOLO 🚀, AGPL-3.0 license
|
|
2
|
-
|
|
3
|
-
import torch
|
|
4
|
-
|
|
5
|
-
from ultralytics.utils.downloads import attempt_download_asset
|
|
6
|
-
|
|
7
|
-
from .modules.encoders import FpnNeck, Hiera, ImageEncoder, MemoryEncoder
|
|
8
|
-
from .modules.memory_attention import MemoryAttention, MemoryAttentionLayer
|
|
9
|
-
from .modules.sam2 import SAM2Model
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def build_sam2_t(checkpoint=None):
|
|
13
|
-
"""Build and return a Segment Anything Model (SAM2) tiny-size model with specified architecture parameters."""
|
|
14
|
-
return _build_sam2(
|
|
15
|
-
encoder_embed_dim=96,
|
|
16
|
-
encoder_stages=[1, 2, 7, 2],
|
|
17
|
-
encoder_num_heads=1,
|
|
18
|
-
encoder_global_att_blocks=[5, 7, 9],
|
|
19
|
-
encoder_window_spec=[8, 4, 14, 7],
|
|
20
|
-
encoder_backbone_channel_list=[768, 384, 192, 96],
|
|
21
|
-
checkpoint=checkpoint,
|
|
22
|
-
)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
def build_sam2_s(checkpoint=None):
|
|
26
|
-
"""Builds and returns a small-size Segment Anything Model (SAM2) with specified architecture parameters."""
|
|
27
|
-
return _build_sam2(
|
|
28
|
-
encoder_embed_dim=96,
|
|
29
|
-
encoder_stages=[1, 2, 11, 2],
|
|
30
|
-
encoder_num_heads=1,
|
|
31
|
-
encoder_global_att_blocks=[7, 10, 13],
|
|
32
|
-
encoder_window_spec=[8, 4, 14, 7],
|
|
33
|
-
encoder_backbone_channel_list=[768, 384, 192, 96],
|
|
34
|
-
checkpoint=checkpoint,
|
|
35
|
-
)
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
def build_sam2_b(checkpoint=None):
|
|
39
|
-
"""Builds and returns a Segment Anything Model (SAM2) base-size model with specified architecture parameters."""
|
|
40
|
-
return _build_sam2(
|
|
41
|
-
encoder_embed_dim=112,
|
|
42
|
-
encoder_stages=[2, 3, 16, 3],
|
|
43
|
-
encoder_num_heads=2,
|
|
44
|
-
encoder_global_att_blocks=[12, 16, 20],
|
|
45
|
-
encoder_window_spec=[8, 4, 14, 7],
|
|
46
|
-
encoder_window_spatial_size=[14, 14],
|
|
47
|
-
encoder_backbone_channel_list=[896, 448, 224, 112],
|
|
48
|
-
checkpoint=checkpoint,
|
|
49
|
-
)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
def build_sam2_l(checkpoint=None):
|
|
53
|
-
"""Build and return a Segment Anything Model (SAM2) large-size model with specified architecture parameters."""
|
|
54
|
-
return _build_sam2(
|
|
55
|
-
encoder_embed_dim=144,
|
|
56
|
-
encoder_stages=[2, 6, 36, 4],
|
|
57
|
-
encoder_num_heads=2,
|
|
58
|
-
encoder_global_att_blocks=[23, 33, 43],
|
|
59
|
-
encoder_window_spec=[8, 4, 16, 8],
|
|
60
|
-
encoder_backbone_channel_list=[1152, 576, 288, 144],
|
|
61
|
-
checkpoint=checkpoint,
|
|
62
|
-
)
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
def _build_sam2(
|
|
66
|
-
encoder_embed_dim=1280,
|
|
67
|
-
encoder_stages=[2, 6, 36, 4],
|
|
68
|
-
encoder_num_heads=2,
|
|
69
|
-
encoder_global_att_blocks=[7, 15, 23, 31],
|
|
70
|
-
encoder_backbone_channel_list=[1152, 576, 288, 144],
|
|
71
|
-
encoder_window_spatial_size=[7, 7],
|
|
72
|
-
encoder_window_spec=[8, 4, 16, 8],
|
|
73
|
-
checkpoint=None,
|
|
74
|
-
):
|
|
75
|
-
"""Builds a SAM2 model with specified architecture parameters and optional checkpoint loading."""
|
|
76
|
-
image_encoder = ImageEncoder(
|
|
77
|
-
trunk=Hiera(
|
|
78
|
-
embed_dim=encoder_embed_dim,
|
|
79
|
-
num_heads=encoder_num_heads,
|
|
80
|
-
stages=encoder_stages,
|
|
81
|
-
global_att_blocks=encoder_global_att_blocks,
|
|
82
|
-
window_pos_embed_bkg_spatial_size=encoder_window_spatial_size,
|
|
83
|
-
window_spec=encoder_window_spec,
|
|
84
|
-
),
|
|
85
|
-
neck=FpnNeck(
|
|
86
|
-
d_model=256,
|
|
87
|
-
backbone_channel_list=encoder_backbone_channel_list,
|
|
88
|
-
fpn_top_down_levels=[2, 3],
|
|
89
|
-
fpn_interp_model="nearest",
|
|
90
|
-
),
|
|
91
|
-
scalp=1,
|
|
92
|
-
)
|
|
93
|
-
memory_attention = MemoryAttention(d_model=256, pos_enc_at_input=True, num_layers=4, layer=MemoryAttentionLayer())
|
|
94
|
-
memory_encoder = MemoryEncoder(out_dim=64)
|
|
95
|
-
|
|
96
|
-
sam2 = SAM2Model(
|
|
97
|
-
image_encoder=image_encoder,
|
|
98
|
-
memory_attention=memory_attention,
|
|
99
|
-
memory_encoder=memory_encoder,
|
|
100
|
-
num_maskmem=7,
|
|
101
|
-
image_size=1024,
|
|
102
|
-
sigmoid_scale_for_mem_enc=20.0,
|
|
103
|
-
sigmoid_bias_for_mem_enc=-10.0,
|
|
104
|
-
use_mask_input_as_output_without_sam=True,
|
|
105
|
-
directly_add_no_mem_embed=True,
|
|
106
|
-
use_high_res_features_in_sam=True,
|
|
107
|
-
multimask_output_in_sam=True,
|
|
108
|
-
iou_prediction_use_sigmoid=True,
|
|
109
|
-
use_obj_ptrs_in_encoder=True,
|
|
110
|
-
add_tpos_enc_to_obj_ptrs=True,
|
|
111
|
-
only_obj_ptrs_in_the_past_for_eval=True,
|
|
112
|
-
pred_obj_scores=True,
|
|
113
|
-
pred_obj_scores_mlp=True,
|
|
114
|
-
fixed_no_obj_ptr=True,
|
|
115
|
-
multimask_output_for_tracking=True,
|
|
116
|
-
use_multimask_token_for_obj_ptr=True,
|
|
117
|
-
multimask_min_pt_num=0,
|
|
118
|
-
multimask_max_pt_num=1,
|
|
119
|
-
use_mlp_for_obj_ptr_proj=True,
|
|
120
|
-
compile_image_encoder=False,
|
|
121
|
-
sam_mask_decoder_extra_args=dict(
|
|
122
|
-
dynamic_multimask_via_stability=True,
|
|
123
|
-
dynamic_multimask_stability_delta=0.05,
|
|
124
|
-
dynamic_multimask_stability_thresh=0.98,
|
|
125
|
-
),
|
|
126
|
-
)
|
|
127
|
-
|
|
128
|
-
if checkpoint is not None:
|
|
129
|
-
checkpoint = attempt_download_asset(checkpoint)
|
|
130
|
-
with open(checkpoint, "rb") as f:
|
|
131
|
-
state_dict = torch.load(f)["model"]
|
|
132
|
-
sam2.load_state_dict(state_dict)
|
|
133
|
-
sam2.eval()
|
|
134
|
-
return sam2
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
sam_model_map = {
|
|
138
|
-
"sam2_t.pt": build_sam2_t,
|
|
139
|
-
"sam2_s.pt": build_sam2_s,
|
|
140
|
-
"sam2_b.pt": build_sam2_b,
|
|
141
|
-
"sam2_l.pt": build_sam2_l,
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
def build_sam2(ckpt="sam_b.pt"):
|
|
146
|
-
"""Constructs a Segment Anything Model (SAM2) based on the specified checkpoint, with various size options."""
|
|
147
|
-
model_builder = None
|
|
148
|
-
ckpt = str(ckpt) # to allow Path ckpt types
|
|
149
|
-
for k in sam_model_map.keys():
|
|
150
|
-
if ckpt.endswith(k):
|
|
151
|
-
model_builder = sam_model_map.get(k)
|
|
152
|
-
|
|
153
|
-
if not model_builder:
|
|
154
|
-
raise FileNotFoundError(f"{ckpt} is not a supported SAM model. Available models are: \n {sam_model_map.keys()}")
|
|
155
|
-
|
|
156
|
-
return model_builder(ckpt)
|
ultralytics/models/sam2/model.py
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
# Ultralytics YOLO 🚀, AGPL-3.0 license
|
|
2
|
-
"""
|
|
3
|
-
SAM2 model interface.
|
|
4
|
-
|
|
5
|
-
This module provides an interface to the Segment Anything Model (SAM2) from Ultralytics, designed for real-time image
|
|
6
|
-
segmentation tasks. The SAM2 model allows for promptable segmentation with unparalleled versatility in image analysis,
|
|
7
|
-
and has been trained on the SA-1B dataset. It features zero-shot performance capabilities, enabling it to adapt to new
|
|
8
|
-
image distributions and tasks without prior knowledge.
|
|
9
|
-
|
|
10
|
-
Key Features:
|
|
11
|
-
- Promptable segmentation
|
|
12
|
-
- Real-time performance
|
|
13
|
-
- Zero-shot transfer capabilities
|
|
14
|
-
- Trained on SA-1B dataset
|
|
15
|
-
"""
|
|
16
|
-
|
|
17
|
-
from ultralytics.models.sam import SAM
|
|
18
|
-
|
|
19
|
-
from .build import build_sam2
|
|
20
|
-
from .predict import SAM2Predictor
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
class SAM2(SAM):
|
|
24
|
-
"""
|
|
25
|
-
SAM2 class for real-time image segmentation using the Segment Anything Model (SAM2).
|
|
26
|
-
|
|
27
|
-
This class extends the SAM base class, providing an interface to the SAM2 model for promptable segmentation
|
|
28
|
-
tasks. It supports loading pre-trained weights and offers zero-shot performance capabilities.
|
|
29
|
-
|
|
30
|
-
Attributes:
|
|
31
|
-
model (torch.nn.Module): The loaded SAM2 model.
|
|
32
|
-
task_map (Dict[str, Type[SAM2Predictor]]): Mapping of 'segment' task to SAM2Predictor.
|
|
33
|
-
|
|
34
|
-
Methods:
|
|
35
|
-
__init__: Initializes the SAM2 model with pre-trained weights.
|
|
36
|
-
_load: Loads specified weights into the SAM2 model.
|
|
37
|
-
|
|
38
|
-
Examples:
|
|
39
|
-
>>> sam2 = SAM2("sam2_b.pt")
|
|
40
|
-
>>> sam2._load('path/to/sam2_weights.pt')
|
|
41
|
-
>>> task_map = sam2.task_map
|
|
42
|
-
>>> print(task_map)
|
|
43
|
-
{'segment': SAM2Predictor}
|
|
44
|
-
|
|
45
|
-
Notes:
|
|
46
|
-
- Supports .pt and .pth file extensions for model weights.
|
|
47
|
-
- Offers zero-shot transfer capabilities for new image distributions and tasks.
|
|
48
|
-
"""
|
|
49
|
-
|
|
50
|
-
def __init__(self, model="sam2_b.pt") -> None:
|
|
51
|
-
"""
|
|
52
|
-
Initializes the SAM2 model with a pre-trained model file.
|
|
53
|
-
|
|
54
|
-
Args:
|
|
55
|
-
model (str): Path to the pre-trained SAM2 model file. File should have a .pt or .pth extension.
|
|
56
|
-
|
|
57
|
-
Raises:
|
|
58
|
-
NotImplementedError: If the model file extension is not .pt or .pth.
|
|
59
|
-
|
|
60
|
-
Examples:
|
|
61
|
-
>>> sam2 = SAM2("sam2_b.pt")
|
|
62
|
-
"""
|
|
63
|
-
super().__init__(model=model)
|
|
64
|
-
|
|
65
|
-
def _load(self, weights: str, task=None):
|
|
66
|
-
"""
|
|
67
|
-
Loads the specified weights into the SAM2 model.
|
|
68
|
-
|
|
69
|
-
This method is responsible for loading pre-trained weights into the SAM2 model. It supports loading
|
|
70
|
-
weights from files with .pt or .pth extensions.
|
|
71
|
-
|
|
72
|
-
Args:
|
|
73
|
-
weights (str): Path to the weights file. Should be a file with .pt or .pth extension.
|
|
74
|
-
task (str | None): Task name. If provided, it may be used to configure model-specific settings.
|
|
75
|
-
|
|
76
|
-
Examples:
|
|
77
|
-
>>> sam2_model = SAM2()
|
|
78
|
-
>>> sam2_model._load('path/to/sam2_weights.pt')
|
|
79
|
-
"""
|
|
80
|
-
self.model = build_sam2(weights)
|
|
81
|
-
|
|
82
|
-
@property
|
|
83
|
-
def task_map(self):
|
|
84
|
-
"""
|
|
85
|
-
Provides a mapping from the 'segment' task to its corresponding 'Predictor'.
|
|
86
|
-
|
|
87
|
-
Returns:
|
|
88
|
-
(Dict[str, Type[SAM2Predictor]]): A dictionary mapping the 'segment' task to its corresponding
|
|
89
|
-
SAM2Predictor class.
|
|
90
|
-
|
|
91
|
-
Examples:
|
|
92
|
-
>>> sam2 = SAM2()
|
|
93
|
-
>>> task_map = sam2.task_map
|
|
94
|
-
>>> print(task_map)
|
|
95
|
-
{'segment': SAM2Predictor}
|
|
96
|
-
"""
|
|
97
|
-
return {"segment": {"predictor": SAM2Predictor}}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# Ultralytics YOLO 🚀, AGPL-3.0 license
|