Open mathieuboudreau opened 11 months ago
Hm I expect the problem comes from the fact that the input image is not formatted like the model expects. This was something I was worried about because we should tell the user why this is failing.
File "/Users/mathieuboudreau/opt/anaconda3/envs/nnunet/lib/python3.9/site-packages/nnunetv2/preprocessing/preprocessors/default_preprocessor.py", line 183, in _normalize
scheme = configuration_manager.normalization_schemes[c]
IndexError: list index out of range
For the unmyelinated TEM model, when we look at the dataset.json
file, we see the following:
{
"channel_names": {
"0": "rescale_to_0_1"
},
[...]
}
So for this one, we expect grayscale single channel images. However, if we look at the other model available, we have this:
{
"channel_names": {
"0": "R",
"1": "G",
"2": "B"
},
[...]
}
This is used for the image preprocessing. rescale_to_0_1
will rescale the histogram, while 'R', 'G' and 'B' are other normalization schemes (see https://github.com/MIC-DKFZ/nnUNet/blob/master/nnunetv2/dataset_conversion/Dataset120_RoadSegmentation.py). Would you mind posting the image you are trying to segment? I would bet it's in RGB format or maybe it has an alpha channel.
Ahh that makes sense ! The image I was trying it with was just our default SEM model test image
Ah yes this image indeed has 3 channels. I think this should be caught by the script and send a warning to the user instead of crashing with this unhelpful error message.
Ah yes this image indeed has 3 channels. I think this should be caught by the script and send a warning to the user instead of crashing with this unhelpful error message.
Maybe this is an example of why #1 might be useful, because we already have the tools to do this conversion (RGB -> Gray) there
Ah yes this image indeed has 3 channels. I think this should be caught by the script and send a warning to the user instead of crashing with this unhelpful error message.
Maybe this is an example of why #1 might be useful, because we already have the tools to do this conversion (RGB -> Gray) there
Yeah and the nnUNet pipeline requires creating a temp folder with different filenames anyway so we can for sure convert the color profile at this step.
Here's the command & output:
MacBookPro 2021, CPU (no CUDA), Python 3.9 pip env: