gift-surg/NiftyMIC

fetal_brain_seg.py failure :: wrong outfile name detection ?

Opened this issue · 0 comments

Helo Trying to run niftymic_segment_fetal_brains // fetal_brain_seg.py but it gaves an error while it looks it is OK
I'm runnig in a apptainer//singularity container

see:

Apptainer> ls
CC2-1-Ax.nii
Apptainer> fetal_brain_seg.py --input_names CC2-1-Ax.nii --segment_output_names  seg/CC2-1-Ax.nii
*** Config file
/usr/local/lib/python3.6/site-packages/monaifbs/config/monai_dynUnet_inference_config.yml
*** Input data: 
CC2-1-Ax.nii
*** MONAI config: 
MONAI version: 0.3.0
Python version: 3.6.8 (default, Nov 16 2020, 16:55:22)  [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
OS version: Linux (4.18.0-240.22.1.el8_3.x86_64)
Numpy version: 1.19.5
Pytorch version: 1.10.2+cu102
MONAI flags: HAS_EXT = False, USE_COMPILED = False

Optional dependencies:
Pytorch Ignite version: 0.4.2
Nibabel version: 3.2.2
scikit-image version: 0.17.2
Pillow version: 8.4.0
Tensorboard version: 2.8.0
gdown version: NOT INSTALLED or UNKNOWN VERSION.
TorchVision version: NOT INSTALLED or UNKNOWN VERSION.
ITK version: 4.13.0
tqdm version: NOT INSTALLED or UNKNOWN VERSION.

For details about installing the optional dependencies, please visit:
    https://docs.monai.io/en/latest/installation.html#installing-the-recommended-dependencies

*** Network inference config: 
device:
  num_workers: 1
inference:
  batch_size_inference: 1
  inplane_size:
  - 448
  - 512
  model_to_load: /usr/local/lib/python3.6/site-packages/monaifbs/models/checkpoint_dynUnet_DiceXent.pt
  nr_out_channels: 2
  probability_threshold: 0.5
  spacing:
  - 0.8
  - 0.8
  - -1.0
output:
  out_dir: seg
  out_postfix: seg

Considering patch size = [448, 512, 1]
Using device: cpu
***  Preparing data ... 
***  Preparing network ... 
***  Preparing evaluator ... 
Using sigmoid=False and softmax=True as final activation
***  Running evaluator ... 
INFO:ignite.engine.engine.DynUNetEvaluator:Engine run resuming from iteration 0, epoch 0 until 1 epochs
INFO:ignite.engine.engine.DynUNetEvaluator:Restored all variables from /usr/local/lib/python3.6/site-packages/monaifbs/models/checkpoint_dynUnet_DiceXent.pt
INFO:ignite.engine.engine.DynUNetEvaluator:saved all the model outputs into files.
INFO:ignite.engine.engine.DynUNetEvaluator:Epoch[1] Complete. Time taken: 00:02:31
INFO:ignite.engine.engine.DynUNetEvaluator:Engine run complete. Time taken: 00:02:32
Done!
Traceback (most recent call last):
  File "/usr/local/bin/fetal_brain_seg.py", line 104, in <module>
    "check if the segmentation pipeline has failed".format(out_filename))
FileNotFoundError: Network output file seg/CC2-1-Ax/CC2-1-Ax_seg.nii not found, check if the segmentation pipeline has failed

BUT

Apptainer> ls seg/CC2-1-Ax/CC2-1-Ax_seg.nii*   
seg/CC2-1-Ax/CC2-1-Ax_seg.nii.gz

seems the detection of file has some flaws on fetal_brain_seg.py about out_filename detection.

regards

Eric