## 4 Materials and Methods
### Convolution Neural Network  
To classify images of PCa, this paper introduces two LWCNN models to perform the classification of the GP and distinguish between two classes. Both model 1 and model 2 included CNN layers, such as those for input, convolution, rectified linear unit (ReLU), max pooling, dropout, flattening, GAP, and classification. Model 1 contained four convolutional blocks, with a depth of 10 layers, which interleaved two-dimensional (2D) convolutional layers (\(3\times 3\) kernel, strides, and padding) with ReLU and batch normalization (BN) layers, followed by three max-pooling (\(2\times 2\)) and three dropout layers. To connect the neural network [52; 53], a flattening layer and a sequence of three dense layers containing 1024, 1024, and 2 neurons were connected for feature classification and two probabilistic outputs. The sigmoid activation function [54; 55] was used as a binary classifier. The numbers of filters in each block were 32, 64, 128, and 256. These filters acted as a sliding window over the entire image. Model 2 contained three convolutional blocks, with a depth of seven layers, where the 2D convolutional, ReLU, and BN layers were identical to model 1 but were interleaved with two max-pooling (\(2\times 2\)) layers and one dropout layer. The numbers of convolutional filters in this model were 92, 192, and 384. A GAP layer was used instead of flattening, the classification section in this model also had three dense layers containing 64, 32, and 2 neurons. Here, a softmax [56; 57] classifier was used to reduce binary loss. The input shape was set to \(224\times 224\times 3\) while building the model. The detailed design and specification of our lightweight CNN (LWCNN) models are shown in Figure 6 and Table 2, respectively. Model 2 was modified from model 1 based on multilevel feature analysis to improve classification accuracy and reduce validation loss, as shown in Figure 7. \begin{table}
\begin{tabular}{c c c c c} \hline \hline  & **Layer Type** & **Filters** & **Output Shape** & **Kernel Size/Strides** \\ \hline \multicolumn{5}{c}{**Model-1 Specification**} \\ \hline Input & Image & 1 & \(224\times 224\times 3\) & - \\ Block-1 & \(2\times\) convolutional + ReLU + BN & 32 & \(56\times 56\times 32\) & \(3\times 3/2\) \\ Block-2 & \(2\times\) convolutional + ReLU + BN & 64 & \(56\times 56\times 64\) & \(3\times 3/1\) \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Detailed information and specifications of lightweight convolutional neural network models. BN: batch normalization, GAP: global average pooling, ReLU: rectified linear unit. Figure 6: Structure of our lightweight convolutional neural networks for cancer image classification between two Gleason grade groups of prostate carcinoma. Spatial features are extracted from an image by convolving through one of the networks. Classification layers (flatten, global average pooling [GAP], dense-1, dense-2, and output) were used to find the required response based on features that were extracted by the convolutional neural network. The multilevel feature maps were extracted after each convolutional block for pattern analysis and to understand the pixel distribution that the CNN detected, based on the number of convolution filters applied for edge detection and feature extraction. The convolution operation was performed by sliding the filter or kernel over the input image. Element-wise matrix multiplication was performed at each location in the image matrix and the output results were summed to generate the feature map. Max pooling was applied to reduce the input shape, prevent system memorization, and extract maximum information from each feature map. The feature maps from the first block held most of the information present in the image; that block acted as an edge detector. However, the feature map appeared more similar to an abstract representation and less similar to the original image, with advancement deeper into the network (see Figure 7). In block-3, the image pattern was somewhat visible, and by block-4, it became unrecognizable.