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

[BUG] Outputs from "cellpose.train.train_seg" are unclear #1081

Open
braymp opened this issue Jan 1, 2025 · 0 comments
Open

[BUG] Outputs from "cellpose.train.train_seg" are unclear #1081

braymp opened this issue Jan 1, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@braymp
Copy link

braymp commented Jan 1, 2025

Describe the bug
Several sources indicate that there should be three outputs from train_seg, i.e., model_path, train_losses and test_losses:

  • The definition for cellpose.train.train_seg describes the three outputs above. The output from this function indicates the same.
  • If calling cellpose for training from the cmd line, the associated code yields just the first element of the output. The GUI code is similar.
  • The test for train_seg obtains the path as the first element of the output.

That said, using Cellpose 3.1.0 to call cellpose.train.train_seg directly from the python cmd line with the three outputs specified yields the error:

Traceback (most recent call last):
File "", line 1, in
TypeError: cannot unpack non-iterable PosixPath object

Calling with just one output succeeds with path to the new model as the only output.

The API documentation for the function is ambiguous in that it says three outputs are returned but only describes the type for the path. The GitHub training documentation also indicates that three outputs are possible.

Please tell me if there's something I'm missing.

To Reproduce
I am calling cellpose.train.train_seg from the python cmd line to retrain the cyto3 Cellpose model:

model = cellpose.models.CellposeModel(gpu=True, model_type='cyto3', pretrained_model='cyto3')
model_path, train_losses, test_losses = cellpose.train.train_seg(net=model.net,
                         train_data=train_data,
                         train_labels=train_labels,
                         test_data=test_data,
                         test_labels=test_labels,
                         channels=channels,
                         model_name="my_new_model",
                         save_path="./test_path/",
                         )

Screenshots
image

@braymp braymp added the bug Something isn't working label Jan 1, 2025
@braymp braymp changed the title [BUG] Outputs from train_seg are unclear [BUG] Outputs from train_seg are unclear Jan 1, 2025
@braymp braymp changed the title [BUG] Outputs from train_seg are unclear [BUG] Outputs from "cellpose.train.train_seg" are unclear Jan 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant