A method and system for detecting typical defects of targets in industrial video images
Through image segmentation and genetic algorithm processing, superpixel region features are extracted and converted, which solves the problem of low target defect detection accuracy in industrial video images and achieves higher detection accuracy and fewer errors.
Patent Information
- Application Number
- CN202410925149.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-11
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2044-07-11
AI Technical Summary
The recognition accuracy of existing target defect detection methods in industrial video images is not high, especially when the target image is large, resulting in large errors in defects identified by machine vision detection.
The image segmentation algorithm is used to pre-segment the image of the target object to be detected, and the color features and texture features of the superpixel area are extracted, and these features are converted and updated through a genetic algorithm to generate a chromosome representation that meets the fitness evaluation conditions, and finally through chromosome decoding The target solution segmentation results are obtained, and the image sub-region results are merged to improve detection accuracy.
It effectively improves the recognition accuracy of target defect detection and reduces detection errors, especially in the case of large target images.
Smart Images

Figure CN118470013B
Abstract
Description
Technical Field
[0001] The present application relates to the field of defect detection technology, and in particular to a method and system for detecting typical defects of a target object in an industrial video image. Background Art
[0002] Defect detection in industrial video images usually refers to the detection of surface defects in images. Surface defect detection uses advanced machine vision detection technology to detect defects such as spots, pits, scratches, color differences and defects on the surface of the target object in the image.
[0003] Existing methods for detecting defects in target objects mainly include laser detection, magnetic flux leakage detection, infrared detection, ultrasonic detection and machine vision detection. Among them, the basic principle of machine vision detection is to illuminate the surface of the target object to be tested with a certain light source, obtain the surface image of the target object with a high-speed CCD camera, extract the image feature vector through image processing, and detect surface defects through a classifier.
[0004] Generally speaking, the image acquisition device is used to take pictures of the target object to be tested and transmit the taken pictures of the target object to be tested to the defect analysis system. The defect analysis system is used to compare and analyze the pictures of the target object to be tested, thereby realizing automatic detection of defects of the target object.
[0005] However, in the above-mentioned existing target defect detection methods, the accuracy of the target image taken by the image acquisition device is usually not high, resulting in large errors in the target defects identified by machine vision detection, especially when the captured target image is large. Summary of the invention
[0006] The present application provides an image segmentation detection solution for grayscale images of target objects, which can solve the problem that in the prior art, there are usually large errors in the detection and identification of target object defects.
[0007] To solve the above problems, according to the first aspect of the present application, the present application provides a method for detecting typical defects of a target object in an industrial video image, comprising:
[0008] Acquire an image of a target object to be detected, and pre-segment the image of the target object to be detected according to a predetermined image segmentation algorithm to obtain a plurality of image sub-regions, wherein each image sub-region corresponds to a group of super-pixel regions;
[0009] For each of the multiple image sub-regions, extracting color features and texture features of a super-pixel region corresponding to the image sub-region, and obtaining a feature representation of the super-pixel region;
[0010] The feature representation of the super-pixel region is converted according to the genetic algorithm to obtain the chromosome representation of the super-pixel region, and the chromosome representation of the super-pixel region is updated to obtain individuals of the offspring population that meet the fitness evaluation conditions;
[0011] The chromosomes of the individuals in the offspring population that meet the fitness evaluation conditions are decoded to obtain the target solution segmentation results;
[0012] For all image sub-regions corresponding to the target image to be detected, the target desegmentation results corresponding to all image sub-regions are merged to obtain a final segmented image to be detected corresponding to the target image to be detected;
[0013] Acquire an original target object defect image, and perform the above steps on the original target object defect image to obtain an original final segmented image corresponding to the original target object defect image;
[0014] By matching the final segmented image to be detected corresponding to the image of the target object to be detected with the original final segmented image corresponding to the original target object defect image, it is determined whether the image of the target object to be detected has defects.
[0015] Preferably, in the above-mentioned method for detecting typical defects of a target object in an industrial video image, the step of pre-segmenting the image of the target object to be detected according to a predetermined image segmentation algorithm comprises:
[0016] Performing image preprocessing on the target object grayscale image to obtain a preprocessed target object grayscale image;
[0017] The preprocessed target grayscale image is segmented using the Meanshift algorithm to obtain multiple image sub-regions, where each image sub-region corresponds to a group of super-pixel regions.
[0018] Preferably, in the above-mentioned method for detecting typical defects of a target object in an industrial video image, the step of converting the feature representation of the superpixel region according to a genetic algorithm to obtain the chromosome representation of the superpixel region includes:
[0019] Initializing a plurality of image sub-regions as a population, and selecting a predetermined number of image sub-regions from the plurality of image sub-regions as individuals of the population;
[0020] Using label-based encoding, the feature vector of the superpixel region corresponding to the individual is converted into a chromosome representation, and the gene bit value on the chromosome representation is randomly determined;
[0021] Convert the attribute classification or attribute clustering results of the superpixel region into labels.
[0022] Preferably, in the above-mentioned method for detecting typical defects of a target object in an industrial video image, the step of updating the chromosome representation of the superpixel region to obtain individuals of the offspring population that meet the fitness evaluation condition includes:
[0023] Calculate the fitness of the chromosome representation corresponding to the image sub-region;
[0024] According to a predetermined selection algorithm, using the fitness value represented by the chromosome, an individual is selected as a parent chromosome;
[0025] Perform crossover operation on the parent chromosome to obtain the offspring chromosome, and perform mutation operation on the offspring chromosome to obtain a new offspring population;
[0026] Call and evaluate the fitness of individuals in the new offspring population;
[0027] Determine whether the individuals in the offspring population meet the basic pre-conditions for fitness evaluation;
[0028] If the individual meets the basic preset conditions, the individual is determined to be an individual of the offspring population that meets the fitness evaluation conditions;
[0029] If the individual does not meet the basic preset conditions, the chromosome representation fitness is recalculated and a new offspring population is sought.
[0030] Preferably, in the above-mentioned method for detecting typical defects of a target object in an industrial video image, the steps of performing a crossover operation on the parent chromosome to obtain a child chromosome, and performing a mutation operation on the child chromosome to obtain a new child population include:
[0031] Set the threshold for the number of individuals generated by crossover and mutation operations;
[0032] When the parent chromosome is crossovered and the number of generated offspring chromosomes reaches the individual number threshold, the offspring chromosomes will no longer be mutated;
[0033] Set the mutation probability of the mutation operation;
[0034] When controlling the offspring chromosome to perform mutation operation, the gene mutation probability of the offspring chromosome is less than or equal to the mutation probability.
[0035] Preferably, in the above-mentioned method for detecting typical defects of a target object in an industrial video image, the step of judging whether the individuals of the offspring population meet the basic preset conditions for fitness evaluation includes:
[0036] Set the mating probability of chromosomes;
[0037] According to the mating probability, the parent chromosomes are selected from the population for mating according to the uniform crossover algorithm to obtain the offspring chromosomes;
[0038] Determine whether the number of offspring chromosomes in the offspring population reaches the individual number threshold;
[0039] If the number of offspring chromosomes does not reach the individual number threshold, the offspring chromosomes are mutated according to the mutation probability and the basic bit mutation algorithm to obtain the mutated offspring chromosomes;
[0040] The mutated offspring chromosomes replace the original offspring chromosomes and are incorporated into the new offspring population;
[0041] Determine whether the number of chromosomes in the current offspring reaches the individual number threshold. If so, stop the mutation operation.
[0042] Preferably, in the above-mentioned method for detecting typical defects of a target object in an industrial video image, the step of performing chromosome decoding on individuals of the offspring population that meet the fitness evaluation conditions to obtain the target desegmentation result includes:
[0043] Designing a fitness objective function, and using the fitness objective function to decode individuals of the offspring population into clustering results, wherein the clustering results include pixel labels;
[0044] Assign superpixel areas belonging to the same clustering result category to the same clustering cluster, and calculate the class center of each clustering cluster;
[0045] Mark the superpixel regions with the same pixel labels as superpixel regions to be selected;
[0046] Using the cluster center of the cluster, calculate the membership matrix X of the color space and the membership matrix P of the texture space of the superpixel region to be selected, and perform secondary verification on the membership matrix X of the color space and the membership matrix P of the texture space;
[0047] The superpixel regions that meet the secondary verification conditions are determined as target superpixel regions, and the target superpixel regions with the same label are merged to obtain the target solution segmentation result.
[0048] Preferably, in the above-mentioned typical defect detection method for a target object in an industrial video image, the class center of the cluster is used to calculate the membership matrix X of the selected superpixel area in the color space and the membership matrix P of the texture space, and the step of performing secondary verification on the membership matrix X of the color space and the membership matrix P of the texture space includes:
[0049] For each superpixel region, the membership weights of the superpixel region and each class center in the color space are calculated according to the fuzzy C-means algorithm to obtain the membership matrix X of the superpixel region in the color space; according to the membership update formula of the fuzzy C-means algorithm, the membership matrix X of the superpixel region in the color space and the class center matrix are iteratively updated until the update stop condition is reached;
[0050] For each superpixel region i, calculate its distance d(i,j) to each category center j;
[0051] The membership u(i, j) of each superpixel region i to each category center j is calculated based on the distance, and the membership is calculated using the fuzzy C-means formula as follows: ;
[0052] Among them, m is a fuzzy parameter that controls the fuzziness of the membership;
[0053] Update the category center matrix C according to the membership degree, and calculate the new position of each category center j as: ;
[0054] Where X(i) is the feature vector of superpixel region i in color space;
[0055] Based on each element X(i) of the membership matrix X, the membership matrix X of the superpixel region in the color space is obtained;
[0056] For each superpixel region, calculate the membership weight of each superpixel region and each class center in the texture space , that is, calculate the elements of the membership matrix P of the texture space corresponding to the superpixel area and each class center : in, represents the Euclidean distance between superpixel region i and category center j, m represents the fuzzy factor, which controls the fuzziness of the membership, and k represents the kth category center;
[0057] The membership weights of the superpixel region and each class center in all class centers in the texture space are combined to obtain the membership matrix of each superpixel region in the texture space;
[0058] The membership matrix X of the color space and the membership matrix P of the texture space are verified twice, specifically through the threshold method: the element values in the membership matrix X of the current color space and the membership matrix P of the texture space are obtained; the secondary verification condition is called, if the element values of the color space of the current superpixel area are higher than the corresponding standard color threshold, and the element values of the texture space of the current superpixel area are also higher than the corresponding standard texture threshold, then the superpixel area is determined to be a valid target superpixel area.
[0059] According to the second aspect of the present application, the present application also provides a typical defect detection system for a target object in an industrial video image, comprising:
[0060] An image pre-segmentation module is used to obtain an image of a target object to be detected, and pre-segment the image of the target object to be detected according to a predetermined image segmentation algorithm to obtain a plurality of image sub-regions, wherein each image sub-region corresponds to a group of super-pixel regions;
[0061] A feature extraction module is used to extract, for each of the multiple image sub-regions, a color feature and a texture feature of a super-pixel region corresponding to the image sub-region, so as to obtain a feature representation of the super-pixel region;
[0062] A superpixel region conversion module is used to convert the feature representation of the superpixel region according to a genetic algorithm to obtain a chromosome representation of the superpixel region;
[0063] The superpixel region update module is used to update the chromosome representation of the superpixel region to obtain individuals of the offspring population that meet the fitness evaluation conditions;
[0064] The chromosome encoding module is used to decode the chromosomes of individuals in the offspring population that meet the fitness evaluation conditions to obtain the target solution segmentation results;
[0065] The segmentation result merging module is used to merge the target desegmentation results corresponding to all image sub-regions corresponding to the target object image to be detected, so as to obtain the final segmented image to be detected corresponding to the target object image to be detected.
[0066] In summary, the technical solution provided by the present application can solve the problem of large errors in target object defects identified by machine vision detection methods in the prior art by matching the original final segmented image with the final segmented image to be detected. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the structures shown in these drawings without paying any creative work.
[0068] Figure 1 It is a flow chart of a typical defect detection method of a target object in an industrial video image provided by an embodiment of the present application;
[0069] Figure 2It is a flow chart of a method for extracting color features and texture features of a superpixel region of a typical defect detection method for a target object in an industrial video image provided in Example 1 of the present application;
[0070] Figure 3 It is a flow chart of a method for converting feature representation of a superpixel region of a typical defect detection method for a target object in an industrial video image provided in Example 1 of the present application;
[0071] Figure 4 It is a flow chart of a method for updating a chromosome representation of a superpixel region in a method for detecting typical defects of a target object in an industrial video image provided in Example 1 of the present application;
[0072] Figure 5 It is a flow chart of a chromosome crossover and mutation method of a typical defect detection method for a target object in an industrial video image provided in Example 1 of the present application;
[0073] Figure 6 It is a flow chart of an individual fitness evaluation method of a typical defect detection method for a target object in an industrial video image provided in Example 1 of the present application;
[0074] Figure 7 It is a flow chart of a chromosome decoding method of a typical defect detection method of a target object in an industrial video image provided in Example 1 of the present application;
[0075] Figure 8 It is a flowchart of a method for calculating a membership matrix P in a color and texture space of a typical defect detection method for a target object in an industrial video image provided in Example 1 of the present application;
[0076] Fig. 9 It is a flow chart of a chromosome uniform crossover method of a typical defect detection method for a target object in an industrial video image provided in Example 1 of the present application;
[0077] Fig.10 It is a flow chart of a basic bit variation method of a chromosome of a typical defect detection method of a target object in an industrial video image provided in Example 1 of the present application;
[0078] Fig.11 It is a structural schematic diagram of a chromosome crossover and variation drawing of a typical defect detection method for a target object in an industrial video image provided in Example 1 of the present application;
[0079] Fig.12 It is a schematic diagram of target desegmentation results corresponding to image sub-regions of a typical defect detection method for a target object in an industrial video image provided in Example 1 of the present application;
[0080] Fig.13 It is a structural schematic diagram of a typical defect detection system for targets in industrial video images provided in Example 2 of the present application.
[0081] Marked: image pre-segmentation module 110; feature extraction module 120; super pixel region conversion module 130; super pixel region update module 140; chromosome encoding module 150; segmentation result merging module 160; repetition module 170; defect matching module 180. DETAILED DESCRIPTION
[0082] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0083] See also Figure 1 , Figure 1 A schematic flow chart of a method for detecting typical defects of an object in an industrial video image provided in an embodiment of the present application.
[0084] like Figure 1 As shown, a typical defect detection method of a target object in an industrial video image of a grayscale image of the target object includes:
[0085] S110: Acquire an image of a target object to be detected, and pre-segment the image of the target object to be detected according to a predetermined image segmentation algorithm to obtain a plurality of image sub-regions, wherein each image sub-region corresponds to a group of super-pixel regions.
[0086] The embodiment of the present application pre-segments the captured image of the target object to be detected, thereby obtaining N image sub-regions {p1, p2, p3, ..., pn}, so that each of the above N image sub-regions corresponds to a group of super-pixel regions.
[0087] Specifically, as a preferred embodiment, Figure 2 As shown, in the above-mentioned method for detecting typical defects of a target object in an industrial video image, S110: the step of pre-segmenting the image of the target object to be detected according to a predetermined image segmentation algorithm comprises:
[0088] S111: performing image preprocessing on the image of the target object to be detected to obtain a preprocessed grayscale image of the target object;
[0089] It should be noted that the image of the target object to be detected may be blurred or have low clarity. This application requires image preprocessing of the image of the target object to be detected, including grayscale conversion and denoising, so as to obtain a preprocessed grayscale image of the target object.
[0090] S112: Use the Meanshift algorithm to segment the preprocessed target grayscale image to obtain multiple image sub-regions, where each image sub-region corresponds to a group of super-pixel regions.
[0091] The embodiment of the present application uses the Meanshift algorithm to perform segmentation processing on the preprocessed grayscale image of the target object, and can obtain N images after segmentation, and each image sub-region corresponds to a super pixel region (or a group of super pixel regions).
[0092] The embodiment of the present application performs image preprocessing on the image of the target object to be detected, including grayscale and denoising processing methods, and then uses the Meanshift algorithm to segment the preprocessed target grayscale image, thereby obtaining N image sub-regions after segmentation, wherein each image sub-region corresponds to a group of super-pixel regions, and the pixels within each group of super-pixel regions have similar color features and texture features, so that the super-pixel regions form a local connectivity.
[0093] Figure 1 The exemplary embodiment provides a typical defect detection method for an industrial video image of a target grayscale image, which further includes the following steps after segmenting to obtain a plurality of image sub-regions and super-pixel regions corresponding to the image sub-regions:
[0094] S120: For each image sub-region of the multiple image sub-regions, extract color features and texture features of a super-pixel region corresponding to the image sub-region to obtain a feature representation of the super-pixel region.
[0095] It should be noted that because each group of superpixel regions has similar color features and texture features, the color features and texture features of the superpixel region corresponding to each image sub-region can be extracted separately, and then the extracted color features and texture features can be converted into feature representations of the superpixel region.
[0096] The specific method for extracting the color features and texture features of the superpixel area is as follows: for each superpixel area, its color features and texture features are extracted, where the color features are extracted from the RGB color space and can be represented by a color histogram or color moment; the texture features can be extracted using the Gabor wavelet method, thereby obtaining the texture feature vector of each superpixel area.
[0097] After this step of processing, the original image can be converted into a feature representation of the superpixel area.
[0098] Figure 1 The exemplary embodiment provides a typical defect detection method for an industrial video image of a target grayscale image, which, after extracting the color features and texture features of the superpixel region corresponding to the image sub-region, further includes:
[0099] S130: Convert the feature representation of the superpixel region according to the genetic algorithm to obtain a chromosome representation of the superpixel region.
[0100] The embodiment of the present application first needs to initialize the population and preset a standard number of individuals in the initialized population, and then perform chromosome encoding in the initialized population to obtain a chromosome representation in the form of label-based encoding, wherein the label represents a variety of attribute classifications or attribute clustering results of the superpixel region.
[0101] Specifically, as a preferred embodiment, Figure 3 As shown, in the above-mentioned typical defect detection method for a target object in an industrial video image, step S130: converting the feature representation of the superpixel region according to a genetic algorithm to obtain the chromosome representation of the superpixel region includes:
[0102] S131: Initialize a plurality of image sub-regions as a population, and select a predetermined number of image sub-regions from the plurality of image sub-regions as individuals of the population.
[0103] The present application first initializes the population, and then presets a standard number of individuals in the initialized population, so that the initialized population and its individuals can be encoded and converted in a targeted manner.
[0104] S132: Using a label-based encoding form, the feature vector of the superpixel region corresponding to the individual is converted into a chromosome representation, and the gene bit value on the chromosome representation is randomly determined.
[0105] After the above-mentioned population is initialized, the present application performs chromosome encoding within the initialized population, wherein one sub-region of the population corresponds to one individual, so that the initialized population can arbitrarily determine several image sub-regions as individuals among the above-mentioned multiple image sub-regions, and randomly determine the values of the gene positions on their chromosomes.
[0106] S133: Convert the attribute classification or attribute clustering result of the superpixel region into a label.
[0107] The technical solution provided in the embodiment of the present application initializes multiple image sub-regions as a population, and then randomly selects a predetermined number of image sub-regions as individuals of the population, and converts the feature vectors of the superpixel regions corresponding to the individuals into chromosome representations. It is then possible to randomly determine the gene positions on the chromosome representation, and then convert the attribute classification or attribute clustering results of the superpixel regions into corresponding labels, which are represented as a variety of mathematical classifications or attribute clustering results of the superpixel regions.
[0108] Specifically, assume that the gene code of the chromosome corresponding to the current superpixel area is [0110, 1110, 1001, 0001, 1101], which is a chromosome with a gene code length of 20 bits, where the 0 or 1 in "0110" has no meaning, that is, "0110" is just a binary string, which is translated into a real number, and the real number is meaningful; the real number value corresponding to the "0110" gene value represents the category probability level of the corrosion defect area, and similarly, the real number value translated from the "1110" gene value represents the shape of the corrosion defect area; the real number value corresponding to the "1001" gene value represents the category probability level of the oil pollution defect area; the real number value corresponding to the "0001" gene value represents the shape of the oil pollution defect area; the real number value corresponding to the "1101" gene value represents the type of the target object.
[0109] Figure 1 The method for detecting typical defects of an object in an industrial video image of a grayscale image of an object provided by the illustrated embodiment further comprises, after the step of obtaining a chromosome representation of a superpixel region:
[0110] S140: updating the chromosome representation of the superpixel region to obtain individuals of the offspring population that meet the fitness evaluation conditions.
[0111] It should be noted that after chromosome encoding, it becomes a preset standard number of individuals, where one image sub-region is an individual. In this way, any number of the n image sub-regions can be selected as individuals, and each individual can be a chromosome composed of multiple gene positions.
[0112] The present application can also randomly determine the numbers on the gene positions, that is, to represent the feature vector of the superpixel region in a chromosome form using a label-based encoding form, wherein the label represents a variety of attribute classification or attribute clustering results of the superpixel region.
[0113] Specifically, as a preferred embodiment, Figure 4 As shown, in the above-mentioned typical defect detection method for a target object in an industrial video image, step S140: updating the chromosome representation of the superpixel region to obtain individuals of the offspring population that meet the fitness evaluation condition, includes:
[0114] S141: Calculate the fitness of the chromosome corresponding to the image sub-region. The method for calculating the fitness of the chromosome corresponding to the current image sub-region is as follows: apply each chromosome to image segmentation to obtain the corresponding image segmentation result.
[0115] It should be noted that, for the chromosomes in the initialized population, the fitness value of the current chromosome is calculated based on the similarity between its category labeling result and the true labeling.
[0116] S142: According to a predetermined selection algorithm, using the fitness value represented by the chromosome, select an individual as a parent chromosome.
[0117] Specifically, according to the fitness values of multiple chromosomes, the individual with the highest fitness value of the chromosome is selected as the parent chromosome. After multiple selection operations using a selection operator (such as a roulette selection operator or a tournament selection operator, etc.), a batch of individuals with the highest fitness values of chromosomes can be screened out as parents, and this part of the chromosomes is retained for subsequent reproduction (i.e., crossover gene operation and mutation gene operation).
[0118] S143: Perform a crossover operation on the parent chromosome to obtain a daughter chromosome, and perform a mutation operation on the daughter chromosome to obtain a new daughter population.
[0119] It should be noted that by randomly selecting a pair of chromosomes from the selected parent chromosomes for crossover operation, new daughter chromosomes can be generated. Commonly used crossover methods include single-point crossover, multi-point crossover and uniform crossover.
[0120] In addition, mutation operations on offspring chromosomes increase the diversity of the population by introducing random disturbances. There are many ways to perform mutation operations, such as randomly changing a gene value, exchanging two gene values, inserting or deleting genes, etc.
[0121] It should be noted that the mutation operation occurs on a gene on a chromosome, which introduces variability into the group, enhances the diversity of the group, and thus provides a means to jump out of the local optimum.
[0122] The mutation method is also a random and blind mutation, so it is necessary to use a relatively small mutation probability (pm) to control it to avoid causing damage to the population, or directly limit the priority of the mutation operation to avoid making it impractical to update individuals in the population.
[0123] S144: Call and evaluate the fitness of individuals in the new offspring population.
[0124] The embodiment of the present application generates a new offspring population according to selection, crossover and mutation operations, calls individuals in the updated offspring population, and then evaluates the fitness of the individuals in the current updated offspring population.
[0125] S145: Determine whether the individuals in the offspring population meet the basic preset conditions for fitness evaluation.
[0126] It should be noted that if the individuals in the currently updated offspring population meet the basic preset conditions in the fitness evaluation, the iteration is terminated, otherwise it returns to the above steps to recalculate the fitness represented by the chromosome and search for a new offspring population.
[0127] S146: If the individual meets the basic preset conditions, the individual is determined to be an individual of the offspring population that meets the fitness evaluation conditions.
[0128] It should be noted that if the individual meets the basic preset conditions, it means that the individual iterative update of the offspring population is successful, and at this time, the individual is determined to be an individual of the offspring population that meets the fitness evaluation conditions.
[0129] S147: If the individual does not meet the basic preset conditions, the chromosome representation fitness is recalculated and a new offspring population is searched again.
[0130] Among them, the basic preset condition in fitness evaluation means that when the maximum number of iterations is reached or the number of individuals in the updated offspring population whose chromosome fitness values reach the standard threshold accounts for N% of the total number of individuals in the offspring population. When this condition is met, the iteration is terminated, otherwise it returns to the above steps to continue looking for a new offspring population.
[0131] In addition, it should be noted that the core operation of the genetic algorithm used in the embodiment of the present application is to generate the desired feasible solutions through selection, crossover and mutation, and delete the feasible solutions that do not meet the requirements; however, in the process of further research, it was found that if the genetic algorithm is excessively used, more superpixel areas that do not meet the requirements will be caused; therefore, it is necessary to restrict the implementation process of the genetic algorithm.
[0132] Specifically, as a preferred embodiment, Figure 5 As shown, in the above-mentioned typical defect detection method for a target object in an industrial video image, step S143: performing a crossover operation on the parent chromosome to obtain a child chromosome, and performing a mutation operation on the child chromosome to obtain a new child population, comprises:
[0133] S1431: Setting a threshold for the number of individuals generated by the crossover operation and the mutation operation. Specifically, as an embodiment, the population size remains unchanged during the genetic process, for example, the number of individuals in the updated offspring population is limited, for example, to 100, specifically k, and the threshold for the number of individuals is set to generate 100 individuals in each round of selection + crossover + mutation.
[0134] S1432: When a crossover operation is performed on a parent chromosome and the number of generated offspring chromosomes reaches an individual number threshold, no mutation operation is performed on the offspring chromosomes.
[0135] For individual genetics, crossover is prioritized, that is, crossover first and then mutation. If the crossover operation directly meets the individual quantity threshold of 100, the mutation operation will no longer be performed. Because both crossover and mutation methods are feasible, this application believes that mutation should be limited to a small probability processing operation. Mutation has a large impact on the expression of individuals, which can lead to problems such as model instability.
[0136] S1433: Set the mutation probability of the mutation operation.
[0137] S1434: When controlling the offspring chromosome to perform a mutation operation, the gene mutation probability of the offspring chromosome is less than or equal to the mutation probability.
[0138] It needs to be explained that the mutation operation usually occurs on a gene on a chromosome, which introduces variability into the population, enhances the diversity of the population, and thus provides a means to jump out of the local optimum.
[0139] The mutation method is also a random and blind mutation, so it is necessary to use a relatively small mutation probability (pm) to control it to avoid causing damage to the population, or directly limit the priority of the mutation operation to avoid making it impractical to update individuals in the population.
[0140] In addition, during the execution of the above crossover and mutation operations, a preset mating probability and a preset mutation probability are also included; then chromosomes are selected from the population for mating according to the preset mating probability, and chromosomes that have not mated are directly copied into the new population.
[0141] Specifically, as a preferred embodiment, Figure 6 As shown, in the above-mentioned typical defect detection method for a target object in an industrial video image, S145: the step of judging whether the individuals of the offspring population meet the basic preset conditions for fitness evaluation includes:
[0142] S1451: Setting the mating probability of the chromosome. Using the mating probability, chromosomes can be selected from the population for mating, thereby generating new offspring chromosomes.
[0143] S1452: According to the mating probability and the uniform crossover algorithm, the parent chromosomes are selected from the population for mating to obtain offspring chromosomes.
[0144] The embodiment of the present application adopts the uniform crossover algorithm in the multi-point crossover, and the genes on each locus in the two paired individuals are exchanged with the same crossover probability, thereby forming two new individuals.
[0145] For details, please refer to the attached Fig. 9 ,like Fig. 9In the uniform crossover method shown, genes are exchanged at crossover point 1 and crossover point 2 of parent chromosome 1 and parent chromosome 2 respectively to generate offspring chromosome 1 and offspring chromosome 2, so that the genes on each locus are exchanged with the same crossover probability, thereby forming two new offspring individuals.
[0146] S1453: Determine whether the number of offspring chromosomes in the offspring population reaches the individual number threshold.
[0147] In the embodiment of the present application, it is specifically detected whether the number of the new population of the current offspring is greater than or equal to the individual number threshold K. If it reaches K, it ends directly. If it does not reach the individual number threshold K, the method of the following step S1454 is executed.
[0148] S1454: If the number of offspring chromosomes does not reach the individual number threshold, the offspring chromosomes are mutated according to the mutation probability and the basic bit mutation algorithm to obtain mutated offspring chromosomes.
[0149] Specific basic bit mutation methods include Fig.10 As shown, a mutation operation is performed on the values of one or several randomly determined gene loci in the individual code string with a mutation probability, thereby forming a new individual.
[0150] For example Fig.10 In the original individual "101110" shown, the gene value "1" at the third locus mutates to "0", thus obtaining a new individual "100110".
[0151] S1455: Replace the original offspring chromosomes with the mutated offspring chromosomes and incorporate them into the new offspring population.
[0152] Specifically set the mutation probability (pm), and perform mutation operations on the genes of the chromosomes of the new population according to the mutation probability (pm). The mutated chromosomes replace the original chromosomes and enter the new population.
[0153] S1456: Determine whether the number of chromosomes in the current offspring reaches the individual number threshold. If so, stop the mutation operation.
[0154] The mutated chromosome replaces the original chromosome and enters the new population, while the unmutated chromosome directly enters the new population and continues to detect whether the number of the new population of the current offspring meets the individual number threshold of k. If k is met, the process ends.
[0155] Specifically, Fig.11It can be seen from the crossover and mutation drawings provided in the illustrated embodiment that the first four bits of the parent chromosome 1 "101010010" and the parent chromosome 2 "010101011" are crossed with each other to obtain new offspring chromosome 1 "010110010" and offspring chromosome 2 "101001011" respectively, and then the 7th bit of the offspring chromosome 1 "010110010" is mutated to obtain a new offspring chromosome 1 "010110110".
[0156] Through the above-mentioned crossover and mutation methods, offspring chromosomes with new gene loci are finally obtained.
[0157] Figure 1 The target object grayscale image provided by the illustrated embodiment is a typical defect detection method for an industrial video image, and after obtaining individuals of a progeny population that meet the fitness evaluation conditions, further comprises the following steps:
[0158] S150: The chromosomes of the individuals in the offspring population that meet the fitness evaluation conditions are decoded to obtain the target solution segmentation results. In this step, the chromosomes are encoded as clustering results, the class center of each cluster is calculated, and the membership matrix P of the color space and texture space is calculated as the input of the subsequent evolutionary algorithm.
[0159] Chromosome decoding occurs in the final result generation stage. In this step, the optimal chromosome is obtained according to the genetic algorithm, and the chromosome decoding operation is performed to convert the chromosome into the final image segmentation result.
[0160] Specifically, as a preferred embodiment, Figure 7 As shown, in the above-mentioned typical defect detection method for a target object in an industrial video image, step S150: performing chromosome decoding on individuals of the offspring population that meet the fitness evaluation conditions to obtain a target solution segmentation result includes:
[0161] S151: Design a fitness objective function, and use the fitness objective function to decode individuals of the offspring population into clustering results, where the clustering results include pixel labels.
[0162] The fitness objective function Jmse indicator is the basic preset condition for fitness evaluation, which means that the number of chromosomes in individuals in the offspring population that have reached the maximum number of iterations or the fitness value of the chromosomes that have reached the standard threshold in the updated offspring population accounts for N% of the total number of individuals in the offspring population.
[0163] S152: Assign superpixel regions belonging to the same clustering result category to the same clustering cluster, and calculate the class center of each clustering cluster.
[0164] After obtaining the offspring population that meets the basic preset conditions, the chromosomes of the currently updated offspring population are decoded and the class center of each class is calculated.
[0165] In this step, the chromosomes are decoded into clustering results, the class center of each clustering result is calculated, and the membership matrix P of the color space and texture space is calculated as the input of the subsequent evolutionary algorithm.
[0166] S153: Mark the superpixel regions with the same pixel label as superpixel regions to be selected.
[0167] Specifically, according to the gene value in the chromosome (i.e., category label or pixel label), each pixel point is assigned to the corresponding image segmentation area or category to generate the final segmented image.
[0168] The image decoding method is to perform the inverse operation according to the chromosome encoding method and convert the gene value into the corresponding pixel label.
[0169] S154: Using the class centers of the clusters, the membership matrix X of the superpixel region to be selected in the color space and the membership matrix P of the texture space are calculated, and the membership matrix X of the color space and the membership matrix P of the texture space are verified twice.
[0170] S155: Determine the superpixel region that meets the secondary verification condition as the target superpixel region, merge the target superpixel regions with the same label, and obtain the target solution segmentation result.
[0171] The selected superpixel region that meets the secondary verification conditions will be used as the final target superpixel region; finally, all target superpixel regions with label j (taking the superpixel region with label j as an example) are merged into several complete regions, and the final segmented image is output.
[0172] In the technical solution provided in the embodiment of the present application, the image decoding method is obtained by performing an inverse operation according to the chromosome encoding method, specifically converting the gene value into the corresponding pixel label. According to the above objective function Jmse indicator, the chromosome is first decoded and the class center of each cluster is calculated;
[0173] Next, the membership matrix X in the color space and the membership matrix P in the texture space are calculated for secondary verification.
[0174] Specifically, the chromosomes are decoded into clustering results, and multiple superpixel regions belonging to the same category are assigned to a cluster cluster.
[0175] Calculate the center of each cluster: For each cluster, calculate its center, using the average value or other cluster center calculation methods.
[0176] That is, identification is performed according to the obtained label value. For example, all superpixel regions with label j are first marked as superpixel regions to be selected (taking the superpixel region with label j as an example).
[0177] Among them, as a preferred embodiment, Figure 8 As shown, the above S154: using the class center of the cluster cluster, calculating the membership matrix X of the superpixel region to be selected in the color space and the membership matrix P of the texture space, and performing a secondary verification on the membership matrix X of the color space and the membership matrix P of the texture space, includes:
[0178] S1541: For each superpixel region, the membership weights of the superpixel region and each class center in the color space are calculated according to the fuzzy C-means algorithm to obtain the membership matrix X of the superpixel region in the color space.
[0179] S1542: According to the membership update formula of the fuzzy C-means algorithm, iteratively update the membership matrix X and the class center matrix of the superpixel region in the color space until the update stop condition is reached.
[0180] Assuming there are N superpixel regions and M color categories, the size of the membership weight matrix W is N×M, where W(i, j) represents the membership weight of the i-th superpixel region belonging to the j-th color category.
[0181] Initialize the category center matrix C with size M×d, where d is the dimension of the color space.
[0182] M superpixel regions can be randomly selected as the initial category centers. Then the following steps are iterated until convergence (the maximum number of iterations is reached or the convergence condition is met):
[0183] a. For each superpixel region i, calculate its distance d(i,j) to each category center j;
[0184] b. Calculate the membership u(i, j) of each superpixel region i to each category center j based on the distance, and use the fuzzy C-means formula to calculate the membership, as follows: ;
[0185] Among them, m is a fuzzy parameter that controls the fuzziness of the membership.
[0186] The usual value range of m is [1.5,2.5].
[0187] Generally speaking, larger values of m make the membership more ambiguous, while smaller values of m make the membership closer to 0 or 1.
[0188] c. Update the category center matrix C according to the membership degree. Calculate the new position of each category center j as: ;
[0189] Among them, X(i) is the feature vector of superpixel region i in color space.
[0190] When the final convergence occurs, each element X(i, j) of the membership matrix X represents the membership of superpixel region i to category j in the color space.
[0191] In this way, since the elements in each matrix of the membership matrix X are known, the membership matrix X of the superpixel region in the color space can be obtained, and this step ends.
[0192] S1543: For each superpixel region, calculate the membership weight of each superpixel region and each class center in the texture space , that is, calculate the elements of the membership matrix P of the texture space corresponding to the superpixel area and each class center : in, represents the Euclidean distance between superpixel region i and category center j, m represents the fuzzy factor, which controls the fuzziness of the membership, and k represents the kth category center. Usually, the value range of m is [1,∞), and it is usually set to a value greater than 1.
[0193] Assuming there are N superpixel regions and K class centers, the elements of the membership matrix P in the texture space are Indicates the membership weight of superpixel region i belonging to category center j.
[0194] S1544: Combine the superpixel region and the membership weights of each class center in the texture space to obtain the membership matrix of each superpixel region in the texture space (i.e., the membership matrix of countless elements , that is, the membership matrix P of the texture space is composed of countless elements).
[0195] The above formula represents the membership weight of superpixel region i belonging to category center j. By normalizing the membership of all category centers, the membership matrix P of each superpixel region in the texture space can be obtained.
[0196] S1545: Perform secondary verification on the membership matrix X of the color space and the membership matrix P of the texture space, specifically by threshold verification; obtain the element values in the membership matrix X of the current color space and the membership matrix P of the texture space; call the secondary verification condition, if the element values of the color space of the current superpixel area are all higher than the corresponding standard color threshold, and the element values of the texture space of the current superpixel area are also higher than the corresponding standard texture threshold, then the superpixel area is determined to be a valid target superpixel area;
[0197] Finally, the valid target superpixel areas that are judged to be of the same label category are merged.
[0198] Above Figure 1 The exemplary embodiment provides a typical defect detection method for an industrial video image of a target grayscale image, and after obtaining the target desegmentation result corresponding to each image sub-region, further includes the following steps:
[0199] S160: for all image sub-regions corresponding to the image of the target object to be detected, merging the target desegmentation results corresponding to all image sub-regions to obtain a final segmented image to be detected corresponding to the image of the target object to be detected;
[0200] Specifically, the target segmentation result corresponding to each image sub-region is as follows: Fig.12 shown.
[0201] S170: Acquire an original target object defect image, and perform steps S110 to S160 on the original target object defect image to obtain an original final segmented image corresponding to the original target object defect image;
[0202] It should be noted that an original target defect image is obtained, which is an image of the target object having defects in the past, and an original final segmented image is obtained for steps S110 to S160 through the original target defect image; the original final segmented image is compared and matched with the final segmented image to be detected to determine whether the target object image to be detected has defects;
[0203] S180: Determine whether the image of the target object to be detected has defects by matching the final segmented image to be detected corresponding to the image of the target object to be detected with the original final segmented image corresponding to the original target object defect image;
[0204] It should be noted that the final segmented image to be detected is matched with the original final segmented image to determine the shape and size between the two. If the size of the final segmented image to be detected is the same as that of the original final segmented image, it means that there is no defect in the image of the target object to be detected; if the size of the final segmented image to be detected is different from that of the original final segmented image, it means that there is a defect in the image of the target object to be detected.
[0205] In summary, the above-mentioned embodiment of the present application provides a method for detecting typical defects of target objects in industrial video images of a target object grayscale image, by acquiring an image of a target object to be detected, and then pre-segmenting the image of the target object to be detected according to a predetermined image segmentation algorithm, thereby obtaining multiple image sub-regions, so that for each image sub-region, the color features and texture features of the superpixel region are extracted to obtain a feature representation of the superpixel region; and then, the feature representation is converted according to a genetic algorithm to obtain a chromosome representation of the superpixel region, and the chromosome representation is updated to obtain individuals of a offspring population that meet fitness evaluation conditions, and then the chromosomes of the individuals of the offspring population are decrypted to obtain the target segmentation result.
[0206] Furthermore, for all image sub-regions, the target desegmentation results corresponding to all image sub-regions are merged to obtain the final segmented image to be detected corresponding to the above-mentioned target object image to be detected; the original final segmented image of the original target object defect image is obtained by the same method; the original final segmented image is matched with the final segmented image to be detected to determine whether the target object image to be detected has defects;
[0207] In summary, the technical solution provided by the present application can solve the problem of large errors in target object defects identified by machine vision detection methods in the prior art by matching the original final segmented image with the final segmented image to be detected.
[0208] Specifically, as a preferred embodiment, Fig.13 The typical defect detection system of a target object in an industrial video image shown in the figure comprises: an image pre-segmentation module 110; a feature extraction module 120; a super pixel region conversion module 130; a super pixel region update module 140; a chromosome encoding module 150; a segmentation result merging module 160; a repetition module 170; and a defect matching module 180;
[0209] An image pre-segmentation module 110 is used to obtain an image of a target object to be detected, and pre-segment the image of the target object to be detected according to a predetermined image segmentation algorithm to obtain a plurality of image sub-regions, wherein each image sub-region corresponds to a group of super-pixel regions;
[0210] A feature extraction module 120 is used to extract, for each of the multiple image sub-regions, a color feature and a texture feature of a super-pixel region corresponding to the image sub-region, and obtain a feature representation of the super-pixel region;
[0211] A superpixel region conversion module 130 is used to convert the feature representation of the superpixel region according to a genetic algorithm to obtain a chromosome representation of the superpixel region;
[0212] The superpixel region updating module 140 is used to update the chromosome representation of the superpixel region to obtain individuals of the offspring population that meet the fitness evaluation conditions;
[0213] The chromosome encoding module 150 is used to decode the chromosomes of the individuals of the offspring population that meet the fitness evaluation conditions to obtain the target solution segmentation result;
[0214] The segmentation result merging module 160 is used to merge the target desegmentation results corresponding to all the image sub-regions corresponding to the target image to be detected, so as to obtain the final segmented image to be detected corresponding to the target image to be detected;
[0215] A repeating module 170 is used to obtain an original target defect image, and to perform image pre-segmentation module 110 to segmentation result merging module 160 on the original target defect image to obtain an original final segmented image corresponding to the original target defect image;
[0216] The defect matching module 180 is used to determine whether the image of the target object to be detected has defects by matching the final segmented image to be detected corresponding to the image of the target object to be detected with the original final segmented image corresponding to the defect image of the original target object.
[0217] In summary, the above-mentioned embodiments of the present application provide a typical defect detection system for targets in industrial video images, which obtains an image of a target object to be detected, and then pre-segments the image of the target object to be detected according to a predetermined image segmentation algorithm, thereby obtaining multiple image sub-regions. In this way, for each image sub-region, the color features and texture features of the super-pixel region are extracted to obtain a feature representation of the super-pixel region; and then, the feature representation is converted according to a genetic algorithm to obtain a chromosome representation of the super-pixel region, and the chromosome representation is updated to obtain individuals of a offspring population that meet fitness evaluation conditions, and then the chromosomes of the individuals of the offspring population are decrypted to obtain the target segmentation result.
[0218] Furthermore, for all image sub-regions, the target desegmentation results corresponding to all image sub-regions are merged to obtain the final segmented image to be detected corresponding to the above-mentioned target object image to be detected; the original final segmented image of the original target object defect image is obtained by the same method; the original final segmented image is matched with the final segmented image to be detected to determine whether the target object image to be detected has defects;
[0219] In summary, the technical solution provided by the present application can solve the problem of large errors in target object defects identified by machine vision detection methods in the prior art by matching the original final segmented image with the final segmented image to be detected.
Claims
1. A method for detecting typical defects of a target object in an industrial video image, characterized in that: include: Acquire an image of a target object to be detected, and pre-segment the image of the target object to be detected according to a predetermined image segmentation algorithm to obtain a plurality of image sub-regions, wherein each image sub-region corresponds to a group of super-pixel regions; For each of the multiple image sub-regions, extracting color features and texture features of a super-pixel region corresponding to the image sub-region to obtain a feature representation of the super-pixel region; The feature representation of the superpixel region is converted according to a genetic algorithm to obtain a chromosome representation of the superpixel region, and the chromosome representation of the superpixel region is updated to obtain individuals of the offspring population that meet the fitness evaluation condition; Performing chromosome decoding on the individuals of the offspring population that meet the fitness evaluation condition to obtain a target solution segmentation result; For all image sub-regions corresponding to the target object image to be detected, the target desegmentation results corresponding to all image sub-regions are merged to obtain a final segmented image to be detected corresponding to the target object image to be detected; Acquire an original target object defect image, and perform the above steps on the original target object defect image to obtain an original final segmented image corresponding to the original target object defect image; By matching the final segmented image to be detected corresponding to the image of the target object to be detected with the original final segmented image corresponding to the defect image of the original target object, it is determined whether the image of the target object to be detected has defects; wherein, the final segmented image to be detected is matched with the original final segmented image to determine the shape and size between the two. If the size of the final segmented image to be detected is the same as that of the original final segmented image, it means that the image of the target object to be detected has a corresponding defect problem; if the size of the final segmented image to be detected is different from that of the original final segmented image, it means that the image of the target object to be detected does not have a defect problem; The step of converting the feature representation of the superpixel region according to the genetic algorithm to obtain the chromosome representation of the superpixel region comprises: Initializing the multiple image sub-regions into a population, and selecting a predetermined number of image sub-regions from the multiple image sub-regions as individuals of the population; Using a label-based encoding form, converting the feature vector of the superpixel region corresponding to the individual into a chromosome representation, and randomly determining the gene bit value on the chromosome representation; Converting the attribute classification or attribute clustering result of the superpixel region into the label; The step of updating the chromosome representation of the superpixel region to obtain individuals of the offspring population that meet the fitness evaluation conditions includes: Calculating the fitness of the chromosome representation corresponding to the image sub-region; According to a predetermined selection algorithm, using the fitness value represented by the chromosome, selecting the individual as the parent chromosome; Performing a crossover operation on the parent chromosome to obtain a progeny chromosome, and performing a mutation operation on the progeny chromosome to obtain a new progeny population; Calling and evaluating the fitness of individuals in the new offspring population; Determine whether the individuals of the offspring population meet the basic preset conditions of the fitness evaluation; If the individual satisfies the basic preset condition, determining the individual as an individual of the offspring population that satisfies the fitness evaluation condition; If the individual does not meet the basic preset conditions, the fitness of the chromosome representation is recalculated and a new offspring population is searched again; The steps of performing a crossover operation on the parent chromosome to obtain a progeny chromosome, and performing a mutation operation on the progeny chromosome to obtain a new progeny population include: Setting a threshold value of the number of individuals generated by the crossover operation and the mutation operation; When the crossover operation is performed on the parent chromosome and the number of the generated offspring chromosomes reaches the individual number threshold, no mutation operation is performed on the offspring chromosomes; Setting the mutation probability of the mutation operation; When controlling the offspring chromosome to perform a mutation operation, the gene mutation probability of the offspring chromosome is less than or equal to the mutation probability; The step of judging whether the individuals of the offspring population meet the basic preset conditions for fitness evaluation includes: Set the mating probability of chromosomes; According to the mating probability and a uniform crossover algorithm, the parent chromosome is selected from the population for mating to obtain the offspring chromosome; Determining whether the number of offspring chromosomes in the offspring population reaches the individual number threshold; If the number of the offspring chromosomes does not reach the individual number threshold, then according to the mutation probability, a mutation operation is performed on the offspring chromosomes according to a basic bit mutation algorithm to obtain a mutated offspring chromosome; The mutated offspring chromosomes replace the original offspring chromosomes and are incorporated into the new offspring population; Determine whether the number of the current offspring chromosomes reaches the individual number threshold, and if so, stop the mutation operation; The step of performing chromosome decoding on the individuals of the offspring population that meet the fitness evaluation conditions to obtain the target solution segmentation result comprises: Designing a fitness objective function, and using the fitness objective function to decode the individuals of the offspring population into clustering results, wherein the clustering results include pixel labels; Assign superpixel areas belonging to the same clustering result category to the same clustering cluster, and calculate the class center of each clustering cluster; Mark the superpixel regions with the same pixel labels as superpixel regions to be selected; Using the class center of the cluster, calculating the membership matrix X of the superpixel region to be selected in the color space and the membership matrix P of the texture space, respectively, and performing a secondary verification on the membership matrix X of the color space and the membership matrix P of the texture space; The superpixel region that meets the secondary verification condition is determined as the target superpixel region, and the target superpixel regions with the same label are merged to obtain the target solution segmentation result.
2. The method for detecting typical defects of an object in an industrial video image according to claim 1, characterized in that: The step of pre-segmenting the image of the target object to be detected according to a predetermined image segmentation algorithm comprises: Performing image preprocessing on the target object image to be detected to obtain a preprocessed target object grayscale image; The preprocessed target grayscale image is segmented using a Meanshift algorithm to obtain a plurality of image sub-regions, wherein each image sub-region corresponds to a group of super-pixel regions.
3. The method for detecting typical defects of an object in an industrial video image according to claim 2, characterized in that: The step of using the class center of the cluster to calculate the membership matrix X of the selected superpixel region in the color space and the membership matrix P of the texture space, and performing secondary verification on the membership matrix X of the color space and the membership matrix P of the texture space comprises: For each superpixel region, the membership weights of the superpixel region and each class center in the color space are calculated according to the fuzzy C-means algorithm to obtain the membership matrix X of the superpixel region in the color space; according to the membership update formula of the fuzzy C-means algorithm, the membership matrix X of the superpixel region in the color space and the class center matrix are iteratively updated until the update stop condition is reached; For each superpixel region i, calculate its distance d(i,j) to each category center j; The membership u(i, j) of each superpixel region i to each category center j is calculated based on the distance, and the membership is calculated using the fuzzy C-means formula as follows: ; Among them, m is a fuzzy parameter that controls the fuzziness of the membership; Update the category center matrix C according to the membership degree, and calculate the new position of each category center j as: ; Where X(i) is the feature vector of superpixel region i in color space; Based on each element X(i) of the membership matrix X, the membership matrix X of the superpixel region in the color space is obtained; For each superpixel region, calculate the membership weight of each superpixel region and each class center in the texture space , that is, calculate the elements of the membership matrix P of the texture space corresponding to the superpixel area and each class center : ; in, represents the Euclidean distance between superpixel region i and category center j, m represents the fuzzy factor, which controls the fuzziness of the membership, and k represents the kth category center; The membership weights of the superpixel region and each class center in all class centers in the texture space are combined to obtain the membership matrix of each superpixel region in the texture space; The membership matrix X of the color space and the membership matrix P of the texture space are verified twice, specifically through the threshold method: the element values in the membership matrix X of the current color space and the membership matrix P of the texture space are obtained; the secondary verification condition is called, if the element values of the color space of the current superpixel area are higher than the corresponding standard color threshold, and the element values of the texture space of the current superpixel area are also higher than the corresponding standard texture threshold, then the superpixel area is determined to be a valid target superpixel area.
