# Convolutional Neural Networks for Off-Line Writer Identification Based on Simple Graphemes
## 4 Experiments with Convolutional Neural Networks
### Experiments with Rectified Simple Grapheme Images  
In this experiment, the images of the rectified graphemes obtained by [PERSON] et al. [15] are used, these are rectangular images in single channel grayscale of the form \(w\times h\times 1\) with \(w\) much greater than \(h\) (50 \(\times\) 700 approximately). Then, these images must be resized according to the corresponding CNN input layer, for AlexNet it is 227 \(\times\) 227 \(\times\) 3 and for VGGs and ResNet it is 224 \(\times\) 224 \(\times\) 3. The process consists of first resizing the rectangular image of a channel to a square image of \(n\times n\times 1\) (\(n=224\) or \(n=227\)). The grayscale image is then converted into an RGB image, using the same matrix for the three channels, as shown in Figure 6. This is to adapt the image to the input layer of the previously trained network. Tables 4-7 show the experiments with AlexNet, VGG-16, VGG-19 and ResNet-18 networks, respectively. For each network, experiments have been carried out with a different number of epochs, but the table shows the smallest number of epochs that gives the best result on validation set (there comes a time when increasing the epochs does not improve the accuracy). Training and test time are expressed in seconds (s). For the AlexNet, VGG-16 and VGG-19 networks considered, the rectified graphemes have an average yield close to 90%, the training took 80 epochs. For the ResNet-18 network, the accuracy results are lower than those of the previous ones, despite training with a more epochs (100 epochs) and from this point on, the increase in the number of epochs does not improve results. The moderate level of performance is explained because a lot of information is lost when transforming the image of the rectified grapheme to the input format of the CNN networks. \begin{table}
\begin{tabular}{c c c c c c c c} \hline \hline \multirow{2}{*}{**Strokes**} & \multicolumn{3}{c}{**Training**} & \multicolumn{3}{c}{**Validation**} & \multicolumn{3}{c}{**Test**} \\ \cline{2-7}  & **Accuracy** & **Time (s)** & **Loss** & **Accuracy** & **Loss** & **Accuracy** & **Time (s)** \\ \hline “C” & 98\% & \(3.3887\times 10^{3}\) & 0.0331 & 90\% & 0.4201 & 93\% & 0.6226 \\ “\(\sim\)” & 98\% & \(2.7596\times 10^{3}\) & 0.0307 & 86\% & 0.5061 & 89\% & 0.6210 \\ “\(\cap\)” & 100\% & \(2.7833\times 10^{3}\) & 0.0147 & 91\% & 0.4291 & 92\% & 0.6262 \\ “S” & 100\% & \(2.6778\times 10^{3}\) & 0.0054 & 91\% & 0.4042 & 88\% & 0.6035 \\ “U” & 98\% & \(2.8385\times 10^{3}\) & 0.0245 & 92\% & 0.3004 & 93\% & 0.5738 \\ \hline Grouped & 100\% & \(2.1066\times 10^{4}\) & 0.0271 & 90\% & 0.4195 & 90\% & 2.3997 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Rectified Simple Grapheme-AlexNet (epoch = 80). Figure 6: Rectified Simple Grapheme Resizing Process for Pretrained CNN Input. Figure 7 shows the test accuracy of applying the pre-trained CNNs to the rectified graphemes. It is observed that AlexNet, which is the simplest neural network, has the best results in general. Results get worse as network size increases. Figure 8 shows the network training times for each rectified grapheme. The AlexNet and VGG16/VGG19 networks of similar architecture, as is known, the execution time increases as the depth of the network increases (epochs = 80). For ResNet-18, despite having trained with a greater number of epochs (epochs = 100) and being similar in depth to the VGGs, the training time is much less similar to that of AlexNet, which is due to the fact that it trains significantly fewer parameters than the other networks.