CN111754533A - Image segmentation method based on improved genetic algorithm and K-mean algorithm - Google Patents
Image segmentation method based on improved genetic algorithm and K-mean algorithm Download PDFInfo
- Publication number
- CN111754533A CN111754533A CN202010842312.2A CN202010842312A CN111754533A CN 111754533 A CN111754533 A CN 111754533A CN 202010842312 A CN202010842312 A CN 202010842312A CN 111754533 A CN111754533 A CN 111754533A
- Authority
- CN
- China
- Prior art keywords
- algorithm
- optimal solution
- individuals
- clustering center
- population
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 230000002068 genetic effect Effects 0.000 title claims abstract description 28
- 238000003709 image segmentation Methods 0.000 title claims abstract description 26
- 238000000034 method Methods 0.000 title claims abstract description 23
- 238000005457 optimization Methods 0.000 claims abstract description 9
- 230000011218 segmentation Effects 0.000 claims abstract description 6
- 230000035772 mutation Effects 0.000 claims description 10
- 238000002922 simulated annealing Methods 0.000 claims description 5
- 238000002921 genetic algorithm search Methods 0.000 claims description 2
- 230000013011 mating Effects 0.000 claims description 2
- 238000006243 chemical reaction Methods 0.000 abstract description 4
- 238000003064 k means clustering Methods 0.000 description 12
- 230000006870 function Effects 0.000 description 8
- 210000000349 chromosome Anatomy 0.000 description 4
- 238000012545 processing Methods 0.000 description 4
- 108090000623 proteins and genes Proteins 0.000 description 4
- 238000005516 engineering process Methods 0.000 description 3
- 230000000694 effects Effects 0.000 description 2
- 230000004075 alteration Effects 0.000 description 1
- 238000004458 analytical method Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000019771 cognition Effects 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000018109 developmental process Effects 0.000 description 1
- 238000001914 filtration Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 238000013178 mathematical model Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000006798 recombination Effects 0.000 description 1
- 238000005215 recombination Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/11—Region-based segmentation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/23—Clustering techniques
- G06F18/232—Non-hierarchical techniques
- G06F18/2321—Non-hierarchical techniques using statistics or function optimisation, e.g. modelling of probability density functions
- G06F18/23213—Non-hierarchical techniques using statistics or function optimisation, e.g. modelling of probability density functions with fixed number of clusters, e.g. K-means clustering
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/12—Computing arrangements based on biological models using genetic models
- G06N3/126—Evolutionary algorithms, e.g. genetic algorithms or genetic programming
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/70—Denoising; Smoothing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10024—Color image
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Life Sciences & Earth Sciences (AREA)
- General Physics & Mathematics (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Bioinformatics & Computational Biology (AREA)
- Biophysics (AREA)
- Evolutionary Biology (AREA)
- Health & Medical Sciences (AREA)
- General Engineering & Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Artificial Intelligence (AREA)
- Evolutionary Computation (AREA)
- Biomedical Technology (AREA)
- Physiology (AREA)
- Genetics & Genomics (AREA)
- Probability & Statistics with Applications (AREA)
- Computational Linguistics (AREA)
- General Health & Medical Sciences (AREA)
- Molecular Biology (AREA)
- Computing Systems (AREA)
- Mathematical Physics (AREA)
- Software Systems (AREA)
- Image Analysis (AREA)
Abstract
The invention provides an image segmentation method based on an improved genetic algorithm and a K-mean algorithm, which is characterized by comprising the following steps of: after denoising and color space conversion are carried out on the image, an improved genetic algorithm is used for searching a global optimal solution, then a K-mean algorithm is used for carrying out local optimization, and the obtained optimal solution is used as an initial clustering center of the K-mean algorithm. The method solves the problems that the genetic algorithm is easy to fall into the local optimal solution and the initial clustering center of the K-means algorithm is difficult to set, and provides the image segmentation method which can achieve higher convergence rate and higher segmentation precision.
Description
Technical Field
The invention belongs to the technical field of image segmentation, and particularly relates to an image segmentation method based on an improved genetic algorithm and a K-means algorithm.
Background
The image segmentation is to divide the image into different areas and select the desired part on the basis of reserving some characteristics of the original image, thereby effectively reducing the workload of subsequent image processing and improving the efficiency of image processing. With the rapid development of image processing technology in recent years, image segmentation techniques have attracted more and more attention.
A plurality of scholars put forward new ideas and continuously improve the cognition of people to the image segmentation field, and the appearance of the clustering technology greatly expands the image segmentation field and provides more choices for people. MacQueen in the sixties of the last century provides a K-means clustering algorithm, which is the most well-known and applied clustering analysis algorithm at present, has outstanding capability of local optimization, and has the advantages of high efficiency, good flexibility and the like. These excellent characteristics of the K-means clustering algorithm are also widely applied to the field of image segmentation. At present, a color segmentation method based on K-means clustering and region merging is proposed, and the segmentation of a color image is greatly improved; the K-means clustering algorithm is also applied to image segmentation containing noise, and the image segmentation capability of the K-means clustering algorithm under different conditions is improved. But the K-means clustering algorithm is difficult to select the clustering center, and is easy to fall into local convergence and miss the global optimal solution.
In view of the shortcomings of the K-means clustering algorithm, researchers propose that the K-means clustering algorithm is improved and optimized through a global optimization algorithm, the genetic algorithm is an excellent global optimal solution searching method, but the standard genetic algorithm is prone to be trapped in local optimal solutions and is unfavorable for searching the global optimal solutions.
Disclosure of Invention
The invention aims to provide an image segmentation method based on an improved genetic algorithm and a K-means algorithm, so as to solve the problems in the background technology.
In order to achieve the purpose, the invention provides the following technical scheme:
an image segmentation method based on an improved genetic algorithm and a K-mean algorithm is characterized in that an image is subjected to denoising processing and color space conversion, and an improved genetic algorithm is used for searching a global optimal solution; local optimization is carried out by using a K-means algorithm, and the obtained optimal solution is used as an initial clustering center of the K-means algorithm, so that image segmentation with higher convergence rate and higher segmentation precision is realized.
As a preferred embodiment, the improved genetic algorithm searches for a global optimal solution, and specifically includes the following steps:
(1) coding and population division: the individual populations are divided into two populations.
(2) Selecting: the more excellent individuals in the two populations are selected respectively, and the excellent characteristics of the excellent individuals are reserved for the next generation of individuals through inheritance and mating.
(3) And (3) crossing: and single-point crossing is used to ensure that the crossing digit of the population 1 is greater than that of the population 2.
(4) Mutation: different mutation probabilities S1 and S2 are set for the two populations respectively, and the value of S1 is ensured to be larger than S2.
(5) And (3) variation acceptance judgment: and judging whether the individuals generated by the mutation are accepted or not according to Metropolis criterion in the simulated annealing algorithm.
(6) And (3) judging a fitness function: and judging the population individuals according to a fitness function H (), and reserving the individuals with better fitness.
(7) Exchanging individuals: and exchanging the optimal individuals obtained from different populations.
(8) And (3) judging the termination of the algorithm: whether the solving precision is met between the two population optimal individuals and the optimal solution of the objective function or not is judged, and if not, the step (2) is carried out; otherwise, the algorithm is terminated and the current optimal solution is returned.
As a preferred embodiment, the local optimization is performed by using a K-means algorithm, so as to obtain an optimal solution as an initial clustering center of the K-means algorithm, and the method specifically includes the following steps:
(1) determination of the cluster center: and taking the global optimal solution obtained by the improved genetic algorithm as a K-mean clustering center.
(2) Updating a clustering center: and calculating the distance between the sample and each clustering center by adopting the Euclidean distance, classifying the sample into the clustering center closest to the sample, and updating the clustering center of each cluster.
(3) Algorithm termination judgment conditions: if the last clustering center is not equal to the new clustering center, returning to the step 2; if the two are equal, the algorithm is terminated, the optimal solution is returned, and image segmentation is realized.
Compared with the prior art, the invention has the beneficial effects that:
the invention provides an image segmentation method based on an improved genetic algorithm and a K-mean algorithm, namely, after the image is denoised and space conversion is carried out, a single population is changed into double populations on the basis of the original genetic algorithm, and Metropolis criterion in a simulated annealing algorithm is added, so that the situation that the genetic algorithm falls into a local optimal solution is well avoided through the improvement; and then, local optimization is carried out by utilizing a K-mean algorithm, and the obtained optimal solution is used as a clustering center of the K-mean, so that the problem that the K-mean algorithm is sensitive to an initial clustering center is effectively solved, and the image segmentation with higher convergence rate and higher segmentation precision on the image is realized.
Drawings
FIG. 1 is a flow chart of the image segmentation method based on the improved genetic algorithm and the K-means algorithm of the present invention
FIG. 2 is a flow chart of an improved genetic algorithm of the present invention
FIG. 3 is a flow chart of the K-means clustering algorithm of the present invention
Detailed Description
In order to make the technical solution of the present invention better understood, the patent of the present invention will be further described with reference to the attached drawings.
FIG. 1 is a flow chart showing an image segmentation method based on an improved genetic algorithm and a K-means algorithm, wherein the method comprises the steps of firstly performing two-dimensional filtering on an input image based on an RGB color model to perform denoising, recombining a denoised H, S, V component channel tristimulus to obtain a preprocessed image, and formulating an HSV color space by researching an RGB stereo color space along a gray axis to obtain a hexagonal color palette; converting the picture from the RGB color space to the HSV color space by the following formula:
V=M (3)
where M is Max (R, G, B), M is min (R, G, B), H is (0,2 pi), S is e (0,1), V is e (0,1), and after converting the color space, a globally optimal solution is found using an improved genetic algorithm.
The image after denoising and color space conversion is used for finding a global optimal solution by using an improved genetic algorithm, fig. 2 is a flow chart of the improved genetic algorithm, and the steps are as follows: 1. coding and dividing of the population: the gray code is used for coding, and the method is shown as the following graph formula:
wherein B ═ Bmbm-1…b2b1Is a binary code. A single population is changed into double populations, so that the situation that the single population is trapped into local optimum is avoided, and the diversity of the populations is increased. 2. Selecting: superior individuals are picked in the two populations using the monte carlo selection operator, and the superior characteristics of the superior individuals are left to the next generation of individuals by means of inheritance and re-mating. 3. And (3) crossing: the gene recombination phenomenon in the natural biogenetic is simulated by adopting single-point cross operation, the searching capability of a genetic algorithm is improved, and the number of cross digits of the population 1 is set to be larger than that of the population 2. 4. Mutation: different variation probabilities S are set for the two populations1And S2And ensuring that the mutation probability of the population 1 is greater than the mutation probability (S) of the population 21>S2) (ii) a Then the chromosome string is encoded by a random function rand () (the random function conforms to a uniformly distributed mathematical model), and each gene of the chromosome string randomly generates a random number tiRandom number t generated when a gene in a chromosome stringiIf the mutation probability is less than the predetermined mutation probability, the gene at the position corresponding to the chromosome string is mutated. When dyeingThe color body string is e ═ g1g2…glThen:
5. and (3) variation acceptance judgment: judging whether an individual receiving variation is judged according to a Metropolis criterion, wherein the Metropolis criterion of the simulated annealing algorithm is represented by a probability transfer method, and the specific method comprises the following steps:
wherein t is a temperature control parameter of the simulated annealing i algorithm, and the value of t is reduced along with the increase of the iteration number. 6. And (3) judging a fitness function: according to fitness functionAnd (4) judging the fitness of the two population individuals to the environment, and reserving the individuals with better fitness. 7. Exchanging individuals: and exchanging the obtained optimal individuals of the two populations to mutually make up the respective defects. 8. And (3) judging the termination of the algorithm:
whereinIs the best individual of the current generation, h*(x) Is the optimal solution of the objective function of the optimization problem, and ζ is the required precision. If the formula precision requirement is met, returning to the current optimal solution, otherwise, turning to the step 2.
After the global optimal solution is found, local search is performed by using a K-means clustering algorithm, and fig. 3 is a flow chart of the K-means clustering algorithm, so that the K-means clustering algorithm has the following steps:
1. determination of the cluster center: taking the global optimal solution obtained by the improved genetic algorithm as the initial cluster selected by usA center. 2. Updating a clustering center: and calculating the distance from the whole group sample to each initial clustering center by using the Euclidean distance, classifying the sample into the clustering center closest to the sample, forming a new cluster, and calculating the mean value of each clustering data sample to obtain a new clustering center. And evaluating the clustering performance by using a sum of squared errors criterion function, wherein the sample set is T ═ x1,x2,…,xmAnd cluster division J ═ J1,J2,…,JKThe equation for the least squares error is as follows:
is a cluster JiThe higher the Z value is, the higher the similarity of the samples in the cluster is, the poorer the clustering effect is, and otherwise, the excellent clustering effect is. 3. Algorithm termination judgment conditions: if the last clustering center is not equal to the new clustering center, returning to the step 2; if the two images are equal, the algorithm is terminated, the optimal solution is returned, and finally the image is segmented quickly and accurately.
Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that changes, modifications, substitutions and alterations can be made in these embodiments without departing from the principles and spirit of the invention, the scope of which is defined in the appended claims and their equivalents.
Claims (3)
1. An image segmentation method based on an improved genetic algorithm and a K-means algorithm is characterized in that: denoising and converting the image into a color space, and searching a global optimal solution by using an improved genetic algorithm; and then, local optimization is carried out by utilizing a K-means algorithm, and the obtained optimal solution is used as an initial clustering center of the K-means algorithm, so that the image segmentation with higher convergence rate and higher segmentation precision is realized.
2. The image segmentation method based on the improved genetic algorithm and the K-means algorithm as claimed in claim 1, wherein the improved genetic algorithm searches for a global optimal solution, and specifically comprises the following steps:
(1) coding and population division: the population is encoded and the entire population is divided into two populations.
(2) Selecting: the more excellent individuals in the two populations are selected respectively, and the excellent characteristics of the excellent individuals are reserved for the next generation of individuals through inheritance and mating.
(3) And (3) crossing: and single-point crossing is used to ensure that the crossing digit of the population 1 is greater than that of the population 2.
(4) Mutation: different variation probabilities S are set for the two populations1And S2And guarantee S1Is greater than S2。
(5) And (3) variation acceptance judgment: and judging whether the individuals generated by the mutation are accepted or not according to Metropolis criterion in the simulated annealing algorithm.
(6) And (3) judging a fitness function: and judging the population individuals according to a fitness function H (), and reserving the individuals with better fitness.
(7) Exchanging individuals: and exchanging the optimal individuals obtained from different populations.
(8) And (3) judging the termination of the algorithm: whether the solving precision is met between the two population optimal individuals and the optimal solution of the objective function or not is judged, and if not, the step (2) is carried out; otherwise, the algorithm is terminated and the current optimal solution is returned.
3. The image segmentation method based on the improved genetic algorithm and the K-means algorithm as claimed in claim 1, wherein the local optimization is performed by the K-means algorithm again to obtain an optimal solution as an initial clustering center of the K-means algorithm, and the method specifically comprises the following steps:
(1) determination of the cluster center: and taking the global optimal solution obtained by the improved genetic algorithm as an initial K-mean clustering center.
(2) Updating a clustering center: and calculating the distance between the sample and each clustering center by adopting the Euclidean distance, classifying the sample into the clustering center closest to the sample, and updating the clustering center of each cluster.
(3) Algorithm termination judgment conditions: if the last clustering center is not equal to the new clustering center, returning to the step 2; if the two are equal, the algorithm is terminated, the optimal solution is returned, and image segmentation is realized.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010842312.2A CN111754533A (en) | 2020-08-20 | 2020-08-20 | Image segmentation method based on improved genetic algorithm and K-mean algorithm |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010842312.2A CN111754533A (en) | 2020-08-20 | 2020-08-20 | Image segmentation method based on improved genetic algorithm and K-mean algorithm |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111754533A true CN111754533A (en) | 2020-10-09 |
Family
ID=72713254
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010842312.2A Pending CN111754533A (en) | 2020-08-20 | 2020-08-20 | Image segmentation method based on improved genetic algorithm and K-mean algorithm |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111754533A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115730432A (en) * | 2022-11-09 | 2023-03-03 | 国网湖南省电力有限公司 | Scheduling method, system, equipment and storage medium for data processing tasks of Internet of things |
-
2020
- 2020-08-20 CN CN202010842312.2A patent/CN111754533A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115730432A (en) * | 2022-11-09 | 2023-03-03 | 国网湖南省电力有限公司 | Scheduling method, system, equipment and storage medium for data processing tasks of Internet of things |
CN115730432B (en) * | 2022-11-09 | 2024-05-28 | 国网湖南省电力有限公司 | Scheduling method and system of data processing task of Internet of things, equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111585816A (en) | Task unloading decision method based on adaptive genetic algorithm | |
WO2022016912A1 (en) | Full convolutional genetic neural network optimization method for infant brain medical record image segmentation | |
CN111353534B (en) | Graph data category prediction method based on adaptive fractional order gradient | |
CN115761735A (en) | Semi-supervised semantic segmentation method based on self-adaptive pseudo label correction | |
CN114897129A (en) | Photovoltaic power station short-term power prediction method based on similar daily clustering and Kmeans-GRA-LSTM | |
CN114118369B (en) | Image classification convolutional neural network design method based on group intelligent optimization | |
CN111462157B (en) | Infrared image segmentation method based on genetic optimization threshold method | |
CN109902808B (en) | Method for optimizing convolutional neural network based on floating point digital variation genetic algorithm | |
CN113627479B (en) | Graph data anomaly detection method based on semi-supervised learning | |
CN115187610A (en) | Neuron morphological analysis method and device based on graph neural network and storage medium | |
CN116883672B (en) | Image segmentation method based on clustering division differential evolution algorithm and OTSU algorithm | |
CN114006870A (en) | Network flow identification method based on self-supervision convolution subspace clustering network | |
CN115640842A (en) | Network representation learning method based on graph attention self-encoder | |
CN111754533A (en) | Image segmentation method based on improved genetic algorithm and K-mean algorithm | |
CN117132849A (en) | Cerebral apoplexy hemorrhage transformation prediction method based on CT flat-scan image and graph neural network | |
Bi et al. | Self-adaptive Teaching-learning-based Optimizer with Improved RBF and Sparse Autoencoder for Complex Optimization Problems | |
CN112149052B (en) | Daily load curve clustering method based on PLR-DTW | |
CN117349687A (en) | Daily load curve clustering method based on variable convolution self-encoder | |
CN110705704A (en) | Neural network self-organizing genetic evolution algorithm based on correlation analysis | |
CN117334252A (en) | Cancer driving gene identification method based on heterophilic graph information maximization | |
CN117056763A (en) | Community discovery method based on variogram embedding | |
CN116844645A (en) | Gene regulation network inference method based on multi-view layered hypergraph | |
CN116523877A (en) | Brain MRI image tumor block segmentation method based on convolutional neural network | |
CN113011589B (en) | Co-evolution-based hyperspectral image band selection method and system | |
CN105654498A (en) | Image segmentation method based on dynamic local search and immune clone automatic clustering |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
WD01 | Invention patent application deemed withdrawn after publication | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20201009 |