## 3 Proposed Framework
### Convolutional Neural Network Model  
The architecture of the Convolutional Neural Network (CNN) is shown in Figure 3.  
According to Figure 3, the model is constituted with five convolution layers where there are 16, 32, 64, 128, and 256 filters with \(2\times 2\) kernel size. ReLU activation function is used in each convolution layer. Mathematically, it can be shown as Equation (1):  
\[Relu(z)=max(0,z). \tag{1}\]  
The input shape of this model is (150, 150, 1), where the first 150 refers to the height of the input image and the second 150 implies the width of the input image. Finally, 1 signifies that the image is a Gray Scale image. A max pooling layer with \(2\times 2\) pool size is introduced in each convolution layer. The max pooling layer decreases the number of total parameters by selecting the highest value from a rectified feature map. Thus, it can lessen the data size. Along with the max pooling layer, ReLu, and dropout layer are also included in each convolution layer. ReLu works for activating the parameters while the dropout layer deactivates the neurons randomly so that it can avoid overfitting. The global Average Pooling layer is introduced in the last layer that is perfect for feeding into the dense layer. Since the model is classifying eight sentiments, the output layer has eight nodes. Therefore, Softmax is used as an activation function that can be shown as Equation (2):  
\[softmax(z)=\frac{e^{i}}{\sum e^{i}}, \tag{2}\]  
Here, \(z\) is the input vector, \(e^{i}\) is the standard exponential function of \(i\) where \(i\in z\). The input vector \(z\) is the output of Fully Connected (FC) layer of the CNN model. The FC layer produces raw prediction values which are known as logits [28]. Logits are real numbers (\(-\infty\) to \(+\infty\)). The softmax activation function turns these logits into the probabilities of each class.  
The Adam optimizer has been used to optimize the integrated model. As a loss function, Categorical Cross-entropy is used to reduce the validation loss. The architecture of the CNN model is shown in Table 2.  
The input image is an array of pixels. The convolution layer consists of multiple kernels with multiple weights. The variation of the kernel weight helps to manipulate different scales of the images. These kernels are used to extract features from the input image. The features of an image (edges, interest points, etc.) provide very rich information on the content. When a kernel is slid over the input image, it produces a feature map for different pixels. This operation is performed based on the weights of the kernel and the neighboring pixels. This feature map is then passed through the ReLu activation function, which increases the nonlinearity by converting the negative values to zero of the feature map. The pooling layer merges the features which are semantically similar into one. The max pooling layer computes the maximum value from the portion of the feature map  
Figure 3: CNN model.  
covered by the pooling layer. For the image segmentation, the layers extract two types of features (full region feature and foreground feature) for each region. Thus, the convolution layer and the max pooling layer generate different feature maps for different images. These feature maps are used to train and validate the model.