{'fraction_non_alphanumeric': 0.038829487900956666, 'fraction_numerical': 0.0118688289763135, 'mean_word_length': 4.752795762213067, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
MaskReID: A Mask Based Deep Ranking Neural Network for Person Re-identification

Person retrieval faces many challenges including cluttered background, appearance variations (e.g., illumination, pose, occlusion) among different camera views and the similarity among different person's images. To address these issues, we put forward a novel mask based deep ranking neural network with a skipped fusing layer. Firstly, to alleviate the problem of cluttered background, masked images with only the foreground regions are incorporated as input in the proposed neural network. Secondly, to reduce the impact of the appearance variations, the multi-layer fusion scheme is developed to obtain more discriminative fine-grained information. Lastly, considering person retrieval is a special image retrieval task, we propose a novel ranking loss to optimize the whole network. The proposed ranking loss can further mitigate the interference problem of similar negative samples when producing ranking results. The extensive experiments validate the superiority of the proposed method compared with the state-of-the-art methods on many benchmark datasets.


INTRODUCTION
Person retrieval, also known as person re-identification (Re-ID), is to match images of the same individual captured by non-overlapping camera views. There are many challenges in person Re-ID, including cluttered background, appearance variations (e.g., illumination, pose, occlusion, resolution) among different camera views and interference of similar images with different identities. Fig. 1 shows images from different camera views on DukeMTMC-reID [1]. As seen, the images in the same camera view have similar background, while the background differs in different camera views. In addition, appearance variations, such as illumination and resolution, also lead to noise in the extracted person feature representation. Moreover, since person Re-ID can be seen as an  image retrieval task, there is an interference problem of similar negative samples in the retrieval precess. Many efforts have been made to address the challenges in person retrieval [2][3] [4][5] [6] [7]. However, most existing methods neglect the problem of background clutter which leads to degraded performance. Besides, these methods adopt the general neural network structure for Re-ID [2][3] [4]. However, there are usually large intra-personal appearance variations in person images. It is thus important to design more specific network structures to capture the fine-grained information from person images. Moreover, as person Re-ID is also an image retrieval problem, most existing Re-ID frameworks are optimized by contrastive loss or triplet loss [5] [8], which employ only one negative sample and one positive sample for an anchor at each iteration. As the ranking process in fact involves a set of samples, using the above loss functions may lead to poor results, which may be interfered by similar negative images.
To address the above mentioned problems, we develop a mask based deep ranking neural network with skipped fusing layer (MaskReID), as shown in Fig. 2. First, to reduce the impact of cluttered background, an image segmentation network is employed to obtain the segmentation results of a person image. The masked image with removed background is adopted as an additional input for feature extraction. Second, considering that person Re-ID is a special fine-grained image recognition task and the different layers of deep neural networks can extract low-, middle-and high-level features, we employ a skipped feature fusion layer scheme to fuse the multi-layer features in the deep neural network. This strategy can extract invariant person representation from different camera views, as it combines all low-level edge and shape in- The pipeline of the proposed method for person retrieval. The image segmentation network is firstly employed to obtain the segmentation results of a person image. Then a mask based deep ranking neural network with a skipped feature fusion layer is proposed to extract robust person features. Finally, a novel ranking loss is designed to train the overall deep neural network.
formation, middle-level structure information and high-level semantic information together. Besides, it can also better propagate the loss to lower layers of neural network for training, making the learning of low-level and middle-level features more accurate. Last, as person Re-ID is a ranking task, i.e., one person has multiple images from different camera views, a ranking loss function is developed to reduce the impact of similar negative samples when producing ranking results. Particularly, an anchor sample interacts with multiple positive and negative samples via exploiting the proposed ranking loss in each iteration. Together, the above three improvements give rise to a novel deep learning framework for person retrieval.
In summary, the major contributions in this work include: i) A novel deep learning framework is proposed, which accepts both the original and masked images as input. Besides, we develop a skipped feature fusion layer to extract robust features; ii) For the person retrieval task, a novel ranking loss function is proposed to further mitigate the interference issue of similar negative samples; iii) Extensive experiments on multiple benchmark datasets demonstrate the superiority of the proposed method when compared with the state-of-the-art methods. Moreover, through ablation studies, the efficacy of the proposed masked input, the skipped feature fusion scheme and the ranking loss is also verified.

