Skip to content

Commit 20b683c

Browse files
Oge MarquesOge Marques
authored andcommitted
First version
1 parent 9d64712 commit 20b683c

File tree

31 files changed

+64
-1
lines changed

31 files changed

+64
-1
lines changed

.DS_Store

8 KB
Binary file not shown.

README.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,33 @@
1-
# xai-matlab
1+
# Explainable AI for Medical Images
2+
This repository shows an example of how to use MATLAB to produce post-hoc explanations (using [Grad-CAM](https://www.mathworks.com/help/deeplearning/ref/gradcam.html) and [image LIME](https://www.mathworks.com/help/deeplearning/ref/imagelime.html)) for a medical image classification task.
3+
4+
Both methods (`gradCAM` and `imageLIME`) are available as part of the MATLAB Deep Learning toolbox and require only a single line of code to be applied to results of predictions made by a deep neural network (plus a few lines of code to display the results as a colormap overlaid on the actual images).
5+
6+
| ![](figures/pa_lateral_gradCAM.png) |
7+
|:--:|
8+
| Example of `gradCAM` results.|
9+
10+
| ![](figures/pa_lateral_lime.png) |
11+
|:--:|
12+
| Example of `imageLIME` results.|
13+
## Experiment objective
14+
Given a chest x-ray (CXR), our solution should classify it into Posteroanterior (PA) or Lateral (L) view.
15+
### Dataset
16+
A small subset of the [PadChest](https://bimcv.cipf.es/bimcv-projects/padchest/) dataset<sup>[1](#myfootnote1)</sup>.
17+
## Requirements
18+
- [X] [MATLAB 2020a](https://www.mathworks.com/products/matlab.html) or later
19+
- [X] [Deep Learning Toolbox](https://www.mathworks.com/products/deep-learning.html)
20+
- [X] [Deep Learning Toolbox™ Model for SqueezeNet Network support package](https://www.mathworks.com/help/deeplearning/ref/squeezenet.html)
21+
- [ ] [Parallel Computing Toolbox](https://www.mathworks.com/products/parallel-computing.html) (only required for training using a GPU)
22+
## Suggested steps
23+
1. Download or clone the repository.
24+
2. Open MATLAB.
25+
3. Edit the contents of the `dataFolder` variable in the `xai_medical.mlx` file to reflect the path to your selected dataset.
26+
4. Run the `xai_medical.mlx` script and inspect results.
27+
## Additional remarks
28+
29+
- You are encouraged to expand and adapt the example to your needs.
30+
- The choice of pretrained network and hyperparameters (learning rate, mini-batch size, number of epochs, etc.) is merely illustrative.
31+
- You are encouraged to (use Experiment Manager app to) tweak those choices and find a better solution.
32+
## Notes
33+
<a name="myfootnote1">[1]</a> This example uses a small subset of images to make it easier to get started without having to worry about large downloads and long training times.

figures/.DS_Store

6 KB
Binary file not shown.

figures/pa_lateral_gradCAM.png

75 KB
Loading

figures/pa_lateral_lime.png

78.6 KB
Loading

sample_rgb/.DS_Store

6 KB
Binary file not shown.

sample_rgb/lateral/.DS_Store

6 KB
Binary file not shown.
6.15 MB
Loading
4.41 MB
Loading
6.32 MB
Loading

0 commit comments

Comments
 (0)