2017-05-06

YOLO & R-CNN

In this post I'll slip a bit more in the technical details which did lead to creations such as YOLO (YOLO 9000 by now) and Faster R-CNN.

The first problem for a system taking an arbitrary input image and identify objects in it is to find regions which can have objects in them. The next step is to classify it with a convolutional neural network.

To have a less complex system than two of the current cutting edge competitors let's dive in the ancestry of these. The obvious choice is to cut off the claims of increased speed and look at R-CNN. It was presented in the Paper Rich feature hierarchies for accurate object detection and semantic segmentation. They use Selective Search for Object Recognition to suggest regions which are fed into the CNN.

First for the Selective Search. It combines the best of segmentation via bottom-up grouping and exhaustive search techniques. It accounts for all scales since objects can occur in all scales and uses multiple strategies to group the regions together as shown below. It does this whilst trying to not become a computational bottleneck.
Selective Search for Object Recognition - Fig. 2 Two examples of selective search showing the necessity of different scales. On the left we find many objects at different scales. On the right we necessarily find the objects at different scales as the girl is contained by the tv

There is a lot more to this, but this gives us a rough idea what happens.

R-CNN consists out of 2 parts. First the region proposal, then the feature extraction. Region proposal is Selective Search or an other algorithm which produces region proposals. Feature extraction starts with fitting the output of the region proposal in a 227x227 RGB image, the warping. The resulting image is then used as an input for the CNN. The CNN uses 5 convolutional layers and 2 fully connected layers and yields features. According to these features, a SVM classifies the whole region.
Rich feature hierarchies for accurate object detection and semantic segmentation - Figure 1:
R-CNN (1) takes an input image, (2) extracts around 2000 bottom-up region proposals, (3) computes features for each proposal using a large convolutional neural network (CNN), and then (4) classifies each region using class-specific linear SVMs  
As suggested above, R-CNN was improved on by Fast R-CNN which is 9x faster than R-CNN. Images are processed in roughly 0.3s. This improvement was achieved by including Spatial pyramid pooling networks (SPPnets)

To not dwindle too long on the legacy systems let's go to the edge of technology systems.
Faster R-CNN introduces the Region Proposal Network (RPN) for finding interesting regions which will then be processed.

YOLO, on the other hand, treats detection as a regression problem.
You Only Look Once: Unified, Real-Time Object Detection  Figure 2: YOLO models detection as a regression problem. It divides the image into an even grid and simultaneously predicts bounding boxes, confidence in those boxes, and class probabilities. These predictions are encoded as an S × S × (B ∗ 5 + C) tensor  
Compared to each other YOLO is faster, but has less accuracy than Faster R-CNN.