MouseLand / cellpose

a generalist algorithm for cellular segmentation with human-in-the-loop capabilities
https://www.cellpose.org/
BSD 3-Clause "New" or "Revised" License
1.38k stars 400 forks source link

error with tissuenet and livecell models #499

Closed romainGuiet closed 2 years ago

romainGuiet commented 2 years ago

Hi ,

I jsut made a fresh install cellpose2.0 and found on the documentation two new models: tissuenet and livecell .

I think the download worked since for the first run I saw a progress bar ending with

100%|███████████████████████████████████████████████████████████████████████████████| 25.3M/25.3M [00:01<00:00, 19.2MB/s]

But I get an error :

(D:\conda_envs\cellposeGPU200_113-821) D:\conda_envs>python -m cellpose --pretrained_model livecell --dir D:\test\ --save_tif --verbose --use_gpu
2022-04-14 11:26:27,319 [INFO] WRITING LOG OUTPUT TO C:\Users\guiet\.cellpose\run.log
2022-04-14 11:26:27,605 [INFO] ** TORCH CUDA version installed and working. **
2022-04-14 11:26:27,606 [INFO] >>>> using GPU
2022-04-14 11:26:27,611 [INFO] >>>> running cellpose on 1 images using chan_to_seg GRAY and chan (opt) NONE
2022-04-14 11:26:27,613 [INFO] ** TORCH CUDA version installed and working. **
2022-04-14 11:26:27,613 [INFO] >>>> using GPU
2022-04-14 11:26:27,613 [INFO] >>livecell<< model set to be used
2022-04-14 11:26:27,687 [INFO] >>>> model diam_mean =  30.000 (ROIs rescaled to this size during training)
2022-04-14 11:26:27,688 [INFO] Downloading: "https://www.cellpose.org/models/size_livecelltorch_0.npy" to C:\Users\guiet\.cellpose\models\size_livecelltorch_0.npy

