Skip to content

Commit b74038d

Browse files
bug with size model location (#1015)
1 parent 6fb288f commit b74038d

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

cellpose/models.py

+12-8
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,20 @@ def model_path(model_type, model_index=0):
5858

5959

6060
def size_model_path(model_type):
61-
if os.path.exists(model_type):
62-
return model_type + "_size.npy"
63-
else:
64-
torch_str = "torch"
65-
if model_type == "cyto" or model_type == "nuclei" or model_type == "cyto2":
66-
basename = "size_%s%s_0.npy" % (model_type, torch_str)
67-
else:
61+
torch_str = "torch"
62+
if (model_type == "cyto" or model_type == "nuclei" or
63+
model_type == "cyto2" or model_type == "cyto3"):
64+
if model_type == "cyto3":
6865
basename = "size_%s.npy" % model_type
66+
else:
67+
basename = "size_%s%s_0.npy" % (model_type, torch_str)
6968
return cache_model_path(basename)
70-
69+
else:
70+
if os.path.exists(model_type) and os.path.exists(model_type + "_size.npy"):
71+
return model_type + "_size.npy"
72+
else:
73+
raise FileNotFoundError(f"size model not found ({model_type + '_size.npy'})")
74+
7175

7276
def cache_model_path(basename):
7377
MODEL_DIR.mkdir(parents=True, exist_ok=True)

0 commit comments

Comments
 (0)