MASK BASED DEEP RANKING NEURAL NETWORK
The framework of the proposed mask based deep ranking neural network is shown in Fig. 2. An image segmentation deep network is employed to capture person (foreground) region and remove the background. Besides, there is a feature fusion layer which merges the multi-level information of the proposed network to extract robust person representation. Lastly, a ranking loss is developed to optimize the proposed network, which aims to rank person images with the same identity at top positions in a training batch.

A New Mask Based Deep Neural Network Structure
Masked Input. Person images, captured under complex scenes (e.g., airport or station), have very messy background.
Besides, the images of different identities in the same camera view have similar background, while the background of the same identity differs in different camera views. These factors result in a challenge that the neural network cannot fully focus on foreground regions. The ideal feature extraction module should try to distinguish the silhouette of the person so as to focus more on the person region instead of the background. Thus it can improve the performance of person retrieval. Currently, image segmentation can effectively separate the foreground from the background. In this paper, Fully Convolutional Networks (FCN) [9] is employed to obtain the masked images. Particularly, for low quality images such as low resolution, poor segmentation results could be generated by the segmentation network. To address this issue, we employ both the original and masked images as the input of the proposed network. Skipped Feature Fusion Layer Structure. As for the network structure, the network of Xiao et al. [3], which has an inception structure, is adopted as the basic network. Especially, domain guided dropout, which is designed to activate the neurons from a special domain, is not utilized in the proposed framework. The proposed network structure is shown in Fig. 3. The two images are processed with several separated layers. Then the two separated features are concatenated and fed into a shared network with three levels, which extract the low-, middle-, and high-level features, respectively. The features of these three levels are fused by a skipped fusing layer to produce the merged feature. The benefits of using different levels of features have been proved in style transfer tasks [10]. In our experiments, we also validate the effectiveness of the scheme. This is because person retrieval is a special fine-grained image recognition task, and the network should focus on fine-grained person information. Fusing the features of three levels can bring more detailed features into consideration and thus improve the Re-ID performance. Another appealing property of this network structure is that it can propagate the loss to lower layers in a more efficient way, as lower layers may experience vanishing gradient issues.

Ranking Loss
Currently, for person retrieval, most existing deep-learningbased methods use classification loss or verification loss (e.g., triplet loss and contrastive loss) to train networks. However, person retrieval is in fact a ranking task. Hence, an anchor sample (a query image) needs to interact with multiple positive and negative samples in the retrieval process. We expect that samples having the same identity with the anchor sample should be ranked at top positions. Inspired by the Npair loss in [11], a novel ranking loss is developed for person retrieval. Define a batch for training a deep network, as B = {I 1 , ..., I |B| }. For any I k , k = 1, 2, ..., |B|, let B + and B − denote positive and negative image sets in B, respec- is the feature vector normalized by L2-norm. The N-pair loss for an anchor x k is defined as where S(x i , x j ) = x T i x j denotes the similarity between two images. x + k and x − j are positive and negative samples with x k , respectively. Different from existing contrastive loss and triplet loss, the N-pair loss interacts with multiple negative samples simultaneously, while it is only influenced by one positive sample at each iteration.
Considering the ranking process of person retrieval needs to consider not only multiple negative samples, but also multiple positive samples, we formulate a new ranking loss as (2) However, Eq. (2) needs to calculate |B + | × |B − | pairs of samples in a training batch. To reduce the computational cost, the most dissimilar positive sample of the query sample is chosen as a reference sample. Meanwhile, to prevent overfitting (i.e., too much attention is paid on predicted correct samples in the ranking), we only select some negative samples which have large similarity with the anchor. Moreover, considering that the similarity of the same identity should be large, we force the similarity between all positive samples and the anchor to be close to one (the largest possible similarity value, as features have been normalized by L2-norm). Thus, by rewriting Eq. (2), we get the final ranking loss for the proposed neural network as α is the margin. In Eq. (3), the first term guarantees the negative samples and the most dissimilar positive samples have a margin. The objective of the second term is to make all positive samples similar with the query image. λ is a parameter to balance the two terms.
Compared with the conventional verification loss, as shown in Fig. 4, the advantage of the proposed ranking loss is that it simultaneously considers multiple positive and negative samples for an anchor at each iteration. Thus, it can make the same ID images from different views closer to query images, and different ID images become farther.

