# Hybrid-Margin Softmax for the Detection of Trademark Image Similarity
###### Abstract  
The detection of image similarity is critical to trademark (TM) legal registration and court judgment on infringement cases. Meanwhile, there are great challenges regarding the annotation of similar pairs and model generalization on rapidly growing data when deep learning is introduced into the task. The research idea of metric learning is naturally suited for the task where similarity of input is given instead of classification, but current methods are not targeted at the task and should be upgraded. To address these issues, loss-driven model training is introduced, and a hybrid-margin softmax (HMS) is proposed exactly based on the peculiarity of TM images. Two additive penalty margins are attached to the softmax to expand the decision boundary and develop greater tolerance for slight differences between similar TM images. With the HMS, a Siamese neural network (SNN) as the feature extractor is further penalized and the discrimination ability is improved. Experiments demonstrate that the detection model trained on HMS can make full use of small numbers of training data and has great discrimination ability on bigger quantities of test data. Meanwhile, the model can reach high performance with less depth of SNN. Extensive experiments indicate that the HMS-driven model trained completely on TM data generalized well on the face recognition (FR) task, which involves another type of image data. trademark image similarity; metric learning; Siamese neural network; softmax function  
detector and binary BRIEF descriptor. These extraction methods focus on some specific image features such as points and edges [7], which makes it expensive to detect TM image similarity comprehensively with several manual descriptors. The great improvement in deep learning, that features which might be omitted by human beings can be extracted efficiently by convolutional kernels, makes introducing computer 'opinions' to the procedure of human judgment on TM image similarity a convincing prospect. There is a great challenge in building training data when deep learning is introduced in the detection of TM image similarity (TMISD). The performance of the detection model is highly correlated with supervised information, while the annotation of similar TM image pairs takes intensive work with skilled labor involved. Furthermore, the model generalization on millions of new TM designs proposes a higher requirement for training data preparation where extensive TM images are supposed to be covered. Metric learning is naturally suitable for solving the problem of limited training shots [8]. A metric function of similarity can be learned to detect whether inputs are similar, instead of classifying the input samples. Siamese neural networks (SNNs) are widely used in metric learning to extract pairs of input image features [9; 10] and metric functions, e.g., Euclidean distance, Manhattan distance, and cosine similarity are used to compare embedded feature vectors [11; 12]. Usually, contrastive loss is used in an SNN to minimize the distance between feature vectors of samples in the same classes and maximize the distance between samples in the different classes. There is a hyper-parameter in contrastive loss to control the threshold of distance. A data-driven triplet network was proposed on the basis of an SNN with an additional CNN branch [13]. The triplet loss function is used to decrease the feature vector distance between the anchor sample and the positive sample, and at the same time increase the distance between the anchor sample and the negative sample. The discrimination ability of the triplet network is improved while the training cost is greatly increased with the combinatorial explosion of the building of triplets, i.e., the input data of the triplet network. In this way, the pressure on training data quantity is transferred to the cost of existing annotated data mining by the more elaborate network architecture.