Introduced:
Siamese Network is a kind of similarity measure method, when the number of categories is many, but the sample quantity of each category is small, it can be used to identify, classify and so on . The traditional classification method used for differentiation is to know exactly which class each sample belongs to, and to have the exact label for each sample. and the relative number of labels is not too much. These methods are less applicable when the number of categories is too large and the number of samples per category is relatively small. Actually also very good understanding, for the entire data set, our data quantity is some, but for each category, can have only a few samples, then uses the classification algorithm to do, because each kind of sample is too few, we simply can not train the good result, therefore only then to find a new method to train this kind of data set, Thus the Siamese network is proposed. The Siamese network learns a similarity metric from the data and uses this learned metric to compare and match new, unknown categories of samples. This method can be applied to classification problems where the number of classes or the entire training sample is not available for the previous method training.
Principle:
The main idea is to map the input to the target space through a function, using a simple distance (Euclidean distance, etc.) in the target space to compare the similarity. Minimizing loss function values from a pair of samples from the same class at the training stage, maximizing loss function values from different classes of samples
Given a set of mapping functions, where the parameter is W, our goal is to find a set of parameter W. The similarity metric is a smaller value when and to the same category, and the similarity metric is larger when it belongs to a different category. The system is trained with a paired sample of the training set. Minimizing loss functions when and from the same category, maximizing when and from different classes
Final thought:
Actually speaking so much, the main idea is three points:
1, the input is no longer a single sample, but a pair of samples, no longer give a single sample of the exact label, and given a pair of samples from the same class label, is 0, not 1
2, designed two identical network, network share weights W, the output of the distance measurement, can say L1, L2 and so on.
3, for the input sample to whether from the same class design loss function, loss function form a bit similar to the loss of cross-entropy:
Finally, using the obtained loss function, using gradient inversion to update the weights of the two network shares W.
In my personal understanding, Siamese is a similarity comparison (template matching can also, that is, this kind of thing) algorithm, compare the target frame and the template picture similarity, give the most similar position, is the target frame in the location of the target.
In the words of the author, offline training is a common learning problem, which can be used for online tracking.
Siamese Network Twin Networks