MATLAB code for training a CNN using transfer learning for radiographic hip osteoarthritic features extraction
This code takes two classes (default) to train a pretained CNN Resnet18 (default) to extract radiogrpahic features of hip osteorathritis.
(c) Robel Gebre. University of Oulu
2021
Step 1: Set the path for datasets and import as imageDatastores
Step 2: Specify the CNN (MATLAB will requesat a download if it doesn't exist)
Step 3: Freeze the top layers (optinal)
Step 4: Peform minor data augmentations randomly in the imageDatastores
Step 5: Speficy the training options (minibatch size, initial learning rate, optimizer)
There is an option to stop the training if accuracy doesn't improve by setting stop training function in the training options from "inf" to a finite number of iterations.
Step 6: Train the network
Step 7: Run code to end to see results
Training, validation and test set accuracies, confusion matrices, and occulusive sensitivity feature maps.