One-Stage vs Two-Stage Detectors
Comparing slow high-accuracy Two-Stage region proposal detectors against ultra-fast One-Stage single-pass detectors.
Two-Stage vs One-Stage Architectural Comparison
TWO-STAGE DETECTOR (Faster R-CNN):
Image ──► Backbone ──► [ Stage 1: RPN (Region Proposals) ] ──► [ Stage 2: RoI Align + Classification ] ──► Output Boxes
(Extracts ~2000 candidate boxes) (Classifies & refines each candidate)
Slow, High Precision (~15-30 FPS)
ONE-STAGE DETECTOR (YOLOv8):
Image ──► Backbone + FPN ──► [ Single Dense Grid Forward Pass ] ───────────────────────────────────────► Output Boxes
(Predicts boxes & classes simultaneously for all grid cells)
Ultra-Fast Real-Time (60-150+ FPS)
Detailed Comparison Matrix
| Property | Two-Stage (Faster R-CNN, Mask R-CNN) | One-Stage (YOLO, SSD, RetinaNet) | Transformer (DETR) |
|---|---|---|---|
| Pipeline Steps | 1. Region Proposals (RPN) -> 2. Refinement | Single dense forward pass | Bipartite matching queries |
| Inference Speed | Slow (15 – 30 FPS) | Ultra-Fast (60 – 150+ FPS) | Moderate (30 – 60 FPS) |
| Accuracy (mAP) | Traditionally higher on small objects | Matches Two-Stage with modern YOLO/RetinaNet | High global context accuracy |
| Anchor Dependency | Uses Anchor Boxes | Anchor-based OR Anchor-Free (YOLOv8) | Anchor-Free (Queries) |
| NMS Dependency | Requires Non-Maximum Suppression | Requires Non-Maximum Suppression | NMS-Free (Direct End-to-End) |
Stage 1 vs Stage 2 Mechanics in Faster R-CNN
- Backbone Feature Extractor: Input passes through ResNet, producing deep feature map $C_4$.
- Stage 1 (Region Proposal Network - RPN): A small 3x3 sliding window slides over feature maps, outputting top ~2,000 candidate regions likely to contain objects.
- RoI Align (Region of Interest Alignment): Extracts fixed $7 \times 7$ feature vectors for each candidate region using precise bilinear interpolation.
- Stage 2 (Full Classification Head): Fully connected layers classify each candidate box and refine final $(x, y, w, h)$ coordinates.
How One-Stage (YOLO) Achieves Real-Time Speed
YOLO divides the image into an $S \times S$ grid (e.g. $80 \times 80, 40 \times 40, 20 \times 20$).
If an object's center falls into a grid cell, that grid cell is responsible for predicting its bounding box offsets and class probabilities.
Because the entire image is processed in a single unified tensor operation, GPUs execute YOLO at 100+ frames per second!
Say this out loud
Two-stage detectors (Faster R-CNN) use a Region Proposal Network (RPN) in Stage 1 to generate candidate boxes before classifying them in Stage 2, achieving high accuracy at lower FPS. One-stage detectors (YOLO) evaluate bounding boxes and class scores simultaneously across a dense grid in a single forward pass, enabling real-time 60+ FPS processing for autonomous vehicles and live video feeds.
Follow-ups to expect
- What is Anchor-Free Object Detection (YOLOv8 / FCOS)? Instead of placing predefined anchor box templates at every grid cell, anchor-free detectors directly predict keypoints (center points, top-left/bottom-right offsets), simplifying training and eliminating hyperparameter tuning.
- What is DETR (DEtection TRansformer - Carion et al., 2020)? Replaces anchor boxes and NMS with a Transformer Encoder-Decoder architecture, using Hungarian Bipartite Matching loss to output set predictions directly.
Check yourself
What is the main architectural difference between Two-Stage (Faster R-CNN) and One-Stage (YOLO) object detectors?