Closed ABCarvalho closed 1 month ago
experiencing the same error but with default cyto3
model, not the denoised one.
Also, it is not occuring to all my image. But just some of them. I assume it is about the image content? e.g. all black?
Update: actually it behaves the same for cyto2
model as well.
what are your image sizes? it might also be helpful to tell cellpose your channel_axis as an input to eval. I've made some updates to the auto-channel_axis detection, but it's useful to directly specify z_axis and channel_axis, especially with stacks
Hi @carsen-stringer, thanks for the suggestion. And indeed I can confirm that the error is gone when specifying channel_axis
.
great! I will close this issue for now but will reopen if there are more problems
Describe the bug My understanding this error is due to how OpenCV is trying to resize the image. The issue may be with the CellposeDenoiseModel, because when I just run the segmentation model CellposeModel, there are no errors. In the code below, if you make the "Segmentation" module run first, everything goes smoothly for the 1st image. Fails after the CellposeDenoiseModel tries to be run.
To Reproduce
Run log 100%|██████████| 21/21 [00:00<00:00, 9712.25it/s] Traceback (most recent call last): File ~\anaconda3\envs\cellpose3\lib\site-packages\spyder_kernels\py3compat.py:356 in compat_exec exec(code, globals, locals) File e:\1.crest\1. cell_rounding\phd_cellpose3_batch_seg.py:87 segment_images(folder_path) File e:\1.crest\1. cell_rounding\phd_cellpose3_batch_seg.py:47 in segment_images masks_dn, flows_dn, styles_dn, imgs_dn = dn.eval(image, channels=[0,0], File ~\anaconda3\envs\cellpose3\lib\site-packages\cellpose\denoise.py:551 in eval masks, flows, styles = self.cp.eval(img_restore, batch_size=batch_size, channels=channels_new, channel_axis=-1, File ~\anaconda3\envs\cellpose3\lib\site-packages\cellpose\models.py:410 in eval masks, styles, dP, cellprob, p = self._run_cp( File ~\anaconda3\envs\cellpose3\lib\site-packages\cellpose\models.py:480 in _run_cp img = transforms.resize_image(img, rsz=rescale) File ~\anaconda3\envs\cellpose3\lib\site-packages\cellpose\transforms.py:727 in resize_image imgs = cv2.resize(img0, (Lx, Ly), interpolation=interpolation) error: OpenCV(4.9.0) D:\a\opencv-python\opencv-python\opencv\modules\imgproc\src\resize.cpp:4155: error: (-215:Assertion failed) inv_scale_x > 0 in function ‘cv::resize’