All Projects → nyukat → Breast_density_classifier

nyukat / Breast_density_classifier

Licence: bsd-2-clause
Breast density classification with deep convolutional neural networks

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Breast density classifier

Pyannote Audio
Neural building blocks for speaker diarization: speech activity detection, speaker change detection, overlapped speech detection, speaker embedding
Stars: ✭ 978 (+613.87%)
Mutual labels:  pretrained-models
Nfnets pytorch
Pre-trained NFNets with 99% of the accuracy of the official paper "High-Performance Large-Scale Image Recognition Without Normalization".
Stars: ✭ 85 (-37.96%)
Mutual labels:  pretrained-models
Mff Pytorch
Motion Fused Frames implementation in PyTorch, codes and pretrained models.
Stars: ✭ 116 (-15.33%)
Mutual labels:  pretrained-models
Gpt2 Ml
GPT2 for Multiple Languages, including pretrained models. GPT2 多语言支持, 15亿参数中文预训练模型
Stars: ✭ 1,066 (+678.1%)
Mutual labels:  pretrained-models
Dialogue Understanding
This repository contains PyTorch implementation for the baseline models from the paper Utterance-level Dialogue Understanding: An Empirical Study
Stars: ✭ 77 (-43.8%)
Mutual labels:  pretrained-models
Covid Twitter Bert
Pretrained BERT model for analysing COVID-19 Twitter data
Stars: ✭ 101 (-26.28%)
Mutual labels:  pretrained-models
Classification models
Classification models trained on ImageNet. Keras.
Stars: ✭ 938 (+584.67%)
Mutual labels:  pretrained-models
Electra
中文 预训练 ELECTRA 模型: 基于对抗学习 pretrain Chinese Model
Stars: ✭ 132 (-3.65%)
Mutual labels:  pretrained-models
Gen Efficientnet Pytorch
Pretrained EfficientNet, EfficientNet-Lite, MixNet, MobileNetV3 / V2, MNASNet A1 and B1, FBNet, Single-Path NAS
Stars: ✭ 1,275 (+830.66%)
Mutual labels:  pretrained-models
Transformers
🤗 Transformers: State-of-the-art Machine Learning for Pytorch, TensorFlow, and JAX.
Stars: ✭ 55,742 (+40587.59%)
Mutual labels:  pretrained-models
Pytorch Image Models
PyTorch image models, scripts, pretrained weights -- ResNet, ResNeXT, EfficientNet, EfficientNetV2, NFNet, Vision Transformer, MixNet, MobileNet-V3/V2, RegNet, DPN, CSPNet, and more
Stars: ✭ 15,232 (+11018.25%)
Mutual labels:  pretrained-models
Farm
🏡 Fast & easy transfer learning for NLP. Harvesting language models for the industry. Focus on Question Answering.
Stars: ✭ 1,140 (+732.12%)
Mutual labels:  pretrained-models
Ghostnet
CV backbones including GhostNet, TinyNet and TNT, developed by Huawei Noah's Ark Lab.
Stars: ✭ 1,744 (+1172.99%)
Mutual labels:  pretrained-models
Cv Pretrained Model
A collection of computer vision pre-trained models.
Stars: ✭ 995 (+626.28%)
Mutual labels:  pretrained-models
Mdm
A TensorFlow implementation of the Mnemonic Descent Method.
Stars: ✭ 120 (-12.41%)
Mutual labels:  pretrained-models
Asteroid
The PyTorch-based audio source separation toolkit for researchers
Stars: ✭ 862 (+529.2%)
Mutual labels:  pretrained-models
Hbonet
[ICCV 2019] Harmonious Bottleneck on Two Orthogonal Dimensions
Stars: ✭ 94 (-31.39%)
Mutual labels:  pretrained-models
Imagenet
Pytorch Imagenet Models Example + Transfer Learning (and fine-tuning)
Stars: ✭ 134 (-2.19%)
Mutual labels:  pretrained-models
Pretrained
Pretrained is the most complete and frequently updated list of pretrained top-performing models. Tensorflow, Theano and others. Want to add your model? File an issue, and we will add it.
Stars: ✭ 129 (-5.84%)
Mutual labels:  pretrained-models
Dimenet
DimeNet and DimeNet++ models, as proposed in "Directional Message Passing for Molecular Graphs" (ICLR 2020) and "Fast and Uncertainty-Aware Directional Message Passing for Non-Equilibrium Molecules" (NeurIPS-W 2020)
Stars: ✭ 106 (-22.63%)
Mutual labels:  pretrained-models

