李宏毅机器学习2022-HW9--Explainable AI

Task

CNN explanation

11种食物图片分类,与HW3使用同一个dataset

  • Bread, Diary product, Dessert, Egg, Fried food, Meat, Noodles/Pasta, Rice, Seafood, Soup, and Vegetables/Fruit

训练一个CNN model用于classification,并做一些explanations

Lime package

Lime

Saliency map

What is Saliency map ?

Saliency: 顯著性

The heatmaps that highlight pixels of the input image that contribute the most in the classification task.

Ref: https://medium.com/datadriveninvestor/visualizing-neural-networks-using-saliency-maps-in-pytorch-289d8e244ab4

We put an image into the model, forward then calculate the loss referring to the label. Therefore, the loss is related to:

  • image
  • model parameters
  • label

Generally speaking, we change model parameters to fit "image" and "label". When backward, we calculate the partial differential value of loss to model parameters. 一般来说,我们改变模型参数来拟合"图像"和"标签"。当反向时,我们计算损失对模型参数的偏微分值。

Now, we have another look. When we change the image's pixel value, the partial differential value of loss to image shows the change in the loss. We can say that it means the importance of the pixel. We can visualize it to demonstrate which part of the image contribute the most to the model's judgment. 现在,我们再看一遍。当我们改变图像的像素值时,损耗对图像的偏微分值表示损耗的变化。我们可以说这意味着像素的重要性。我们可以将其可视化,以演示图像的哪一部分对模型的判断贡献最大。

Smooth Grad

Smooth grad 的方法是,在圖片中隨機地加入 noise,然後得到不同的 heatmap,把這些 heatmap 平均起來就得到一個比較能抵抗 noisy gradient 的結果。

The method of Smooth grad is to randomly add noise to the image and get different heatmaps. The average of the heatmaps would be more robust to noisy gradient.

ref: https://arxiv.org/pdf/1706.03825.pdf

Filter Visualization

https://reurl.cc/mGZNbA

Integrated Gradients

https://arxiv.org/pdf/1703.01365.pdf

BERT Explanation

  • Attention Visualization
  • Embedding Visualization
  • Embedding analysis

##Attention Visualization

https://exbert.net/exBERT.html

##Embedding Visualization

Embedding 二维化

##Embedding analysis

用Euclidean distance 和 Cosine similarity 两种方法比较output embedding

下图是"果"

#Code Link

详细代码和问题解答见Github

相关推荐
AI闲人4 分钟前
Agent 平台的两种哲学:从 WeKnora 和 Molio 聊起
人工智能·知识库·企业ai落地
richard_yuu7 分钟前
LMS 算法:从最小二乘到随机梯度下降,工业自适应滤波的核心
深度学习·神经网络·机器学习
林伽一15 分钟前
从开源基础设施到垂直封装,AI 产业的技术主轴正在位移
人工智能·科技·ai·语言模型
lie..18 分钟前
30天从零开始学AI应用开发(Day 3):30 分钟搭好开发环境,Python + VSCode 一次配齐
人工智能·python·大模型
β添砖java18 分钟前
机器学习2 KNN算法、距离度量、特征预处理、超参数选择、手写数字、鸢尾花
人工智能·算法·机器学习
cc_瀚海知行19 分钟前
模型调用 3|怎样让程序可靠地接收模型输出?
人工智能·ai
科创致远19 分钟前
科创致远 ESOP 系统深度评测:从参数解析到 ROI 实战验证
大数据·人工智能·制造·精益工程
CAIE研习社23 分钟前
从“会聊天”到能落地:光伏、风电运维里的AI怎么用?
大数据·人工智能
TAN-90°-25 分钟前
Deep Learning for Computer Vision——Generative Models 2
人工智能·深度学习·神经网络·算法·目标检测·机器学习·计算机视觉
洞见新研社29 分钟前
豆包手机发售,AI代理进入“终端”竞赛
人工智能·ai