MouseLand/cellpose

CellposeGUI Stuck on Draw Masks [BUG]

mayishazn opened this issue · 11 comments

Describe the bug
I have reinstalled cellpose 2. When I try to draw masks I right click and I see the red circle. I draw the mask and finish at the circle. The circle then disappears but no new mask appears. Instead the purple dots that indicate you are actively drawing an outline still appear. I noticed after returning to the red circle and the circle disappears, any additional movement of the cursor prints "QGraphicsScene::removeItem: item 0x1d8259b8340's scene (0x0) is different from this scene (0x1d827c093d0)"

To Reproduce
Steps to reproduce the behavior:

  1. right click to start drawing a mask
  2. move mouse around a cell and return to red circle

Run log
(cellpose2) C:\Users\mayis>cellpose --verbose
2024-05-02 02:17:15,805 [INFO] WRITING LOG OUTPUT TO C:\Users\mayis.cellpose\run.log
2024-05-02 02:17:16,473 [INFO] TORCH CUDA version not installed/working.
(2048, 2048, 4)
GUI_INFO: auto-adjust enabled, computing saturation levels
GUI_INFO: loaded in previous changes
GUI_INFO: 402 masks found in C:/Users/mayis/Downloads/C3-20x_MII_-_dapi_betacat-488_p120-568_ph633-02-0001_seg.npy
QGraphicsScene::removeItem: item 0x1d8259b8340's scene (0x0) is different from this scene (0x1d827c093d0)
QGraphicsScene::removeItem: item 0x1d8259b8340's scene (0x0) is different from this scene (0x1d827c093d0)
QGraphicsScene::removeItem: item 0x1d8259b8340's scene (0x0) is different from this scene (0x1d827c093d0)
QGraphicsScene::removeItem: item 0x1d8259b8340's scene (0x0) is different from this scene (0x1d827c093d0)
QGraphicsScene::removeItem: item 0x1d8259b8340's scene (0x0) is different from this scene (0x1d827c093d0)
QGraphicsScene::removeItem: item 0x1d8259b8340's scene (0x0) is different from this scene (0x1d827c093d0)
QGraphicsScene::removeItem: item 0x1d8259b8340's scene (0x0) is different from this scene (0x1d827c093d0)
QGraphicsScene::removeItem: item 0x1d8259b8340's scene (0x0) is different from this scene (0x1d827c093d0)
QGraphicsScene::removeItem: item 0x1d8259b8340's scene (0x0) is different from this scene (0x1d827c093d0)
QGraphicsScene::removeItem: item 0x1d8259b8340's scene (0x0) is different from this scene (0x1d827c093d0)
QGraphicsScene::removeItem: item 0x1d8259b8340's scene (0x0) is different from this scene (0x1d827c093d0)
QGraphicsScene::removeItem: item 0x1d8259b8340's scene (0x0) is different from this scene (0x1d827c093d0)
QGraphicsScene::removeItem: item 0x1d8259b8340's scene (0x0) is different from this scene (0x1d827c093d0)
QGraphicsScene::removeItem: item 0x1d8259b8340's scene (0x0) is different from this scene (0x1d827c093d0)
QGraphicsScene::removeItem: item 0x1d8259b8340's scene (0x0) is different from this scene (0x1d827c093d0)
QGraphicsScene::removeItem: item 0x1d8259b8340's scene (0x0) is different from this scene (0x1d827c093d0)
QGraphicsScene::removeItem: item 0x1d8259b8340's scene (0x0) is different from this scene (0x1d827c093d0)

For the environment info:
env2.txt

I also have this bug!

Sorry, please upgrade, this is fixed in cellpose3

Well part of the reason I wanted to fix masks in cellpose2 is because cellpose3 takes up all my RAM. (See suspected memory leak issue: #921

Also it seems this still sometimes but thankfully not always happens on cellpose3. Or like I'll draw the mask and it doesnt show up. -Particularly when editing a single frame of a zstack.

Ya this still happens on cellpose3 (even after upgrading)

image

So what seems to work but isn't great is I reinstalled cellpose 1, went in the source code and swapped all the instances of np.bool to bool and np.float to float, and now I can finally draw masks. The workflow is now segment things with the python notebook with cellpose 3, fix the masks in cellpose 1, export them in cellpose 3...

For what its worth I can sometimes get cellpose3 to draw exactly one mask before it gets stuck in draw mode, save, close cellpose, reopen cellpose3 and draw another mask but thats tedious as heck. I suppose one could compare the gui parts of both source codes and see where cellpose 3 gets stuck on draw mode but I'm not too confident if I'll be able to fix it that way.

I have exactly the same problem

someone have any solution???

someone have any solution???

So what seems to work but isn't great is I reinstalled cellpose 1 (pip install cellpose==1.*), went in the source code and swapped all the instances of np.bool to bool and np.float to float, and now I can finally draw masks. The workflow is now segment things with the python notebook with cellpose 3, fix the masks in cellpose 1, export them in cellpose 3...

sorry I haven't been able to replicate this in windows, mac and linux with python=3.10 and python=3.11, please try upgrading, there are some suggestions in #961 , that issue will remain open until this is resolved