0Pricing
Deep Learning Academy · Урок

Grad-CAM: посмотрите, на что смотрит модель

Визуализируйте пиксели, влияющие на решение

«Grad-CAM: посмотрите, на что смотрит модель» — бесплатный урок Deep Learning Academy на CoddyKit. Это урок 3 из 4. Ты можешь прочитать весь урок бесплатно ниже — а потом практиковать его прямо в браузере с встроенным редактором кода и ИИ-репетитором 24/7. Это часть пути обучения 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.6

Quick 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/7) и разблокировать остальной курс Deep Learning Academy, подпишись на CoddyKit PRO. Курс Deep Learning Academy содержит 4 уроков всего.

Чему я научусь в уроке «Grad-CAM: посмотрите, на что смотрит модель»?

Визуализируйте пиксели, влияющие на решение Ты практикуешь Deep Learning Academy с помощью реального кода, который запускаешь прямо в браузере, и ИИ-репетитор 24/7 отвечает на твои вопросы во время урока.

Нужен ли мне опыт, чтобы начать Deep Learning Academy?

Предыдущий опыт не требуется. Deep Learning Academy на CoddyKit структурирован для всех уровней — от новичков до продвинутых, поэтому ты можешь начать отсюда или с самого начала и учиться в своем темпе. Это урок 3 из 4.

Сколько времени занимает урок «Grad-CAM: посмотрите, на что смотрит модель»?

Большинство уроков CoddyKit занимают около 5–10 минут. Каждый из них компактный и интерактивный, поэтому ты постоянно делаешь прогресс и продолжаешь с того же места в веб-версии и приложении.

Можно ли писать и запускать код в этом уроке Deep Learning Academy?

Да. Каждый урок Deep Learning Academy включает встроенный редактор кода, поэтому ты пишешь и запускаешь реальный код прямо в браузере и получаешь моментальную обратную связь от AI — локальная установка не требуется.

Все уроки этого курса

  1. Точность, полнота, F1 и ROC-AUC
  2. Матрицы ошибок и анализ ошибок
  3. Grad-CAM: посмотрите, на что смотрит модель
  4. Калибруйте уверенность
← Назад к Deep Learning Academy