-
Notifications
You must be signed in to change notification settings - Fork 409
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
The predictions by Command line and GUI are different #972
Comments
I also have the issue of different output in the GUI and from the command line using Cellpose2.0 and we are not alone, as I found others reporting that, however no good explanation or solution to the problem: #843 and #758 I trained a model using command line and now when I evaluate it through the command line in PyTorch, I have good results. Here is the code snippet: Now this is what happens when I run the model with the same parameters in GUI: To make things even more confusing, when I try to run the same model on the same image in Arivis with the same parameters, this is what happens (again showing 15th slice from the z-stack). Prediction is different than from Cellpose GUI and different than from the command line. Everything is run in the same environment. Does anyone have any idea what's going on? I don't know which result to trust. I have the best results fromt he command line and this is also where I did evaluation of different parameters and now I want to give the model to another person so they can work with it in Arivis and we can't replicate the results. |
can you please check if this is the case in cellpose v3? this is the old GUI. also it would be helpful if you could please provide the image that has discrepancies in segmentation, then I can debug it, thanks |
if you can provide a google drive link that would be great thanks, and the CLI command you are using |
Hi Thanks for your response. I can also provide some example images I tried before. Please see them in this drive link: https://drive.google.com/drive/folders/1UKnCFPk5G3RQkn65VJcfyzjkuvu7y-I4?usp=sharing Below is the command I used for the cell count, I tried to keep the parameter same with the GUI. cellpose --dir “D:/Yichao/CellPose/input” --image_path “D:/Yichao/CellPose/Input” --add_model “C:/Users/winshah/.cellpose/models/cyto2_cp3.npy” --chan 0 --use_gpu --flow_threshold 0.4 --cellprob_threshold 0 --save_rois --save_png --save_outlines --savedir “D:/Yichao/CellPose/Output” If you have any questions, please let me know. Thanks for your kind help. |
you've added ".npy" to the end of the model name, I think the command you want is
with this command and using the "cyto2_cp3" model in the GUI I got the exact same result (using CPU, got 1012 cells for img1t.tif in both cases). going to close this issue for now, but let me know if you have more questions |
Here is a folder with my example image and the model I trained: masks = model.eval(test_data, where model is the model that I provided in the google drive and test_data is the image. The same model and the same image were loaded in GUI and I believe the parameters in GUI were also the same as in my code (see screenshots). |
Since this is 3D, can you please check if the normalization parameters are the same in both cases? They are printed in the GUI as a dictionary, and you can input that dictionary into Regarding arivis outputs, their code is closed source and I don't have a license so we can't verify whether it would work the same way |
Can you include what is printed when the script runs? I think you're missing the do_3D=True flag in model.eval |
Oh I see you are stitching, please do include what the script is printing |
hmm I am confused because in the GUI it looks like you have cell fragments that result from running the 2.5D model not the stitching model, are you sure that the screenshot is from running with stitch_threshold=0.2? |
I loaded the image, set the settings like it's shown in the screenshot and then pressed 'run' and that's the result. I repeated that several times, on different days, just to make sure I didn't click something wrong by accident, and it's always the same result. |
the 2.5d model is described in the Cellpose1 paper (runs on YX, ZY and ZX), can you please post the command line info that prints when you run in the gui vs in the API? |
thanks can you run the script with |
it looks like in the script you are running many images, and you may be comparing the output potentially from two different tiffs (indeed it should say 41 if it has 41 planes it loads in) |
Yes, I am laoding initially everything that is in the test set directory (3 images), but then I do prediction only on the first image (test_data[0]), when I was running the script in iPython I visualised the output with Napari and that's what I posted in the screenshots above and it's definitely the same image that I load in the GUI.
one difference between the output from the script and GUI is that GUI says that it loads a tiff image of 41 planes and 3 channels, whereas the script correctly reads it as 41 planes with 2 channels. Not sure why it is like that, it is definitely the same image analysed in both cases. |
I have found the reason. I dont know why, but when I give up using "for”, instead of using "def+list", it works the same as it in GUI. input_dir = Path('F:/温敏分子行为/D218/2024-10-31/Control_MIP/') output_dir.mkdir(parents=True, exist_ok=True) model = models.Cellpose(model_type='nuclei', gpu=True) def process_file(file_path): tiff_files = list(input_dir.glob('.tiff')) + list(input_dir.glob('.tif')) |
Hello,
I'm recently using the CellPose to do the cell count. However, I found the predictions between GUI and command line are very different that the GUI gave me a better prediction, can you give me some suggestions?
Here is the command I used:
cellpose --dir “D:/user/CellPose/input” --image_path “D:/user/CellPose/Input” --add_model “C:/Users/winshah/.cellpose/models/cyto2_cp3.npy” --chan 0 --use_gpu --flow_threshold 0.4 --cellprob_threshold 0 --save_rois --save_png --save_outlines --savedir “D:/user/CellPose/Output”
Here is the screenshot of the GUI I use:
If I want to get the similar result by command line, whant kind of parameter should I use?
I found if I use the pretrained model named cyto3, it gave me the opposite results. The result from command line is much better than the GUI.
Thanks for your help.
The text was updated successfully, but these errors were encountered: