-
Notifications
You must be signed in to change notification settings - Fork 423
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] Different Segementation Result between GUI and Python command #1026
Comments
do you think that edge removal function is the issue? EDIT: I see you are saving the when you run cellpose from the API, please run after saying |
Hello @carsen-stringer I want to start by saying thank you for making this freely accessible tool, as it has been very helpful! I am experiencing a similar problem and have not been able to resolve it. To preface, I am not an image analysis nor computational expert. Problem: my masks as outputted in running cellpose in Jupyter Notebook python script look starkly different from that ran in the GUI. I have not been able to determine why this is the case, as I thought, to the best of my knowledge, that I included the necessary parameters in my script. Any help resolving this would be greatly appreciated! https://drive.google.com/file/d/1-estVYbUV3xZkdTRrcHUqMFTq5GpTjbI/view?usp=drivesdk Context: I trained my own model using CellPose 3.1.0 for image segmentation using the GUI in a cellpose-env using Anaconda Prompt. My python version is 3.9.20 and torch version is 2.5.1. I started by using the Cyto3 model with default additional settings and applied the cyto3 deblur, then ran. With each new image that popped up after training the model, I continued to work within the human-in-the-loop over about 20-30 images. I used default parameters except for n_epochs = 300. My images are single channel images that I segmented in grayscale. Code:
Zip File to Code |
Hello! Dear Carsen-Stringer, I'm sorry for the delayed reply. I don’t think “edge removal function is the issue,” because I’ve tried running it with and without that function. This is the information from the API, which is the same as in the GUI.
|
I have found the reason. I dont know why, but when I give up using "for”,Instead of "def+list", it works the same as 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 got different segmentation results using the Cellpose GUI and the Python command line, and I'm very confused. Could you please explain why this is happening? Am I missing any parameters? Thank you!
when I use command:
![1728559090837](https://private-user-images.githubusercontent.com/108987241/375352205-7f01d14a-b09d-4ae6-96df-ab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mWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjA4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIwOFQxMzAzMjJaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT05N2Q3ZmE4MTUwZTQwYzRiNTUyZmNhYjgyM2E1YTRlMjg5MjBiNzViY2NmYTZiMjhiOGJkNWVlYzJhZDU5NTZhJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.Svdk6HnW-IxNqzTlIjOApso8vFvmukQQO5OUNa8fEsg)
its segmentation results is supplied.
but when I use GUI, the result is perfect:
![1728569663661](https://private-user-images.githubusercontent.com/108987241/375416543-8e4ce992-04c1-4264-a713-afd54d88d312.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwMjAxMDIsIm5iZiI6MTczOTAxOTgwMiwicGF0aCI6Ii8xMDg5ODcyNDEvMzc1NDE2NTQzLThlNGNlOTkyLTA0YzEtNDI2NC1hNzEzLWFmZDU0ZDg4ZDMxMi5qcGc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjA4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIwOFQxMzAzMjJaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT04NmY4YzY0NzJhZDgzODIwMTNkMWYyYzI1N2Q3ZDYyMjQ1OGVjNmFjMWNkNzNjODdlODQzNTc0MGFkNDYyZTJhJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.F9r0oJWXi_aIBtaoKyFnHTG0csmSkH14JroQ10snCZo)
(cellpose) D:>python -m cellpose --Zstack
2024-10-10 19:21:38,176 [INFO] WRITING LOG OUTPUT TO C:\Users\Administrator.DESKTOP-286EQ11.cellpose\run.log
2024-10-10 19:21:38,177 [INFO]
cellpose version: 3.0.11
platform: win32
python version: 3.10.15
torch version: 2.4.1+cu118
2024-10-10 19:21:38,339 [INFO] ** TORCH CUDA version installed and working. **
GUI_INFO: loading image: E:/温敏分子行为/D218/2024-09-08/3DTexture/3Dvolume/2.MedianFilter/10.tiff
2024-10-10 19:22:05,982 [INFO] reading tiff with 52 planes
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 52/52 [00:00<00:00, 800.01it/s]
GUI_INFO: converted to float and normalized values to 0.0->255.0
GUI_INFO: normalization checked: computing saturation levels (and optionally filtered image)
{'lowhigh': None, 'percentile': [1.0, 99.0], 'normalize': True, 'norm3D': True, 'sharpen_radius': 0, 'smooth_radius': 0, 'tile_norm_blocksize': 0, 'tile_norm_smooth3D': 1, 'invert': False}
[0, 255.0]
2024-10-10 19:22:28,696 [INFO] ** TORCH CUDA version installed and working. **
2024-10-10 19:22:28,696 [INFO] >>>> using GPU (CUDA)
2024-10-10 19:22:28,697 [INFO] >> cyto3 << model set to be used
2024-10-10 19:22:28,728 [INFO] >>>> loading model C:\Users\Administrator.DESKTOP-286EQ11.cellpose\models\cyto3
2024-10-10 19:22:28,761 [INFO] >>>> model diam_mean = 30.000 (ROIs rescaled to this size during training)
{'lowhigh': None, 'percentile': [1.0, 99.0], 'normalize': True, 'norm3D': True, 'sharpen_radius': 0, 'smooth_radius': 0, 'tile_norm_blocksize': 0, 'tile_norm_smooth3D': 1, 'invert': False}
2024-10-10 19:22:28,795 [INFO] channels set to [0, 0]
2024-10-10 19:22:28,795 [INFO] ~~~ FINDING MASKS ~~~
2024-10-10 19:22:28,795 [INFO] multi-stack tiff read in as having 52 planes 1 channels
2024-10-10 19:22:30,131 [INFO] running YX: 52 planes of size (1365, 1254)
2024-10-10 19:22:30,137 [INFO] 0%| | 0/7 [00:00<?, ?it/s]
2024-10-10 19:22:30,380 [INFO] 14%|#4 | 1/7 [00:00<00:01, 4.12it/s]
2024-10-10 19:22:30,489 [INFO] 29%|##8 | 2/7 [00:00<00:00, 6.09it/s]
2024-10-10 19:22:30,594 [INFO] 43%|####2 | 3/7 [00:00<00:00, 7.29it/s]
2024-10-10 19:22:30,696 [INFO] 57%|#####7 | 4/7 [00:00<00:00, 8.11it/s]
2024-10-10 19:22:30,799 [INFO] 71%|#######1 | 5/7 [00:00<00:00, 8.62it/s]
2024-10-10 19:22:30,901 [INFO] 86%|########5 | 6/7 [00:00<00:00, 8.99it/s]
2024-10-10 19:22:30,996 [INFO] 100%|##########| 7/7 [00:00<00:00, 8.15it/s]
2024-10-10 19:22:31,582 [INFO] running ZY: 1365 planes of size (52, 1254)
2024-10-10 19:22:31,604 [INFO] 0%| | 0/86 [00:00<?, ?it/s]
2024-10-10 19:22:31,712 [INFO] 9%|9 | 8/86 [00:00<00:01, 74.35it/s]
2024-10-10 19:22:31,820 [INFO] 20%|#9 | 17/86 [00:00<00:00, 79.21it/s]
2024-10-10 19:22:31,929 [INFO] 30%|### | 26/86 [00:00<00:00, 80.75it/s]
2024-10-10 19:22:32,037 [INFO] 41%|#### | 35/86 [00:00<00:00, 81.77it/s]
2024-10-10 19:22:32,145 [INFO] 51%|#####1 | 44/86 [00:00<00:00, 82.33it/s]
2024-10-10 19:22:32,254 [INFO] 62%|######1 | 53/86 [00:00<00:00, 82.41it/s]
2024-10-10 19:22:32,363 [INFO] 72%|#######2 | 62/86 [00:00<00:00, 82.46it/s]
2024-10-10 19:22:32,474 [INFO] 83%|########2 | 71/86 [00:00<00:00, 82.18it/s]
2024-10-10 19:22:32,584 [INFO] 93%|#########3| 80/86 [00:00<00:00, 82.07it/s]
2024-10-10 19:22:32,655 [INFO] 100%|##########| 86/86 [00:01<00:00, 81.84it/s]
2024-10-10 19:22:33,542 [INFO] running ZX: 1254 planes of size (52, 1365)
2024-10-10 19:22:33,564 [INFO] 0%| | 0/79 [00:00<?, ?it/s]
2024-10-10 19:22:33,674 [INFO] 11%|#1 | 9/79 [00:00<00:00, 81.82it/s]
2024-10-10 19:22:33,785 [INFO] 23%|##2 | 18/79 [00:00<00:00, 81.38it/s]
2024-10-10 19:22:33,897 [INFO] 34%|###4 | 27/79 [00:00<00:00, 80.91it/s]
2024-10-10 19:22:34,009 [INFO] 46%|####5 | 36/79 [00:00<00:00, 80.69it/s]
2024-10-10 19:22:34,119 [INFO] 57%|#####6 | 45/79 [00:00<00:00, 81.09it/s]
2024-10-10 19:22:34,228 [INFO] 68%|######8 | 54/79 [00:00<00:00, 81.59it/s]
2024-10-10 19:22:34,337 [INFO] 80%|#######9 | 63/79 [00:00<00:00, 81.91it/s]
2024-10-10 19:22:34,446 [INFO] 91%|#########1| 72/79 [00:00<00:00, 82.12it/s]
2024-10-10 19:22:34,531 [INFO] 100%|##########| 79/79 [00:00<00:00, 81.78it/s]
2024-10-10 19:22:35,381 [INFO] network run in 6.41s
2024-10-10 19:23:11,285 [INFO] masks created in 35.90s
2024-10-10 19:23:14,383 [INFO] >>>> TOTAL TIME 45.59 sec
2024-10-10 19:23:15,903 [INFO] 11 cells found with model in 47.225 sec
GUI_INFO: 11 masks found
GUI_INFO: plane 0 outlines processed
GUI_INFO: plane 50 outlines processed
GUI_INFO: creating cellcolors and drawing masks
Due to my work on morphological and texture analysis of time series 3D layered scanning images, high-throughput segmentation of the images is essential. I sincerely seek your guidance. Thank you!
The text was updated successfully, but these errors were encountered: