Code Monkey home page Code Monkey logo

brain_mri_medicalnet_classification's Introduction

Fine-tuning a medical-wise CNN for brain MRIs classification.

Author: alexcla99
Version: 1.0.0

Folder content:

+--- data/                              # The folder containing brain MRIs
|
+-+- models/                            # The folder containing models
| +--- resnet.py                        # The base model builder
| +--- resnet_10.pth                    # The pretrained Resnet model with 10 layers
| +--- resnet_18.pth                    # The pretrained Resnet model with 18 layers
| +--- resnet_34.pth                    # The pretrained Resnet model with 34 layers
| +--- resnet_50.pth                    # The pretrained Resnet model with 50 layers
| +--- resnet_101.pth                   # The pretrained Resnet model with 101 layers
| +--- resnet_152.pth                   # The pretrained Resnet model with 152 layers
| +--- resnet_200.pth                   # The pretrained Resnet model with 200 layers
|
+--- results/                           # The folder containing both train and test results
+--- __init__.py                        # An empty file to make this directory being a Python library
+--- dataset.py                         # The dataset loader
+--- model.py                           # The fine-tuned model builder
+--- preprocess_to_numpy.py             # A script to preprocess the dataset and store it into numpy files
+--- README.md                          # This file
+--- requirements.txt                   # The Python libraries to be installed in order to run the project
+--- settings.json                      # The settings of the model and the train phase
+--- test.py                            # A script to test the fine-tuned model performances
+--- train.py                           # A script to train the fine-tuned model
+--- utils.py                           # Some utils

Usage:

This library has been implemented and used with Python>=3.8.0

Requirements:

pip3 install -r requirements

Preprocess data:

python3 preprocess_to_numpy.py

Data are loaded from both "coma" and "control" subdirectories (from "data") in order to get stored in numpy files.

Fine-tune the model:

python3 train.py python3 train.py resnet_<layers:int> <debug:bool>
# Example: python3 train.py resnet_50 False

Data to be used are selected from the "data" folder and results are saved in the "results" folder.

Available networks: See the models folder.

Note: both resnet_18 and resnet_34 pretrained models have not been tested in this project because of missing values in their state dictionnary (for classification task). Resnet_10, resnet_101, resnet_152 and resnet_200 have been fine-tuned and tested.

Test the model:

python3 test.py resnet_<layers:int> <debug:bool>
# Example: python3 test.py resnet_101 False

Note: the layers specified should match the subdirectory results/r<layers> such as "results/r101" if you selected the 'resnet_101' model. Data to be used are selected from the "data" folder and results are saved in the "results" folder.

Many thanks to:

@article{
    chen2019med3d,
    title={Med3D: Transfer Learning for 3D Medical Image Analysis},
    author={Chen, Sihong and Ma, Kai and Zheng, Yefeng},
    journal={arXiv preprint arXiv:1904.00625},
    year={2019}
}

License: MIT.

brain_mri_medicalnet_classification's People

Contributors

alexcla99 avatar

Stargazers

zzz avatar  avatar 马向辉 avatar luzz avatar  avatar  avatar  avatar  avatar Leilei avatar  avatar ZZ avatar  avatar  avatar  avatar Wind&Moon avatar  avatar  avatar

Watchers

 avatar

brain_mri_medicalnet_classification's Issues

data

May I ask which dataset is in the "data"?

May i ask a Qa?

Would you please tell The Pertrain weight come form which Datasets?

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.