Our implementation used for the MICCAI 2021 FLARE Challenge titled 'Efficient Multi-Organ Segmentation Using SpatialConfiguartion-Net with Low GPU Memory Requirements'.

Overview

Efficient Multi-Organ Segmentation Using SpatialConfiguartion-Net with Low GPU Memory Requirements

Our implementation used for the MICCAI 2021 FLARE Challenge titled Efficient Multi-Organ Segmentation Using SpatialConfiguartion-Net with Low GPU Memory Requirements.

You need to have the MedicalDataAugmentationTool framework by Christian Payer downloaded and in your PYTHONPATH for the scripts to work.

If you have questions about the code, write me a mail.

Dependencies

The following frameworks/libraries were used in the version as stated. If you run into problems with the libraries, please verify that you have the same version installed.

  • Python 3.9
  • TensorFlow 2.6
  • SimpleITK 2.0
  • Numpy 1.20

Dataset and Preprocessing

The dataset as well as a detailed description of it can be found on the challenge website. Follow the steps described there to download the data.

Define the base_dataset_folder containing the downloaded TrainingImg, TrainingMask and ValidationImg in the script preprocessing/preprocessing.py and execute it to generate TrainingImg_small and TrainingMask_small.

Also, download the setup folder provided in this repository and place it in the base_dataset_folder, the following structure is expected:

.                                       # The `base_dataset_folder` of the dataset
├── TrainingImg                         # Image folder containing all training images
│   ├── train_000_0000.nii.gz            
│   ├── ...                   
│   └── train_360_0000.nii.gz            
├── TrainingMask                        # Image folder containing all training masks
│   ├── train_000.nii.gz            
│   ├── ...                   
│   └── train_360.nii.gz  
├── ValidationImg                       # Image folder containing all validation images
│   ├── validation_000_0000.nii.gz            
│   ├── ...                   
│   └── validation_360_0000.nii.gz  
├── TrainingImg_small                   # Image folder containing all downsampled training images generated by `preprocessing/preprocessing.py`
│   ├── train_000_0000.nii.gz            
│   ├── ...                   
│   └── train_360_0000.nii.gz  
├── TrainingMask_small                  # Image folder containing all downsampled training masks generated by `preprocessing/preprocessing.py`
│   ├── train_000_0000.nii.gz            
│   ├── ...                   
│   └── train_360_0000.nii.gz  
└── setup                               # Setup folder as provided in this repository

Train Models

To train a localization model, run localization/main.py after defining the base_dataset_folder as well as the base_output_folder.

To train a segmentation model, run scn/main.py. Again, base_dataset_folder and base_output_folder need to be set accordingly beforehand.

In both cases in function run(), the variable cv can be set to 0, 1, 2, 3 or 4. The values 1-4 represent the respective cross-validation fold. When choosing 0, all training data is used to train the model, which also deactivates the generation of test outputs.

Further parameters like the number of training iterations (max_iter) and the number of iterations after which to perfrom testing (test_iter) can be modified in __init__() of the MainLoop class.

Generate a SavedModel

To convert a trained network to a SavedModel, the script localization/main_create_model.py respectively scn/main_create_model.py can be used after a model was trained.

Before running the respective script, the variable load_model_base needs to be set to the trained models output folder, e.g., .../localization/cv1/2021-09-27_13-18-59.

Furthermore, load_model_iter should be set to the same value as max_iter used during training the model. The value needs to be set to an iteration for which the network weights have been generated.

Generate tf_utils_module

The script inference/inference_tf_utils_module.py can be used to trace and save the tf.functions used for preprocessing during inference into a SavedModel and generate saved_models/tf_utils_module.

To do so, the input_path and output_path need to be defined in the script. The input_path is expected to contain valid images, we suggest to use the folder ValidationImg.

Inference

The provided inference script can be used to evaluate the performance of our method on unseen data efficiently.

The script inference/inference.py requires that all SavedModels are present in the saved_models folder, i.e., saved_models/localization, saved_models/segmentation and saved_models/tf_utils_module need to contain the respective SavedModel. Either, use the provided SavedModels for inference by copying them from submitted_saved_models to saved_models, or use your own models generated as described above.

