for cite this repositry, please cite: Integrated feature analysis for deep learning interpretation and class activation maps, arxiv.org/abs/2407.01142
refering to "A lightweight model for physiological signals-based sleep staging with multiclass CAM for model explainability", Y. Yang, Y. Li.
refering to "Automatic segmentation-free inflammation scoring in rheumatoid arthritis from MRI using deep learning", Y. Li, et. al.
Thanks to https://github.com/frgfm/torch-cam and https://github.com/jacobgil/pytorch-grad-cam for their functions.
Currently, default test support for MNIST, ILSVRC2012, Cats&Dogs, and other four public medical datasets. ESMIRA (private data) is not supported as it includes the information of patients.
Agent = CAMAgent(model, target_layer, dataset, groups, ram=False, cam_method=method, name_str=f'{task}_{fold_order}', batch_size=batch_size, select_category=target_category, rescale='norm', remove_minus_flag=True, scale_ratio=1, feature_selection='all', feature_selection_ratio=1.0, cam_type='2D')
indiv_cam = Agent.indiv_return(x, target_category, None)
1. main.py provides some examples of runners, with some predefined tasks and datasets that were presented in the manuscript.
Find them in the ./runner. In main.py, examples were given for generating CAMs of MNIST, ILSVRC2012, Cats&Dogs and other four medical image tasks with the default paths.