MIC-DKFZ/nnDetection

[Bug] nndet_unpack does not work with environment variables in the path

FrankTN opened this issue ยท 2 comments

๐Ÿ’€ Bug

When I come to the nndet_unpack part of the README, the script runs silently without generating any output. I saw that it happens because the subfiles function (inside unpack_dataset) does not find any *.npz files in my imagesTr directory. This happens because I provide a path

${det_data}/Task101_CarotidBifurcationDetection/preprocessed/D3V001_3d/imagesTr'

The environment variable det_data is not expanded and so the directory is not found. As a result, the subfiles command returns an empty list.

I think this could be fixed by first passing the string through os.path.expandvars(), apparently, pathlib does not support expanding environment variables yet. If there are no safety/security concerns from expanding environment variables in the string I would be willing to help/implement this. Additionally, I suggest adding a warning to the unpack logger if no files are unpacked.

Environment

Please provide some information about the used environment.

How was nnDetection installed [source]:

Environment Information:

PyTorch Version: 2.3.0+cu121
PyTorch Debug: False
PyTorch CUDA: 12.1
PyTorch Backend cudnn: 8902
PyTorch CUDA Arch List: ['sm_50', 'sm_60', 'sm_70', 'sm_75', 'sm_80', 'sm_86', 'sm_90']
PyTorch Current Device Capability: (7, 5)
PyTorch CUDA available: True

----- System Information -----
System NVCC: nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2024 NVIDIA Corporation
Built on Thu_Mar_28_02:18:24_PDT_2024
Cuda compilation tools, release 12.4, V12.4.131
Build cuda_12.4.r12.4/compiler.34097967_0

System Arch List: None
System OMP_NUM_THREADS: 1
System CUDA_HOME is None: True
System CPU Count: 20
Python Version: 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]

----- nnDetection Information -----
det_num_threads 12
det_data is set True
det_models is set True

If necessary, please provide the used run command with all overwrites:

nndet_unpack ${det_data}/Task101_CarotidBifurcationDetection/preprocessed/D3V001_3d/imagesTr 6

Dear @FrankTN ,

thank you for the very detailed report, if you would like to create a PR for this, I would be happy to review it ๐Ÿ‘

Best,
Michael

Fixed with #251