December 19, 2019

654 words 4 mins read



Many studies have shown that the performance on deep learning is significantly affected by volume of training data. The MedicalNet project provides a series of 3D-ResNet pre-trained models and relative code.

repo name Tencent/MedicalNet
repo link
language Python
size (curr.) 48776 kB
stars (curr.) 797
created 2019-07-17
license Other


This repository contains a Pytorch implementation of Med3D: Transfer Learning for 3D Medical Image Analysis. Many studies have shown that the performance on deep learning is significantly affected by volume of training data. The MedicalNet project aggregated the dataset with diverse modalities, target organs, and pathologies to to build relatively large datasets. Based on this dataset, a series of 3D-ResNet pre-trained models and corresponding transfer-learning training code are provided.


MedicalNet is released under the MIT License (refer to the LICENSE file for detailso).

Citing MedicalNet

If you use this code or pre-trained models, please cite the following:

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


We uploaded 4 pre-trained models based on more datasets (23 datasets).

Model name             : parameters settings
resnet_10_23dataset.pth: --model resnet --model_depth 10 --resnet_shortcut B
resnet_18_23dataset.pth: --model resnet --model_depth 18 --resnet_shortcut A
resnet_34_23dataset.pth: --model resnet --model_depth 34 --resnet_shortcut A
resnet_50_23dataset.pth: --model resnet --model_depth 50 --resnet_shortcut B

We transferred the above pre-trained models to the multi-class segmentation task (left lung, right lung and background) on Visceral dataset. The results are as follows:


  1. Requirements
  2. Installation
  3. Demo
  4. Experiments
  5. TODO
  6. Acknowledgement


  • Python 3.7.0
  • PyTorch-0.4.1
  • CUDA Version 9.0
  • CUDNN 7.0.5


  • Install Python 3.7.0
  • pip install -r requirements.txt


  • Structure of data directories
MedicalNet is used to transfer the pre-trained model to other datasets (here the MRBrainS18 dataset is used as an example).
    |--datasets/:Data preprocessing module
    |   | data preprocessing script
    |	|--models/:Model construction module
    |   | network build script
    |   | script
    |--toy_data/:For CI test
    |--data/:Data storage module
    |   |--MRBrainS18/:MRBrainS18 dataset
    |	|   |--images/:source image named with patient ID
    |	|   |--labels/:mask named with patient ID
    |   |--train.txt: training data lists
    |   |--val.txt: validation data lists
    |--pretrain/:Pre-trained models storage module
    | Network processing script
    | Parameter setting script
    | MRBrainS18 training demo script
    | MRBrainS18 testing demo script
    |--requirement.txt: Dependent library list
  • Network structure parameter settings
Model name   : parameters settings
resnet_10.pth: --model resnet --model_depth 10 --resnet_shortcut B
resnet_18.pth: --model resnet --model_depth 18 --resnet_shortcut A
resnet_34.pth: --model resnet --model_depth 34 --resnet_shortcut A
resnet_50.pth: --model resnet --model_depth 50 --resnet_shortcut B
resnet_101.pth: --model resnet --model_depth 101 --resnet_shortcut B
resnet_152.pth: --model resnet --model_depth 152 --resnet_shortcut B
resnet_200.pth: --model resnet --model_depth 200 --resnet_shortcut B
  • After successfully completing basic installation, you’ll be ready to run the demo.
  1. Clone the MedicalNet repository
git clone
  1. Download data & pre-trained models (Google Drive or Tencent Weiyun)

    Unzip and move files

mv MedicalNet/.
cd MedicalNet
  1. Run the training code (e.g. 3D-ResNet-50)
python --gpu_id 0 1    # multi-gpu training on gpu 0,1
python --gpu_id 0    # single-gpu training on gpu 0
  1. Run the testing code (e.g. 3D-ResNet-50)
python --gpu_id 0 --resume_path trails/models/resnet_50_epoch_110_batch_0.pth.tar --img_list data/val.txt


  • Computational Cost
  • Performance
Visualization of the segmentation results of our approach vs. the comparison ones after the same training epochs. 
It has demonstrated that the efficiency for training convergence and accuracy based on our MedicalNet pre-trained models.
Results of transfer MedicalNet pre-trained models to lung segmentation (LungSeg) and pulmonary nodule classification (NoduleCls) with Dice and accuracy evaluation metrics, respectively.


  • 3D-ResNet series pre-trained models
  • Transfer learning training code
  • Training with multi-gpu
  • 3D efficient pre-trained models(e.g., 3D-MobileNet, 3D-ShuffleNet)
  • 2D medical pre-trained models
  • Pre-trained MedicalNet models based on more medical dataset


We thank 3D-ResNets-PyTorch and MRBrainS18 which we build MedicalNet refer to this releasing code and the dataset.


If you want to contribute to MedicalNet, be sure to review the contribution guidelines

comments powered by Disqus