Pneumonia detection using butterfly optimization and hybrid butterfly optimization algorithm

Received Feb 14, 2021 Revised Apr 30, 2021 Accepted May 27, 2021 Pneumonia affects so many people around the world, which leads to many of them being killed. In order to identify and diagnose the disease, the patient must first undergo an x-ray scan of the chest (CXR). Disease will be identified according to the CXR images. Software diagnostic tools are used to help decision-making and to promote the pneumonia diagnosis process. From these tools is the gray level distribution moments (GLDM) algorithm which is used for CXR image features extraction, and we used the meta-heuristic algorithm representing the basic butterfly optimization algorithm using lèvy flight (BOALF) and the modified butterfly optimization algorithm (BOARN) to detect pneumonia on the basis of these extracted features. And then we've also been making hybrid between the BOA with fuzzy membership function to get as novel method called it fuzzy butterfly optimization algorithm (FBOA). These methods were based on various x-ray images of the chest. In testing phase, the proposed method obtained the highest diagnostic rate of the disease compared to the other two methods in this work.


INTRODUCTION
For many children around the world pneumonia is the cause of death. Two types of causes of pneumonia are either bacterial pneumonia, or viral pneumonia. Antibiotics are used to treat bacterial pneumonia, while supportive treatment is required for viral pneumonia, which makes the diagnostic accuracy very significant. Diagnosis of pneumonia is typically by analyzing x-rays of the chest, that is, by radiographic examination [1]. If there's a lack of radiologists, the diagnosis speed would be reflect negatively. The discovery of pneumonia is carried out by traditional CXR analysis, and to help doctors and radiologists interpret the chest images quickly and accurately, some Artificial Intelligence algorithms are used such as the butterfly optimization algorithm [2]. And Figure 1 shows the chest x-ray images, sample of normal, and sample for infected for the bacterial pneumonia, and viral pneumonia [3], [4].
To facilitate image handling, minimize image data and aim to obtain a subset of essential and efficient image data features by extracting the features. To extract the features from the images of the used database, an algorithm (gray level distribution moments) was used here. Different features have been extracted in this method, namely mean, standard deviation, − , energy and entropy, which depend on the first order graph [5] .
To detect pneumonia disease, in this work we used one of the swarm intelligence method is a butterfly optimization algorithm, it is one of the nature-inspired algorithms that depends on population behavior, as it is considered a biological behavior model for finding mating and food source. These algorithms which are inspired by nature will find the best solutions to many different problems [6]- [8]. There are many works relating to the use features in chest radiographs for pneumonia detection. Ebenezer J et al, proposed firefly based fuzzy c-means for chest x rays images segmentation [1]. X. Wang et al, used deep convolution neural network based "reading chest x-rays", to recognize and locate common patterns of disease trained with image-level labels only [9]. Yu. Tang et al, built and tested various deep convolution neural networks CNN to differentiate between normal and abnormal frontal chest radiographs [10]. D. S. Kermany et al, used a pre-trained Inception V3 model as an extractor for fixed features to classifying normal and pneumonia infected pediatric (CXR)s and further distinction between viral and bacterial pneumonia with a region under the curve AUC of 0.968 and 0.940 respectively then the average accuracy 95.5% [11]. V. Chouhan et al, for pneumonia detection, they presented a transfer learning-based approach, they got accuracy equal 96.3% [12]. S. H. Yoo et al, they used a deep learning-based decision-tree classifier for chest x-ray images classification and covid-19 detection, and the CXR images classified by decision tree got accuracy of 95% [13]. T. Mahmud et al, they presented a proposed method by using (multi-dilation CNN) for covid-19 detection, and pneumonia detection and classification [14]. N. Wang et al, used ResNet-101 and ResNet-151 with effect for fusion for classification of chest x-ray images to three group such as, normal, viral pneumonia, and covid-19 achieved accuracy of 96.1% [15]. M. Z. C. Azemin et al, used a deep learning method based on the ResNet-101 CNN model to recognize and detect abnormality in the chest x-ray images, this method got accuracy 71.9 % [16]. This research has been organized as: section 2 presents the proposed method obtained by combining the fuzzy membership function with the butterfly optimization algorithm (BOA) to produce a proposed algorithm called fuzzy butterfly optimization algorithm (FBOA), section 3 contains the description of the gray level distribution moments, section 4 discusses the details of the butterfly optimization algorithm (BOA), section 5 includes the performance measurements, section 6 explains the results of the experiments, section 7 conclusion.

