πŸŽ‰ 75% of content is free forever β€” Unlock Premium from $10/mo β†’
CW
Search courses…
πŸ’Ό Servicesℹ️ Aboutβœ‰οΈ ContactView Pricing Plansfrom $10

Weakly Supervised Learning

Computer VisionWeakly Supervised Learning🟒 Free Lesson

Advertisement

Weakly Supervised Learning

Module: Computer Vision | Difficulty: Advanced

Class Activation Mapping (CAM)

where is the class-specific weight and is the feature map.

Erasing-Based Approach

  1. Generate CAM
  2. Erase most discriminative region
  3. Re-train to find other regions

Bounding Box Supervision

Multiple Instance Learning (MIL)

import torch
import torch.nn as nn

class CAMGenerator(nn.Module):
    def __init__(self, backbone, num_classes):
        super().__init__()
        self.backbone = backbone
        self_GAP = nn.AdaptiveAvgPool2d(1)
        self.fc = nn.Linear(backbone.out_channels, num_classes)
    
    def forward(self, x):
        features = self.backbone(x)  # (B, C, H, W)
        pooled = self.GAP(features).flatten(1)
        weights = self.fc(pooled)  # (B, num_classes)
        
        # Generate CAM for each class
        cam = torch.einsum('bc,bchw->bhw', weights, features)
        return cam, weights

Key Takeaways

  • CAM visualizes discriminative regions learned by CNNs
  • Weak supervision reduces annotation cost significantly
  • Erasing-based methods discover additional object regions

Need Expert Computer Vision Help?

Get personalized tutoring, project support, or professional consulting.

Advertisement