# Convolutional Neural Networks for Off-Line Writer Identification Based on Simple Graphemes
## 4 Experiments with Convolutional Neural Networks  
This section describes the experiments carried out with simple graphemes and the pretrained CNNs AlexNet, VGG-16, VGG-19 and ResNet-18, performing learning transfer modality.  
Two variants of the grapheme image are considered for the experiments. The first one consists of the rectified grapheme, which is the approach used in most articles that work with simple graphemes. The second one consists of the RGB image of the original grapheme, in order to carry out experiments without transforming the original image. All the images used in this article make up the LITRP-SGDB database (LITRP- Simple Grapheme Data Base), which is available for download under the signature of a license agree form on the official site of the database [[http://www.litrp.cl/repository.html#LITRP-SGDB](http://www.litrp.cl/repository.html#LITRP-SGDB)]([http://www.litrp.cl/repository.html#LITRP-SGDB](http://www.litrp.cl/repository.html#LITRP-SGDB)).  
Figure 4: General architecture of AlexNet, VGG-16, VGG-19 and ResNet-18.  
The rectification procedure is composed of a sequence of simple image processing operations that are graphically represented in Figure 5. The operations sequence is explained in detail in Reference [15], and can be summarized as follows:  
* Convert the color image of the grapheme to a grayscale image using the achromatic component V, or V channel of the HSV model, generating a single channel grayscale image [30].
* Binarize the grayscale image of the V channel using the well-known Otsu algorithm [31].
* Obtain the morphological skeleton of the binary image of the H channel (white line in Figure 5b).
* Obtain the lines perpendicular to the morphological skeleton (black lines in Figure 5b).
* Finally, build an image with the pixels of the grayscale image that lie on the perpendicular lines.  
Figure 5c shows the resulting image from the rectification process. It is important to note that this rectified image, being grayscale and not including background pixels, dramatically reduces the dimensionality of the color image of the original grapheme.  
In the neural networks constructed, the input corresponds to one of the two representations of the image and the output corresponds to a vector of 50 elements to represent the number of people that form the repository. In the training of the CNNs, 3 sets (Training, Validation and Test) are considered and balanced training sets are created per class. This process consists of: First taking the original set of images for a grapheme, dividing it randomly into the Training (80%), Validation (10%) and Test (10%) sets. Second, to avoid bias or imbalance in the network training, the Training set, the number of samples per person is equated to the smallest number that one of the people contains. This process is carried out for each grapheme individually, as well as for the rectified graphemes as for the original ones, in order to have sets with the same number of samples. Table 3 shows the number of samples from the training, validation and test sets by grapheme. The last row shows the composition of the sets grouping all the person's graphemes.  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline \multirow{2}{*}{**Strokes**} & \multicolumn{3}{c}{**DataTraining**} & \multirow{2}{*}{**DataValidation**} & \multirow{2}{*}{**DataTest**} \\ \cline{2-2} \cline{4-5}  & **Samples** & & & \\ \hline \({}^{\text{\text{\text{\text{\text{\text{\text{\text{\text{\text{\text{\text{ \text{\text{\text{\text{\text{\text{\text{\text{\text{ \text{  }}}}}}}}}}}}}}}}  
To carry out the experiments, the MatLab Deep Learning Toolbox [17] was used, which provides a framework for designing and implementing deep neural networks with algorithms, pre-trained models, and applications.The experiments were carried out with a computer server of the following characteristics: 2x Intel Xeon Gold 6140 CPU @ 2.30 GHz, 36 total physical cores, 24.75 MB L3 Cache Memory 126 GB, Operatin System Debian GNU/Linux 10 (buster) Kernel 4.19.0-10-amd64 x86_64.