Closed playgamemy closed 1 year ago
Hello! I have a similar error. When following the guide for v3 cell segmentation model:
AttributeError: module 'stereo.image' has no attribute 'cell_seg_v3'
Checked module attributes to see if it exists via print(dir(im)):
['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', 'cell_seg', 'cell_seg_deepcell', 'create_pyramid', 'merge_pyramid', 'pyramid', 'segmentation', 'segmentation_deepcell', 'tissue_cut']
Confirms` that cell_seg_v3 does not exist. Out of curiosity, I tried running im.cell_seg() with the model_path arg pointing to the v3 model. This results in a pickling error:
File "/home/dm2763/micromamba/envs/segmentation/lib/python3.8/site-packages/torch/serialization.py", line 920, in _legacy_load magic_number = pickle_module.load(f, **pickle_load_args) _pickle.UnpicklingError: invalid load key, '\x08'.
After outputting:
[2023-07-06 15:50:54][Stereo][1107028][140495023171392][cell_seg_pipeline][45][INFO]: Transform 16bit to 8bit : 0.00
[2023-07-06 15:50:54][Stereo][1107028][140495023171392][cell_seg_pipeline][100][INFO]: get tissue mask, process 1
[2023-07-06 15:50:59][Stereo][1107028][140495023171392][cell_seg_pipeline][126][INFO]: get roi
Checked v1 model to see if it still functions properly (to see if my environment is bugged) and seems to work fine.
Hi! @playgamemy
As mentioned in the bottom of the Exception, you need to install some necessary modules.
Hi!! @Tripfantasy , what is the version of your stereopy? the cell_seg_v3 is in stereopy from 0.12.0 and the cell_seg can not support the v3 model.
Hello @tanliwei-coder I've updated to 0.12.1 and now receive a similar error to @playgamemy above, despite installing the necessary modules and versions. Running pip/conda list shows them existing at the preferred versions. I have even tried a new conda environment with dev install using git repo + installing requirements.txt. Same error.
Hi! @playgamemy
As mentioned in the bottom of the Exception, you need to install some necessary modules.
@tanliwei-coder But as the tutorial indicated, the cell_seg_v3 has converted to .onnx model and should require only the onnx runtime library. If that is true the error raised cannot be ignored during import of cell_seg_v3.
FYI, i am using Stereopy 0.12.1, and I can run cell_seg_v3 after installing the "necessary" modules, so my issue is different from that of @Tripfantasy
@playgamemy
Because the cell_seg_v3
is in stereo.image
module which is the same as cell_seg
and cell_seg_deepcell
, and those necessary modules mentioned in the Excepion is necessary for cell_seg
and cell_seg_deepcell
, so it will check if installed while importing stereo.image
.
@tanliwei-coder I've updated to the proper version and still have all dependencies installed at proper versions. I was able to eliminate the error from running 'sudo apt-get install -y libgl1-mesa-dev'.
@Tripfantasy OK, I have installed this library(libgl1-mesa-dev) when I created my docker image based on my past experience, despite I can't remember which python module dependent on it (seems to be opencv), so I never encounter this error, thanks for your feedback.
Tried to import and use the deep learning model v3 as listed in here https://stereopy.readthedocs.io/en/latest/Tutorials/Cell_Segmentation.html which claims no install of tensorflow and torch is required,
However, since image module mport the deep learning v1 module on initiation, ModuleNotFound error occurs when following code runs
Maybe convert "raise" to "warning" to allow importing cell_seg_v3 without error raised, eventuallly these should be moved to init of individual method instead of the image module.