QUANTUM INSPIRED GENETIC ALGORITHM FOR BI-LEVEL THRESHOLDING OF GRAY-SCALE IMAGES

: Thresholding is the primitive step in the process of image segmentation. Finding the optimal threshold for satellite images with reduced computation time and resources is still a challenging task. In this paper, we propose a Grey-Level Co-occurrence Matrix based Quantum Inspired Genetic Algorithm (QGA-GLCM) for bi-level thresholding of gray-scale images (natural and satellite). In this paper, QGA was used to find the optimal threshold. The results are compared with four different variants of Differential Evolution (DE) meta-heuristic algorithms, namely-DE-Otsu, DE-Kapur, DE-Tsali’s, DE-GLCM, and three different variants of QGA, namely- QGA-Otsu, QGA-Kapur, QGA-Tsali’s. Intensity value from image pixel is the only information used by Otsu, Tsali’s and Kapur for thresholding and are highly affected by noise. The main objective of this paper was a) To have a binary threshold for images corrupted with noise by bringing in spatial context b) To reduce the computational complexity and time for generating a threshold. Performance evaluators viz., CPU time, Peak Signal-to-Noise Ratio (PSNR), Mean Square Error (MSE), and Structural Similarity Index Measure (SSIM) were used for quantitative assessment of partitioned images. From this study we observed that our proposed technique, QGA-GLCM is a) very good at producing a diverse population b) ten times faster than its classical counterparts c) generates better threshold for images corrupted by noise. In general, the threshold values generated by QGA and its variants are better than its classical counterparts. The results clearly show that exploration and exploitation capability of QGA is superior to DE for all variants. QGA-GLCM can be an effective technique to generate thresholds both in terms of computational speed and time.


