Closed manerotoni closed 1 week ago
This is fixed in the latest release, I'll reopen if it's not working for you
Thanks for the quick reply. I upgraded cellpose3 and the diameter is now not reverted to 30.
However, I am not sure if there is still not a problem. I checked cellpose 2 and 3 side by side with the same data and I consistently get worse results for cellpose3. Although the starting models are different, given enough training data one should get a similar result.
The loss function in cellpose2 reaches values <0.2 (0.16), in cellpose 3 i barely get close to 0.4 (typically >0.4). Also visually the segmentation results in cellpose3 look worse. I tried several different models and the results are consistent. I will rescale the data for cellpose3 and see if I get a different result.
Cellpose2 gives me an hint that the the mean of training label mask is not 30
>>>> mean of training label mask diameters (saved to model) 68.676
I do not get an hint whether the labels have been rescaled or not.
2024-06-18 16:09:49,163 [INFO] >>>> model diam_mean = 30.000 (ROIs rescaled to this size during training)
GUI_INFO: name of new model: cyto_20240618_155600
2024-06-18 16:09:49,690 [INFO] computing flows for labels
100%|███████████████████████████████████████████████████████████████████████████████████████████████| 16/16 [00:02<00:00, 6.20it/s]
2024-06-18 16:09:52,616 [INFO] >>>> median diameter set to = 30
2024-06-18 16:09:52,617 [INFO] >>>> mean of training label mask diameters (saved to model) 68.676
2024-06-18 16:11:10,542 [INFO] >>>> model diam_mean = 30.000 (ROIs rescaled to this size during training)
GUI_INFO: name of new model: cyto3_cp3_20240618_155847
2024-06-18 16:11:10,542 [INFO] computing flows for labels
100%|██████████████████████████████████████████████████████████████████████████████████| 16/16 [00:02<00:00, 7.35it/s]
2024-06-18 16:11:12,727 [INFO] >>> computing diameters
100%|█████████████████████████████████████████████████████████████████████████████████| 16/16 [00:00<00:00, 422.34it/s]
2024-06-18 16:11:12,765 [INFO] >>> using channels [0, 0]
oh there was another bug with the nimg_per_epoch that I just fixed, but I'm not sure if that's enough to make such a large difference. please try pip install git+https://github.com/mouseland/cellpose.git
On Tue, Jun 18, 2024 at 10:48 AM Antonio Politi @.***> wrote:
Thanks for the quick reply. I upgrade cellpose3 and the diameter is now not reverted to 30.
However, I am not sure if there is still not a problem. I checked cellpose 2 and 3 side by side and I consistently get worse results for cellpose3. Although the starting models are different, given enough training data one should get a similar result.
The loss function in cellpose2 reaches values <0.2 (0.16), in cellpose 3 i barely get close to 0.4 (typically >0.4). The segmentation results in cellpose3 are significantly worse. I tried several different models and the results are consistent. I will rescale the data for cellpose3 and see if I get a different result. train model in cellpose2
Cellpose2 gives me an hint that the the mean of training label mask is not 30
mean of training label mask diameters (saved to model) 68.676
train model in cellpos3
I do not get an hint whether the labels have been rescaled or not.
2024-06-18 16:09:49,163 [INFO] >>>> model diam_mean = 30.000 (ROIs rescaled to this size during training) GUI_INFO: name of new model: cyto_20240618_155600 2024-06-18 16:09:49,690 [INFO] computing flows for labels 100%|███████████████████████████████████████████████████████████████████████████████████████████████| 16/16 [00:02<00:00, 6.20it/s] 2024-06-18 16:09:52,616 [INFO] >>>> median diameter set to = 30 2024-06-18 16:09:52,617 [INFO] >>>> mean of training label mask diameters (saved to model) 68.676 2024-06-18 16:11:10,542 [INFO] >>>> model diam_mean = 30.000 (ROIs rescaled to this size during training) GUI_INFO: name of new model: cyto3_cp3_20240618_155847 2024-06-18 16:11:10,542 [INFO] computing flows for labels 100%|██████████████████████████████████████████████████████████████████████████████████| 16/16 [00:02<00:00, 7.35it/s] 2024-06-18 16:11:12,727 [INFO] >>> computing diameters 100%|█████████████████████████████████████████████████████████████████████████████████| 16/16 [00:00<00:00, 422.34it/s] 2024-06-18 16:11:12,765 [INFO] >>> using channels [0, 0]
— Reply to this email directly, view it on GitHub https://github.com/MouseLand/cellpose/issues/963#issuecomment-2176293838, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADS6TFITGEVVC5FXEBT4FLDZIBCDTAVCNFSM6AAAAABJP6PZYSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNZWGI4TGOBTHA . You are receiving this because you modified the open/close state.Message ID: @.***>
Describe the bug Using cellpose 3.0.7 Training a model with image and masks from directory resets the diameter to default 30. As in my case the diameter is 80, this leads to a poor training.
To Reproduce Steps to reproduce the behavior: