Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

contrast_phase pipeline broken due to TS weights unavailable #134

Open
alkamid opened this issue Aug 23, 2024 · 1 comment
Open

contrast_phase pipeline broken due to TS weights unavailable #134

alkamid opened this issue Aug 23, 2024 · 1 comment

Comments

@alkamid
Copy link

alkamid commented Aug 23, 2024

I tried running the contrast phase detection pipeline:

bin/C2C contrast_phase -i /data/dicom_dir/

This crashes with the following error:

Inference pipeline:
(1) DicomToNifti
(2) ContrastPhaseDetection

Starting inference pipeline for:

Running DicomToNifti with input keys odict_keys(['inference_pipeline'])
Finished DicomToNifti with output keys dict_keys([])

Running ContrastPhaseDetection with input keys odict_keys(['inference_pipeline'])
Segmenting...
Downloading pretrained weights for Task 251 (~230MB) ...
ERROR PROCESSING /data/dicom_dir

Traceback (most recent call last):
  File "/code/Comp2Comp/comp2comp/utils/process.py", line 131, in process_3d
    pipeline(output_dir=output_dir, model_dir=model_dir)
  File "/code/Comp2Comp/comp2comp/inference_pipeline.py", line 73, in __call__
    output = inference_class(inference_pipeline=self, **output)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/code/Comp2Comp/comp2comp/contrast_phase/contrast_phase.py", line 31, in __call__
    seg, img = self.run_segmentation(
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/code/Comp2Comp/comp2comp/contrast_phase/contrast_phase.py", line 71, in run_segmentation
    download_pretrained_weights(task_id)
  File "/home/user/miniconda3/envs/c2c_env/lib/python3.11/site-packages/totalsegmentator/libs.py", line 194, in download_pretrained_weights
    download_url_and_unpack(WEIGHTS_URL, config_dir)
  File "/home/user/miniconda3/envs/c2c_env/lib/python3.11/site-packages/totalsegmentator/libs.py", line 80, in download_url_and_unpack
    raise e
  File "/home/user/miniconda3/envs/c2c_env/lib/python3.11/site-packages/totalsegmentator/libs.py", line 67, in download_url_and_unpack
    r.raise_for_status()
  File "/home/user/miniconda3/envs/c2c_env/lib/python3.11/site-packages/requests/models.py", line 1024, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://zenodo.org/record/6802342/files/Task251_TotalSegmentator_part1_organs_1139subj.zip?download=1

It looks like the forked TotalSegmentatorV1's version is 1.5.3:

$ pip list | grep Segmentator
TotalSegmentator              1.5.3
TotalSegmentatorV2            2.0.1

So it's unsurprising that zenodo downloads are failing, see wasserth/TotalSegmentator#200

I thought I'd try a quick hack and ran pip install totalsegmentator==1.5.7, but then I'm getting the following from bin/C2C contrast_phase:

Traceback (most recent call last):
  File "/code/Comp2Comp/bin/C2C", line 13, in <module>
    from comp2comp.contrast_phase.contrast_phase import ContrastPhaseDetection
  File "/code/Comp2Comp/comp2comp/contrast_phase/contrast_phase.py", line 6, in <module>
    from totalsegmentator.libs import (
ImportError: cannot import name 'setup_nnunet' from 'totalsegmentator.libs' (/home/user/miniconda3/envs/c2c_env/lib/python3.11/site-packages/totalsegmentator/libs.py)
@dkarakay
Copy link

dkarakay commented Sep 13, 2024

I found a solution. Download weights from your browser and extract zip file. Then go to Comp2Comp/models/.totalsegmentator/nnunet/results/nnUNet/3d_fullres/ and copy the extracted folder here. This time it will work, because we are downloading the pre-trained weights manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@alkamid @dkarakay and others