PROPOSED METHOD
To improve the work of the butterfly optimization algorithm and to help butterflies develop global and local search capabilities and find the best solution. We hybridized between the fuzzy membership function and butterfly optimization algorithm. And then we got to a novel method called FBOA, and the equation of global and local search after hybrid method became as: Where is the fuzzy membership function Function Bi coefficient is based on the fuzzy generator q, which is an actual number larger than one. And to improve the work of the proposed algorithm, after adding the membership function to the equations for adjusting butterfly positions to find the best solution. Another fitness function was used to ensure optimal detection and classification of pneumonia diseases. Where the law or the ratio of disclosure ratio was used represented by (5): = .
otal um. f × 100 Calculates the detection ratio at each step to ensure the optimum solution in the classification process for xray images. Where the algorithm continues to run until the best detection ratio is reached.

GRAY LEVEL DISTRIBUTION MOMENTS
First-order probability distribution It is one simple way for extract the statistical features in the image. Estimate first order histogram of ( ) is: Where in an image: is represent total number of pixels, and represent a gray level, and number of pixels of gray value( ) represented by ( ), where (0 ≤ ≤ − 1). And (7) represented how to compute features which as extracted by using first order histogram: This feature denoted to the mean of pixel intensities values This feature represented the (variance) or standard deviation between the pixels for input image.
The − is distinguishes degree of symmetry of density distribution around the average density. The value of − can be negative or positive. : The energy is important to examined the (repeated transitions) which represent power content in a determine frequency band.
By entropy feature, the randomness of the gray level distribution is represented. If gray levels are distributed randomly throughout the image then the entropy will be high [5], [17], [18].

. Butterfly
Butterflies use the senses of smell, taste, hearing, sight to locate the source of food and to mate. These senses are of great importance, helping the butterfly lay eggs in the right locations, and helping them to migrate from one location to another, as well as helping them to avoid the predator. In a butterfly the most important sense is the sense of smell, from which the butterfly can scent the scent of nectar from long distances. Butterflies have sensory receptors distributed across the body of the butterfly, and use them to smell, such as antennas, legs. Butterflies use these receptors to explore mating and the food source. Chemoreceptor are referred to as these receptors, which are neurons on the butterfly corpus surface. It is the chemoreceptor that direct the butterflies to find the best mating partner for genetic line to continue. And the male butterflies will recognize the female butterflies, via the pheromone. And pheromone is the fragrance secretion which is released from the butterfly to cause particular reactions [19]. Butterflies can identify with high precision the source of the fragrance, as well as feel intensities fragrances and can separate the different. In BOA algorithm the butterflies are agents the search. The butterfly can produce a fitness-related fragrance, as the fitness of the butterfly varies from one position to another according to its movement. The fragrance spreads over long distances, and the other butterflies can detect it. Butterflies will then exchange personal details with the other butterflies in this situation. When the butterfly detects the fragrance from another butterfly, it heads towards the butterfly that emits the fragrance, this step in algorithm called the global search process. But if the butterfly can not feel the fragrance that surrounds it, then the butterfly moves randomly, this stage is called the local search stage in the algorithm. Butterflies have three properties, these are [20]: a. All butterflies release some fragrance to attract butterflies to one another. b. Random movement of each butterfly or move towards of best butterfly in the direction of the butterfly that produces more fragrance. c. The area of research is influenced by the landscape and this, in turn, would affect the butterfly's stimulus intensity level [21]- [23].