Additionally, the input_path and output_path need to be defined in the script. The input_path is expected to contain valid images, we suggest to use the folder ValidationImg.

.                                       # The base folder of this repository.
├── saved_models                        # Required by `inference.py`.
│   ├── localization                    # SavedModel of the localization model.
│   │   ├── assets
│   │   ├── variables
│   │   └── saved_model.pb
│   ├── segmentation                    # SavedModel of the segmentation (scn) model.
│   │   ├── assets
│   │   ├── variables
│   │   └── saved_model.pb
│   └── tf_utils_module                 # SavedModel of the tf.functions used for preprocessing during inference.
│       ├── assets
│       ├── variables
│       └── saved_model.pb
...

Docker

The provided Dockerfile can be used to generate a docker image which can readily be used for inference. The SavedModels are expected in the folder saved_models, either copy the provided SavedModels from submitted_saved_models to saved_models or generate your own. If you have a problem with setting up docker, please refer to the documentation.

To build a docker model, run the following command in the folder containing the Dockerfile.

docker build -t icg .

To run your built docker, use the command below, after defining the input and output directories within the command. We recommend to use ValidationImg as input folder.

If you have multiple GPUs and want to select a specific one to run the docker image, modify /dev/nvidia0 to the respective GPUs identifier, e.g., /dev/nvidia1.

docker container run --gpus all --device /dev/nvidia0 --device /dev/nvidia-uvm --device /dev/nvidia-uvm-tools --device /dev/nvidiactl --name icg --rm -v /PATH/TO/DATASET/ValidationImg/:/workspace/inputs/ -v /PATH/TO/OUTPUT/FOLDER/:/workspace/outputs/ icg:latest /bin/bash -c "sh predict.sh" 

Citation

If you use this code for your research, please cite our paper.

Efficient Multi-Organ Segmentation Using SpatialConfiguartion-Net with Low GPU Memory Requirements

@article{Thaler2021Efficient,
  title={Efficient Multi-Organ Segmentation Using SpatialConfiguartion-Net with Low GPU Memory Requirements},
  author={Thaler, Franz and Payer, Christian and Bischof, Horst and {\v{S}}tern, Darko},
  year={2021}
}
Owner
Franz Thaler
Franz Thaler
Project page for our ICCV 2021 paper "The Way to my Heart is through Contrastive Learning"

The Way to my Heart is through Contrastive Learning: Remote Photoplethysmography from Unlabelled Video This is the official project page of our ICCV 2

36 Jan 06, 2023
[ECCV2020] Content-Consistent Matching for Domain Adaptive Semantic Segmentation

[ECCV20] Content-Consistent Matching for Domain Adaptive Semantic Segmentation This is a PyTorch implementation of CCM. News: GTA-4K list is available

Guangrui Li 88 Aug 25, 2022
A Rao-Blackwellized Particle Filter for 6D Object Pose Tracking

PoseRBPF: A Rao-Blackwellized Particle Filter for 6D Object Pose Tracking PoseRBPF Paper Self-supervision Paper Pose Estimation Video Robot Manipulati

NVIDIA Research Projects 107 Dec 25, 2022
Hierarchical Aggregation for 3D Instance Segmentation (ICCV 2021)

HAIS Hierarchical Aggregation for 3D Instance Segmentation (ICCV 2021) by Shaoyu Chen, Jiemin Fang, Qian Zhang, Wenyu Liu, Xinggang Wang*. (*) Corresp

Hust Visual Learning Team 145 Jan 05, 2023
Code for KDD'20 "Generative Pre-Training of Graph Neural Networks"

GPT-GNN: Generative Pre-Training of Graph Neural Networks GPT-GNN is a pre-training framework to initialize GNNs by generative pre-training. It can be

Ziniu Hu 346 Dec 19, 2022
End-to-end Temporal Action Detection with Transformer. [Under review]

TadTR: End-to-end Temporal Action Detection with Transformer By Xiaolong Liu, Qimeng Wang, Yao Hu, Xu Tang, Song Bai, Xiang Bai. This repo holds the c

