## 5 Methods
### Custom CNN with Handcrafted Features  
Artificial neural networks (ANNs), inspired by brain connections, are designed to solve complex real-world problems. ANNs have simple architectures organized in layers, each of which is composed of functional units called neurons (or nodes), which are connected by arcs that simulate synaptic connections [57]. Each layer extracts meaningful representations for the problem at hand from the data and processes them before sending them to the next layer. The learning process of a neural network is iterative and relies on adjusting the weights associated with the connections between neurons; changing the weights is based on experience gained in previous iterations. Convolutional neural networks (CNNs or ConvNets) are artificial neural networks that specialize in computer vision and are inspired by the biological neural networks of the visual cortex [58]. Their structure involves an input, i.e., an image, a feature learning block in which the various hidden layers are responsible for feature extraction, and finally, the output. Each layer consists of elementary computational units that communicate through weighted connections. CNNs are suitable for the field of computer vision precisely because, unlike ANN, they have the units organized in three dimensions (width, height, and depth) and also are connected to only a portion of the previous layer. Layers in CNNs may or may not have trainable parameters; in the latter case, they simply implement functions. The most frequently used types of layers in CNNs are [59]:  
* **Convolutional layers**: Convolutional layers are able to learn local patterns invariant to translation, so that any pattern learned within the image can be recognized even if it is in a different spatial location, and the learning extends to spatial hierarchies of patterns: i.e., the layers learn larger and larger patterns starting from the features of previous layers. This allows the convnet to efficiently learn increasingly complex visual concepts. Convolutional layers contain a series of filters that during the forward phase are run on the input by performing the convolutional (or rather, cross-correlation) operation--that is, the scalar product between the two matrices--from time to time. The result is an m-dimensional feature map, with m equal to the number of filters applied to each layer. The output of the convolution is processed using nonlinear activation functions, such as Hyperbolic, Softmax, Rectified Linear Unit (ReLU), Exponential Linear Unit (ELU), and Scaled Exponential Linear Unit (SELU). * **Pooling layers**: Pooling layers aim to sub-sample feature maps by keeping the main information contained in them in order to reduce the number of model parameters and the computational cost. To do this, convolution is again performed between the input image to the layer and a new filter, but in this case, the overlap between the matrices is avoided. The most commonly used pooling filters use mean pooling, the result of which is a matrix in which each value is the average of the submatrices of the source image, and max pooling, the result of which is a matrix in which each value is the maximum value of the submatrices of the source image. The hyperparameters of the pooling layers are the filter size and pitch. * **Normalization layers**: Normalization layers are layers for normalizing input data by means of a specific function that does not provide any trainable parameters and only acts in forward propagation. Their contribution is also to reduce the problem of overfitting. * **Fully connected layers**: Fully connected layers are layers in which all neurons are connected to all neurons in the previous layer; that is, they use the global connectivity property. The output of such layers is a \(1\times 1\times\) k vector--where k is the number of neurons hosted--containing the activations computed for each neuron. Generally, multiple fully connected layers are used in sequence, the last of which has the parameter k equal to the number of classes in the dataset.