|
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 | +|  | |
| 7 | +|:--:| |
| 8 | +| Example of `gradCAM` results.| |
| 9 | + |
| 10 | +|  | |
| 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. |
0 commit comments