{'fraction_non_alphanumeric': 0.03753268727888017, 'fraction_numerical': 0.01692047377326565, 'mean_word_length': 4.709601873536299, 'pattern_counts': {'":': 0, '<': 0, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Multi-layered Semantic Representation Network for Multi-label Image Classification

Multi-label image classification (MLIC) is a fundamental and practical task, which aims to assign multiple possible labels to an image. In recent years, many deep convolutional neural network (CNN) based approaches have been proposed which model label correlations to discover semantics of labels and learn semantic representations of images. This paper advances this research direction by improving both the modeling of label correlations and the learning of semantic representations. On the one hand, besides the local semantics of each label, we propose to further explore global semantics shared by multiple labels. On the other hand, existing approaches mainly learn the semantic representations at the last convolutional layer of a CNN. But it has been noted that the image representations of different layers of CNN capture different levels or scales of features and have different discriminative abilities. We thus propose to learn semantic representations at multiple convolutional layers. To this end, this paper designs a Multi-layered Semantic Representation Network (MSRN) which discovers both local and global semantics of labels through modeling label correlations and utilizes the label semantics to guide the semantic representations learning at multiple layers through an attention mechanism. Extensive experiments on four benchmark datasets including VOC 2007, COCO, NUS-WIDE, and Apparel show a competitive performance of the proposed MSRN against state-of-the-art models.


Introduction
Multi-label image classification (MLIC) deals with assigning multiple labels to each image, and it has been applied in many fields, including multi-object recognition [12], medical diagnosis recognition [9] and Person re-identification [21]. The recent progress is mainly made by exploiting label correlations and learning semantic representations with deep learning models.
Modeling label correlations has been long studied in multi-label classification and has been demonstrated very effective because correlated labels are highly likely to co-occur [5]. For an image recognition task, deep learning models, especially convolutional neural networks (CNNs), have been widely recognized as state-of-the-art models. Hence, many recent approaches to MLIC are based on deep learning models and exploiting label correlations, e.g., [5,2,18]. In these approaches, an existing deep learning model is usually employed as a tool to transform a raw image into a high-level abstract representation. But objects of interest may only be in certain regions of an image. Therefore, some studies [25,32,3,4,29] utilize semantics of labels to guide the learning of semantic representations of images. The semantic representations are expected to only cover the regions of interest, and thereby improve the classification performance. This paper advances this research direction by improving both the modeling of label correlations and the learning of semantic representations. On the one hand, unlike existing approaches only learn local semantics of each label, we propose to further explore global semantics shared by multiple labels. The global semantics can effectively capture high-order correlations among multiple labels. On the other hand, existing approaches mainly learn the semantic representations at the last convolutional layer of a CNN. But it has been noted that the image representations at different layers of CNN capture different levels or scales of features and have different discriminative abilities [1,11,8,27]. Therefore, better performance might be achieved by simultaneously exploiting features at multiple layers of a CNN.
To realize the proposals mentioned above, we design a novel Multi-layered Semantic Representation Network (MSRN). MSRN generates both label-specific and group embeddings which capture local semantics and global semantics respectively, and then combines them with multiple layers of a CNN by an attention mechanism to learn label and group shared semantic representations of images. To be specific, first, we introduce LGE (Label-Group Embedding) module to capture both local semantics of each label and semantics of a group of labels in embeddings based on the label co-occurrence graph. Second, we propose SGA (Semantic Guided Attention) module to explicitly guide the CNN to focus on the regions of interest. Third, we design a framework to combine the LGE module with the multiple layers of a CNN through the attention mechanism built in the SGA module. We conduct experiments on four benchmark multi-label image datasets including COCO, VOC 2007, Apparel and NUS-WIDE. The experimental results show that our method outperforms state-of-theart approaches.
The contributions of this paper are summarized as follows: • A Multi-layered Semantic Representation Network (MSRN) is designed for multi-label image classification. • Second-order and high-order label correlations are considered simultaneously to improve the performance of multi-label image classification. • Semantic representations are learned at multiple layers through an attention mechanism by modeling label correlations.
The rest of the paper is organized as follows. Section 2 introduces related work. Section 3 presents the proposed method. Section 4 presents empirical evaluation. Section 5 concludes this paper and introduces future work.

Related Work
In MLIC, images are annotated with multiple labels simultaneously where labels usually have correlations. It has been demonstrated that exploiting label correlations can significantly improve the performance [31]. Recent progress has been made by employing deep learning models, especially convolutional neural networks. Wang et al. [22] extract label semantics and associate it to Recurrent Neural Network (RNN). In addition, Lee et al. [14] apply knowledge graphs to exploit the label dependencies based on the label co-occurrence graph. ML-GCN [5] learns the semantic label embeddings through Graph Convolution Network (GCN), and applies it as inter-dependent object classifiers at the prediction stage. In [23], a label graph superimposing framework is proposed to exploit label correlations. The label graph is constructed by superimposing statistical label graph into knowledge prior oriented graph, which, however, is usually unavailable in real applications.
Some studies further locate regions of interest because each class label might be determined by some specific regions of an image. Examples include [33] [26] which apply bounding box to focus on the regions of proposal. To learn regions with arbitrary boundaries, more studies propose attention based methods where attention is a spatial weight map representing relative importance among pixels [11]. SRN [32] is an end-to-end CNN model which trains learnable convolutions on the attention maps of labels. In LGE module which can output the label and the group embeddings capturing label semantics and group semantics, respectively. Then, the SGA module produces label-level semantic representations and group-level semantic representations of the image by combining each image feature map from each branch with the learned label and group embeddings through an attention mechanism. At last, we concatenate the generated semantic representations and apply fully connected layers to perform the classification.
Recently, some methods [29] [5] [4] apply Graph Neural Network (GNN) techniques to generate semantic label embeddings which can be utilized as visual attention for multi-label image classification. You et al. [29] propose a method of computing cosine similarity between label embeddings to exploit label dependencies. Chen et al. [4] apply a GNN with graph propagation mechanism to exploit the interaction between DNN and label dependencies. Despite having achieved high performance on multi-label image classification, these methods do not explicitly consider high-order label dependencies which may result in semantics shared by a group of labels [31]. Moreover, to the best of our knowledge, no existing approaches utilize image representations extracted from multiple layers of a CNN.

Architecture
The architecture of the proposed MSRN is shown in Figure 1. We design an LGE module to generate label and group embeddings with the input of a graph is the feature matrix of labels where v i is a vector of features and n is the number of labels, and A = {a ij } n i,j=1 is the adjacency matrix about label co-occurrence. The outputs of LGE module are label embeddings where m is the number of groups, and d is the dimension of the embeddings.
The backbone in our framework can be any kind of CNNs, such as VGG [19], ResNet [10] and DenseNet [8]. In this paper, Resnet-101 is chosen for experiment. Given an input image, indicates the output image features of different branches, where B is the total number of branches, and The branches marked as blue lines in Figure 1 are used to receive the image feature map f b from corresponding layers in the CNN. We provide three branches in our work to receive the output image features from the last layer of the last three blocks of Resnet-101. Since the channel C b of image features from different layers of CNN are distinct, we use a convolutional layer with 1×1 kernel to project image features from which has the same dimension d as the label embeddings E l and group embeddings E g .
Then we propose an SGA module to position-wisely combine the image feature maps with label embeddings E l and group embeddings E g . The outputs of SGA module are label semantic where o b ∈ R n×d and q b ∈ R m×d . Some of the existing approaches utilize the label-specific representation for each label. But since in real applications the labeling results of a dataset usually have noisy or missing labels, the label-specific semantic representation might not be sufficient enough to predict correct labels. Therefore, in the final stage of our framework, we concatenate the generated label and group shared semantic representations into M = [O||Q], and apply fully connected layers to perform the prediction where the cross entropy loss function is adopted as follows: where y i is equal to 1 or 0 for image i in terms of a certain label,ŷ i is the output of fully connected layer, and σ(·) is the sigmoid function.

Label-Group Embedding Module
Since label correlation is important information in multi-label image classification as we mentioned in section 1, we build a Label-Group Embedding (LGE) module to generate semantic label embeddings E l and group embeddings E g .

Semantic Label Embeddings
Graph attention Networks (GAT) [20] is a self-attention based model which is most frequently used for learning embeddings of graph-structured data. With GAT algorithm, we can obtain the semantic label embeddings E l from the label graph G. In our model, GAT first produces the attention coefficient α ij between the i-th and j-th label as follows: where P ∈ R 1×2w and U ∈ R w×v are two learnable weight matrices, N i is the set of neighborhoods of label i in the graph, and || represents the concatenation operation. The negative input slope in LeakyReLU is set to be 0.2 in our work. Then, we can obtain label embeddings from the first GAT layer by linearly combining attention coefficients α with the transformed label features: where the σ(·) is non-linear activation function which is ELU in our method. For simplicity, GAT t (·) is used to represent the t-th GAT layer that consists of equations (2) and (3), and the semantic label embeddings E t l can be generated by the following equation: where E 0 l = V is the original feature matrix of labels.

Semantic Group Embeddings
Differentiable graph pooling (Diffpool) [28] is a graph clustering algorithm that soft map graph nodes to a set of clusters. Once we capture the semantic label embeddings E l , we can apply Diffpool to generate semantic group embeddings E g as E g = Diffpool(E l , A).
Moreover, in order to learn more compact group embeddings, we try to minimize the distance between the group embeddings E g and the labels embeddings E l as follow where C k indicates the k-th cluster of labels which are highly correlated labels.

Semantic Guided Attention Module
The aim of SGA module is to utilize the semantic embeddings E l and E g to guide the learning of semantic representations of images at different branches. As the feature contained in each position (w, h) of an image feature map could be correlated to the semantics of the label embeddings, we propose a position-wise attention mechanism to fully combine the image feature space and the semantic embedding space. Similar to existing studies [13,4], we adopt the Hadamard product between each position (w, h) of an image feature map from the b-th branch and the label, group embeddings to calculate the attention weights as where the is Hadamard product, sl bw,h ∈ R 1×1×n×d and sg bw,h ∈ R 1×1×m×d . Then we apply normalization to the computed compatibility scores x,y exp(sl bx,y ) , ag w,h b = exp(sg bw,h ) x,y exp(sg bx,y ) .
Once obtained the normalized compatibility scores, we apply the second Hadamard product to generate position-wise attention maps.
Finally, we concatenate the local semantic representations O={o b } B b=1 ∈R n×(Bd) and group shared semantic representations Q={q b } B b=1 ∈R m×(Bd) and predict the labels bŷ y i =f c 2 (LeakeyReLU(f c 1 (tanh(M )))), where M =[O||Q], f c 1 and f c 2 are fully connected layers. The total training loss is L 1 + λL 2 , where λ is a regularization parameter.

Empirical Evaluation
In this section, we will describe the implementation details of our proposed model MSRN and the experimental results.

Implementation Details and Evaluation Metrics
The input label features V are 300-dimensional Glove features pretrained on Wikipedia dataset. The backbone ResNet-101 is pretrained on ImageNet for accelerating training process. We remove the last average pooling layer and classifier of Resnet-101 and apply the MaxPooling with kernel size 2 × 2 and stride 2 to obtain image features, F , from last three building blocks of ResNet-101. The output dimension of f c 1 is 2048, and the output dimension of f c 2 is the same as the number of labels. In addition, to reduce the impact of branches corresponding to lower layers of the backbone on gradients, we add a buffer convolutional layer [1] with kernel size 1 × 1 and stride 1 before we obtain image features from the last two branches. Both the output feature dimension of first GAT layer and input feature dimension of second layer are 300 and the output feature dimension of second GAT layer is 512. The number of groups of labels m is set as 4. The regularization parameter λ is set to 0.001. The input image is resized to 448x448 for both training and testing. We train our model on one Tesla V100-16GB GPU and set the batch size to 8. For optimization, we apply SGD as optimizer with momentum 0.9 and weight decay 10 −4 . The initial learning rate is set to 0.01 and the learning rate decay by 0.1 each 30 epochs in total 90 epochs 1 .
The evaluation metrics we used in our experiments include mean average precision (mAP) over all categories, precision (CP, OP), recall (CR, OR), and F1 score (CF1, OF1).

Experimental results
VOC2007 [7]: We compare our method with ResNet-101 [10], CNN-RNN [22], AR [3], ML-GCN [5], FGCN [24], SSGRL [4]. Following [4], we also pretrain our model on the MS-COCO dataset.  The results of all the methods are shown in Table 1. We can see that the result of MSRN(pre) is 2%, 1.9%, and 1% better than ML-GCN [5], FGCN [24], SSGRL [4] on mAP respectively. It should be noted that the input image size of SSGRL(pre) is 576×576 which is larger than ours. Our model also achieves the best AP score on 17 categories. The results definitely demonstrate the effectiveness of modeling multi-layered semantic representations. [16]: The comparison results on MS-COCO dataset are shown in Table 2. We compare our method with ResNet-101 [10], ML-GCN [5], FGCN [24] and CMA [29]. Our method can achieve 83.4% mAP score which is in the first rank. Our model achieves comparable performance with the state-of-the-art methods. Specifically, MSRN wins the second place in terms of mAP, CP, and CF1. For the results on top-3 labels, MSRN obtains the best performance in terms of CR, CF1, OR and OF1.

MS-COCO
NUS-WIDE [6] contains 269,648 images and 81 concepts. The dataset is split by following [29]. We compare MSRN with CNN-RNN [22], AT [30], S-CLs [17] and CMA [29]. As shown in Table  3, our model achieves 0.1% better than MS-CMA on mAP. In addition, MSRN achieves the best performance in terms of CF1, OF1 and CF1-3. Both our model and MS-CMA [29] extract image features from lower layers of CNNs, but our model outperforms it by 0.1%, 0.2%, 0.2% and 0.4% in terms of mAP, CF1, OF1 and CF1-3, respectively. Apparel 2 is a clothing dataset for multi-label image classification. We test our model on it and make comparisons with ResNet-101 [10], SSGRL [4] and ML-GCN [5]. In our experiment, we randomly select 50% images from the dataset for training, and other 50% images for testing. The result in Table 4 shows that our model achieves 99.65 mAP score. Our model is 0.18% better than ResNet-101 and 0.06% better than the current best model on mAP. Our model also achieves the best score on all metrics that we employ.

Ablation Studies
In this section, we perform ablation studies to evaluate the effectiveness of different components of our framework.
Label and Group Embeddings: To verify the effectiveness of label and group embeddings, we conduct experiments with three simplified versions of our proposed method MSRN, i.e., label-E (only using label embedding), group-E (only using group embedding), and no LGE module. The results shown in Table 5 clearly indicate the effectiveness of label and group embeddings.  Table 6. We can find that the multi-branch architecture can improve at least 0.12% compared to the single-branch architecture, and achieves the best performance with the last 3 branches.

Parameter Sensitivity
In this section, we study the sensitivity of MSRN to two hyper-parameters, i.e., the number of groups of labels m and the regularization parameter λ. Due to the limitation of space, we only present the analyses on VOC2007 dataset. For the number of groups m, we conduct experiments of six different cases corresponding to 2, 4, 6, 8, 10 and 20, respectively, with λ fixed as 10 −3 . The experimental results in Table 7 show that the performance in terms of mAP is not much sensitive to m. For λ, we study the values from {10 −1 , 10 −2 , ..., 10 −6 }. The results with different values of λ are shown in Table 7, which shows the performance is not much sensitive to λ.

Conclusion and Future Work
This paper proposes a novel Multi-layered Semantic Representation Network (MSRN) for multilabel image classification. MSRN for the first time considers both local semantics and global semantics of labels through modeling label correlations, and learns semantic representations of images at multiple layers of a convolutional neural network through an attention mechanism. Extensive experiments show that MSRN outperforms many state-of-art methods on VOC2007, MS-COCO, NUS-WIDE and Apparel datasets. In the future, we will improve our method to explicitly utilize labels which exist but are unobservable due to lack of labeling efforts.