# The Diagnostic Classification of the Pathological Image Using Computer Vision
## 4 Architectures, Features, and Advantages of CNNs  
CNNs are a powerful deep learning model that revolutionized computer vision and image processing tasks. CNNs comprise multiple layers that process and extract features from input data, typically images. The main components include convolutional, pooling, and fully connected layers. The convolutional layers apply filters (kernels) to detect features like edges, textures, and shapes [136]. The filters slide across the input, performing convolution operations to create feature maps. The pooling layers reduce the spatial dimensions of feature maps, retaining the most important information. Common types include max pooling and average pooling. Fully connected layers are usually found near the end of the network and connect every neuron to all neurons in the previous layer for final classification or regression tasks. Also, CNNs have several distinguishing characteristics: (i) Local Receptive Fields: neurons that connect to small regions of the input, allowing for efficient processing of spatial data, (ii) Weight Sharing: filter parameters that are shared across the entire input, reducing the number of parameters and improving efficiency, and (iii) Hierarchical Feature Learning: CNNs that automatically learn features from low-level (e.g., edges) to high-level (e.g., complex shapes) without manual feature engineering [137]. CNNs are powerful artificial neural networks specifically designed for processing and analyzing visual data. While no single formula fully encapsulates CNNs, we can break down their key components and operations to understand how they work. CNNs typically consist of three main types of layers: convolutional layers, pooling layers, and fully connected layers. Each layer plays a crucial role in the network's ability to learn and extract features from visual data. The convolutional layer is the fundamental building block of a CNN. Its operation can be described by the following formula:  
\[\text{F}\left(i,j\right)=\sum x\left(p,q*w\left(i-p,j-q\right)\right. \tag{1}\]  
where  
* \(F(i,j)\) is the feature map;
* \(x\) is the input image;
* \(w\) is the filter;
* \(i,j,p,q\) are the indices of the pixels. This formula represents a 2D convolution operation, which is a fundamental operation in image processing and convolutional neural networks. This operation slides the kernel over the input image, computing the dot product at each position. \[F(i,j)=\text{The output of the convolution at position ($i,j$)}\]  
This operation is used in various applications, such as edge detection, blurring, sharpening in image processing, and feature extraction in convolutional neural networks. Pooling layers reduce the spatial dimensions of the feature maps. The most common pooling operation is max pooling, which can be represented as:  
\[Z(i,j)_{k}(^{(l+1)})=max_{(x,y)\in R(i,j)}\ Z(x,y)_{k}(^{(l)}) \tag{2}\]  
This formula describes the max pooling operation, where  
* \(Z(i,j)_{k}(^{(l+1)})\) is the output of the pooling layer;
* \(R(i,j)\) represents the receptive field (kernel window) at position (\(i,j\));
* \(Z(x,y)_{k}(^{(l)})\) is the input feature map. Max pooling selects the maximum value within each kernel window, effectively downsampling the input while preserving the most prominent features. This operation is typically performed with a stride of 2 and a kernel size of \(2\times 2\), which reduces the spatial dimensions of the input by half. After each convolutional layer, an activation function is applied. The most common is the Rectified Linear Unit (_ReLU_):  
\[ReLU(x)=max(0,x) \tag{3}\]  
The fully connected layer at the end of the network performs the final classification [138]. Its operation can be described as  
\[y=\sigma\left(Wx+b\right) \tag{4}\]  
where  
* \(y\) is the output vector;
* \(x\) is the input vector;
* \(b\) is the bias vector;
* \(\sigma\) is a nonlinear activation function;
* \(W\) is the weight matrix. This equation represents an affine transformation (\(Wx+b\)) followed by a nonlinear activation function.