Brain Tumors Detection By Using Convolutional Neural Networks and Selection of Thresholds By Histogram Selection

Brain tumors in medical images have a high diversity in terms of shape and size. Some of the data found a form between the tumor tissue and normal tissue, whereas knowing the tumor’s profile and characteristics becomes a crucial part of searching. By using machine learning capabilities, where machines are given several variables and provide decisions to a certain degree, they have broadly given decisions that support subject matter in making decisions. This study applies the threshold selection method using histogram selection on CT scan data, while the appropriate threshold selection method selects the tumor position accordingly. Furthermore, the Convolutional Neural Network (CNN) is used to classify whether the selected image is a tumor or not. Using CT scan data and calculated experiments, this algorithm can finally be approved and given a brain classification with an accuracy of 75.42 percent.


Introduction
The medical image becomes a remarkable breakthrough in medicine in detecting a condition in a patient's limbs. Some activities include the detection of tumors or cancer. By using medical images, the resulting image will provide an overview of the visible form so that it can determining the patient needs further treatment. Viewing medical images up to now is still a challenge for users to determine the tumor's position or classify the tumor in the brain because there is still a possibility of the shape and color of the resulting image similar to normal tissue.
With medical images, health workers can analyze and determine the position of tumors in the brain. However, the manual method requires a long time and a severe challenge to CT scans produced in routine medical activities. For this reason, experiments need to be conducted on ways that can help provide an automatic classification as a weigher in making faster decisions.
CNN for image classification in several studies was able to provide good results. Some studies include various plants on resolution images with an accuracy of 82 percent [1]. It is also used in the fruit image classification model [2], facial recognition [3], to make automatic vehicles using CNN [4]. This method is then performed a brain tumor classifica-tion experiment using CNN. Previous research has conducted several methods to detect brain tumors. Some of them are using classification techniques, such as K-Nearest Neighbor [5], ANN [6], SVM [7], and particle swarm optimization (PSO) [8]. In this research, the preprocessing of data is done first by making a segmentation using histogram selection, then forming a model using CNN. Histogram selection works by creating the best segmentation to determine the most likely position to occur tumors [9]. CNN is given afterward to determine whether the detected is a tumor or healthy tissue.

Methodology
This research consists of several stages, namely: collecting data, converting images into grayscale, determining the position of the head, segmenting images, training data with CNN, and testing.

Collecting Data
The data used are data sourced from Kaggle [10] with the title MRI Brain Image for Brain Tumor Detection. The dataset consists of 96 normal brain images and 157 brain images containing tumors with different shapes and positions. Images that have been processed into grayscale, then the head position is determined for each image. Each image has a variety of sizes and positions so that the head size and position are uninformed by removing the black sides on the left, right, front, and back of the head. After that, the resolution is resized to 200 x 200 pixels. It is performed by using some computation. The head's position is determined as Algorithm 1 on the table below.

Making the image segmentation
Based on research [9], images that have been processed as in point 2.3 are further divided into four segments, namely in the upper right, upper left, lower right, and lower left. After that, the average standard deviation for the four regions is calculated. Then calculate the average of each segment and add up the values. It aims to find the right threshold. If the value is greater than the threshold, it is marked with white, while others are marked with black. This clustering technique is used to determine the position most likely to occur brain tumors in the image. Threshold determination follows the provisions in research [9], which refer to the Algorithm 2 on the table below.

Convolutional Neural Network
Convolutional Neural Network is the development of a multilayer perceptron, which is inspired by the neural network of living things [11]. CNN is part of deep learning, a branch of machine learning that can work on computers to work like humans, like computers that learn from the training process (Deng and Yu) [12]. In general, the dataset used to classify using a convolutional neural network has three layers, namely width, height, and depth. This study will use two layers, namely width, and height only because the data to be processed does not have a color depth. Broadly speaking, the CNN stage consists of Feature Learning and Fully Connected. This study uses the CNN architecture as follows: (1) convolutional as many as 50 nodes, then fully connected with (2) 100 nodes of relay layer, (3) sigmoid of 100 nodes, and (4) softmax of 2 nodes. Convolutional. In Feature learning, the computational process that occurs changes the image obtained into a collection of numbers that represent the image. The process consists of 2 stages, namely Convolutional and Pooling. At this stage, each image will be filtered. A filter is an (n x n) matrix that is used to extract images. The next filter will be weight as training material. The filter is shifted to all parts of the image, then matrix multiplication operations are finally produced. This output will henceforth be a feature map. In comparison, the number of filter shifts can be done as much as every 1 pixel or more.
The formula for calculating convolution can be seen as shown as the image above, which can be written as: where the Z 1 value is convolutional (figure 4), the sum of each multiplication between input X and filter F. The multiplication technique, as shown above (figure 5), it shows that the filter has a fixed size. Like the picture above, the filter has 2x2 pixels. Then, to calculate the value of Z, the filter is moved to each row and column, multiplied, adding all of them together, and it will produce output that has the size as shown below: issue 2, June 2021 (2) The next stage is pooling. The pooling stage is the same as the convolutional stage. Still, the application is made after convolutional. It is not part of the weight that will be trained because it is only reducing dimensions so that computing is lighter and suppresses overfitting.

