MouseLand / cellpose

a generalist algorithm for cellular segmentation with human-in-the-loop capabilities
https://www.cellpose.org/
BSD 3-Clause "New" or "Revised" License
1.33k stars 382 forks source link

AttributeError: 'CellposeModel' object has no attribute 'diam_labels'[BUG] #901

Closed VerbeekM closed 2 weeks ago

VerbeekM commented 6 months ago

I am training a model using the GUI. When I train the model using my annotated set of images with nuclei as an initial model all is well. However, when I swap the initial model for the scratch model I get the following error without changing the input images. I am using cellpose 3.

LOG: 2024-03-26 17:34:59,427 [INFO] 90, train_loss=0.0459, test_loss=0.0000, LR=0.1000, time 72.43s Traceback (most recent call last): File "/.conda/envs/cellposeyml/lib/python3.12/site-packages/cellpose/gui/gui.py", line 1958, in new_model self.train_model(restore=restore, normalize_params=normalize_params) File "/.conda/envs/cellposeyml/lib/python3.12/site-packages/cellpose/gui/gui.py", line 1992, in train_model diam_labels = self.model.diam_labels #.copy() ^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'CellposeModel' object has no attribute 'diam_labels'

Any idea how I could solve this? Thank you!

tanpancodes commented 5 months ago

I had a similar issue before... can you send a picture of the code you used//commands you executed (more log info)

XylotrupesGideon commented 4 months ago

I ran into the same issue when I forgot to use the keyword pretrained_model in cellpose_models_CellposeModel

it occured when i did: cellpose.models.CellposeModel(cp_pretrained_model) instread of cellpose.models.CellposeModel(pretrained_model = cp_pretrained_model)

carsen-stringer commented 2 weeks ago

I think this shouldn't be an issue in Cellpose3 but please let us know if you're still having issues