Skip to content

Commit

Permalink
Update README and architecture name to Siamese3D
Browse files Browse the repository at this point in the history
  • Loading branch information
MoraRubio committed Apr 13, 2023
1 parent 5d0129a commit ec5ee54
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 12 deletions.
4 changes: 2 additions & 2 deletions evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from monai.transforms import Compose, MapTransform, EnsureChannelFirstd, \
Resized, ScaleIntensityd, ToTensord

from models.bilinear3D import Bilinear3D
from models.siamese3D import Siamese3D
from monai.networks.nets import ViT, EfficientNetBN, DenseNet

pin_memory = torch.cuda.is_available()
Expand Down Expand Up @@ -72,7 +72,7 @@ def __call__(self, x):

"""# Evaluation"""
weights = f"EfficientNet_2Classes_CN_AD.pth"
#model = Bilinear3D(n_classes=n_classes).to(device)
#model = Siamese3D(n_classes=n_classes).to(device)
#model = DenseNet(spatial_dims=3, in_channels=1, out_channels=n_classes, dropout_prob=0.3).to(device)
model = EfficientNetBN(model_name="efficientnet-b7", pretrained=False, progress=False, \
spatial_dims=3, in_channels=1, num_classes=n_classes).to(device)
Expand Down
6 changes: 3 additions & 3 deletions models/bilinear3D.py → models/siamese3D.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import torch
import torch.nn as nn

class Bilinear3D(nn.Module):
class Siamese3D(nn.Module):
def __init__(self, n_classes):
super(Bilinear3D, self).__init__()
super(Siamese3D, self).__init__()
self.conv3d_5_2 = nn.ModuleList([nn.Conv3d(in_channels=1, out_channels=32, kernel_size=(5,5,5), stride=(2,2,2), padding='valid') for _ in range(2)])
self.conv3d_3_1 = nn.ModuleList([nn.Conv3d(in_channels=32, out_channels=32, kernel_size=(3,3,3), stride=(1,1,1), padding='valid') for _ in range(12)])
self.bn3d = nn.ModuleList([nn.BatchNorm3d(num_features=32) for _ in range(14)])
Expand Down Expand Up @@ -62,7 +62,7 @@ def forward(self, x):
return output

def test():
model = Bilinear3D(n_classes=5)
model = Siamese3D(n_classes=5)
print(model)
input = torch.randn(3, 1, 91, 109, 91)
out = model(input)
Expand Down
26 changes: 22 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Classification of Alzheimer's Disease stages from Magnetic Resonance Images using Deep Learning

## Authors

Alejandro Mora-Rubio<sup>1</sup>, Mario Alejandro Bravo-Ortiz<sup>1</sup>, Sebastián Quiñones-Arredondo<sup>1</sup>, Jose Manuel Saborit-Torres<sup>2</sup>, Gonzalo A. Ruz<sup>3,4,5</sup>, and Reinel Tabares-Soto<sup>1,3,6</sup>

[1] Department of Electronics and Automation, Universidad Autónoma de Manizales, Manizales 170001, Colombia
Expand All @@ -15,14 +16,31 @@ Alejandro Mora-Rubio<sup>1</sup>, Mario Alejandro Bravo-Ortiz<sup>1</sup>, Sebas

[6] University of Caldas, 27985, Department of Systems and Informatics, Manizales, Colombia

## Abstract
## Abstract

Alzheimer's Disease (AD) is a progressive type of dementia characterized by loss of memory and other cognitive abilities, including speech. Since AD is a progressive disease, detection in the early stages is essential for the appropriate care of the patient across all stages, going from asymptomatic to a stage known as Mild Cognitive Impairment (MCI), and then progressing to dementia and severe dementia. Along with cognitive tests, evaluation of the brain morphology is the primary tool for AD diagnosis, where atrophy and loss of volume of the frontotemporal lobe are common features in patients who suffer from the disease. Regarding medical imaging techniques, Magnetic Resonance Imaging (MRI) scans are one of the methods used by specialists to assess brain morphology. Recently, with the rise of Deep Learning (DL) and its successful implementation in medical imaging applications, it is of growing interest in the research community to develop computer-aided diagnosis systems that can help physicians to detect this disease, especially in the early stages where macroscopic changes are not so easily identified. This paper presents a DL-based approach to classifying MRI scans in the different stages of AD, using a curated set of images from Alzheimer's Disease Neuroimaging Initiative (ADNI) and Open Access Series of Imaging Studies (OASIS) databases. Our methodology involves image preprocessing using FreeSurfer, spatial data-augmentation operations, such as rotation, flip, and random zoom during training, and state-of-the-art 3D Convolutional Neural Networks such as EfficientNet, DenseNet, and a custom siamese network. With this approach, the detection percentage of AD vs Control is around 85\%, Early MCI vs Control 67\%, and MCI vs Control 66\%.

