# A Framework for Pedestrian Attribute Recognition Using Deep Learning
## 4 Experiments
### Results and Discussion  
For experimenting with the CNN architecture for the pedestrian attribute recognition task, we split the RAP v2 dataset into training, testing, and validation data with a split ratio of 6:2:2 (50,862:16,951:16,953). There are 69 binary attributes and three multi-class attributes in the dataset. However, for comparing our work with previous works [1; 25; 48; 49], we experimented with 54 binary attributes as in other works. Additionally, the split ratio is chosen for maintaining consistency with previous results. The image dimension is chosen \(150\times 150\times 3\) for our proposed framework. The reason behind it is to reduce the computation cost as larger image size increases the parameters of the CNN architecture. Hence, it also increases the computation cost. Additionally, to avoid overfitting the CNN architecture and making a better generalization for the pedestrian attribute recognition task, we applied different augmentation techniques, i.e., horizontal shift, vertical shift, rotation, shearing, and horizontal flip. Examples of these different augmentation techniques are shown in Figure 10.  
Many robust CNN architectures are developed which can be used for different computer vision tasks. We experimented with powerful CNN architectures for the pedestrian attributes recognition task, i.e., Inception ResNet v2, Xception, ResNet 152 v2, ResNet 101 v2. For maintaining consistency, the experiments on these architectures are performed with the same hyperparameters. All the layers are frozen for applying the transfer learning technique. The selection of the hyperparameters is discussed further in this section. The comparison of the pre-trained models on the RAP v2 dataset is shown in Table 2. The table shows that ResNet 152 v2 CNN architecture performed better than other CNN architectures for recognizing the pedestrian attributes. After selecting the ResNet 152 v2 architecture as our primary architecture, we performed a vivid experiment to improve the results. A transfer learning technique requires freezing layers, which means that the weights of the frozen layers will not be updated while training the CNN architecture. In our proposed framework, we also froze some layers and experimented with them. The experimented results are shown in Table 3. The results show that Model 5 performed best among other experiments with 93.41% mA. Model 5 is obtained by freezing all layers except the last 14 layers (excluding the fully connected layers) of ResNet 152 v2 CNN architecture. The hyperparameter selection is the same as before. We used a dense layer of 1024 nodes in all cases and 40 epochs per experiment for consistency. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Pre-trained Models** & **Trainable Parameters** & **Nodes in Dense Layer** & **Test Accuracy (\%)** \\ \hline Xception & 2.1 M & & 91.56 \\ Inception ResNet V2 & 1.6 M & & 91.61 \\ ResNet 101 V2 & 2.1 M & & 92.11 \\
**ResNet 152 V2** & 2.1 M & & **92.14** \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Comparison of the pretrained models on the RAP v2 Dataset. Figure 10: Example of augmentation techniques: (**a**) original image; (**b**) width shift by 20%; (**c**) height shift by 20%; (**d**) rotation by 25 degree; (**e**) shearing by 20%; (**f**) horizontal flip. Additionally, we also experimented on the effect of normalization on our proposed framework. The performance comparison of the ResNet 152 V2 architecture on normalized and unnormalized data are represented in Table 4.  
Table 4 shows that our normalized data did not perform better than unnormalized data. The reason behind it is that we have already scaled our image data in the range [0, 1]. Thus, the task of normalization is already is done by scaling. This is why the normalization of the image data did not have much effect. In addition, scaling made the convergence faster in our proposed architecture as we used a larger learning rate. In the previous section, we discussed the data oversampling technique as well as weighted binary cross-entropy loss.