INTRODUCTION
Thresholding, is a widely explored and researched area with applications in all domains, like identifying faults and tumours, edge detection etc. Images acquired by satellites are at times corrupted by noise found in the sensor or transmission channel during acquisition and transmission.Segmenting satellite images is a process of grouping pixels into regions based on similarity resulting into a segmented image which labels each pixel and associates the pixel to its class.Thus formed homogeneous regions help to distinguish various objects present in the satellite images.Thresholding plays an important role in the separation of background from the foreground or an object from its surroundings.The number of thresholds used to segment an image can lead to bi-level or multi-level thresholding.The former classifies the image into two classes: foreground and background and the latter classifies the image into n+1 classes with 'n' different thresholds.Finding this single optimal threshold, or multiple optimal thresholds, is based on peaks and valleys in the histogram.A bi-modal histogram has two peaks and a valley.A threshold can be found around this valley.For images with multiple regions, the histogram is multi-modal, multiple peaks and valleys, generating multiple thresholds, one per valley for each region, and is called multi-level thresholding.Thresholding, being a classical technique, relies on the information values contained in the pixel.If all the pixels present in the image contribute towards finding the threshold, then the technique is called global thresholding.If only some of the pixels are used to find the threshold, then the technique is called local thresholding.Global thresholding techniques are prone to noise and sensitive to illumination effects, shadows, etc., which is usually the case with satellite images.Due to their global nature, an exhaustive search needs to be carried out, which consumes computational resources exponentially with an increase in number of thresholds.To address the problem of exhaustive search, researchers used various combinations of meta-heuristic algorithms with different objective functions (Aziz et al., 2017;Bhandari et al., 2015aBhandari et al., , 2015bBhandari et al., , 2016;;Mirjalili et al., 2016;Pare et al., 2017Pare et al., , 2018Pare et al., , 2020Pare et al., , 2021;;Singh Gill et al., 2019;Upadhyay and Chhabra, 2020;Xing and Jia, 2019).1D(dimension) thresholding techniques are fast, effective for real-world objects, and computationally less expensive but there are certain drawbacks with this approach: a) Two images with identical histogram leads to the same thresholds b) In the presence of noise and shadows, the performance of these histogram-based thresholding is poor.Researchers in the past addressed the problem of noisy images by including second order statistics like mean, median, and variance, as well as gradient magnitude and direction as additional information.This increases the algorithm complexity, time for processing and also the dimensionality of the pixel.Recently, with the development in quantum computing, quantum inspired algorithms using principles of quantum mechanics are being used.Quantum-Inspired Genetic Algorithm (QGA) is one among them.It has good exploration and exploitation capability and hence needs very few iterations to reach a global optima (Xiong et al., 2018).Previously, QGA was used for bilevel and multi-level thresholding of gray/color images using different histogram-based objective functions (Dey et al., 2014(Dey et al., , 2017;;Hilali-Jaghdam et al., 2020;Sabeti et al., 2020).In this work, we address the problem of finding threshold of noisy images using GLCM, which records the frequency distribution of gray level transitions, retaining the spatial relationship among pixels.The GLCM being symmetric in nature uses only upper triangular entries to find the threshold.Spatial context helps in reducing the noise and restricts the threshold search to be 1D.To the best of our knowledge, this is the first time a QGA is used along with edge information from the contrast feature of GLCM to find optimal threshold value of images.This combination of QGA and GLCM reduces the computational complexity both in terms of computational resources and time by exploiting the feature preservation capabilities of GLCM and the exploration skills of QGA, respectively.The rest of the paper is organized as follows: Section 2 presents the required background information about the various fitness functions, the algorithms used, the technologies used and the proposed methodology.Section 3 discusses in detail about experiments and results and finally, we conclude the paper with a conclusion.

BACKGROUND AND METHODOLOGY
This section deals with the required background and formulates the problem statement used in finding the threshold value of given image.Bi-level thresholding technique, partitions the pixels 'p' of the image into two regions based on intensity values(L) by selecting an appropriate threshold.Consider a grayscale image 'I' of dimension M*N defined using 'L' grey levels.
→  1  0 ≤  ≤ ℎ and  →  2  ℎ + 1 ≤  ≤  − 1 where,  ∈  , represents the pixel at location (x, y) of an image I, C1 and C2 represent the foreground and background classes respectively, and 'th' represent the threshold value.Section 2.1 explains in brief the various objective functions used.Section 2.2 introduces the basics of quantum computing.Section 2.3 briefly describes the various meta-heuristics algorithms used.Section 2.4 presents the proposed methodology.

Objective Functions
The efficiency of our proposed algorithm is compared using 3 different histogram based objective functions widely accepted in the literature.In the next section, we briefly discuss about each of them.

Otsu Method:
It is based on the criteria of betweenclass variance.It tries to maximize the distance between the classes while minimizing the variance within the class.This is expressed as a summation of sigma values for each of the classes (Otsu., 1979).and where  denotes mean intensity of the image independent of threshold, background mean  0 and foreground mean  1 are given as, and The optimal threshold  * = { 0

Gray-scale co-occurrence matrix(GLCM):
GLCM proposed by Haralick (Haralick et al., 1973) is a second order statistic which incorporates pair-wise coexistence of the graylevels instead of intensity values of the pixel.GLCM considers the spatial relationship between a pair of pixels with parameters (d, ).Each entry of GLCM at (i, j) location records the frequency of occurrence of intensities 'i' and 'j' between the pixel pairs separated by a constant distance 'd' and in the direction .For a given image with 'L' intensity levels, GLCM is a square matrix of dimension 'L*L'.Each directional GLCM is sparse.The neighbouring pixel can be in one of the 4 standard directions (0 o , 45 o , 90 o , 135 o ).Usually, the GLCM matrix is the average of these 4 standard directional matrices if directional features are not present in the image (Haralick et al., 1973).
Edge information available in the contrast feature of GLCM is used to calculate the value of 'q'.It exploits the symmetrical property of the GLCM matrix and considers only the upper triangular entries of the GLCM matrix to calculate the threshold , reducing the computational complexity to half (Mokji & Abu Bakar, 2007).

Quantum Computing
Quantum computing exploits quantum mechanical principles of superposition and entanglement to device quantum algorithms, and hence the algorithm generated is significantly faster (in terms of the reduced number of queries made, searching/evaluating all possible outcomes) than any classical algorithm when solving the same problem.Encouraged by this idea, currently, many computer science applications are developed in a hybrid model using quantum principles.Quantum computers are good at certain computational workloads where their classical counterparts are less efficient (Malossini et al., 2008).The smallest unit of information in quantum is a qubit.A bit in classical computing can be in one of the two states, viz., 0 or 1.A qubit, when in 0 or 1 state, is called the basis state and is said to be in superposition state, when in a linear combination of 0 and 1.Hence, the state of a general two-level qubit is given as |⟩ = |0⟩ + |1⟩ where, || 2 + || 2 = 1.Each qubit is known as 'ket', which is a column vector |⟩ and its complex conjugate is known as 'bra', which is row vector ⟨| named after the founder, Paul Dirac, representing the 'bracket' mathematically.An 'n' size quantum system is a collection of n qubits combined using a tensor product.

Meta-heuristic Algorithm
To avoid exhaustive search, population based meta-heuristic algorithms are used.This reduces the search to the size of the population and also spans the entire solution space, improving the solution iteratively.This session introduces us to the algorithms we used and compared viz., Quantum Genetic Algorithm (QGA) and Differential Evolution (DE).

Differential Evolution (DE): DE was proposed by
Storn and Price.It is free derivatives and is known as derivative-free optimization.It uses very few parameters and has faster convergence (Storn and Price, 1997).In the literature, many authors have used DE for bi-level, multi-level, and color thresholding of natural and satellite images using different objective functions.DE outperforms many of the conventional meta-heuristic algorithms, providing a good threshold (Bhandari et al., 2016;Pare et al., 2017;Upadhyay and Chhabra, 2020).

Quantum Genetic Algorithm (QGA):
A Quantum genetic algorithm was introduced by Narayan and Moore (Narayanan and Moore, 1996) which combines the advantages of both classical and quantum mechanics.The Q-bit encoded chromosomes can represent a linear superposition of states probabilistically and can potentially map to a larger search space than other evolutionary algorithms (Zhang et al., 2014).The diversity of individuals in populations is greatly increased by the use of qubit instead of binary, or any other form of symbolic representation, which also helps to avoid premature convergence effectively.As a result, QGA proves to have higher efficiency and is faster.

Proposed Methodology
In this paper, we proposed QGA-GLCM which combines the exploration skills of QGA with spatial correlation among pixel intensities to find the optimal threshold.Our proposed quantuminspired genetic algorithm uses GLCM as a fitness function to evaluate the individual chromosomes in the population.The proposed method reduces the computational time and aids in finding the optimal threshold.Figure 1 shows the flowchart of the proposed methodology.An explanation of the various steps in the proposed algorithm is given as follows:

Quantum rotation:
The use of a rotation gate greatly reduces the algorithm search space becuase it is based on the table look-up.It also helps in improving the solution by advancing towards the global optimum.Each qubit is rotated by a phase angle ,  ∈ (0, /2) producing a pair of amplitudes (α, β) that defines the state of j th qubit.The chromosome is initialized when all the qubits of chromosome are rotated.This completes the initialization process.This rotation can be achieved using a rotation matrix.
() = �   −      � 2.4.3Measure the system: This step converts the system from its superposition state back to binary.Let the qubit be represented by amplitudes (α, β) where || 2  || 2 represents probability of getting zero and one respectively.Select a random number in the range (0, 1), and if the selected random number(),  < || 2 then the state of the corresponding qubit is set to 0 or else it is set to 1.This process is repeated for all the qubits of chromosome.This process measures the system of m-qubits probabilistically, leaving the system in one of its basis states to represent the chromosome.Each individual chromosome now represents an intensity value, which forms the initial set of intensity values.This process serves two purposes: it creates a classical population of the current quantum population to assist in evaluating the fitness function and it prevents the quantum system from collapsing to basis states (Lahoz-Beltra, 2016).

Update the system:
On evaluating all chromosomes in population for the fitness, we obtain the best chromosome for the current iteration.The rotation gate is used as update operator of QGA to drive the individuals toward better solutions.They can strive the balance between exploration and exploitation.Rotation of a qubit by an arbitrary angle  brings in randomness and helps in exploration of the search space.Rotation of a qubit is supported by look-up table (refer to Table 1) which is specific to a particular optimization problem.The angle  is used for updating the qubit, and the sign of  indicates the direction while its value indicates the angle of rotation.The speed of convergence of the solution directly depends on the value of  and needs to be selected carefully.Selection of a very high value for  , results in a solutions diverging or converging to a local optimum.We update the qubits of the chromosome using rotation gate and it is represented as ( + 1) = ()() where (), ( + 1) represent the state of chromosomes in the population at 't' and 't+1' generations respectively.This is processed using rotation gate operator: The International Archives of the Photogrammetry, Remote Sensing and Spatial Information Sciences, Volume XLVIII-4/W6-2022 Geoinformation Week 2022 "Broadening Geospatial Science and Technology", 14-17 November 2022, Johor Bahru, Malaysia (online) 2.4.5Quantum crossover: This process resembles the classical crossover where the values are replaced by of the qubits.The two individual chromosomes for mating are selected using the tournament selection process.Here, each chromosome undergoes crossover, if crossover probability (  ), is greater than the generated random number(rcr), i.e. rcr< pcr.In this case, a random crossover point is selected and the amplitude values of all the qubits after this crossover point are interchanged, forming two new off-springs.Then a greedy selection is done between offspring and parents.
2.4.6Quantum mutation: This process resembles the classical mutation, which is achieved by inverting the amplitudes of the qubit using an inversion gate.This process brings in diversity in the population.A chromosome mutates, if mutation probability (  ) is greater than the generated random number (  ) for the chromosome.i.e.,   <   .Thus, if a chromosome is selected for mutation, then one or more genes in the chromosome mutate by swapping the amplitudes.A gene mutates if the mutation rate for the gene (  ) is greater than random number generated for the gene (  ).i.e.,   <   .Let �  ,   � represent the amplitudes of k th qubit of i th chromosome then the mutation operation is given as: 2.4.7 Termination condition: Now measure the state of the population by evaluating the fitness value of each individual in the population.Obtain the best chromosome for the generation and optimal threshold value.Terminate the process, if current iteration is equal to   else repeat the steps for measurement, to update the system, mutation, and crossover for   number of times.The optimal threshold is the threshold value obtained at the end of   .

EXPERIMENTS, RESULTS AND DISCUSSION
This session analyses the results of our proposed algorithm using various objective functions.The experimental set-up for this research work is described in Section 3.1.The obtained results are described in section 3.2.

Experimental Setup
The performance of the algorithm was evaluated for images from two groups: a) natural images consisting of an object and background from Berkeley Segmentation Dataset (Martin et al., 2001).b) satellite images of various regions collected from Google Earth, where the built-up areas (roads and buildings) form the object and the rest forms the background.We evaluated the performance of our algorithm for 10 images from each group.We compared the performance of algorithms quantitatively based on the CPU time required to execute the algorithm, Peak Signalto-Noise Ratio (PSNR), Mean Square Error (MSE), and Structural Similarity Index (SSIM) measures.To evaluate the exploration capabilities of the algorithms, we used the mean and variance of fitnesses generated by the population in each generation.Finally, the partitioned images were validated for their quality of segmentation using K-Means algorithm with K=2.