## Materials and Methods
The implementation of DL models and training was done using [MONAI](https://docs.monai.io/en/stable) framework, it facilitates the development with the included architectures and preprocessing operations, as well as, allowing the use of custom models such as the [Bilinear](models/bilinear3D.py) used in this work.

The implementation of DL models and training was done using [MONAI](https://docs.monai.io/en/stable) framework, it facilitates the development with the included architectures and preprocessing operations, as well as, allowing the use of custom models such as the [Siamese3D](models/siamese3D.py) used in this work.

The FreeSurfer software was utilized in the study and the command line used for processing the data is provided below:

`Recon-all -s $SUBJECT_NAME -i $INPUT_PATH -sd $PATH_RESULTS -all -cw256 -ba-labels`

The arguments included in the command line are explained as follows:

- `-s $SUBJECT_NAME`: specifies the ID of the different subjects.
- `-i $INPUT_PATH`: denotes the path where the images of the subjects are located.
- `-sd $PATH_RESULTS`: defines the path where the results will be saved.
- `-all`: applies all of the steps available in FreeSurfer.
- `-cw256`: reduces the size of the magnetic resonance imaging (MRI) image by cropping it to 256 pixels, which is done using the `mri_convert` command.
- `-ba-labels`: includes the volumes of the Brodmann areas in the analysis.

## Data
Data from [ADNI](https://adni.loni.usc.edu) and [OASIS](https://www.oasis-brains.org) can be accesed by request in their corresponding websites. The search parameters for ADNI database are presented in the [_IDASearch.pdf_](partition_tables/IDASearch.pdf) file; furthermore, only the 3 Tesla, T1 weighted, sagittal plane images with slice thickness between 1 and 1.5 mm were used. The *tsv* files on the [partition_tables](partition_tables/) folder contain 10 different train, validation and test partitions maintaining a correct distribution of the subjects among the sets.

Data from [ADNI](https://adni.loni.usc.edu) and [OASIS](https://www.oasis-brains.org) can be accesed by request in their corresponding websites. The search parameters for ADNI database are presented in the [_IDASearch.pdf_](partition_tables/IDASearch.pdf) file; furthermore, only the 3 Tesla, T1 weighted, sagittal plane images with slice thickness between 1 and 1.5 mm were used. The _tsv_ files on the [partition_tables](partition_tables/) folder contain 10 different train, validation and test partitions maintaining a correct distribution of the subjects among the sets.

## Environment
Use anaconda and the provided YAML file to replicate the programming environment `conda env create -f pytorch_monai.yml`.

Use anaconda and the provided YAML file to replicate the programming environment `conda env create -f pytorch_monai.yml`.
6 changes: 3 additions & 3 deletions training.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
Resized, ScaleIntensityd, ToTensord, RandFlipd, RandZoomd
from monai.networks.nets import ViT, EfficientNetBN, DenseNet

from models.bilinear3D import Bilinear3D
from models.siamese3D import Siamese3D

pin_memory = torch.cuda.is_available()
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
Expand Down Expand Up @@ -87,7 +87,7 @@ def __call__(self, x):
class_weights = class_weight.compute_class_weight(class_weight='balanced', \
classes=np.unique(df['intLabel'].values), y=df['intLabel'].values)

#model = Bilinear3D(n_classes=n_classes).to(device)
#model = Siamese3D(n_classes=n_classes).to(device)
#model = DenseNet(spatial_dims=3, in_channels=1, out_channels=n_classes, dropout_prob=0.3).to(device)
model = EfficientNetBN(model_name="efficientnet-b7", pretrained=False, progress=False, \
spatial_dims=3, in_channels=1, num_classes=n_classes).to(device)
Expand All @@ -104,7 +104,7 @@ def __call__(self, x):
accuracy_values = []

log_flag = True
#experiment_name = f'Bilinear3D_{n_classes}Classes_CN_MCI_AD'
#experiment_name = f'Siamese3D_{n_classes}Classes_CN_MCI_AD'
#experiment_name = f'DenseNet_{n_classes}Classes_CN_MCI_AD'
experiment_name = f'EfficientNet_{n_classes}Classes_CN_MCI_AD'

Expand Down

0 comments on commit ec5ee54

Please sign in to comment.