Deformable DETR Explained
Introduction to Object Detection
Finding Objects in Images
Computer vision gives machines the ability to “see” and interpret the visual world. One of its most important tasks is object detection, which answers two basic questions: What objects are in this image, and where are they located?
This process involves two key steps:
- Classification: Identifying what an object is (e.g., a person, a car, a book).
- Localization: Drawing a tight box, called a bounding box, around each identified object.
By combining these two, a model can tell you there's a book in the top-left corner and a pen next to it.
The applications are everywhere. Self-driving cars use it to see pedestrians and other vehicles. Security systems detect unauthorized people in restricted areas. In retail, it can track inventory on shelves automatically. Object detection transforms a simple image into a source of structured, useful information.
Classic Detection Methods
Early approaches to object detection broke the problem down into sequential steps. These are often called two-stage detectors because they first propose potential object locations and then classify them.
A two-stage detector first identifies regions of interest and then analyzes each region to classify the object within it.
The pioneering model in this category was the Region-Based Convolutional Neural Network (R-CNN). Its process was methodical but slow:
- Propose Regions: It used an algorithm called Selective Search to generate about 2,000 potential bounding boxes, or "regions of interest," where an object might be.
- Extract Features: For each of these 2,000 regions, it warped the image patch to a fixed size and fed it into a Convolutional Neural Network (CNN) to extract a feature vector.
- Classify: A separate classifier then determined what object, if any, was in each region.
Think of it like a security guard scanning a wall of monitors. First, they spot areas with movement (proposing regions), then they zoom in on each one to identify what's happening (classification). This method was accurate for its time, but running a powerful CNN on thousands of overlapping regions per image made it incredibly slow.
To solve the speed problem, researchers developed one-stage detectors. These models look at the entire image just once to make all their predictions simultaneously.
A one-stage detector predicts all bounding boxes and class probabilities in a single pass.
A popular one-stage model is the Single Shot MultiBox Detector (SSD). Instead of a separate region proposal step, SSD uses a single network to predict bounding boxes and classes directly. It evaluates a grid of default bounding boxes of different sizes and aspect ratios across the image. For each box, it predicts both the class of the object inside and how to adjust the box to fit the object better.
This unified approach made SSD much faster than R-CNN, making it suitable for real-time applications where speed is critical. However, this speed often came at the cost of accuracy, especially when detecting small objects.
The Lingering Problems
While models like R-CNN and SSD were groundbreaking, they shared limitations rooted in their design. Both relied on a large set of pre-defined boxes, called anchors or priors, which the model would then refine. This anchor-based design created several challenges:
- Complex Tuning: The performance of these models was highly sensitive to the size, aspect ratio, and number of anchors used. Finding the optimal configuration required a lot of manual tuning and domain expertise.
- Redundant Predictions: These models would often produce many overlapping bounding boxes for the same object. They needed an extra step, called non-maximum suppression (NMS), to filter out the duplicates and keep only the best one. NMS is a handcrafted algorithm that can sometimes mistakenly remove correct predictions.
- Fixed Assumptions: The anchor-based approach assumes objects will generally fit into a set of predefined shapes, which isn't always true for irregularly shaped or rotated objects.
These challenges showed there was room for improvement. The next generation of models would need a new way of thinking about object detection, one that could simplify the pipeline and remove the need for handcrafted steps like anchor generation and NMS.
Object detection is a computer vision task that combines two fundamental steps. What are they?
What is the key characteristic that distinguishes a two-stage detector like R-CNN from a one-stage detector like SSD?