Traceback (most recent call last):
  File "D:\conda_envs\cellposeGPU200_113-821\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "D:\conda_envs\cellposeGPU200_113-821\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "D:\conda_envs\cellposeGPU200_113-821\lib\site-packages\cellpose\__main__.py", line 345, in <module>
    main()
  File "D:\conda_envs\cellposeGPU200_113-821\lib\site-packages\cellpose\__main__.py", line 189, in main
    model = models.Cellpose(gpu=gpu, device=device, model_type=args.pretrained_model,
  File "D:\conda_envs\cellposeGPU200_113-821\lib\site-packages\cellpose\models.py", line 88, in __init__
    self.pretrained_size = size_model_path(model_type, self.torch)
  File "D:\conda_envs\cellposeGPU200_113-821\lib\site-packages\cellpose\models.py", line 33, in size_model_path
    return cache_model_path(basename)
  File "D:\conda_envs\cellposeGPU200_113-821\lib\site-packages\cellpose\models.py", line 41, in cache_model_path
    utils.download_url_to_file(url, cached_file, progress=True)
  File "D:\conda_envs\cellposeGPU200_113-821\lib\site-packages\cellpose\utils.py", line 64, in download_url_to_file
    u = urlopen(url)
  File "D:\conda_envs\cellposeGPU200_113-821\lib\urllib\request.py", line 216, in urlopen
    return opener.open(url, data, timeout)
  File "D:\conda_envs\cellposeGPU200_113-821\lib\urllib\request.py", line 525, in open
    response = meth(req, response)
  File "D:\conda_envs\cellposeGPU200_113-821\lib\urllib\request.py", line 634, in http_response
    response = self.parent.error(
  File "D:\conda_envs\cellposeGPU200_113-821\lib\urllib\request.py", line 563, in error
    return self._call_chain(*args)
  File "D:\conda_envs\cellposeGPU200_113-821\lib\urllib\request.py", line 496, in _call_chain
    result = func(*args)
  File "D:\conda_envs\cellposeGPU200_113-821\lib\urllib\request.py", line 643, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 500: INTERNAL SERVER ERROR

Thank you for your help !

Cheers,

R

carsen-stringer commented 2 years ago

sorry I can't reproduce the error, could you send your env details perhaps?

image

romainGuiet commented 2 years ago

Hi, sorry for the delay with my answer (chasing Easter eggs 😄 )

I created the env with this this yml file :

dependencies:
  - python>=3.8
  - pip
  - cudnn==8.2.1
  - cudatoolkit=11.3
  - numpy
  - pytorch::pytorch 
  - pip:
    - cellpose==2.0.0
    - jupyterlab
    - scikit-image
    - scikit-learn

and export this yml from the created env :

name: D:\conda_envs\cellposeGPU200_113-821
channels:
  - pytorch
  - defaults
dependencies:
  - blas=1.0=mkl
  - bzip2=1.0.8=he774522_0
  - ca-certificates=2022.3.29=haa95532_0
  - certifi=2021.5.30=py310haa95532_0
  - cudatoolkit=11.3.1=h59b6b97_2
  - cudnn=8.2.1=cuda11.3_0
  - intel-openmp=2021.4.0=haa95532_3556
  - libffi=3.4.2=h604cdb4_1
  - libuv=1.40.0=he774522_0
  - mkl=2021.4.0=haa95532_640
  - mkl-service=2.4.0=py310h2bbff1b_0
  - mkl_fft=1.3.1=py310ha0764ea_0
  - mkl_random=1.2.2=py310h4ed8f06_0
  - numpy=1.21.5=py310h6d2d95c_1
  - numpy-base=1.21.5=py310h206c741_1
  - openssl=1.1.1n=h2bbff1b_0
  - pip=21.2.4=py310haa95532_0
  - python=3.10.4=hbb2ffb3_0
  - pytorch=1.11.0=py3.10_cuda11.3_cudnn8_0
  - pytorch-mutex=1.0=cuda
  - setuptools=61.2.0=py310haa95532_0
  - six=1.16.0=pyhd3eb1b0_1
  - sqlite=3.38.2=h2bbff1b_0
  - tk=8.6.11=h2bbff1b_0
  - typing_extensions=4.1.1=pyh06a4308_0
  - tzdata=2022a=hda174b7_0
  - vc=14.2=h21ff451_1
  - vs2015_runtime=14.27.29016=h5e58377_2
  - wheel=0.37.1=pyhd3eb1b0_0
  - wincertstore=0.2=py310haa95532_2
  - xz=5.2.5=h62dcd97_0
  - zlib=1.2.12=h8cc25b3_0
  - pip:
    - anyio==3.5.0
    - argon2-cffi==21.3.0
    - argon2-cffi-bindings==21.2.0
    - asttokens==2.0.5
    - attrs==21.4.0
    - babel==2.9.1
    - backcall==0.2.0
    - beautifulsoup4==4.11.1
    - bleach==5.0.0
    - cellpose==2.0
    - cffi==1.15.0
    - charset-normalizer==2.0.12
    - colorama==0.4.4
    - debugpy==1.6.0
    - decorator==5.1.1
    - defusedxml==0.7.1
    - entrypoints==0.4
    - executing==0.8.3
    - fastjsonschema==2.15.3
    - fastremap==1.12.2
    - idna==3.3
    - imageio==2.16.2
    - ipykernel==6.13.0
    - ipython==8.2.0
    - ipython-genutils==0.2.0
    - jedi==0.18.1
    - jinja2==3.1.1
    - joblib==1.1.0
    - json5==0.9.6
    - jsonschema==4.4.0
    - jupyter-client==7.2.2
    - jupyter-core==4.9.2
    - jupyter-server==1.16.0
    - jupyterlab==3.3.3
    - jupyterlab-pygments==0.2.1
    - jupyterlab-server==2.12.0
    - llvmlite==0.38.0
    - markupsafe==2.1.1
    - matplotlib-inline==0.1.3
    - mistune==0.8.4
    - natsort==8.1.0
    - nbclassic==0.3.7
    - nbclient==0.6.0
    - nbconvert==6.5.0
    - nbformat==5.3.0
    - nest-asyncio==1.5.5
    - networkx==2.8
    - notebook==6.4.10
    - notebook-shim==0.1.0
    - numba==0.55.1
    - opencv-python-headless==4.5.5.64
    - packaging==21.3
    - pandocfilters==1.5.0
    - parso==0.8.3
    - pickleshare==0.7.5
    - pillow==9.1.0
    - prometheus-client==0.14.1
    - prompt-toolkit==3.0.29
    - psutil==5.9.0
    - pure-eval==0.2.2
    - pycparser==2.21
    - pygments==2.11.2
    - pyparsing==3.0.8
    - pyrsistent==0.18.1
    - python-dateutil==2.8.2
    - pytz==2022.1
    - pywavelets==1.3.0
    - pywin32==303
    - pywinpty==2.0.5
    - pyzmq==22.3.0
    - requests==2.27.1
    - scikit-image==0.19.2
    - scikit-learn==1.0.2
    - scipy==1.8.0
    - send2trash==1.8.0
    - sniffio==1.2.0
    - soupsieve==2.3.2
    - stack-data==0.2.0
    - terminado==0.13.3
    - threadpoolctl==3.1.0
    - tifffile==2022.4.8
    - tinycss2==1.1.1
    - tornado==6.1
    - tqdm==4.64.0
    - traitlets==5.1.1
    - urllib3==1.26.9
    - wcwidth==0.2.5
    - webencodings==0.5.1
    - websocket-client==1.3.2
prefix: D:\conda_envs\cellposeGPU200_113-821
romainGuiet commented 2 years ago

The livecell and tissuenet are downloaded : image

and error message seems to refer to the download of size_livecelltorch_0.npy

 Downloading: "**https://www.cellpose.org/models/size_livecelltorch_0.npy" to C:\Users\guiet\.cellpose\models\size_livecelltorch_0.npy**

Traceback (most recent call last):
  File "D:\conda_envs\cellposeGPU200_113-821\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "D:\conda_envs\cellposeGPU200_113-821\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "D:\conda_envs\cellposeGPU200_113-821\lib\site-packages\cellpose\__main__.py", line 345, in <module>
    main()
  File "D:\conda_envs\cellposeGPU200_113-821\lib\site-packages\cellpose\__main__.py", line 189, in main
    model = models.Cellpose(gpu=gpu, device=device, model_type=args.pretrained_model,
  File "D:\conda_envs\cellposeGPU200_113-821\lib\site-packages\cellpose\models.py", line 88, in __init__
    self.pretrained_size = size_model_path(model_type, self.torch)
  File "D:\conda_envs\cellposeGPU200_113-821\lib\site-packages\cellpose\models.py", line 33, in size_model_path
    return cache_model_path(basename)
  File "D:\conda_envs\cellposeGPU200_113-821\lib\site-packages\cellpose\models.py", line 41, in cache_model_path
    utils.download_url_to_file(url, cached_file, progress=True)
  File "D:\conda_envs\cellposeGPU200_113-821\lib\site-packages\cellpose\utils.py", line 64, in download_url_to_file
    u = urlopen(url)
  File "D:\conda_envs\cellposeGPU200_113-821\lib\urllib\request.py", line 216, in urlopen
    return opener.open(url, data, timeout)
  File "D:\conda_envs\cellposeGPU200_113-821\lib\urllib\request.py", line 525, in open
    response = meth(req, response)
  File "D:\conda_envs\cellposeGPU200_113-821\lib\urllib\request.py", line 634, in http_response
    response = self.parent.error(
  File "D:\conda_envs\cellposeGPU200_113-821\lib\urllib\request.py", line 563, in error
    return self._call_chain(*args)
  File "D:\conda_envs\cellposeGPU200_113-821\lib\urllib\request.py", line 496, in _call_chain
    result = func(*args)
  File "D:\conda_envs\cellposeGPU200_113-821\lib\urllib\request.py", line 643, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 500: INTERNAL SERVER ERROR
carsen-stringer commented 2 years ago

You need to upgrade to the latest cellpose version please (pip install cellpose --upgrade)

On Tue, Apr 19, 2022, 22:53 romainGuiet @.***> wrote:

The livecell and tissuenet are downloaded : [image: image] https://user-images.githubusercontent.com/8309560/164159527-018ec709-f54c-4ecd-a50a-c1f6fffa8aed.png

and error message seems to refer to the download of livesize_livecelltorch_0.npy

Downloading: "https://www.cellpose.org/models/size_livecelltorch_0.npy" to C:\Users\guiet.cellpose\models\size_livecelltorch_0.npy

Traceback (most recent call last): File "D:\conda_envs\cellposeGPU200_113-821\lib\runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "D:\conda_envs\cellposeGPU200_113-821\lib\runpy.py", line 86, in _run_code exec(code, run_globals) File "D:\conda_envs\cellposeGPU200_113-821\lib\site-packages\cellpose__main.py", line 345, in main() File "D:\conda_envs\cellposeGPU200_113-821\lib\site-packages\cellpose\main.py", line 189, in main model = models.Cellpose(gpu=gpu, device=device, model_type=args.pretrained_model, File "D:\conda_envs\cellposeGPU200_113-821\lib\site-packages\cellpose\models.py", line 88, in init__ self.pretrained_size = size_model_path(model_type, self.torch) File "D:\conda_envs\cellposeGPU200_113-821\lib\site-packages\cellpose\models.py", line 33, in size_model_path return cache_model_path(basename) File "D:\conda_envs\cellposeGPU200_113-821\lib\site-packages\cellpose\models.py", line 41, in cache_model_path utils.download_url_to_file(url, cached_file, progress=True) File "D:\conda_envs\cellposeGPU200_113-821\lib\site-packages\cellpose\utils.py", line 64, in download_url_to_file u = urlopen(url) File "D:\conda_envs\cellposeGPU200_113-821\lib\urllib\request.py", line 216, in urlopen return opener.open(url, data, timeout) File "D:\conda_envs\cellposeGPU200_113-821\lib\urllib\request.py", line 525, in open response = meth(req, response) File "D:\conda_envs\cellposeGPU200_113-821\lib\urllib\request.py", line 634, in http_response response = self.parent.error( File "D:\conda_envs\cellposeGPU200_113-821\lib\urllib\request.py", line 563, in error return self._call_chain(args) File "D:\conda_envs\cellposeGPU200_113-821\lib\urllib\request.py", line 496, in _call_chain result = func(args) File "D:\conda_envs\cellposeGPU200_113-821\lib\urllib\request.py", line 643, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 500: INTERNAL SERVER ERROR

— Reply to this email directly, view it on GitHub https://github.com/MouseLand/cellpose/issues/499#issuecomment-1103498403, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADS6TFNY3WDP4IB7RSUJD23VF6LXHANCNFSM5TNGYXIA . You are receiving this because you commented.Message ID: @.***>

romainGuiet commented 2 years ago

You need to upgrade to the latest cellpose version please (pip install cellpose --upgrade)

Thanks ! indeed 2.0.4 solved the issue and I can run with the model livecell

BUT (sorry for that) I've downloaded the image from livecell-dataset and I got the error below :

python -m cellpose --pretrained_model livecell --dir D:\test\test\ --save_tif --verbose --use_gpu
2022-04-20 14:30:51,603 [INFO] WRITING LOG OUTPUT TO C:\Users\guiet\.cellpose\run.log
2022-04-20 14:30:51,790 [INFO] ** TORCH CUDA version installed and working. **
2022-04-20 14:30:51,791 [INFO] >>>> using GPU
2022-04-20 14:30:51,795 [INFO] >>>> running cellpose on 1 images using chan_to_seg GRAY and chan (opt) NONE
2022-04-20 14:30:51,797 [INFO] >> livecell << model set to be used
2022-04-20 14:30:52,905 [INFO] >>>> model diam_mean =  30.000 (ROIs rescaled to this size during training)
2022-04-20 14:30:52,906 [INFO] >>>> using diameter 30.000 for all images
2022-04-20 14:30:52,910 [INFO] 0%|          | 0/1 [00:00<?, ?it/s]
2022-04-20 14:30:52,916 [INFO] 0%|          | 0/1 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "D:\conda_envs\cellposeGPU200_113-821\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "D:\conda_envs\cellposeGPU200_113-821\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "D:\conda_envs\cellposeGPU200_113-821\lib\site-packages\cellpose\__main__.py", line 345, in <module>
    main()
  File "D:\conda_envs\cellposeGPU200_113-821\lib\site-packages\cellpose\__main__.py", line 229, in main
    image = io.imread(image_name)
  File "D:\conda_envs\cellposeGPU200_113-821\lib\site-packages\cellpose\io.py", line 81, in imread
    img = tif.asarray()
  File "D:\conda_envs\cellposeGPU200_113-821\lib\site-packages\tifffile\tifffile.py", line 3390, in asarray
    result = pages[0].asarray(out=out, maxworkers=maxworkers)
  File "D:\conda_envs\cellposeGPU200_113-821\lib\site-packages\tifffile\tifffile.py", line 6880, in asarray
    for _ in self.segments(
  File "D:\conda_envs\cellposeGPU200_113-821\lib\site-packages\tifffile\tifffile.py", line 6725, in segments
    yield decode(segment)
  File "D:\conda_envs\cellposeGPU200_113-821\lib\site-packages\tifffile\tifffile.py", line 6713, in decode
    return func(keyframe.decode(*args, **decodeargs))
  File "D:\conda_envs\cellposeGPU200_113-821\lib\site-packages\tifffile\tifffile.py", line 6334, in decode
    raise ValueError(f'{exc}')
ValueError: <COMPRESSION.LZW: 5> requires the 'imagecodecs' package 

a simple pip install imagecodecs solved the problem, I just wanted to let you know in case you want to add it as a dependency...

Thank you a again !