# The Diagnostic Classification of the Pathological Image Using Computer Vision
## 4 Architectures, Features, and Advantages of CNNs
The fully connected layer connects every input to every output, combining all features learned by previous layers to produce the final output of the network. The network is trained using backpropagation and gradient descent to minimize a loss function. For a classification task, the cross-entropy loss is commonly used:  
\[L=-\sum\!y!i\ log(y) \tag{5}\]  
These formulas represent the core operations in a CNN. The power of CNNs comes from stacking multiple convolutional and pooling layers, allowing the network to learn hierarchical features from the input data. This architecture enables CNNs to excel at tasks like image classification, object detection, and other computer vision applications. In addition, CNNs excel in various domains, particularly those involving visual data as follows:* Image classification and recognition;
* Object detection;
* Medical image analysis;
* Facial recognition;
* Natural language processing (adapted versions);
* Video analysis. Several influential CNN architectures have advanced the field, as follows:
* AlexNet: As the winner of the 2012 ImageNet Large Scale Visual Recognition Challenge (ILSVRC), AlexNet marked a significant breakthrough in computer vision and deep learning. AlexNet is a pioneering CNN architecture that significantly impacted the field of computer vision. This CNN architecture, developed by [PERSON], [PERSON], and [PERSON], achieved a top-5 error rate of 15.3%, outperforming the nearest competitor by 9.8 percentage points. Key features of AlexNet include the following: (i) an eight-layer architecture with five convolutional layers and three fully connected layers. (ii) The use of Rectified Linear Units (ReLU) activation functions for faster convergence. (iii) The implementation of dropout to control overfitting. (iv) The utilization of GPUs for efficient training. AlexNet's success demonstrated the power of deep learning in handling large-scale visual recognition tasks, paving the way for further advancements in CNN architectures and applications across various fields, including medical imaging, agriculture, and autonomous driving. The output size of a convolutional layer in AlexNet is calculated using the following formula:  
\[O=SW-K+2P+1 \tag{6}\]  
where  
* \(O\) is the output size;
* \(W\) is the input size;
* \(K\) is the kernel (filter) size;
* \(P\) is the padding;
* \(S\) is the stride. For example, the output size in the first convolutional layer of AlexNet includes the following:  
* Input size: 224 \(\times\) 224;
* Kernel size: 11 \(\times\) 11;
* Stride: 4;
* Padding: 2. Applying the formula (224 \(-\) 11 + 2 \(\times\) 2)/4 + 1 = 55(224 \(-\) 11 + 2 \(\times\) 2)/4 + 1 = 55 results in an output size of 55 \(\times\) 55 for the first convolutional layer. AlexNet uses the ReLU as its activation function:  
\[f(x)=max(0,x)f(x)=max(0,x) \tag{7}\]  
This non-saturating activation function showed improved training performance compared to traditional sigmoid or tanh functions. The max pooling layers in AlexNet use a similar formula to the convolutional layers for calculating output size. For instance, the first max pooling layer includes the following:  
* Input size: 55 \(\times\) 55;
* Kernel size: 3 \(\times\) 3;
* Stride: 2;
* Resulting in an output size of 27 \(\times\) 27. The fully connected layers perform matrix multiplication. For example, in the first fully connected layer  
\[Y=WX+bY=WX+b \tag{8}\]  
where  
* \(X\) is the input vector (13 \(\times\) 13 \(\times\) 256 = 43,264 neurons);
* \(W\) is the weight matrix (43,264 \(\times\) 4096);
* \(b\) is the bias vector (4096);
* \(Y\) is the output vector (4096 neurons). The softmax function in the final layer of a neural network converts raw output scores (logits) into class probabilities. The mathematical expression for the softmax function is  
\[\mathit{softmax}\ (xi)=e^{xi}\sum_{j=1}^{k}e^{yi} \tag{9}\]  
where  
* \(x\) is the input value for class \(i\);
* \(K\) is the total number of classes;
* \(e\) is the mathematical constant (approximately 2.718).