Xiaolong Liu 105 Dec 25, 2022
Code for Towards Streaming Perception (ECCV 2020) :car:

sAP — Code for Towards Streaming Perception ECCV Best Paper Honorable Mention Award Feb 2021: Announcing the Streaming Perception Challenge (CVPR 2021

Martin Li 85 Dec 22, 2022
Source code of our BMVC 2021 paper: AniFormer: Data-driven 3D Animation with Transformer

AniFormer This is the PyTorch implementation of our BMVC 2021 paper AniFormer: Data-driven 3D Animation with Transformer. Haoyu Chen, Hao Tang, Nicu S

24 Nov 02, 2022
A certifiable defense against adversarial examples by training neural networks to be provably robust

DiffAI v3 DiffAI is a system for training neural networks to be provably robust and for proving that they are robust. The system was developed for the

SRI Lab, ETH Zurich 202 Dec 13, 2022
House_prices_kaggle - Predict sales prices and practice feature engineering, RFs, and gradient boosting

House Prices - Advanced Regression Techniques Predicting House Prices with Machine Learning This project is build to enhance my knowledge about machin

Gurpreet Singh 1 Jan 01, 2022
TDN: Temporal Difference Networks for Efficient Action Recognition

TDN: Temporal Difference Networks for Efficient Action Recognition Overview We release the PyTorch code of the TDN(Temporal Difference Networks).

Multimedia Computing Group, Nanjing University 326 Dec 13, 2022
links and status of cool gradio demos

awesome-demos This is a list of some wonderful demos & applications built with Gradio. Here's how to contribute yours! 🖊️ Natural language processing

Gradio 96 Dec 30, 2022
Used to record WKU's utility bills on a regular basis.

WKU水电费小助手 一个用于定期记录WKU水电费的脚本 Looking for English Readme? 背景 由于WKU校园内的水电账单系统时常存在扣费延迟的现象,而补扣的费用缺乏令人信服的证明。不少学生为费用摸不着头脑,但也没有申诉的依据。为了更好地掌握水电费使用情况,留下一手证据,我开源

2 Jul 21, 2022
Experiments for distributed optimization algorithms

Network-Distributed Algorithm Experiments -- This repository contains a set of optimization algorithms and objective functions, and all code needed to

Boyue Li 40 Dec 04, 2022
Implementation for paper LadderNet: Multi-path networks based on U-Net for medical image segmentation

Implementation for paper LadderNet: Multi-path networks based on U-Net for medical image segmentation This implementation is based on orobix implement

Juntang Zhuang 116 Sep 06, 2022
Code release for "COTR: Correspondence Transformer for Matching Across Images"

COTR: Correspondence Transformer for Matching Across Images This repository contains the inference code for COTR. We plan to release the training code

UBC Computer Vision Group 360 Jan 06, 2023
🔥🔥High-Performance Face Recognition Library on PaddlePaddle & PyTorch🔥🔥

face.evoLVe: High-Performance Face Recognition Library based on PaddlePaddle & PyTorch Evolve to be more comprehensive, effective and efficient for fa

Zhao Jian 3.1k Jan 02, 2023
Reproduces ResNet-V3 with pytorch

ResNeXt.pytorch Reproduces ResNet-V3 (Aggregated Residual Transformations for Deep Neural Networks) with pytorch. Tried on pytorch 1.6 Trains on Cifar

Pau Rodriguez 481 Dec 23, 2022
Python scripts for performing object detection with the 1000 labels of the ImageNet dataset in ONNX.

Python scripts for performing object detection with the 1000 labels of the ImageNet dataset in ONNX. The repository combines a class agnostic object localizer to first detect the objects in the image

Ibai Gorordo 24 Nov 14, 2022
Code for ACL2021 long paper: Knowledgeable or Educated Guess? Revisiting Language Models as Knowledge Bases

LANKA This is the source code for paper: Knowledgeable or Educated Guess? Revisiting Language Models as Knowledge Bases (ACL 2021, long paper) Referen

Boxi Cao 30 Oct 24, 2022