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

min_train_masks option #15

Closed
RAHoebe opened this issue Nov 7, 2022 · 7 comments
Closed

min_train_masks option #15

RAHoebe opened this issue Nov 7, 2022 · 7 comments

Comments

@RAHoebe
Copy link

RAHoebe commented Nov 7, 2022

Hi,

Would it be possible to add the min_train_masks option. I try to train the detection of mitosis. But get an error like: "train images with number of masks less than min_train_masks (5)". Would be nice to set this to a lower value.

image

Best, Ron

@lacan
Copy link
Member

lacan commented Nov 7, 2022

Dear Ron,

Thanks for the issue. I am personally not comfortable adding this option to the Cellpose extension, even though it is available within Cellpose...

From the QuPath extension cellpose, we do not make use of the "human-in-the-loop" training options, meaning that we need dense annotations.

What you are doing would create a cellpose model that would detect only mitotic cells and ignore everything else, but you might run into the issue that with very few labeled data, training will not yield appropriate results unless you add many more images...

Is your goal only to find the mitotic cells? In which case a better stragegy would be as follows

  1. Run cellpose (cyto or cyto2) on your training and validation squares with createAnnotations()
  2. Correct the annotations that are wrong within QuPath, which should be very few
  3. Train your model with the fully annotated regions instead
  4. Use QuPath's object classifier to classify cells as mitotic or non-mitotic. .

I am pinging @carsen-stringer in case my suggestions would need more details or if I am wrong.

If you wish to discuss this more with me and the other developers, feel free to open a topic on the image.sc forum
https://forum.image.sc/tag/qupath

Happy to discuss

Oli

@RAHoebe
Copy link
Author

RAHoebe commented Nov 7, 2022

Dear Oli,

I understand your concern. The reason I wanted this option is actually for educational purposes. I would have likes to show students the difference in training a deep learning model detecting the sparsely labeled images and compare it to detecting all the cells and perform object classification afterwards. It would indeed take a lot of training images to get a good result. This would require exactly what you mention. Correcting mistakes in of the trained model, creating extra data and train again (human in the loop).

Best, Ron

@lacan
Copy link
Member

lacan commented Nov 7, 2022

Hi Ron

Awesome thanks for the info!

I can think of implementing it if you want.

Otherwise you could simply take the command as it was printed in the log, paste into your command line and add the missing flags. The training will run, just without the fancy QA bits

@RAHoebe
Copy link
Author

RAHoebe commented Nov 8, 2022

Dear Oli,

Yes, please. Would be very nice if you can implement it. I also have pictures of adopicytes. These also contain just a few cells in a patch most of the time.

Best, Ron

@lacan
Copy link
Member

lacan commented Nov 8, 2022

The latest release adds the min_train_masks option
https://github.com/BIOP/qupath-extension-cellpose/releases/tag/v0.5.1

Let me know if there are any issues and I will close the issue afterwards.
Best

@RAHoebe
Copy link
Author

RAHoebe commented Nov 8, 2022

Many thanks.

I tested it, and everything works fine. Used min_train_mask(1) and (a bit to my suprise) mitosis are detected quite well. Trained on 17 patches in 7 images. During my course I will see how good compared with object classification.

Best, Ron

@lacan lacan closed this as completed Nov 8, 2022
@carsen-stringer
Copy link

thanks for the implementation @lacan , glad it's working, this is a neat use case

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

3 participants