## 2 Methodology
### Convolutional Neural Network Architecture  
For our study, we built a deep neural network that utilizes convolution and pooling operations, which have proven to be very effective on problems regarding image classification. Classic feature extraction techniques, used in computer vision, required the manual feature selection in order to find the appropriate feature to utilize. Convolutional Neural Networks (CNN), a subcategory of Artificial Neural Networks (ANN), can do this automatically by applying multiple filters on the input images, and then learn to select the ones that are necessary for the images' proper classification.  
A typical structure of a CNN is to start with a convolutional layer, followed by a pooling layer, repeating this combination as many times as necessary, continuing with one, or more fully-connected layers, before ending with the final output layer. Additionally, a dropout layer can be added after either a dense layer, a fully connected layer, or a pooling layer.  
In our implementation we built a deep-layer network with five convolutional-pooling layers, a dense layer followed by a dropout layer, and finally, the output layer with one node since it is a binary classification. A layout of the network's architecture along with the layers' shapes and the number of trainable parameters, is given in Table 4. A more detailed figure of the proposed CNN is presented in the Appendix A.  
\begin{table}
\begin{tabular}{c c c} \hline _Layer (Type)_ & _Output Shape_ & _Param \#_ \\ \hline conv2d\_1 (Conv2D) & (None, 254, 254, 32) & 896 \\ max\_pooling2d\_1 (MaxPooling2) & (None, 127, 127, 32) & 0 \\ conv2d\_2 (Conv2D) & (None, 125, 125, 64) & 18,496 \\ max\_pooling2d\_2 (MaxPooling2) & (None, 62, 62, 64) & 0 \\ conv2d\_3 (Conv2D) & (None, 60, 60, 128) & 73,856 \\ max\_pooling2d\_3 (MaxPooling2) & (None, 30, 30, 128) & 0 \\ conv2d\_4 (Conv2D) & (None, 28, 28, 256) & 295,168 \\ max\_pooling2d\_4 (MaxPooling2) & (None, 14, 14, 256) & 0 \\ conv2d\_5 (Conv2D) & (None, 12, 12, 512) & 1,180,160 \\ max\_pooling2d\_5 (MaxPooling2) & (None, 6, 6, 512) & 0 \\ flatten\_1 (Pattern) & (None, 18,432) & 0 \\ dropout\_1 (Dropout) & (None, 18,432) & 0 \\ dense\_1 (Dense) & (None, 512) & 9,437,696 \\ dense\_2 (Dense) & (None, 1) & 513 \\ Total params: 11,006,785 & & \\ Trainable params: 11,006,785 & & \\ Non-trainable params: 0 & & \\ \hline \end{tabular}
\end{table}
Table 4: The selected convolutional neural network (CNN) architecture.  
The images enter the network at a \(256\times 256\) pixels dimension. The first (input) convolutional layer consists of 32 filters (kernels) of size \(3\times 3\), always followed by a max-pooling layer of size \(2\times 2\), which chooses the maximum value of each consecutive four (\(2\times 2\)) pixels. Each next convolutional layer doubles the numbers of filters (\(32\to 64\to 128\to 256\to 512\)), just like the following max-pooling layers. After the convolution and pooling operations, a flattening operation transforms the 2-dimensional matrices, to 1-dimensional arrays in order to run through the hidden, fully connected (dense) layer with 512 nodes. Following, a dropout layer drops randomly 20% of the learned weights in order to avoid overfitting. Last is the output layer with one node, since we are dealing with binary classification.  
The activation function that is used in all convolutional and fully connected (dense) layers is the rectified linear unit (ReLU) and the final activation function is the sigmoid function. The algorithm is set to train for 100 epochs, however an early stopping function prevents the network to over-fit by stopping its training when the validation loss starts to increase and diverge from the training loss. For the loss, the binary cross-entropy function is calculated with an Adam optimizer [28], and accuracy is used as the measurable metric. For the model training, the ImageDataGenerator class [29] was used, offering augmentations on images such as rotations, shifting, zoom and flips.