ultralytics 8.3.218__py3-none-any.whl → 8.3.219__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
ultralytics/__init__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
2
2
 
3
- __version__ = "8.3.218"
3
+ __version__ = "8.3.219"
4
4
 
5
5
  import importlib
6
6
  import os
@@ -4,7 +4,7 @@ import torch
4
4
  from PIL import Image
5
5
 
6
6
  from ultralytics.models.yolo.segment import SegmentationPredictor
7
- from ultralytics.utils import DEFAULT_CFG, checks
7
+ from ultralytics.utils import DEFAULT_CFG
8
8
  from ultralytics.utils.metrics import box_iou
9
9
  from ultralytics.utils.ops import scale_masks
10
10
  from ultralytics.utils.torch_utils import TORCH_1_10
@@ -101,7 +101,7 @@ class FastSAMPredictor(SegmentationPredictor):
101
101
  continue
102
102
  masks = result.masks.data
103
103
  if masks.shape[1:] != result.orig_shape:
104
- masks = scale_masks(masks[None], result.orig_shape)[0]
104
+ masks = (scale_masks(masks[None].float(), result.orig_shape)[0] > 0.5).byte()
105
105
  # bboxes prompt
106
106
  idx = torch.zeros(len(result), dtype=torch.bool, device=self.device)
107
107
  if bboxes is not None:
@@ -161,20 +161,14 @@ class FastSAMPredictor(SegmentationPredictor):
161
161
  Returns:
162
162
  (torch.Tensor): Similarity matrix between given images and texts with shape (M, N).
163
163
  """
164
- try:
165
- import clip
166
- except ImportError:
167
- checks.check_requirements("git+https://github.com/ultralytics/CLIP.git")
168
- import clip
169
- if (not hasattr(self, "clip_model")) or (not hasattr(self, "clip_preprocess")):
170
- self.clip_model, self.clip_preprocess = clip.load("ViT-B/32", device=self.device)
171
- images = torch.stack([self.clip_preprocess(image).to(self.device) for image in images])
172
- tokenized_text = clip.tokenize(texts).to(self.device)
173
- image_features = self.clip_model.encode_image(images)
174
- text_features = self.clip_model.encode_text(tokenized_text)
175
- image_features /= image_features.norm(dim=-1, keepdim=True) # (N, 512)
176
- text_features /= text_features.norm(dim=-1, keepdim=True) # (M, 512)
177
- return (image_features * text_features[:, None]).sum(-1) # (M, N)
164
+ from ultralytics.nn.text_model import CLIP
165
+
166
+ if not hasattr(self, "clip"):
167
+ self.clip = CLIP("ViT-B/32", device=self.device)
168
+ images = torch.stack([self.clip.image_preprocess(image).to(self.device) for image in images])
169
+ image_features = self.clip.encode_image(images)
170
+ text_features = self.clip.encode_text(self.clip.tokenize(texts))
171
+ return text_features @ image_features.T # (M, N)
178
172
 
179
173
  def set_prompts(self, prompts):
180
174
  """Set prompts to be used during inference."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ultralytics
3
- Version: 8.3.218
3
+ Version: 8.3.219
4
4
  Summary: Ultralytics YOLO 🚀 for SOTA object detection, multi-object tracking, instance segmentation, pose estimation and image classification.
5
5
  Author-email: Glenn Jocher <glenn.jocher@ultralytics.com>, Jing Qiu <jing.qiu@ultralytics.com>
6
6
  Maintainer-email: Ultralytics <hello@ultralytics.com>
@@ -7,7 +7,7 @@ tests/test_exports.py,sha256=3o-qqPrPqjD1a_U6KBvwAusZ_Wy6S1WzmuvgRRUXmcA,11099
7
7
  tests/test_integrations.py,sha256=ehRcYMpGvUI3KvgsaT1pkN1rXkr7tDSlYYMqIcXyGbg,6220
8
8
  tests/test_python.py,sha256=x2q5Wx3eOl32ymmr_4p6srz7ebO-O8zFttuerys_OWg,28083
9
9
  tests/test_solutions.py,sha256=oaTz5BttPDIeHkQh9oEaw-O73L4iYDP3Lfe82V7DeKM,13416
10
- ultralytics/__init__.py,sha256=-cmy8wbhEXQSozdsSFrklvknpsp0kac_c0ubp8T_wSc,1302
10
+ ultralytics/__init__.py,sha256=7uzzHJ_BNNdFGNxDhqmBa6J31FBzcdeJ0euztxmHZ4A,1302
11
11
  ultralytics/py.typed,sha256=la67KBlbjXN-_-DfGNcdOcjYumVpKG_Tkw-8n5dnGB4,8
