Fast R-CNN is an improved object detection framework that addresses the inefficiencies of R-CNN by sharing convolutional computations across the entire image and performing region-based detection on a single feature map. This significantly reduces computation time while improving accuracy and enabling end-to-end training of the detection pipeline.
- Processes the full image once through a CNN to generate a shared feature map for all region proposals.
- Uses RoI pooling with softmax classification and bounding box regression for efficient and accurate detection.
Architecture
Fast R-CNN improves object detection by processing the image only once through a CNN and sharing the computed feature map across all region proposals.

- Input and Region Proposals: The input image is combined with region proposals generated using Selective Search, where around 2000 proposals are created for potential object locations.
- Feature Extraction using CNN: The entire image is passed through a CNN once to produce a shared convolutional feature map.
- RoI Pooling Layer: Region proposals are mapped onto the feature map, and each is converted into a fixed-size feature vector using the RoI Pooling layer.
- Classification Head: The extracted features are passed into a softmax classifier to predict the object category for each region.
- Bounding Box Regression Head: The regression head refines the coordinates of each detected object to improve localization accuracy.
CNN Network of Fast R-CNN
Fast R-CNN uses pre-trained ImageNet models such as VGG-16, which consist of convolution and max-pooling layers for feature extraction. The architecture is modified in three main ways:
- The network takes both the input image and region proposals as input.
- The final pooling layer is replaced with the RoI Pooling layer to handle region proposals.
- The final classification layers are replaced with two branches: a softmax classifier for object classification and a bounding box regressor for localization.

Region of Interest (RoI) Pooling
RoI Pooling is a key component introduced in Fast R-CNN that converts variable-sized region proposals into fixed-size feature maps. This ensures that all regions have a uniform representation before being passed to fully connected layers.
It takes two inputs:
- A convolutional feature map obtained from the CNN (for example, 14 × 14 × 512 in VGG-16).
- A set of region proposals represented as an N × 4 matrix, where each proposal defines the coordinates and size of a region (r, c, h, w).
RoI Pooling works by dividing each region proposal into a fixed number of equal sections and applying max pooling within each section. This produces a fixed-size output regardless of the original region size, allowing consistent feature extraction for all proposals.

Training and Loss Function
Fast R-CNN uses a multi-task loss function to jointly optimize object classification and bounding box localization for each Region of Interest (RoI). During training, each RoI is associated with a ground truth class and a ground truth bounding box. The model compares these labels with the outputs of the softmax classifier and bounding box regressor to compute the final loss.
The multi-task loss is defined as:
L = L_{cls}(p, u) + \lambda \, u \, L_{loc}(t, v)
L_{cls} (Classification Loss): Measures how accurately the model predicts the object class using log loss.L_{loc} (Localization Loss): Measures how closely the predicted bounding box matches the ground truth bounding box.- A balancing parameter λ controls the contribution of classification and localization losses.
- The variable u ensures localization loss is applied only when the region contains an object (u = 1), and ignored for background regions (u = 0).
Here, Lcls is log loss and Lloc is defined as the localization loss function for bounding box regression.
Results and Performance Comparison
Fast R-CNN achieves state-of-the-art performance on the PASCAL VOC 2007, 2010, and 2012 datasets. It significantly reduces both training and inference time compared to R-CNN due to shared convolutional computation and end-to-end training.
- Improves detection speed by eliminating repeated CNN processing for region proposals.
- Reduces training time and computational cost while maintaining or improving accuracy (mAP).

Advantages
- The entire image is processed once through the CNN, reducing repeated computation for each region proposal.
- Combines classification and bounding box regression in a single unified network, improving optimization and accuracy.
- RoI pooling and shared feature maps improve object localization compared to traditional R-CNN.
Challenges
- It still uses Selective Search, which is slow and not learnable, limiting overall speed.
- Although faster than R-CNN, the region proposal step prevents it from achieving real-time performance.
- Processing thousands of RoIs per image still requires significant memory and computation.