Fragrance movement of butterflies
The algorithm of (BO) have own a basic characteristic that distinguish it from the other metaheuristic algorithms, which is that each fragrance has a personal touch and unique smell, the fragrance (F) in the (BO) algorithm was identifying as a function of stimulated physical intensity as in [24,25] F represent the fragrance magnitude perceived, i.e., the fragrance strength that ℎ butterfly perceived. sensory modality represent by . And represent the intensity of stimulus, and represent modality dependent exponent of power, that explains the absorption degree. BOA contained of two stage, that represented by the local search stage and global search stage. In global search stage, The butterfly is heading towards the best butterfly, that is this solution known as * that represented by (13): Where represent the position for ℎ butterfly at iteration . In the current generation * represents the best solution. represent of the fragrance of ℎ butterfly, step size represented by . Local search stage represented by (14) and represent ℎ and ℎ butterflies from solution space. is step size, then (13) becomes a local random walk. To control the global and local search in BOA the probability of switching (p) is used because the search for food can occur globally and locally level. And algorithm 1 represent pseudo code of the BOA [23], [26]. The general flowchart of standard BOA [25] shown in Figure 2 And the (local search stage) represented as in (16) 1] In this paper, the Euclidean distance between the characteristics of the x-ray images and the centers of the clusters was extracted as a fitness function to calculate the S value, which is represented intensity of stimulus in the equation for the calculation of fragrance magnitude F in order to obtain the best detection or classification of x-ray images.
Where the data represents the x-ray image data represented by the feature extracted using the gray level distribution moments (GLDM) method and the represent the center of the cluster.

PERFORMANCE MEASURES
In this work, two indicators were used to measure the accuracy of the methods used. Which are the classification rate and detection rate as shown in [5], [6]:

EXPERIMENTS RESULTS
In this paper, several types of butterfly algorithms were implemented to detect pneumonia based on x-ray images of the chest. To extract features from these images, we used the GLDM algorithm, and we used the meta-heuristic algorithm to detect and classify pneumonia. Such as the standard butterfly optimization algorithm that using a lèvy flight (BOALF) for a local and global search and the modified butterfly optimization algorithm using random number (BOARN) in local and global search. And we combined fuzzy membership function with standard BO algorithm and got a novel method called the fuzzy butterfly optimization algorithm (FBOA) that was proposed. The first step in implementing a model to detect pneumonia on x-ray images is to collect image data that will consist of training sets and model testing. Dataset available for download was used on the kaggle website. Kaggle provides users a wide variety of different datasets which can be used for different research purposes. Dataset was used of the pneumonia CXR images, this dataset consisted of normal person CXR images, and images of chest x-ray representing viral and bacterial pneumonia. Figure 3 shows the pneumonia detection system block diagram. Training and testing dataset consist of (1607) CXR images with two category of CXR images, it is normal and pneumonia. Category pneumonia is two kind which is viral pneumonia, and bacterial pneumonia.  At first, we were used GLDM algorithm to extract features from all images. Powerful features, and image data reduction. And those features were then normalized. We conducted numerous experiments for system evaluation, and also to investigate the effect of the methods parameters used (BOALF, BOARN, FBOA). The number of CXR images in each category is shown in Table 1. In this work we have applied BOALF, BOARN, and the novel method FBOA methods to the dataset of chest x-ray images. These methods classified the training data set containing (1167) images in the training stage and obtained a classification rate equal to 100%. And the test dataset contained (440) x-ray images of the chest, and applied these methods to this dataset. In the testing stage, the novel method FBOA method was better than BOALF, BOARN methods, because it is obtained larger detection rate from other methods (BOALF, BOARN). Table 2 shows the test stage results for the three categories for chest x-ray images, normal, virus pneumonia and bacterial pneumonia. And Figure 7 shows the relation between BOALF, BOARN, FBOA algorithms with detection rate. Also, when these methods were applied in the test-stage for two of chest x-ray images normal and abnormal categories, the new FBOA method was better than the BOALF, BOARN methods, because FBOA had got large detection rate (97.62), whereas BOARN obtained the detection rate (95.83) and the BOALF method detection rate equal (92.96). Table 3 shows the test results for the two categories normal and abnormal of the chest x-ray images for pneumonia disease. Figure 8 shows the relationship between BOALF, BOARN, FBOA algorithms with detection rate for two category normal and abnormal in test stage. The

CONCLUSION
In this work, meta-heuristic methods representing various types of butterfly algorithms were implemented to detect pneumonia based on chest x-ray images. We used GLDM algorithm for extracted powerful features to facilitate image manipulation and we used the best meta-heuristic algorithms, the (BOALF). And modified algorithm of the butterfly (BOARN), And by combining the fuzzy membership function with the butterfly algorithm, we improved that algorithm and we got a novel improved method called FBOA. And applied these methods to dataset of chest x-ray images. And the new method FBOA got the highest rate of detection among the methods used in this system. Also, the proposed new method obtained the highest accuracy of detection and classification compared to previous works as well.