Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stardist #30

Open
Mdack1 opened this issue Nov 26, 2024 · 1 comment
Open

Stardist #30

Mdack1 opened this issue Nov 26, 2024 · 1 comment

Comments

@Mdack1
Copy link

Mdack1 commented Nov 26, 2024

Hi, I am trying to run the below from the standard workflow recieving this error. Please can you help?

b2c.stardist(image_path="stardist/he.tiff",
labels_npz_path="stardist/he.npz",
stardist_model="2D_versatile_he",
prob_thresh=0.1
)

Found model '2D_versatile_he' for 'StarDist2D'.

OSError Traceback (most recent call last)
Cell In[33], line 1
----> 1 b2c.stardist(image_path="stardist/he.tiff",
2 labels_npz_path="stardist/he.npz",
3 stardist_model="2D_versatile_he",
4 prob_thresh=0.1
5 )

File ~\miniconda3\envs\myenv\lib\site-packages\bin2cell\bin2cell.py:122, in stardist(image_path, labels_npz_path, stardist_model, block_size, min_overlap, context, **kwargs)
120 img = normalize(img)
121 #use pretrained stardist model
--> 122 model = StarDist2D.from_pretrained(stardist_model)
123 #will need to specify axes shortly, which are model dependent
124 if stardist_model == "2D_versatile_he":
125 #3D image, got the axes YXC from the H&E model config.json

File ~\miniconda3\envs\myenv\lib\site-packages\csbdeep\models\base_model.py:130, in BaseModel.from_pretrained(cls, name_or_alias)
128 try:
129 get_model_details(cls, name_or_alias, verbose=True)
--> 130 return get_model_instance(cls, name_or_alias)
131 except ValueError as e:
132 if name_or_alias is not None:

File ~\miniconda3\envs\myenv\lib\site-packages\csbdeep\models\pretrained.py:116, in get_model_instance(cls, key_or_alias)
115 def get_model_instance(cls, key_or_alias):
--> 116 path = get_model_folder(cls, key_or_alias)
117 model = cls(config=None, name=path.stem, basedir=path.parent)
118 model.basedir = None # make read-only

File ~\miniconda3\envs\myenv\lib\site-packages\csbdeep\models\pretrained.py:108, in get_model_folder(cls, key_or_alias)
106 path_folder = path_folder.with_name(path_folder.name[:-len(suffix)])
107 if not path_folder.exists():
--> 108 path_folder.symlink_to(path.relative_to(path.parent))
109 else:
110 path_folder = path.parent

File ~\miniconda3\envs\myenv\lib\pathlib.py:1403, in Path.symlink_to(self, target, target_is_directory)
1398 def symlink_to(self, target, target_is_directory=False):
1399 """
1400 Make this path a symlink pointing to the target path.
1401 Note the order of arguments (link, target) is the reverse of os.symlink.
1402 """
-> 1403 self._accessor.symlink(target, self, target_is_directory)

OSError: [WinError 1314] A required privilege is not held by the client: '2D_versatile_he_extracted' -> 'C:\Users\uCTImagingA\.keras\models\StarDist2D\2D_versatile_he\2D_versatile_he'

@ktpolanski
Copy link
Contributor

Interesting, you seem unable to extract the model to its desired folder? Good thing there's a workaround function in #28

Download the 2D_versatile_he model from https://github.com/stardist/stardist-models/releases/tag/v0.1 and then load it like dfgao did, and then use the custom function I posted to use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants