# Attention-Aware Adversarial Network for Person Re-Identification
## 3 Method
### Attention-Aware Adversarial Network  
Established on the attention assignment network, the generated attention map is further integrated with the representative feature maps of the input person image, aiming to assign more attentions to the interesting regions besides the most important one. The framework of the attention-aware adversarial network for final person re-ID is illustrated in Figure 3. This is also a two-stream network, in which the common convolution modules are fine-tuned by the parameters of the attention assignment network pre-trained in Section 3.2. For one stream, the attention map is generated from the input person image. Attributed to the pre-trained network in Section 3.2, instead of only highlighting the most attentive regions, the attention map is able to assign attentions to nearly all target regions of the input person  
Figure 2: The attention assignment network. fm1 represents that the first part of the feature map is occluded, and s1 represents the classification probability of fm1. An occlusion feature map with the lowest classification probability is selected to guide the generation of the attention map according to the adversarial loss. image. For the other stream, the attention map is integrated with the representative feature maps of the person image by an element-wise multiplication operation. The generated feature maps are known as attention-aware feature maps and are occluded by the attention mask. Together with the original representative feature maps, the occluded attention-aware feature maps are entered into the subsequent classification network. Not only will we update the parameters of the attention mask again by the switchable gradient update mechanism, but also we will update the entire baseline synchronously. The switchable gradient update mechanism is realized by the parameter of \(\omega\), which is detailed in Section 4.3. We focus on the feature maps to produce occlusions and might simply abide by the identical strategy to generate occlusions on feature maps with a square mask. Nevertheless, we consider that there may be multiple regions in the feature maps, for instance both the satchel and the T-shirt have equally significant effects when the classifier makes decisions. Consequently, we make use of a flexible policy to solve this weakness. The implementation details are as follows. We use the raw feature maps and occluded feature maps as the inputs for the rest of the CNN network. These feature maps are used to calculate the predicted probability of classification. In this stage, the two parts of our network are jointly optimized. The loss function of the model on these samples is computed by the cross-entropy. The procedure is shown in Algorithm 2. ```
1:Nperson images;
2:While\(N>0\)do
3:The feature maps obtained by the pre-training attention assignment mechanism are used as 0-1 attention mask;
4:The feature maps of the middle layer multiplied by the 0-1 mask as occluded feature maps;
5:The occluded feature maps are entered into the classification network along with the original feature maps to obtain \(p_{bf}\), which is the classification probability of the original feature maps, and \(p_{af}\), which is the classification of occluded feature maps;
6:Update parameters of the entire network by combining \(p_{bf}\) and \(p_{af}\) with adversarial loss;
7:\(N\gets N-1\);
8:end
```  
**Algorithm 2** The training strategy of the attention-aware adversarial network. Figure 3: The attention-aware adversarial network. The entire adversarial loss function is formulated as follows:  
\[L=\left\{ \begin{array}{cc}\lambda_{1}\cdot L_{1}+\lambda_{2}\cdot L_{2},&\quad if \quad p_{bf}-p_{af}>\omega\\ 0,&\quad otherwise\end{array} \right. \tag{4}\]  
where \(\lambda_{1},\lambda_{2}\) are the constants, which are obtained by heuristic methods, respectively, and \(L_{1},L_{2}\) are the same as the pre-training adversarial loss function (1) in which \(L_{1}\) represents a regularization term and \(L_{2}\) represents \(\mathcal{L}_{att}\).