Ivadomed: Training Error: FILM layers value error

Created on 9 Nov 2020  路  5Comments  路  Source: ivadomed/ivadomed

I'm trying to follow the documentation, in particular, the tutorials to get started with training the models using ivadomed.

I'm following the tutorial of one class segmentation using 2D-unet. When I execute ivadomed -c config.json, I encounter following error log.

(ivadomed_env) p112473@bireli:~/p112473/ivadomed$ ivadomed -c config.json
Log directory already exists: spineGeneric
Using GPU number 1

Selected architecture: FiLMedUnet, with the following parameters:
        dropout_rate: 0.3
        bn_momentum: 0.9
        depth: 3
        is_2d: True
        folder_name: seg_sc_t1-t2-t2s-mt
        applied: True
        metadata: contrasts
        film_layers: [0, 1, 0, 0, 0, 0, 0, 0, 0, 0]
        in_channel: 1
        out_channel: 1

Selected transformations for the ['training'] dataset:
        Resample: {'wspace': 0.75, 'hspace': 0.75, 'dspace': 1}
        CenterCrop: {'size': [128, 128]}
        RandomAffine: {'degrees': 5, 'scale': [0.1, 0.1], 'translate': [0.03, 0.03], 'applied_to': ['im', 'gt']}
        ElasticTransform: {'alpha_range': [28.0, 30.0], 'sigma_range': [3.5, 4.5], 'p': 0.1, 'applied_to': ['im', 'gt']}
        NumpyToTensor: {}
        NormalizeInstance: {'applied_to': ['im']}

Selected transformations for the ['validation'] dataset:
        Resample: {'wspace': 0.75, 'hspace': 0.75, 'dspace': 1}
        CenterCrop: {'size': [128, 128]}
        NumpyToTensor: {}
        NormalizeInstance: {'applied_to': ['im']}
Loading dataset: 100%|鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻坾 6/6 [00:00<00:00, 1545.15it/s]
Loaded 93 axial slices for the validation set.
Loading dataset: 100%|鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻坾 18/18 [00:00<00:00, 1552.58it/s]
Loaded 291 axial slices for the training set.
Model directory already exists: spineGeneric/seg_sc_t1-t2-t2s-mt

Initialising model's weights from scratch.
Traceback (most recent call last):
  File "/home/GRAMES.POLYMTL.CA/p112473/miniconda/envs/ivadomed_env/bin/ivadomed", line 33, in <module>
    sys.exit(load_entry_point('ivadomed', 'console_scripts', 'ivadomed')())
  File "/home/GRAMES.POLYMTL.CA/p112473/p112473/ivadomed/ivadomed/main.py", line 311, in run_main
    resume_training=bool(args.resume_training))
  File "/home/GRAMES.POLYMTL.CA/p112473/p112473/ivadomed/ivadomed/main.py", line 216, in run_command
    debugging=context["debugging"])
  File "/home/GRAMES.POLYMTL.CA/p112473/p112473/ivadomed/ivadomed/training.py", line 101, in train
    model = model_class(**model_params)
  File "/home/GRAMES.POLYMTL.CA/p112473/p112473/ivadomed/ivadomed/models.py", line 522, in __init__
    "UNet depth. There should 2 * depth + 2 layers.".format(len(film_layers)))
ValueError: The number of FiLM layers 10 entered does not correspond to the UNet depth. There should 2 * depth + 2 layers.

NOTE: - The same data example and config file is used as mentioned in RTD, which is data_example_spinegenericand config.json respectively.

All 5 comments

Thank you for opening this issue!

Currently you are adding FiLM layers to your model. To avoid this error, you can simply disable this parameter by setting FiLMedUNet:applied to false:

    "FiLMedUnet": {
        "applied": false
}

By default it should be set to false. I fixed this in this PR .

Thanks again @andreanne-lemay . I'll close this issue.

issues are closed via PRs, not manually

It's too late for this one since the PR is already merged but good to know for the future

It's too late for this one since the PR is already merged but good to know for the future

Agree. At least as far as I know.
So I will kindly close this issue. But if anyone knows how to proceed despite the PR already being merged: please feel to reopen it and proceed :-) (and I would be happy to learn this new tip!!)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

charleygros picture charleygros  路  5Comments

charleygros picture charleygros  路  3Comments

andreanne-lemay picture andreanne-lemay  路  4Comments

mariehbourget picture mariehbourget  路  3Comments

mariehbourget picture mariehbourget  路  4Comments