Results
The behaviour of QGA-GLCM was analysed for efficiency and The graph of execution time taken v/s images by various algorithms to generate optimal threshold values can be visualized in Figure 4. On an average QGA-GLCM takes only 0.02seconds to generate threshold value for a given image, whereas DE-GLCM takes 2-3 seconds for the same.Due to huge difference of time between DE-GLCM and other variants, the time line corresponding to DE-GLCM is missing in the Figure 4.The QGA and its variants generate the threshold value for a given image in 0.002s-0.005s,which is 10 times faster than its classical variant which takes 0.02s-0.05s,proving the QGA and its variant's computational efficiency.

Conclusion
In this paper, we proposed a GLCM based QGA which uses edge information from contrast features.Including the contrast feature into GLCM has generated superior threshold values.Our experimental observations were as follows with respect to QGA and its variants: a) The average of the fitness values generated over various iterations has higher variance and low mean values, indicating that the solution space was less explored b) They are robust and have faster convergence (nearly 10 times faster).The proposed QGA-GLCM a) gives a better threshold for a noisy image without adding any additional information, and thus the segmented image is of superior quality, which is accounted for by higher SSIM value.b) The threshold values obtained are better than DE-GLCM and, in most cases, its equivalent to QGA-OTSU and DE-OTSU.c) The performance of the segmented image was compared with that of the two-class K-Means classifier using SSIM to obtain a value of almost 1.Notably, it can be concluded that the QGA-GLCM reduces overall computational time, generating a threshold value better than Otsu method for noisy images and equivalent to Otsu in other cases.
Further, this research work can be extended for multilevel thresholding considering multiple classes.

