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

YOLO, Faster R-CNN, and Modern Object Detection

Computer VisionYOLO, Faster R-CNN, and Modern Object Detection🟒 Free Lesson

Advertisement

YOLO, Faster R-CNN, and Modern Object Detection

Module: Computer Vision | Difficulty: Premium

Intersection over Union

Anchor Box Regression

Classification Loss (Focal Loss)

where is the model's estimated probability for the ground-truth class.

Non-Maximum Suppression

DetectorStageSpeedmAPParadigm
R-CNNTwoSlow58.5%Selective Search
Faster R-CNNTwo5 fps73.2%RPN
SSDOne59 fps76.8%Multi-scale anchors
YOLOv8One140 fps78.4%Anchor-free
DETROne28 fps78.9%Set prediction
import torch

def compute_iou(box1, box2):
    x1 = torch.max(box1[:, None, 0], box2[None, :, 0])
    y1 = torch.max(box1[:, None, 1], box2[None, :, 1])
    x2 = torch.min(box1[:, None, 2], box2[None, :, 2])
    y2 = torch.min(box1[:, None, 3], box2[None, :, 3])
    inter = (x2 - x1).clamp(0) * (y2 - y1).clamp(0)
    area1 = (box1[:, 2] - box1[:, 0]) * (box1[:, 3] - box1[:, 1])
    area2 = (box2[:, 2] - box2[:, 0]) * (box2[:, 3] - box2[:, 1])
    union = area1[:, None] + area2[None, :] - inter
    return inter / (union + 1e-6)

def nms(boxes, scores, iou_threshold=0.5):
    order = scores.argsort(descending=True)
    keep = []
    while order.numel() > 0:
        i = order[0].item()
        keep.append(i)
        if order.numel() == 1:
            break
        ious = compute_iou(boxes[i:i+1], boxes[order[1:]])[0]
        mask = ious < iou_threshold
        order = order[1:][mask]
    return keep

Research Insight: DETR (Detection Transformer) reframed object detection as a set prediction problem, eliminating hand-crafted components like anchors and NMS. Its bipartite matching loss assigns predictions to ground-truth via the Hungarian algorithm, producing a permutation-invariant training objective. Despite slower convergence, DETR and its successors (Deformable DETR, DINO) have become the dominant paradigm for open-vocabulary and zero-shot detection.

Need Expert Computer Vision Help?

Get personalized tutoring, project support, or professional consulting.

Advertisement