李宏毅机器学习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

相关推荐
Raink老师12 分钟前
【AI面试临阵磨枪-72】电商全场景 AI Agent 设计(商品咨询 / 订单 / 物流 / 售后 / 退款)
人工智能·面试·职场和发展
仙女修炼史18 分钟前
CNN更看重Texture还是shape:imagenet-trained cnns are biased
论文阅读·人工智能·cnn
视***间35 分钟前
视程空间 AIR SC6N0-C-MB NX 16GB 规格详解与机器人/机器狗适配说明
人工智能·机器人·边缘计算·机器狗·ai算力·具身机器人·视程空间
视***间36 分钟前
小身板・强算力・全适配 —— 视程空间 AI 算力开发板如何完美适配机器人 / 机器狗
人工智能·机器人·边缘计算·ai算力·视程空间·算力开发板
网宿安全演武实验室39 分钟前
当AI跑进容器:全链路容器安全检测与智能运营实
人工智能·安全·容器·k8s
Cosolar41 分钟前
2026年AI Agent技术生态开源项目合集
人工智能·开源·agent·智能体
带娃的IT创业者1 小时前
本地AI的觉醒:GitNexus如何让GenAI从云端走向你的口袋
人工智能·大模型·边缘计算·开源项目·genai·本地ai·gitnexus
火山引擎开发者社区1 小时前
龙虾突然“罢工”?别慌,我们派出了“AI 医生”
人工智能
NQBJT1 小时前
青鸾云步:基于 Cordova 的 AI 导盲机器人 APP 全栈开发实战
人工智能·app·导盲·轮足机器人·青鸾云步
深兰科技2 小时前
韩国KAIST AI半导体高管项目代表团到访深兰科技,聚焦AI算力与智能产业合作机会
人工智能·机器人·symfony·ai算力·深兰科技·韩国科学技术院·kaist