Breast density classification with deep convolutional neural networks

Introduction

This is an implementation of the model used for breast density classification as described in our paper "Breast density classification with deep convolutional neural networks". The implementation allows users to get breast density predictions by applying one of our pretrained models: a histogram-based model or a multi-view CNN. Both models act on screening mammography exams with four standard views. As a part of this repository, we provide a sample exam (in images directory). The models are implemented in both TensorFlow and PyTorch.

Prerequisites

  • Python (3.6)
  • TensorFlow (1.5.0) or PyTorch (0.4.0)
  • NumPy (1.14.3)
  • SciPy (1.0.0)

Data

To use one of the pretrained models, the input is required to consist of four images, one for each view (L-CC, L-MLO, R-CC, R-MLO). Each image has to have the size of 2600x2000 pixels. The images in the provided sample exam were already cropped to the correct size.

How to run the code

Available options can be found at the bottom of the file or density_model_tf.py or density_model_torch.py.

Run the following command to use the model.

# Using TensorFlow
python density_model_tf.py histogram
python density_model_tf.py cnn

# Using PyTorch
python density_model_torch.py histogram
python density_model_torch.py cnn

This loads an included sample of four scan views, feeds them into a pretrained copy of our model, and outputs the predicted probabilities of each breast density classification.

You should get the following outputs for the sample exam provided in the repository.

With histogram:

Density prediction:
        Almost entirely fatty (0):                      0.0819444
    	Scattered areas of fibroglandular density (1):  0.78304
        Heterogeneously dense (2):                      0.133503
    	Extremely dense (3):                            0.00151265

With cnn:

Density prediction:
        Almost entirely fatty (0):                      0.209689
        Scattered areas of fibroglandular density (1):  0.765076
        Heterogeneously dense (2):                      0.024949
        Extremely dense (3):                            0.000285853

The results should be identical for both TensorFlow and PyTorch implementations.

Additional options

Additional flags can be provided to the above script:

  • --model-path: path to a TensorFlow checkpoint or PyTorch pickle of a saved model. By default, this points to the saved model in this repository.
  • --device-type: whether to use a CPU or GPU. By default, the CPU is used.
  • --gpu-number: which GPU is used. By default, GPU 0 is used. (Not used if running with CPU)
  • --image-path: path to saved images. By default, this points to the saved images in this repository.

For example, to run this script using TensorFlow on GPU 2 for the CNN model, run:

python density_model_tf.py cnn --device-type gpu --gpu-number 2

Converting TensorFlow Models

This repository contains pretrained models in both TensorFlow and PyTorch. The model was originally trained in TensorFlow and translated to PyTorch using the following script:

python convert_model.py \
    histogram \
    saved_models/BreastDensity_BaselineHistogramModel/model.ckpt \
    saved_models/BreastDensity_BaselineHistogramModel/model.p

python convert_model.py \
    cnn \
    saved_models/BreastDensity_BaselineBreastModel/model.ckpt \
    saved_models/BreastDensity_BaselineBreastModel/model.p

Tests

Tests can be configured to your environment.

# Using TensorFlow, with GPU support
python test_inference.py --using tf

# Using PyTorch, with GPU support
python test_inference.py --using torch

# Using TensorFlow, with GPU support
python test_inference.py --using tf --with-gpu

# Using PyTorch, with GPU support
python test_inference.py --using torch --with-gpu

Reference

If you found this code useful, please cite our paper:

Breast density classification with deep convolutional neural networks
Nan Wu, Krzysztof J. Geras, Yiqiu Shen, Jingyi Su, S. Gene Kim, Eric Kim, Stacey Wolfson, Linda Moy, Kyunghyun Cho
ICASSP, 2018

@inproceedings{breast_density,
    title = {Breast density classification with deep convolutional neural networks},
    author = {Nan Wu and Krzysztof J. Geras and Yiqiu Shen and Jingyi Su and S. Gene Kim and Eric Kim and Stacey Wolfson and Linda Moy and Kyunghyun Cho},
    booktitle = {ICASSP},
    year = {2018}
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].