Grad-CAM:モデルが見ているものを確認する
判定に影響したピクセルを可視化します
「Grad-CAM:モデルが見ているものを確認する」はCoddyKit上の無料Deep Learning Academyレッスンです。 これはレッスン3/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはDeep Learning Academy学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Deep Learning Academyコースには全4レッスンが含まれています。
このレッスンの一部はまだ翻訳されておらず、英語で表示されています。
Open the Black Box
A CNN can be right for the wrong reason. Grad-CAM reveals which pixels actually drove a prediction, so you can trust or question it.
Heatmaps Over the Image
Grad-CAM paints a heatmap on top of the input. Warm regions are where the model focused; cool regions it ignored. 🔥
Gradients Carry Importance
It traces the gradient of the chosen class score back to a convolutional layer, measuring how much each feature map mattered.
Pick a Late Conv Layer
The best maps come from the last convolutional layer, where features are rich yet still spatial enough to localize.
Weight the Feature Maps
Average the gradients to get a weight per feature map, then combine the maps with those weights into one coarse map.
Keep Only the Positive
A ReLU over the combined map keeps regions that push the class up, discarding pixels that argue against it.
cam = torch.relu((weights * activations).sum(dim=0))Upsample to Pixel Size
The map is small, so you upsample it to the image resolution before overlaying it for a clear visual.
Catch Shortcut Learning
If the heatmap lights up the background instead of the object, your model learned a shortcut, not the real signal.
Debug Misclassifications
Run Grad-CAM on wrong predictions to see what misled the model. The focus region often explains the error instantly.
Build Stakeholder Trust
Clear visual evidence of where a model looks makes it far easier to explain and defend in real deployments.
A Window, Not a Proof
Grad-CAM is an approximate visualization, not exact math. Treat it as a strong hint, then confirm with other checks. 🪟
overlay = heatmap * 0.4 + image * 0.6Quick Check
Think about why Grad-CAM is most useful when read alongside model predictions.
Recap
Use Grad-CAM to turn gradients into a heatmap over the image, exposing what drove a prediction and catching shortcut learning. 🎯
よくある質問
「Grad-CAM:モデルが見ているものを確認する」レッスンは無料ですか?
はい。「Grad-CAM:モデルが見ているものを確認する」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Deep Learning Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Deep Learning Academyコースには全4レッスンが含まれています。
「Grad-CAM:モデルが見ているものを確認する」で何を学びますか?
判定に影響したピクセルを可視化します ブラウザで直接実行するハンズオンコードでDeep Learning Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。
Deep Learning Academyを始めるのに経験は必要ですか?
事前経験は必要ありません。CoddyKitのDeep Learning Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン3/4です。
「Grad-CAM:モデルが見ているものを確認する」レッスンにはどのくらい時間がかかりますか?
ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。
このDeep Learning Academyレッスンでコードを書いて実行できますか?
はい。すべてのDeep Learning Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。
このコースのすべてのレッスン
- 適合率、再現率、F1、ROC-AUC
- 混同行列とエラー分析
- Grad-CAM:モデルが見ているものを確認する
- 信頼度を較正する