Ivadomed: Adaptative Loader

Created on 7 Jan 2020  路  5Comments  路  Source: ivadomed/ivadomed

To reproduce the Pseudo-Curriculum Training Procedure from the HeMIS paper, we need a loader that can change its distribution across time. To do so, I came up with the idea of adding a Dataframe in the Dataset class. (see example below)

Why

  • Dataframes are easy to manipulate and perfectly supported by the loader of Pytorch.
  • No need to recreate a Dataset every epoch (which is very long) - We can just re-initialize the loader. (shouldn't be very long)
  • Add new features

New Features

  • files can be loaded/ partially-loaded (later) into RAM or read "on the fly"
  • Dataframe can be saved and used later
  • possibility to load only the slices we want
  • Allows curriculum learning procedures (including HeMIS)
  • Columns can be added to create to deal with new strategies such as active learning (_Difficulty_)

WIP

  • Create a class Dataframe - need to be more modulable
  • Create new loader that uses that class

TODO

  • change Medical-torch such that files are not necessarily loaded into RAM
  • implement strategies

Questions

  • This loader seems to be very specific to our problem, but maybe it should be added directly to MedicalTorch?
  • Any suggestions/ problems?

_Example of Dataframe_
Screen Shot 2019-12-19 at 5 00 01 PM

DESIGN_DISCUSSION enhancement

All 5 comments

Like really like your ideas @AnBucquet !

As said during meeting:

  • start by implementing the new loader within ivadomed repo'. If too much duplication with medicaltorch, then we will consider of moving it there.
  • use HDF5 file instead of files can be loaded/ partially-loaded (later) into RAM or read "on the fly"

About the use of HDF5 file:

I'm currently working on a function to generate an HDF5 file from a Bids dataset (SpineGeneric in my case). After discussing with @charleygros, we agree to use the following architecture in the HDF5 file:
Screen Shot 2020-01-16 at 4 06 56 PM
The idea is to create a GROUP for each patient. Each of this GROUP has at most 3 sub-groups:

  • Inputs: contains the different modalities as Datasets
  • gt: idem
  • roi idem

As those datasets are like _Numpy array_, we would be able to read only some slices (to replace the slice filter).

looks good! could you detail what would be in each of the metadata block?

Yes! I'm currently working on that. I will keep you informed!

About the metadata block, I've started listing metadata in each block:

  • HDF5 block:

    • list of patients
    • Canonical reordering of the volume axes or not
    • slice axis
    • slice filter
    • metadata choice
  • Group block (Patient):

    • Different modalities
    • Useful slices (i.e. slices with GT)
  • Sub-GROUP (inputs, gt, roi):

    • datasets inside (i.e.: different modailities, gt, ...)
  • Dataset (MRI and labels):

    • all parameters in JSON file (_FlipAngle_, _TE_, _TR_, ... )

This list is not fixed for now.

Was this page helpful?
0 / 5 - 0 ratings