Fully
Conencted. At this stage, transformation is carried out into one dimension. This aims to facilitate the application of the perceptron multilayer learning process. Figure 4 shows that the fully connected method is divided into three main activities: flatten, linear transformation, and nonlinear transformation.
Flatten. Flatten is a step to transform data into a matrix into one dimension matrix or array. It aims to conduct training data as well as the multilayer perceptron method. In this example, the illustration can be seen in Figure 6.
Linear Transformation. In applying feedforward, a linear regression technique provides a relationship between one layer and another. The linear transformation formula is shown in the following formula: where W is the random weight value, b is the bias value, and Z 2 is the result of linear transformation as shown in figure 4.

Backpropagation.
Backpropagation is a method applied for learning from models that have been formed from feedforward. Backpropagation is a major part of every neural network model in terms of weight and filter improvements.
Nonlinear Transformation. Most cases that occur in the formation of models are nonlinear.
For this reason, the transformation of functions from linear to nonlinear can be done. Some transformation methods that can be applied are as shown in the following table: Weight improvement. The resulting error can be minimized by gradient descent, where the value derived from the value to be changed to zero. The mathematical notation can be written as follows: Each formula and its derivatives can be seen in table below.
After knowing the value of , the improvement of the old value with the new one is:  Filter improvement. Not only are weights needed to be improved, but filters also need to be updated in backpropagation activities. Following the same steps as in weight correction, the filter also needs to do the derivative of the error against the filter, and the value of this derivative is zero. The steps in question can be seen as in the figure 8. By using chain rules, it can be denoted as follows:

Making the image segmentation.
Model testing is carried out using the Monte Carlo crossvalidation technique. The selection of training and testing data is made by taking samples without returning for training and testing. This iterative disagreement process, sometimes also called Monte Carlo Cross-Validation, provides a better estimate of how well the model can perform random training data compared to standard disagreement validation methods [13]. This was carried out several times and then seen the average and standard deviation of the resulting accuracy. The models that issue 2, June 2021 will be included in the testing of this model are logistic regression, support vector machine, random forest, k-nearest neighbor, stochastic gradient descend, and naive-bayes. After that, compare the results of the six models.

Results and Explanation
There are three basic stages in implementing the proposed algorithm, namely selection and segmentation of images, modeling, and testing. Image selection and segmentation are used to estimate brain tumors' position in the image by giving black and white colors to a certain threshold. Modeling is used to make CNN models, while testing is done to determine the predicted images' accuracy with data outside of training data. The threshold selection results result by looking at the rules following table 1, visible images with a brain with a tumor and a normal brain. The difference is shown by the white grouping that appears in the figures in Table 2 and  Table 3, where the brain that has a tumor has more color and tends to be asymmetrical. Some examples of the results of a threshold search experiment can be seen in the figure 9 and figure 10.  Based on the pictures presented in tables 2 and 3, it appears that the automatic threshold selection based on the rules in table 1 can sort out contrasting colors. This image is then collected into an array and then combined, then randomized the position to produce a model from the CNN method.
The model built has convolutional structures of 50 nodes, then fully connected with 100 nodes of relay layer, 100 nodes of sigmoid, and two softmax nodes. This model's final result is the chance of being selected as a tumor or normal at each node of the softmax results. This research will take the greatest opportunity as the final result of the decision.
Furthermore, a trial was conducted using the Monte Carlo method, where data was randomly randomized, then 25 percent was taken for testing, and the remainder was for training. Conducted as many as 100 experiments, calculated the level of accuracy, then averaged. The results of each model can be seen as in the following table: The table above shows the average accuracy rate of 100 experiments conducted, with a 95 percent confidence interval. CNN can provide an average accuracy rate of 75.42 percent, with the accuracy interval being between 74.54 to 76.31 percent. This is a good sign compared to 6 other leading methods with an accuracy difference of 0.87 percent to Random Forest's accuracy.
Henceforth, it needs to be checked again whether the average accuracy between CNN and the random forest is significantly different. The steps taken are using the normality test in advance for 100 CNN accuracy data used and 100 random forest accuracy data. If these two data are normally distributed, then a t-test is performed to see whether the two results' average is significantly different. Normality test uses the Shapiro method with the following hypothesis: For CNN, the p-value of Shapiro test is 0.0077, which means Reject H 0 . For Random Forest, the p-value is 0.0970, which means Accept H 0 . the results shown by the convolutional model are not normally distributed, in contrast to the random forest model. For this case, a Wilcoxon test was performed to check whether the two models produce significantly have different accuracy.
P-value obtained from existing data is 0.027, so it can be concluded that the accuracy of CNN is significantly different from Random Forest. Seeing the previous results that CNN is greater than Random Forest, then from the tests conducted, CNN gave significantly better results than other best models.

Conclusion
Based on the results shown in table 4, it can be seen that CNN with the threshold selection method using histogram selection produces a model that can classify brain tumors with an accuracy of 75.42 percent and a confidence interval between 74.54 and 76.31 percent. This shows that by using this method, the algorithm can provide a fairly good level of accuracy compared with some other classification methods.
This study uses the CNN architecture as follows: (1) convolutional as many as 50 nodes, then fully connected with (2) 100 nodes of relay layer, (3) sigmoid of 100 nodes, and (4) softmax of 2 nodes. However, it is possible to increase by considering the layer structure with different combinations and numbers of nodes for each layer.