Coder Social home page Coder Social logo

zeigar / acenet-for-neuroanatomy-segmentation Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ymli39/acenet-for-neuroanatomy-segmentation

0.0 1.0 0.0 341.79 MB

ACEnet: Anatomical Context-Encoding Network for Neuroanatomy Segmentation

License: MIT License

Python 100.00%

acenet-for-neuroanatomy-segmentation's Introduction

ACEnet-for-Neuroanatomy-Segmentation

ACEnet: Anatomical Context-Encoding Network for Neuroanatomy Segmentation


Preprocessing

Data can be found at 2012 MALC MICCAI challenge website.

  1. Use Freesurfer to preprocess data into 256x256x256 along with the brainmask generated.
  2. convert data and brainmasks to numpy, refer to ./data_utils/utils.py function remaplabels() to generate corresponding labels.

The file should follow the directory:

|-->Project
    |-->resampled
       |-->training-imagesnpy (1000_3.npy and 1000_3_brainmask.npy)
       |-->training-labels-remapnpy (1000_3_glm.npy --labels for coarse segmentation)
       |-->training-labels139 (1000_3_glm.npy --labels for fine-grained segmentation)
       |-->testing-imagesnpy (1003_3.npy and 1000_3_brainmask.npy)
       |-->testing-labels-remapnpy (1003_3_glm.npy --labels for coarse segmentation)
       |-->testing-labels139 (1003_3_glm.npy --labels for fine-grained segmentation)
    |-->segmentation
       |-->all git files

Installation:

git clone https://github.com/ymli39/ACEnet-for-Neuroanatomy-Segmentation
cd ACEnet-for-Neuroanatomy-Segmentation
pip install nibabel tqdm

Training

Parameter could be tuned at the beginning of the running files: train.py, test_coarse.py, test_fine.py.

You need to modify the folowing subjects for training and testing:

RESUME_PATH: directory to resume the model
SAVE_DIR: directory to save the model
NUM_CLASS: label classes +1 (background)
TWO_STAGES: use two stage training
RESUME_PRETRAIN: set False if want to train from epoch 0, True to resume the pretrained epoch

DATA_DIR = '../resampled/'
DATA_LIST = './datasets/'

-b-train: For NVIDIA TITAN XP GPU with 12 GB memory, use batch size of 4. 
-b-test: use 2, must be bigger than 1.
-num-slices: slice thickness used for Spatial Encoding Module, use 3 for coase-grained segmentation and 7 for for-grained segmentation.
--lr-scheduler: used poly
--lr: for train from scratch, use 0.01 and 0.02 for coarse and fine-grained respecitvely, for pretrain, use 0.001 and 0.005 for coarse and fine-grained respecitvely.

For start a new training, use:

CUDA_VISIBLE_DEVICES=0 python train.py --resume-pretrain False

For load the data augmented pretrain model, use:

CUDA_VISIBLE_DEVICES=0 python train.py --resume-pretrain True

For running the test, use:

CUDA_VISIBLE_DEVICES=0 python test_(coarse/fine).py

Testing

I have updated a test_demo folder for people to use, this folder contains the models trained on 30 MALC 2012 dataset in both coarse-grained and fine-grained segmentations.

You could chose any MRI images to generate corresponding segmentation labels. This model takes the input of a MRI brain images and output the setgmentation mask and skull mask.

The testing run script is referred in file "runscript.txt"


Reference

Please refer to the paper for more implementation details:

@article{li2021acenet,
  title={ACEnet: Anatomical Context-Encoding Network for Neuroanatomy Segmentation},
  author={Li, Yuemeng and Li, Hongming and Fan, Yong},
  journal={Medical Image Analysis},
  pages={101991},
  year={2021},
  publisher={Elsevier}
}

acenet-for-neuroanatomy-segmentation's People

Contributors

ymli39 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.