Skip to content
/ FetalGAN Public

Framework developed for training and inference in motion correction of fetal MRI stack developed by Pedro Alarcón GIl as part of Phd traineeship in KCL with the supervision of Alena Uus, Lucilio Cordero-Grande and Maria Jesus Ledesma-Carbayo

License

Notifications You must be signed in to change notification settings

SVRTK/FetalGAN

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

FetalGAN

FetalGAN is a Python-based interface for training and inference across different architectures for deep learning supervised tasks, specialized in medical imaging such as fetal MRI. It provides a flexible, easy-to-use environment based on MONAI framework for rapid experimentation and reproducible research.
License: Apache License 2.0

Features

  • Modular interface for training and inference in supervised networks.
  • Supports multiple architectures (e.g., GANs, U-Nets, etc.) and allow easy integration of your own architectures and losses (conditioning, diffusion model and deep supervision will be integrated soon; transformer architectures and additional advanced loss functions can be added).
  • Easy modification between experiments as all management of the process is using .json.
  • Pythonic API for integration with existing pipelines.

Project Structure

FetalGAN/
SELECT/
README.md
  • FetalGAN/: Main source code for all the training and inference process.
  • SELECT/: Additional scripts that must be added after you create a project folder and in all the projects you create. Used to control the desired dataset, training and inference names and parameters.
  • README.md: Project documentation and license.

Installation

Clone the repository:

git clone https://github.com/pedroalarcongil/FetalGAN.git
cd FetalGAN

Create your own conda environment

conda create -name FetalGAN2 python==3.9

Activate your desired conda environment

conda activate FetalGAN2

Install the required dependencies (Python 3.8+ recommended):

pip install -e .

Usage

Starts a project:

   Activate the environment for this package

   conda activate FetalGAN2
 
   Move to different actions commands

   cd ./FetalGAN/Scripts/

   Define the path to build the structure where all training and inference processes will be saved

   ./Init.sh

   Place in the generated SELECT path (/Root_path/SELECT/) the three files in the SELECT folder of this package called Dataset.json, Network.json and inference.json (these files will manage the different dataset, training and inference architectures and run parameters).

Create a dataset:

     Configure the files you want to add in the dataset and the type of dataset you want depending on you want cross-validation or not. Available generation options to generate test/train splits, support for cross-validation and class balancing. It supports with different approachs to select the input and ground truth file paths.
     
     Dataset configuration file is in /FetalGAN/Creator/Dataset.py
   
     When you have selected your desired configuration for your dataset:

     cd /FetalGAN/Scripts
     ./Dataset.sh

     This dataset will be referenced throughout the process with the name you define in the dataset configuration file. The result is saved in /Rootpath/DATASETS/Dataset_Name/. In this folder will be the configuration, splits, and meta-information.

Create a preprocessor:

     Configure the steps you want to add in the preprocessing in /FetalGAN/NETS/Creator/Preprocess.py. 
     
     Look at the current available steps and integrate your new steps in the file LoadedDA.py in folder /FetalGAN/NETS/Data/. The file designed to add your own preprocessing steps is Presteps.py in that folder.
   
     When you have selected your desired configuration for the preprocessor:

     cd /FetalGAN/Scripts
     ./Preprocessor.sh

     You can create all the different preprocessing as you want or overwrite old preprocessing with the name you assign to the file. After generation, you can modify your preprocessing file in /Rootpath/NETS/Data/Presteps.py for custom specifications.

Create a training architecture:

     Configure the networks, losses and optimizer you want to use in /FetalGAN/NETS/Creator/Network.py. 
     
     Look at current available networks, losses and optimizers and integrate your own creations in the file Benchmark.py in folder /FetalGAN/NETS/Options/. The file designed to add your own creations must follow the specified class structure and API conventions.

Start your trainings:

      You must first change the variable path_selector inside /FetalGAN/NETS/train.py with the path of Network.json from the SELECTOR folder.

      In Network.json you can define different parameters of the training like training name, GPU used, epochs (definition of epoch is when the training has seen all the images one time, it means that the end of epoch is the completion of a full pass through the dataset), batch size, optimizer settings, and advanced options.

      When you have finished configuring your network, go to /FetalGAN/Scripts/ and run:
      ./Trainer.sh

Run inference:

       You must first change the variable path_inference inside /FetalGAN/NETS/infer.py with the path of Inference.json from the SELECTOR folder. 

       Define the variables of inference.json with your own paths and parameters.

       Go to /FetalGAN/Scripts and run:
       ./Inference.sh

Technologies Used

  • Python
  • PyTorch
  • Numpy, Scikit-learn
  • MONAI

Contributing

Contributions and suggestions are welcome! Please fork the project, create a feature branch, and open a pull request.

Author

Developed by Pedro Pablo Alarcón Gil with the supervision of [Alena Uus], [Lucilio Cordero Grande] and [María Jesús Ledesma Carbayo] as part of Phd studies.

License

This project is licensed under the Apache License 2.0.
See the LICENSE file for details.

Contact

For questions, suggestions, or collaborations, please reach out through GitHub or email listed in your profile.


FetalGAN: Interface for train and inference different architectures for supervised segmentation in medical imaging. rent architectures for supervised segmentation in medical imaging.*

About

Framework developed for training and inference in motion correction of fetal MRI stack developed by Pedro Alarcón GIl as part of Phd traineeship in KCL with the supervision of Alena Uus, Lucilio Cordero-Grande and Maria Jesus Ledesma-Carbayo

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published