Figure 1 :
Figure 1: Flowchart of the proposed methodology 2.4.1 Initialize the population: QGA begins by initializing the population size (npop) and chromosome length(m), crossover probability (  ), mutation probability (  ), mutation rate for each gene (  ) and the maximum number of generations (  ).Each gene in the chromosome is represented using a qubit.A combination of such m-qubits forms a chromosome representing each individual in the population.A set of npop chromosomes represents a population.The population is denoted by  = { 1 ,  2 , … ,   } where   represents the i th individual in the population.The population corresponding to generation 't' is given by Q(t).Each qubit is initially set to |0⟩ and later put into superposition of all states with equal probabilities using Hadamard gate.

Figure 3 :Figure 4 :
Figure 3: Comparing of thresholds of various algorithm for 20 different images

Figure 5 :
Figure 5: Comparing SSIM values of various algorithm for 20 different images

2.1.2 Kapur's Entropy: It
Subject to:|   +   | − 1 <  < 1 − |   +   | is a generalization of Shannon's entropy.Kapur assumed the image to contain two probability distributions, corresponding to the object and the background,

Table 1 :
Look-up table for rotational angle()

Table 2 :
Comparison of Threshold, PSNR, MSE, and SSIM for different algorithm

Table 3 :
Comparison of Threshold, Mean, Variance, and CPU Time (in sec) for different algorithm