Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.

Tabella dei contenuti


NameInstitutionMail AddressSocial Contacts
Camilla Scapicchio

University of Pisa,

INFN Sezione di Pisa

Linkedin: Camilla Scapicchio
Francesca Lizzi

University of Pisa,

INFN Sezione di Pisa

How to Obtain Support

General Information

ML/DL TechnologiesCNN (ResNet)
Science FieldsMedical Physics



Fully annotated and runnable

Software and Tools

Programming LanguagePython
ML Toolset

Keras, Tensorflow

Additional libraries

sklearn, pandas, OpenCv

Suggested EnvironmentsINFN-Cloud VM, bare Linux Node, Google CoLab

Needed datasets

Data TypePreprocessed Mammographic Images
Data SourceExamples of test images on GitHub repository:

Short Description of the Use Case

Deep neural network explainability is a critical issue in Artificial Intelligence (AI). In this use case, we develop a method to explain a deep Residual Convolutional Neural Network able to automatically classify mammograms into breast density classes.


2) The scripts in Jupiter notebooks can be run on Google CoLab or you can clone the GitHub repo and execute the notebook locally.

Annotated Description

  1.  this is the first script to execute if you want to train the CNN ResNet model from scratch. You may train the network four times, one per projection. You can use your own dataset as training set. It should consist of at least about 1000 images and it should be divided in 4 different folders  (CC_R, CC_L, MLO_L, MLO_R) and each folder divided into 4 sub-folders, one per class (A, B, C, D). In "CC_R_model" directory we saved the output of a training as an example.
  2. this is the script to test the saved trained model on new images.  It is suggested to use your own test set also for testing. The test set of images should be organized in folders as the training set. If you don't have enough images to train the model but you just want to test it, you can use a pre-trained model ('weights-improvement-46-0.80.h5') saved in the folder "CC_R_model".
  3. Figure_merit.ipynb: this is the script to obtain the metrics, the final figures of merit to evaluate the classification performance on the test set. You need as input the .txt files, obtained with the script "" and containing the prediction outcomes. We uploaded "predictions_mlor.txt, predictions_ccr.txt, predictions_mlol.txt, predictions_ccl.txt" files in folder "Prediction", obtained from a pre-trained and tested ResNet model to use them as examples.
  4. ClassActivationMaps.ipynb: this is the script to obtain the Class Activation Maps based on the Grad-CAM technique. You can use the test images we uploaded as example in the folder “TestSet”, they are just one image per class for each projection. You can use them and the pre-trained model in the folder "CC_R_model" to try the script as tutorial  the first time. Then, you can execute the script on your own larger dataset and on your trained model to obtain the maps in your specific case.


Here you can find a more detailed description of the ResNet model architecture:

Here you can find a more detailed description of the Grad-CAM technique: