MIC-DKFZ / nnUNet

Apache License 2.0
5.91k stars 1.76k forks source link

What should the dataset.json be like for a rgb 2d images? #2443

Closed aymuos15 closed 3 months ago

aymuos15 commented 3 months ago

My Current .json:

# Saving dataset.json
dataset = {
    "description": "URDE Dataset",
    "labels": {
        "background": 0,
        "Dust": 1
    },
    "name": "Dataset1234_URDE",
    "numTraining": new_num_training_images,
    "channel_names": {
        "R": 0,
        "G": 1,
        "B": 2
    },
    "file_ending": ".png"
}

Data Info:

Image shape: (1024, 1024, 3)
Label shape: (1024, 1024)

My error on verify command:


nnUNetv2_plan_and_preprocess -d 1234 --verify_dataset_integrity
Fingerprint extraction...
Dataset1234_URDE
Using <class 'nnunetv2.imageio.natural_image_reader_writer.NaturalImage2DIO'> as reader/writer

####################
verify_dataset_integrity Done.
If you didn't see any error messages then your dataset is most likely OK!
####################

Experiment planning...

############################
INFO: You are using the old nnU-Net default planner. We have updated our recommendations. Please consider using those instead! Read more here: https://github.com/MIC-DKFZ/nnUNet/blob/master/documentation/resenc_presets.md
############################

Traceback (most recent call last):
  File "/home/localssk23/backup/soumya/env/nnunet/bin/nnUNetv2_plan_and_preprocess", line 8, in <module>
    sys.exit(plan_and_preprocess_entry())
  File "/home/localssk23/backup/soumya/nnUNet/nnunetv2/experiment_planning/plan_and_preprocess_entrypoints.py", line 188, in plan_and_preprocess_entry
    plans_identifier = plan_experiments(args.d, args.pl, args.gpu_memory_target, args.preprocessor_name,
  File "/home/localssk23/backup/soumya/nnUNet/nnunetv2/experiment_planning/plan_and_preprocess_api.py", line 94, in plan_experiments
    _, plans_identifier = plan_experiment_dataset(d, experiment_planner, gpu_memory_target_in_gb,
  File "/home/localssk23/backup/soumya/nnUNet/nnunetv2/experiment_planning/plan_and_preprocess_api.py", line 72, in plan_experiment_dataset
    ret = planner.plan_experiment()
  File "/home/localssk23/backup/soumya/nnUNet/nnunetv2/experiment_planning/experiment_planners/default_experiment_planner.py", line 486, in plan_experiment
    plan_2d = self.get_plans_for_configuration(fullres_spacing_transposed[1:],
  File "/home/localssk23/backup/soumya/nnUNet/nnunetv2/experiment_planning/experiment_planners/default_experiment_planner.py", line 384, in get_plans_for_configuration
    self.determine_normalization_scheme_and_whether_mask_is_used_for_norm()
  File "/home/localssk23/backup/soumya/nnUNet/nnunetv2/experiment_planning/experiment_planners/default_experiment_planner.py", line 204, in determine_normalization_scheme_and_whether_mask_is_used_for_norm
    normalization_schemes = [get_normalization_scheme(m) for m in modalities.values()]
  File "/home/localssk23/backup/soumya/nnUNet/nnunetv2/experiment_planning/experiment_planners/default_experiment_planner.py", line 204, in <listcomp>
    normalization_schemes = [get_normalization_scheme(m) for m in modalities.values()]
  File "/home/localssk23/backup/soumya/nnUNet/nnunetv2/preprocessing/normalization/map_channel_name_to_normalization.py", line 20, in get_normalization_scheme
    norm_scheme = channel_name_to_normalizatio
```n_mapping.get(channel_name.casefold())
AttributeError: 'int' object has no attribute 'casefold'
Shrajan commented 3 months ago

Hi @aymuos15,

You need to invert the key and value pairs in the channel_names dictionary. Like this: channel_names {"0": "R", "1": "G", "2": "B"}.

aymuos15 commented 3 months ago

Not sure how I missed that haha. Thanks a lot! :) @Shrajan