File size: 771 Bytes
e6b3e35 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import tensorflow as tf
import tensorflow.keras as keras
from gradcam_explainer import GradCAMExplainer
from gradcampp_explainer import GradCAMPPExplainer
from lime_explainer import LIMEExplainer
class Explicador:
explainers = {"LIME": LIMEExplainer(),
"Grad-CAM": GradCAMExplainer(),
"Grad-CAM++":GradCAMPPExplainer()}
#retorna nome dos explicadores
def get_explainers_name(self):
return list(self.explainers.keys()).copy()
#metodo utilizado para retornar uma explicacao
def get_explanation(self, img_path, model, size, explainer, prepocess_input, index=None, props=None):
explainer = self.explainers[explainer]
return explainer.get_explanation(img_path, model, size, props, prepocess_input, index)
|