28 lines
1.4 KiB
Python
28 lines
1.4 KiB
Python
from task.image_interpretability import ImageInterpretability
|
||
|
||
|
||
# # TODO: 使用gradcam算法,针对resnet模型,利用本地图片both.png进行可解释性分析,参数为默认参数
|
||
# files_path = ImageInterpretability().perform(image_path='sample/both.png',method='gradcam', model_name='resnet',output_path='D:\桌面\image_interprebility\image_interprebility\image_interprebility/test')
|
||
# print(files_path)
|
||
#
|
||
kwargs={
|
||
"aug_smooth":True,
|
||
"eigen_smooth":True
|
||
}
|
||
model_info ={"model_name":'resnet50',
|
||
"source": "torchvision"
|
||
}
|
||
# TODO: 使用fullgrad算法,针对resnet模型,利用本地图片both.png进行可解释性分析,参数为默认参数
|
||
files_path = ImageInterpretability().perform(image_path='sample/img_2.png',method='fullgrad',model_info=model_info,output_path="D:/test_image/",**kwargs)
|
||
print(files_path)
|
||
|
||
|
||
# kwargs={
|
||
# "target_layer":'',
|
||
# "aug_smooth":True,
|
||
# "eigen_smooth":True
|
||
# }
|
||
# # TODO: 使用fullgrad算法,针对resnet模型,利用本地图片both.png进行可解释性分析,采用数据增强技术来改善cam质量,并使用提取主成分的方式减少噪声,通过改变target_layer得到不同层的结果
|
||
# files_path = ImageInterpretability().perform(image_path='sample/ILSVRC2012_val_00000002.JPEG',method='gradcam', model_name='resnet',**kwargs)
|
||
# print(files_path)
|