Skip to content

Commit 56f11e0

Browse files
authored
Merge pull request #1289 from MouseLand/flows_and_message
Output zeros for style vector and remove welcome message
2 parents df6b944 + d915511 commit 56f11e0

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

cellpose/__init__.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1 @@
11
from cellpose.version import version, version_str
2-
message = f'''\n
3-
Welcome to CellposeSAM, cellpose v{version_str}! The neural network component of
4-
CPSAM is much larger than in previous versions and CPU excution is slow.
5-
We encourage users to use GPU/MPS if available. \n\n'''
6-
print(message)

cellpose/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def eval(self, x, batch_size=8, resample=True, channels=None, channel_axis=None,
209209
flows[k][1] = XY flows at each pixel;
210210
flows[k][2] = cell probability (if > cellprob_threshold, pixel used for dynamics);
211211
flows[k][3] = final pixel locations after Euler integration;
212-
styles (list of 1D arrays of length 256 or single 1D array): Style vector summarizing each image, also used to estimate size of objects in image.
212+
styles (list of 1D arrays of length 256 or single 1D array): Style vector containing only zeros. Retained for compaibility with CP3.
213213
214214
"""
215215

cellpose/vit_sam.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def forward(self, x):
7777

7878
# maintain the second output of feature size 256 for backwards compatibility
7979

80-
return x1, torch.randn((x.shape[0], 256), device=x.device)
80+
return x1, torch.zeros((x.shape[0], 256), device=x.device)
8181

8282
def load_model(self, PATH, device, strict = False):
8383
state_dict = torch.load(PATH, map_location = device, weights_only=True)

docs/settings.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ See the :ref:`cpmclass` for all run options.
1010
Cellpose 3 used ``models.Cellpose`` class which has been removed in Cellpose 4. Users should
1111
now only use the ``models.CellposeModel`` class.
1212

13+
.. warning::
14+
Cellpose-SAM **does NOT** calculate a style vector in the CellposeModel.eval() method. For compatibility a
15+
vector of zeros is returned as the style vector. You will need to use Cellpose 3 if you want to use the style vector.
16+
1317
Here is an example of calling the ``CellposeModel`` class and
1418
running a list of images for reference:
1519

0 commit comments

Comments
 (0)