Datasets and Evaluation Protocol
In this paper, we utilize multiple datasets including smallscale and large-scale datasets to validate the effectiveness of the proposed method. These small-scale datasets with few persons are collected by few cameras, such as VIPeR, 3DPeS, iLIDS, PRID, Shinpuhkan and CUHK01, as described in [3].
Rank-1 accuracy of CMC and mAP are adopted for performance evaluation on Market1501 and DukeMTMC-reID [13]. We only report Rank-1 accuracy on CUHK03 and all small-scale datasets. Following most of the related work [14] [15], all experiments on Market1501 are performed under single query and multiple query settings.

Implementation Details
Our experiments are done by Caffe with 1080ti (11GB). All small-scale datasets and CUHK03 are combined together to   For the small-scale datasets, we set the learning rate and iteration to 0.1 and 55, 000, respectively. In addition, we train the MaskReID with the proposed ranking loss by 20, 000 iterations on Market1501 and DukeMTMC-reID.
In the training stage, to construct the ranking task, we randomly select one person, then P images with the same identity are chosen randomly. Afterwards, N negative samples are sampled from N person randomly (i.e., one person has only one image). Therefore, in each batch, we can have more negative samples than conventional sampling schemes, which is more reasonable for the retrieval task. In the experiments, we set P/N to 10/54. Especially, if the chosen person has only k < 10 images, P/N is set to k/(64 − k).

Comparison with Related Methods
Small-Scale Datasets. For the small-scale datasets, all datasets are combined to train a model. The settings are the same with [3]. Since several persons only have two images, softmax loss is used for training our network (MaskReID). The proposed method is compared with different deep learning methods [8] [2][3] [4], and different loss function based methods [5][6] [7]. Experimental results are reported in Table 1. As seen, some observations can be made as follows: i) Performance varies on different datasets. In particular, the Rank-1 is up to 92.25% on the CUHK03. This may be because CUHK03 has more training images than other datasets. However, the relatively poor performance on VIPeR is partly because the images of VIPeR are of low resolution  Table 3: Comparison with the state-of-the-art methods on DukeMTMC-reID. Note that 1 st /2 nd best in red/blue.

Method
Rank-1 mAP LSRO [19] 67.68 47.13 SVDNet [20] 76.70 56.80 OIM [21] 68.10 -ACRN [22] 72 which makes the segmentation results poor; ii) The proposed method can achieve competitive results when compared with the state-of-the-art methods on several benchmark datasets. This confirms the effectiveness of our proposed MaskReID.
Large-Scale Datasets. The proposed method is also validated on Market1501 [13] and DukeMTMC-reID [1]. In this experiment, the proposed method is compared with a set of the state-of-the-art methods, i.e., DLPAR [16], Spindle [4], MSCAN [14], S2S [17], P2S [6], SSM [15] and JLML [18]. Experimental results are given in Table 2 and 3. From the two tables, we can observe that: i) Comparison with several part-based methods, such as MSCAN [14] and JLML [18], the proposed method has a competitive performance. Although MaskReID is a global method which extracts features from the global image, it attends more on the foreground region and fuses features of different layers to obtain the lowlevel detailed information and high-level semantic information from person images. Moreover, the proposed method outperforms DLPAR [16] that used attention mechanism and Spindle [4] that employed human pose information; ii) The proposed method consistently outperforms the state-of-the-art methods on large-scale datasets. Especially, on Market1501, Rank-1/mAP of the multiple query is up to 93.35/82.37%. As demonstrated, it can effectively learn a more discriminative feature representation for person retrieval; iii) Employing the re-ranking algorithm [23] can further improve the performance of our proposed method. Re-ranking algorithm [23] is commonly used for Re-ID, which can further enhance the performance of person retrieval via exploring the relationship of each sample in the ranking list. As can be seen in both Table 2 and 3, performance can be further improved. On Market1501, Rank-1/mAP of the single query is now up to 92.46/88.13%.

