cellpose icon indicating copy to clipboard operation
cellpose copied to clipboard

y.segmented = y_data unboundlocalerror: local variable 'y_data' referenced before assignment

Open Pvannd opened this issue 1 year ago • 3 comments

Cellpose version 3.0.10 and cellprofiler 4.2.6. I can't get cellpose to run as a plug-in. It runs in the same environment fine. But I can't edit the runcellpose file to much with out cellprofiler not recognizing the file. Please help me im losing sleep trying to figure it out. Ive changed the workers and GPU memory share workers but nothing has fix the issue for it to run. 452a56dcf75121f31a5c74ffb064563219ba00dc_2_1332x1000 3b0b8d3bf8fd5581ad09d4b17784f85546780f1d_2_750x1000 31645f6b34adc9ced4abf115012c16e8a0d450bb_2_750x1000

31f21affe6bca626ae6720de44a7ccc61842e668_2_750x1000

Pvannd avatar Jul 02 '24 14:07 Pvannd

My gut reaction is that Cellprofiler was built cooperate with Cellpose 2 and not on Cellpose 3. The relevant error seems to be that net_avg was provided as a parameter to eval(), but this is no longer a parameter in Cellpose 3. Therefore, masks/segmentations can't be generated.

I would suggest downgrading to Cellpose 2 or else going into the underlying script to remove that parameter as an input.

ian-coccimiglio avatar Jul 02 '24 22:07 ian-coccimiglio

My gut reaction is that Cellprofiler was built cooperate with Cellpose 2 and not on Cellpose 3. The relevant error seems to be that net_avg was provided as a parameter to eval(), but this is no longer a parameter in Cellpose 3. Therefore, masks/segmentations can't be generated.

I would suggest downgrading to Cellpose 2 or else going into the underlying script to remove that parameter as an input.

Omg! Thank you sweet soul for helping me and for replying downgrading worked.

Pvannd avatar Jul 02 '24 23:07 Pvannd

My gut reaction is that Cellprofiler was built cooperate with Cellpose 2 and not on Cellpose 3. The relevant error seems to be that net_avg was provided as a parameter to eval(), but this is no longer a parameter in Cellpose 3. Therefore, masks/segmentations can't be generated.

I would suggest downgrading to Cellpose 2 or else going into the underlying script to remove that parameter as an input.

I tried changing the input but then Cellprofiler wouldn't recognize the file. But downgrading worked.

Pvannd avatar Jul 02 '24 23:07 Pvannd

great! I think you may want to raise an issue on cellprofiler to see if they'll support cellpose3 in the future since we have more models available in that version

carsen-stringer avatar Sep 10 '24 07:09 carsen-stringer

I also encountered this issue "local variable 'y_data' referenced before assignment, and I can confirm it was solved by uninstalling cellpose3 and downgrading to cellpose2. I am running CellProfiler inside a Python venv with cellpose within it, so I used:

pip uninstall cellpose

followed by:

pip install cellpose==2.3.2

And that worked!

andysaiz avatar Feb 13 '25 22:02 andysaiz