0Pricing
Deep Learning Academy · Lección

Grad-CAM: vea qué observa el modelo

Visualice qué píxeles impulsan una decisión

Grad-CAM: vea qué observa el modelo es una lección gratuita de Deep Learning Academy en CoddyKit. Esta es la lección 3 de 4. Puedes leer la lección completa abajo gratuitamente — luego la practicas en el navegador con un editor de código integrado y un tutor de IA 24/7. Forma parte de la ruta de aprendizaje de Deep Learning Academy, y tu progreso se sincroniza en la web y la app de CoddyKit. El curso de Deep Learning Academy incluye 4 lecciones en total.

Partes de esta lección aún no han sido traducidas y se muestran en inglés.

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. 🎯

Preguntas frecuentes

¿La lección «Grad-CAM: vea qué observa el modelo» es gratis?

Sí — el texto completo de «Grad-CAM: vea qué observa el modelo» es gratis para leer aquí en la web. Para practicarla de forma interactiva (editor de código integrado y tutor de IA 24/7) y desbloquear el resto del curso de Deep Learning Academy, actualiza a CoddyKit PRO. El curso de Deep Learning Academy incluye 4 lecciones en total.

¿Qué aprenderé en «Grad-CAM: vea qué observa el modelo»?

Visualice qué píxeles impulsan una decisión Practicas Deep Learning Academy con código real que ejecutas directamente en el navegador, y un tutor de IA 24/7 responde tus preguntas mientras trabajas en la lección.

¿Necesito experiencia previa para empezar Deep Learning Academy?

No se requiere experiencia previa. Deep Learning Academy en CoddyKit está estructurado para principiantes hasta estudiantes avanzados, así que puedes empezar aquí o desde el inicio y avanzar a tu ritmo. Esta es la lección 3 de 4.

¿Cuánto tiempo toma la lección «Grad-CAM: vea qué observa el modelo»?

La mayoría de las lecciones de CoddyKit toman alrededor de 5–10 minutos. Cada una es compacta e interactiva, así que avanzas constantemente y retomas exactamente por donde dejaste en la web y la app.

¿Puedo escribir y ejecutar código en esta lección de Deep Learning Academy?

Sí. Cada lección de Deep Learning Academy incluye un editor de código integrado, así que escribes y ejecutas código real directamente en tu navegador y obtienes retroalimentación instantánea de IA — sin configuración local necesaria.

Todas las lecciones de este curso

  1. Precisión, recall, F1 y ROC-AUC
  2. Matrices de confusión y análisis de errores
  3. Grad-CAM: vea qué observa el modelo
  4. Calibre la confianza
← Volver a Deep Learning Academy