12
12
  ultralytics/assets/bus.jpg,sha256=wCAZxJecGR63Od3ZRERe9Aja1Weayrb9Ug751DS_vGM,137419
13
13
  ultralytics/assets/zidane.jpg,sha256=Ftc4aeMmen1O0A3o6GCDO9FlfBslLpTAw0gnetx7bts,50427
@@ -136,7 +136,7 @@ ultralytics/hub/google/__init__.py,sha256=8o3RorFafO_DzlzImXnzNQXtyPM1k-CQ8tsWSf
136
136
  ultralytics/models/__init__.py,sha256=DqQFFYJ4IQlqIDb61H1HzcnZU7SuHN-43bw94-l-YAQ,309
137
137
  ultralytics/models/fastsam/__init__.py,sha256=HGJ8EKlBAsdF-e2aIwQLjSDAFI_r0yHR0A1gzrp4vqE,231
138
138
  ultralytics/models/fastsam/model.py,sha256=vIdl536LUrefjqMFEJ-9UyK4Ta6p2ki2G_gn2DZ9X_Y,3438
139
- ultralytics/models/fastsam/predict.py,sha256=_qTgUNL8L0XQBvpIBZR_GII0Tt1-cjpu11JcbP-8nbM,9086
139
+ ultralytics/models/fastsam/predict.py,sha256=QoG9GnUKVNIDgxeVMIFSP3YbOOFcqVvaQiGaUiAoFzc,8664
140
140
  ultralytics/models/fastsam/utils.py,sha256=yuCXB4CVjRx8lDf61DP8B6qMx7TVf7AynQvdWREeFco,884
141
141
  ultralytics/models/fastsam/val.py,sha256=oLxB8vBKTfiT7eBbTzvpqq_xNSvDOjGdP1J7egHGsCA,2041
142
142
  ultralytics/models/nas/__init__.py,sha256=wybeHZuAXMNeXMjKTbK55FZmXJkA4K9IozDeFM9OB-s,207
@@ -275,9 +275,9 @@ ultralytics/utils/callbacks/tensorboard.py,sha256=_4nfGK1dDLn6ijpvphBDhc-AS8qhS3
275
275
  ultralytics/utils/callbacks/wb.py,sha256=ngQO8EJ1kxJDF1YajScVtzBbm26jGuejA0uWeOyvf5A,7685
276
276
  ultralytics/utils/export/__init__.py,sha256=eZg5z2I61k8H0ykQLc22HhKwFRsLxwuSlDVMuUlYXfU,10023
277
277
  ultralytics/utils/export/imx.py,sha256=Jl5nuNxqaP_bY5yrV2NypmoJSrexHE71TxR72SDdjcg,11394
278
- ultralytics-8.3.218.dist-info/licenses/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
279
- ultralytics-8.3.218.dist-info/METADATA,sha256=sbgNoHw9u1XoAtvRMhsiQSLKs0gwmH0dfX6jTwC9JFs,37667
280
- ultralytics-8.3.218.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
281
- ultralytics-8.3.218.dist-info/entry_points.txt,sha256=YM_wiKyTe9yRrsEfqvYolNO5ngwfoL4-NwgKzc8_7sI,93
282
- ultralytics-8.3.218.dist-info/top_level.txt,sha256=XP49TwiMw4QGsvTLSYiJhz1xF_k7ev5mQ8jJXaXi45Q,12
283
- ultralytics-8.3.218.dist-info/RECORD,,
278
+ ultralytics-8.3.219.dist-info/licenses/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
279
+ ultralytics-8.3.219.dist-info/METADATA,sha256=xcKqAIsxDsmJUAEHOKQH5guwuv4aVg1AtVz8IQe-wNI,37667
280
+ ultralytics-8.3.219.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
281
+ ultralytics-8.3.219.dist-info/entry_points.txt,sha256=YM_wiKyTe9yRrsEfqvYolNO5ngwfoL4-NwgKzc8_7sI,93
282
+ ultralytics-8.3.219.dist-info/top_level.txt,sha256=XP49TwiMw4QGsvTLSYiJhz1xF_k7ev5mQ8jJXaXi45Q,12
283
+ ultralytics-8.3.219.dist-info/RECORD,,