Training Deep Neural Networks using a low-code app in MATLAB
Training Deep Neural Networks using a low-code app in MATLAB
This repository shows an example of how to use MATLAB and the Deep Network Designer app to build deep learning solutions to two different problems:
- Diabetes prediction
- Medical image classification.
Part 1: Diabetes prediction
Problem
Given (tabular) anonymized health data about the incidence of a diabetes in a given population, design a binary classifier to predict whether an individual with certain health indicators is likely to develop diabetes or not.
Dataset
We will use the Kaggle's version of the Pima Indians diabetes database.
The dataset consists of several medical predictor variables (such as age, BMI, insulin level, and number of pregnancies) and one target variable, Outcome
.
See https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7270283/ for an example of a recent scientific article using this dataset.
Solution
We build a fully connected feedforward neural network from scratch using the Deep Network Designer app and test the resulting model to determine its accuracy.
Part 2: Medical image modality classification
Problem
Given a collection of medical images from 6 different modalities, design a multiclass classifier to label a previously unseen image according to the category (modality) to which it should belong.
Dataset
The MedNIST dataset was created for educational purposes and contains medical images gathered from several sets from TCIA, the RSNA Bone Age Challenge, and the NIH Chest X-ray dataset. The name MedNIST was inspired by the popular MNIST dataset, which has been called "the 'Hello World' of deep learning." The main difference is that, instead of containing images of handwritten digits, MedNIST contains medical images.
There are 6 folders in the dataset: Hand, AbdomenCT, CXR, ChestCT, BreastMRI, HeadCT, whose names should be used as the labels to train our classification model.
The dataset is kindly made available by Dr. Bradley J. Erickson M.D., Ph.D. (Department of Radiology, Mayo Clinic) under the Creative Commons CC BY-SA 4.0 license. If you use the MedNIST dataset, please acknowledge the source.
Solution
In this part we build an image classifier starting from a pre-trained (on ImageNet) CNN under the transfer learning paradigm. Once again, we use the Deep Network Designer app to build our solution by following these steps:
- Open the Deep Network Designer app and choose a pretrained network.
- Import the new data set.
- Replace the final layers with new layers adapted to the new data set.
- Set learning rates so that learning is faster in the new layers than in the transferred layers.
- Train the network using Deep Network Designer, or export the network for training at the command line.
Requirements
- MATLAB 2021a or later
- Deep Learning Toolbox
- Parallel Computing Toolbox (only required for training using a GPU)
Suggested steps
- Download or clone the repository.
- Download the MedNIST dataset using this link.
Once you open the file and expand it, it should produce a folder structure where each folder is named with the image category.
MedNIST folder structure. |
- Open MATLAB.
- Run the
design_nn_matlab.mlx
script and inspect results.
Additional remarks
- You are encouraged to expand and adapt the example to your needs.
- The choice of network architecture for Part 1 and pretrained model for Part 2 is merely illustrative, and so are the choice of hyperparameters (learning rate, mini-batch size, number of epochs, etc.). You are encouraged to (use Experiment Manager to) tweak those choices and find a better solution 1.
Notes
[1] See this for ideas and example code for using MATLAB Experiment Manager.
Cita come
Oge Marques (2024). Training Deep Neural Networks using a low-code app in MATLAB (https://github.com/ogemarques/deep-network-designer-matlab/releases/tag/v1.0), GitHub. Recuperato .
Compatibilità della release di MATLAB
Compatibilità della piattaforma
Windows macOS LinuxTag
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Scopri Live Editor
Crea script con codice, output e testo formattato in un unico documento eseguibile.
Versione | Pubblicato | Note della release | |
---|---|---|---|
1.0 |