Posts

SSD-Single Shot Detector

Image
There is one class of models for localization and object detection, called  Single Shot Detectors , which are even faster and require less computational cost in general. By processing the image only once and output the prediction immediately, these types of models are called Single Shot Detectors. Single Shot Detectors(SSD): Instead of having a dedicated system to propose ROIs, we have a set of predefined boxes to look for objects, which are forwarded to a bunch of convolutional layers to predict class scores and bounding box offsets .  Then for each box we predict a number of bounding  boxes with a confidence score assigned to each one, we detect one object centered in that box and we output a set of probabilities for each possible class. Once we have all that, we simply and maybe naively keep only the box with high confidence score.  Details below adopt from: https://towardsdatascience.com/review-ssd-single-shot-detector-object-detection-851a9460...

Fast RCNN

Image
The idea is straightforward.  1)Instead of passing all regions into the convolutional layer one by one, we pass the entire image once and produce a feature map.   2)Then we take the region proposals as before (using some external method) and sort of project them onto the feature map .  3)Now we have the regions in feature map instead of the original image and we can forward them in some fully connected layers to output the classification decision and the bounding box correction. Note that the projection of regions proposal is implemented using a special layer( ROI pooling layer ), which is essentially a type of max-pooling with a pool size dependent on the input, so that the output always has the same size .

R-CNN

Image
Given an image with multiple objects, we generate some ROIs using a proposal method ( Selective Search ) and wrap the regions into a fixed size .  Then forward each region to CNN(such as AlexNet), which will use an SVM to make a classification decision for each one and predicts a regression for each bounding box. This prediction comes as a correction of the region proposed, which may be in the right position but not at the exact size and orientation. Although the model produces good results, it suffers from a main issue.  It is quite slow and computational expensive.  Image that in an average case, we produce 2000 regions, which we need to store in disk, and we forward each of them into the CNN for multiple passes until it is trained.

ROC & AUC

ROC: Receiver Operating Characteristic A ROC curve is a graphic plot that illustrates the diagnostic ability of a binary classifier system as its discrimination threshold is varied. The ROC curve is created by plotting the true positive rate(TPR) against the false positive rate(FPR) at various threshold settings. The true positive rate is also know as sensitivity, recall or probability of detection in machine learning. Acc = (True Positive + True Negative)/Total population F1 Score = 2*(Precision*Recall)/(Precision + Recall) False positive: type I error False negative: type II error AUC: Area Under the Curve When using normalized units, the area under the curve is equally to the probability that a classifier will rank a randomly chosen positive instance higher than a randomly chosen negative one.

DeepSnake

Image
Traditional snake algorithms: Given an initial contour, traditional snake algorithms treat the coordinates  of the vertices as a set of variables and optimize an energy functional with respect to these variables.  Active contour models could optimize the contour to the object boundary. The energy functional is typically  nonconvex, the deformation process tend to find local optimal solutions. Network Architecture: Deep snake consists of three parts:  a backbone ,  a fusion block  and  a prediction head . The backbone is comprised  of 8 “CirConvBn-ReLU” layers and  uses residual skip connections for all layers . The fusion block aims to fuse  the information across all contour points at multiple scales. Detail: Add deep snake to an object detection model.  The detector first produces detected boxes that are used to construct  diamond contours. Then deep snake deforms the diamond vertices to obje...

Batch Normalization

BatchNorm address es the  internal covariate shift problems  by normalizing layer inputs, which makes using large learning rate to  accelerate network training  feasible.

class imbalance

Image
While negative samples are much more than positive samples, to deal with the large class imbalance , two ways can be tried: 1) Focal loss: use the focal loss as the loss on the output of the classification subnet; 2) Adding hard negative samples gradually(Hard example mining). Focal loss:  Address class imbalance by reshaping the standard cross entropy loss such that it down-weights the loss assigned to well-classified examples. Focal loss is designed to address the one-stage object detection scenario in which there is an extreme imbalance between foreground and background classes during training. How to choose the hard negative to be included in the computation of loss? First, N negative samples are randomly selected as a candidate pool; Second, the negative samples in this pool are sorted in descending order based on their classification confidence scores and the top n samples are selected as the hard negatives.