Ablation Studies
Effectiveness of Different Network Components. In this section, we validate the effectiveness of different network components. Table 4 shows the experimental results on multiple datasets. DGD is the original network framework. MaskReID is built on DGD with both masked image as input and the multi-level feature fusion. Compared with MaskReID, MaskReID-F and MaskReID-M denote the removal of the input masked images and multi-level feature fusion structure, respectively. By comparing with the reports on multiple datasets in Table 4, some observations can be made as follows: i) The fusion of multi-layer features is effective for the person Re-ID, i.e., MaskReID-F outperforms the original DGD. This demonstrates the effectiveness of the multilayer feature fusion in the proposed framework; ii) Using masked images can improve the performance of person Re-ID, i.e., MaskReID-M outperforms the original DGD. Employing masked images can reduce the impact of background clutter, and only focus on the person region; iii) MaskReID, including masked input and stacking the multi-layer features, further improves the performance of the person Re-ID. In summary, the experimental results are consistent with the analysis in Section 2.1. Effectiveness of the Ranking Loss. In this part, we utilize different loss functions, including softmax loss, triplet loss, N-pair loss and the proposed ranking loss, to train the proposed network on Market1501. Specifically, we train our model with triplet loss by online hard sample mining and uti-lize the same parameters (e.g., the number of iterations, learning rate, batch size, etc.) for all loss functions. Table 5 reports the experimental results. We can observer that: i) N-pair loss outperforms the triplet loss. Compared with the conventional triplet loss, N-pair loss interacts with one positive sample and multiple negative samples; ii) The proposed method has better performance than N-pair loss and triplet loss. This validates the analysis in Section 2.2.

Evaluation of Parameters in Ranking Loss
In this section, parameters of the proposed ranking loss function are analyzed, i.e., parameters in Eq. (3). From Table 6, we can observe that: i) when λ is set to 0, i.e., removing the second item in Eq. (3), the performance is poor on mAP. This demonstrates that enhancing the similarity between all the positive images and the query image in the optimization process is useful; ii) In addition, when λ increases to values larger than 2, the performance decreases slightly. This implies that focusing too much on the second term of Eq. (3) could hurt the performance. We need a reasonable λ to balance the two terms in Eq. (3); iii) The results of setting α to 0.1, 0.15 and 0.2 are similar, with the results of 0.2 slightly better. As a margin parameter, α should not be too large as an over-large α may easily lead to overfitting problems. When α is over-large (say ≥ 0.5), there will be excessive penalty from the loss function while optimizing the weights of the proposed network. In conclusion, we set λ/α to 1/0.2 in all experiments.

CONCLUSION
In this paper, a mask based deep ranking neural network is developed to deal with person retrieval. First, to reduce the impact of messy background in different camera views, the masked images together with the original images are used as input. Second, to obtain more discriminative information, we can combine low-, middle-and high-level features to form a merged feature. Third, we put forward a novel ranking loss function to optimize the weights of the network to further alleviate the interference of similar appearance in person retrieval. Results on various datasets, including both small-scale and large-scale datasets, show the effectiveness of the proposed method compared with a set of state-of-the-art methods.