Analyzing the Papers Behind Facebook ' s computer Vision approachIntroduction
You know this company called Facebook? The Yeah, the one, have 1.6 billion people hooked on their website. Take all of the happy birthday posts, embarrassing pictures of your as a little kid, that's one family relative that likes every Single One of the Your statuses, and you had a whole lot of data to analyze.
In terms of analyzing the images, Facebook had undoubtedly made great progress with deep cnns. A little over a week ago, the team at Facebook AI (FAIR) published a blog post detailing the computer vision Tech Niques that is behind some of their object segmentation algorithms. In this post, we'll go to summarizing and explaining the 3 papers that the blog referenced.
The main pipeline that FAIR utilizes goes as follows. Images is fed into a deepmask segmentation framework. The segments is refined through a sharpmask model and classified with multipathnet. Let's look at how each of the these components operates separately.
Deepmask
Introduction
Written by Pedro Pinheiro, Roman Collobert, and Piotr Dollar, this paper was titled "Learning to Segment Object candidates" . The authors approach the task of object segmentation through a model, given an image patch, first outputs a segmentat Ion mask and then outputs the probability, the patch is centered on a full object. That process was applied over the whole image so, a mask can be created to each object. This whole process is do through just one CNN, as both components share many of the layers in the network.
Inputs and Outputs
Let's first visualize what want the model to do. Given an input image, we want the network to output a set of masks, or outlines, for each object. We can think of each input image as containing a set of patches (crops of the original image). For each input patch, the output is a binary mask that outlines the shape of the main object as well as a score (between- 1 and 1) for how likely the input patch was to contain an object.
Each training example would need to contain these 3 elements (Side note:examples with a 1 label need to contain an object That's roughly centered, fully contained in the image, and with a given scale range). The model applies this process at multiple scales and locations on the "image" (This is the patch set, we were talking a Bout earlier). The results is then aggregated together to form one final image with all of the masks. Now, let's take a look at the "how this" model is structured.
Network Architecture
The network was pre-trained to classification on ImageNet (Transfer learning works. Use it). The image is fed through a vgg-like model (without the fully connected layers) with eight 3x3 conv layers and five 2x2 max Pool layers. Depending on your input image dimensions, you'll get a certain output volume (in this case, 512x14x14).
Input: 3 x h x w
Output: x H/16 x w/16
Then, the model separates to the 2 components described earlier. One head tackles segmentation while the other determines whether or not there are an object in the image.
Segmentation Head
Now we take our output volume, pass it through a network-in-network layer and a ReLU layer. We have a layer ofW ' x h ' (where w ' and h ' is less than the H and W of the original image) pixel classifiers which determine whether or not a given pixel are part of the object in the Center of the image (If you have a 28x28 sized original image, there would be less than 784 classifiers). We then look at the outputs of these classifiers, bilinearly upsample the output to fit the full original resolution, and Obtain a black and white binary mask (1 's for Yes Classification and zeros for no classification).
Objectness Head
The other component of the network determines if the image contains a object that's centered and at a appropriate scale . Putting the output of vgg-like layers through a 2x2 maxpool, a dropout unit, and both fully connected layers, we ' re able to Obtain our "objectness" score.
Training
Both components of the network are trained simultaneously as the loss function is a sum of logistic regression losses (one For the objectness head and one for every location in the segmentation head). BackPropagation alternates between going through the segmentation head and the objectness head. Data augmentation techniques were used to improve the model. The model was trained with stochastic gradient descent on a Nvidia Tesla k40m GPU for around 5 days.
Why this Paper is Cool
A single convolutional neural network. We didn ' t need an extra object proposal step or some complex training pipeline. There is a certain simplicity to this model which helps the network's flexibility as well as its efficiency and speed.
Sharpmask
Introduction
the previous group (along with Tsung-yi Lin) Also Authored the paper titled "Learning to Refine Object segments". Evidenced by the title, the paper aims to refine the segmentation masks created in the Deepmask model. The main issue with Deepmask are that it uses a simple feeds forward network that's successful in creating "coarse object M Asks ", but not in" Pixel-accurate segmentations ". The reason for it, as may remember, there are a bilinear up sampling that takes place in order to fit the ful L size of the image. This causes rough and imprecise alignment with the object boundaries. To address this, the Sharpmask model works to combine information from the low-level features that comes from the early LA Yers with the high-level object information this comes from the layers deeper in the network. The model does this by first creating a rough mask for each input patch (Deepmask's job), and then passing it throuGH different refinement modules throughout the network. Let's look at the specifics.
Network Architecture
The motivation behind Sharpmask ' s architecture are that because object-level (high-level) information are needed to find a P Recise segmentation Mask, we need to use a top-down approach so first creates a coarse outline but then integrates Impor Tant low-level information from earlier layers. As can see from the above picture, the original input first goes through the Deepmask pipeline to obtain a rough Segme Ntation. It then was exposed to a series of refinement modules this allow for a more precise upsampling back to the original Dimensi ONS of the image.
Refinement Module
let ' s dig a little Deeper into the specifics of this refinement module. The goal of this module are to counter the effects of the pooling layers in the Deepmask pipeline (the layers that shrunk T He 224x224 image to 14x14) by upsampling the generated masks in a-out, also takes into account the feature maps that W Ere created in the Bottom-up pass (you can think of Deepmask = bottom-up and refinement Module = Top-down). a Mathematical-A-looking at it is, the refinement module R is A function This generates an upsampled mask M That's a function of the mask in the previous layer as well as a function of the feature map F. The number of refinement modules used would is equal to the number of pooling layers used in the Deepmask pipeline.
Now, what's exactly goes on in that function R? Glad you asked. A naïve approach would is to just concatenate M and F since they has the same width and height. The problem there lies in the depth channels of all those components. The number of depth channels for feature maps can is much larger compared to that of the mask. Therefore, concatenating would put too much of an emphasis on F. The solution would is to simply reduce the number of depth channels for F by applying a 3x3 conv layer, then concatenating M, going through another 3x3 conv, and finally using a bilinear upsampling (see network Architecture image to follow Alon g).
Training
The same training data, Deepmask uses also applies for sharpmask. We need input patches with binary masks as well as labels. The deepmask layers is trained first. The weights is then frozen as the refinement modules begin their training.
Why this Paper is Cool
This paper is able to build on Deepmask's approach while introducing a new and Easy-to-use module. The authors creatively realized that they could obtain more precise segmentations by just integrating the low level inform ation that is available in the early layers of the Deepmask pipeline.
multipathnet
Introduction
Deepmask generates Coarse segmentation masks. Sharpmask refines those outlines. Multipathnet has the job of identifying or classifying the objects in the masks. A group consisting of Sergey Zagoruyko, Adam lerer, Tsung-yi Lin, Pedro Pinheiro, Sam Gross, Soumith Chintala, and Piotr D Ollar published the paper titled "A MultiPath Network for Object Detection". The goal of this paper are to improve on object detection techniques by focusing on higher precision localization as well a s difficult images with scale variance, heavy occlusion, and clutter. This model takes Fast R-CNN as a starting-point, so if you haven ' t already, check out that paper or look at my p Revious blog post for a summary. Basically, this model is a-implementing Fast R-CNN with Deepmask/sharpmask object proposals. The 3 main modifications that this paper introduced include skip connections, foveal regions, and an integral loss function. Let's look at the network architecture before diving to each of the those.
Network architecture/foveal Regions
As with Fast r-cnn, We pass the input image through a VGG network without the fully connected layers. ROI pooling is used to extract features of the region proposals (If we remember from the Fast r-cnn paper, ROI Pooli Ng is a by-mapping features of the image to a feature map of the fixed spatial extent that describes the regions). For each object proposal, we then create 4 different region crops for the purpose of viewing the object at multiple scales . These is the "foveal regions" discussed in the intro. These region crops is fed through fully connected layers, the outputs is concatenated, and the network splits into a CLA Ssification and a regression head. The authors hypothesize that these foveal regions help with localization precision because the network are able to view the Image at different scales and with different context around the object of interest.
Skip Connections
Due to Fast R-CNN's architecture, an input image of 32x32 would quickly get reduced to 2×2 after the last Vgg conv layer. ROI pooling would create a 7x7 map, but we've still lost a lot of the original spatial information. To combat this, we concatenate the features from the Conv3, conv4, and conv5 layers and then feeds that into the F Oveal classifier. The paper states that this concatenation "gives the classifier access to information from features at multiple locations".
Integral Loss
Don ' t want to go too much into this one since I feel like the math would undoubtedly be much better explained in the paper itself, but the "idea of the general" is the "authors came up" with a loss function, "performs better while testing with multiple Intersection over Union (IoU) values.
Why this Paper is Cool
If you like Fast r-cnn, I think you'll definitely like the this model. It takes the main ideas of using Vgg Net and ROI pooling, while also introducing a-to-obtain more precise localization s and classifications through foveal regions, skip connections, and integral loss.
Facebook kinda have this CNN stuff down.
If anyone have anything to add or different explanations of any of the papers, let me knowin the comments!
The code for Deepmask and Sharpmask. The code for multipathnet.
Dueces.
Sourceswritten on September 1, 2016
Analyzing the Papers Behind Facebook ' s computer Vision approach