Appearance evaluation method and device, computer equipment and storage medium
The method improves coating surface defect recognition accuracy by preprocessing images and optimizing SVM models with a genetic algorithm, addressing the low accuracy of existing methods in high-demand manufacturing.
Patent Information
- Application Number
- CN202411324435.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-23
- Publication Date
- 2024-12-27
AI Technical Summary
Existing methods for coating surface defect recognition, such as traditional image processing and deep learning, suffer from low accuracy in detecting and classifying surface defects in high-demand manufacturing industries.
An appearance evaluation method that includes preprocessing the coating surface image through grayscale conversion, denoising, sharpening, and edge detection, followed by feature extraction using entropy mean, variance, roughness, and energy mean, and optimizing the SVM model's hyperparameters with a genetic algorithm to improve defect recognition accuracy.
The method enhances defect recognition accuracy, especially for small or complex defects, by reducing complexity and time consumption in parameter adjustment, improving model robustness and training efficiency, and minimizing computing resource occupation.
Smart Images

Figure CN119205690A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of quality monitoring, and in particular to an appearance evaluation method, device, computer equipment and storage medium. Background Art
[0002] In industrial production, the detection of coating surface quality is a crucial link, especially in high-demand manufacturing industries (such as electronics, automobiles, aviation, etc.), where the accurate detection and classification of surface defects affects the final quality of the product.
[0003] At present, the coating surface defect recognition technology mainly includes: Traditional image processing technology: based on classic image processing methods such as edge detection, grayscale transformation, image segmentation, etc., such as identifying coating surface defects by extracting basic features in the image (such as edges, colors, brightness changes, etc.). Deep learning method based on neural network: Identify coating surface defects by automatically learning features in the image. Defect recognition technology based on support vector machine (SVM): Map the input image feature data to a high-dimensional space through a kernel function, and calculate the data in the high-dimensional space to identify coating surface defects.
[0004] However, the results obtained by the above method have low accuracy. Summary of the invention
[0005] The main purpose of this application is to provide an appearance evaluation method, device, computer equipment and storage medium, which can improve the accuracy of appearance evaluation.
[0006] In order to achieve the above objectives, in a first aspect, the present application provides an appearance evaluation method, comprising:
[0007] Acquiring an image of a coated surface to be tested;
[0008] Processing the coated surface image to be tested to obtain image features corresponding to the coated surface image to be tested, wherein the image features are represented by image feature values, and the image feature values at least include entropy mean and variance, roughness, and energy mean;
[0009] Obtaining a target SVM model, wherein the target SVM model is obtained by optimizing the hyperparameters of the SVM through a genetic algorithm;
[0010] The image features are input into the target SVM model, and the scoring results of the coated surface image to be tested are output.
[0011] In one embodiment, the coated surface image to be tested is processed to obtain image features corresponding to the coated surface image to be tested, including:
[0012] Preprocessing the coating surface image to be tested to obtain a preprocessed coating surface image;
[0013] Feature extraction is performed on the preprocessed coated surface image to obtain image features corresponding to the coated surface image to be tested.
[0014] In one embodiment, preprocessing the coating surface image to be tested to obtain the preprocessed coating surface image includes:
[0015] Perform grayscale conversion on the coated surface image to be tested to obtain a grayscale image;
[0016] Perform image denoising on the grayscale image to obtain a denoised image;
[0017] Performing image sharpening on the denoised image to obtain a sharpened image;
[0018] The sharpened image is subjected to image segmentation and edge detection to obtain the preprocessed coated surface image.
[0019] In one embodiment, obtaining a target SVM model includes:
[0020] Obtaining an initial SVM model and training data, wherein the training data is composed of image features obtained after processing the coated surface image to be trained;
[0021] The initial SVM model is trained using the training data to obtain the target SVM model.
[0022] In one embodiment, the initial SVM model is trained by training data to obtain a target SVM model, including:
[0023] The training data is input into the initial SVM model, the initial SVM model is trained by the training data for classification, and the hyperparameters of the initial SVM model are optimized by a genetic algorithm until the change in the fitness value of the target parameter combination is less than a preset threshold, thereby obtaining the target SVM model.
[0024] In one embodiment, a genetic algorithm is used to optimize the hyperparameters of the initial SVM model until the change in the fitness value of the target parameter combination is less than a preset threshold, thereby obtaining a target SVM model, including:
[0025] Obtaining the hyperparameters of the initial SVM model, where the hyperparameters include penalty coefficients and kernel function parameters;
[0026] The hyperparameter combination consisting of the penalty coefficient and the kernel function parameter is used as the initial population of the genetic algorithm;
[0027] The initial population is iteratively processed by a genetic algorithm to find the target hyperparameter combination until the change in the fitness value of the target parameter combination is less than a preset threshold, thereby obtaining the target SVM model.
[0028] In one embodiment, the target hyperparameter combination is found by iteratively processing the initial population through a genetic algorithm until the change in the fitness value of the target parameter combination is less than a preset threshold, thereby obtaining a target SVM model, including:
[0029] The genetic algorithm is used to iteratively perform initialization, fitness calculation, selection operation, crossover operation and mutation operation on the initial population until the change in the fitness value of the target parameter combination is less than a preset threshold, thereby obtaining the target SVM model.
[0030] In a second aspect, an embodiment of the present application provides an appearance evaluation device, comprising:
[0031] An image acquisition module, used to acquire an image of the coating surface to be tested;
[0032] An image processing module is used to process the coated surface image to be tested to obtain image features corresponding to the coated surface image to be tested, wherein the image features are represented by image feature values, and the image feature values at least include entropy mean and variance, roughness and energy mean;
[0033] A model acquisition module is used to acquire a target SVM model, wherein the target SVM model is acquired by optimizing the hyperparameters of the SVM through a genetic algorithm;
[0034] The model evaluation module is used to input the image features into the target SVM model and output the scoring result of the coated surface image to be tested.
[0035] In a third aspect, an embodiment of the present application provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any of the above methods when executing the computer program.
[0036] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps of any of the above methods are implemented.
[0037] The embodiment of the present application provides a method, device, computer equipment and storage medium for appearance evaluation, including: obtaining a coating surface image to be tested, then processing the coating surface image to be tested, obtaining image features corresponding to the coating surface image to be tested, wherein the image features are represented by image feature values, and the image feature values at least include entropy mean and variance, roughness and energy mean, and then obtaining a target SVM model, wherein the target SVM model is obtained by optimizing the hyperparameters of SVM through a genetic algorithm, and finally inputting the image features into the target SVM model, and outputting the scoring result of the coating surface image to be tested. The present application automatically optimizes the hyperparameters of the SVM model through a genetic algorithm, reduces the complexity and time consumption of manual parameter adjustment, and can maintain a high classification accuracy in complex industrial scenarios. In addition, the optimized SVM model (target SVM model) has stronger robustness, effectively improves the training and reasoning efficiency of the model, reduces the occupation of computing resources, and improves the evaluation accuracy. The present application also captures the defect information in the image more accurately through the image processing process, especially performs well when processing small or complex defects, and the recognition accuracy is significantly improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] The drawings constituting a part of this application are used to provide a further understanding of this application, so that other features, purposes and advantages of this application become more obvious. The schematic embodiment drawings and their descriptions of this application are used to explain this application and do not constitute an improper limitation on this application. In the drawings:
[0039] Figure 1 It is a flow chart of an appearance evaluation method provided in an embodiment of the present application;
[0040] Figure 2 is a structural schematic diagram of an image acquisition device provided in an embodiment of the present application;
[0041] Figure 3 is a schematic diagram of characteristic values provided in an embodiment of the present application;
[0042] Figure 4 is a schematic diagram of a chaotic matrix of training data and test data provided in an embodiment of the present application;
[0043] Figure 5 It is a structural schematic diagram of an appearance evaluation device provided in an embodiment of the present application;
[0044] Figure 6 It is a schematic diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0046] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the application described herein can be implemented in an order other than those illustrated or described herein.
[0047] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.
[0048] It should be understood that in the various embodiments of the present application, the size of the serial number of each process does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0049] It should be understood that in the present application, "include" and "have" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or apparatus comprising a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to these processes, methods, products or apparatuses.
[0050] It should be understood that in the present application, "plurality" refers to two or more than two. "And / or" is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "Contains A, B and C", "Contains A, B, C" means that A, B, and C are all included, "Contains A, B or C" means that one of A, B, and C is included, and "Contains A, B and / or C" means that any one, any two, or any three of A, B, and C are included.
[0051] It should be understood that in this application, "B corresponding to A", "B corresponding to A", "A corresponds to B" or "B corresponds to A" means that B is associated with A and B can be determined based on A. Determining B based on A does not mean determining B based only on A, but B can also be determined based on A and / or other information. A and B match when the similarity between A and B is greater than or equal to a preset threshold.
[0052] Depending on the context, "if" as used herein may be interpreted as "when" or "when" or "in response to determining" or "in response to detecting."
[0053] The data involved in this application may be data authorized by the tester or fully authorized by all parties. The collection, dissemination, and use of the data shall comply with the relevant laws, regulations, and standards of the relevant countries and regions. The implementation methods / examples of this application may be combined with each other.
[0054] The technical solution of the present application is described in detail with specific embodiments below. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
[0055] Next, the present application scheme will be described through specific embodiments in conjunction with the accompanying drawings.
[0056] See also Figure 1 , Figure 1 A schematic diagram of a flow chart of an appearance evaluation method provided in an embodiment of the present application. Figure 1 As shown, the following steps are included:
[0057] Step S101: Acquire an image of a coating surface to be tested.
[0058] This application designs a device with adjustable brightness light source and camera angle, which can obtain high-resolution and clear images of the coating surface under different lighting conditions to ensure clear capture of defect features.
[0059] This application is approved by Figure 2The image acquisition device shown in the figure is used to obtain the image of the coated surface to be tested, and the specific execution steps are as follows:
[0060] The coated substrate 201 is placed in a sealed and light-proof device 202 to avoid interference from external light sources.
[0061] Then, LED lamp 203 is used as a supplementary light source to ensure uniform and controllable illumination. The position and angle of LED lamp 203 can be adjusted according to the properties of the coating surface and the light reflection characteristics to enhance the contrast of the defective area.
[0062] Finally, a high-precision camera 204 is selected and matched with an appropriate optical lens to ensure accurate shooting without losing image details, and then the high-precision image of the coated surface to be tested is transmitted to a computer 205. The camera has a resolution of 50 million pixels and a frame rate of 60 frames per second, which can capture subtle surface defects.
[0063] Traditional image acquisition technology often uses low-resolution cameras or scanners, which makes it difficult to detect tiny defects or complex surface details. However, this application uses a high-precision camera to capture the image of the coating surface to be tested, which can obtain high-resolution and clear images of the coating surface under different lighting conditions, ensuring clear capture of defect features.
[0064] Step S102: Processing the coated surface image to be tested to obtain image features corresponding to the coated surface image to be tested.
[0065] The image features are represented by image feature values, which include at least entropy mean and variance, roughness and energy mean. Image features can fully reflect the quality of the coating surface and are key input data for the subsequent classification and scoring model.
[0066] The coated surface image to be tested is processed to obtain image features corresponding to the coated surface image to be tested. The coated surface image to be tested needs to be preprocessed to obtain a preprocessed coated surface image, and then feature extraction is performed on the preprocessed coated surface image to obtain image features corresponding to the coated surface image to be tested.
[0067] Among them, the coated surface image to be tested is preprocessed to obtain the preprocessed coated surface image, including: performing grayscale conversion on the coated surface image to be tested to obtain a grayscale image; performing image denoising on the grayscale image to obtain a denoised image; performing image sharpening on the denoised image to obtain a sharpened image; performing image segmentation and edge detection on the sharpened image to obtain the preprocessed coated surface image.
[0068] Among them, grayscale conversion: convert the original image into a grayscale image, retain the brightness information of the defect, reduce the data dimension, and improve the subsequent processing speed. Image denoising: use Gaussian filtering and other methods to remove the noise introduced by shooting and transmission in the image, ensuring that the subsequent processing will not be disturbed by noise. Image sharpening: enhance the edges and grayscale mutation areas in the image to highlight the contour information of the defect. Image segmentation and edge detection: use the Otsu threshold method to perform binarization processing, segment the defect area, and use the improved Canny edge detection method to extract the defect contour of the coating surface.
[0069] After the coated surface image to be tested is preprocessed in the above manner, the preprocessed coated surface image is obtained, and it is also necessary to perform feature extraction on the preprocessed coated surface image to obtain image features corresponding to the coated surface image to be tested.
[0070] Among them, the feature values of feature extraction include at least entropy mean and variance, roughness, energy mean, etc. Entropy mean and variance: Entropy reflects the complexity of the grayscale distribution of the image, and the statistical characteristics of the image are extracted by calculating the entropy of the local area. Entropy variance is used to evaluate the local detail changes of the image. Roughness: Fourier transform is used to analyze the image frequency domain to extract surface roughness information. Rough areas usually correspond to uneven coating or defects. Energy mean: The uniformity of the coating is evaluated by calculating the energy of the local grayscale changes in the image.
[0071] The present application first preprocesses the coated surface image to be tested, which can improve the image processing efficiency and accuracy, and then performs feature extraction on the preprocessed coated surface image to extract feature values related to the defects, which can more accurately capture the defect information in the image, especially when dealing with tiny or complex defects, and the recognition accuracy is significantly improved.
[0072] Step S103: Obtain the target SVM model.
[0073] Among them, the target SVM model is obtained by optimizing the hyperparameters of SVM through genetic algorithm.
[0074] In order to obtain the target SVM model, it is necessary to first obtain the initial SVM model and training data, wherein the training data is composed of image features obtained after processing the coated surface image to be trained, and then the initial SVM model is trained with the training data to obtain the target SVM model.
[0075] The initial SVM model is trained by training data to obtain a target SVM model, including: inputting the training data into the initial SVM model, training the initial SVM model by training data for classification, and optimizing the hyperparameters of the initial SVM model by using a genetic algorithm until the change in the fitness value of the target parameter combination is less than a preset threshold, thereby obtaining the target SVM model.
[0076] The method comprises the following steps: optimizing the hyperparameters of the initial SVM model by using a genetic algorithm until the change in the fitness value of the target parameter combination is less than a preset threshold value, thereby obtaining a target SVM model, including: obtaining the hyperparameters of the initial SVM model, wherein the hyperparameters include a penalty coefficient and a kernel function parameter; using the hyperparameter combination consisting of the penalty coefficient and the kernel function parameter as the initial population of the genetic algorithm; and searching for the target hyperparameter combination by performing iterative processing operations on the initial population through the genetic algorithm, thereby obtaining the target hyperparameter combination, until the change in the fitness value of the target parameter combination is less than a preset threshold value, thereby obtaining the target SVM model.
[0077] The target hyperparameter combination is found by iteratively processing the initial population through a genetic algorithm until the change in the fitness value of the target parameter combination is less than a preset threshold, thereby obtaining a target SVM model, including: iteratively performing initialization, fitness calculation, selection operation, crossover operation and mutation operation on the initial population through a genetic algorithm until the change in the fitness value of the target parameter combination is less than a preset threshold, thereby obtaining a target SVM model.
[0078] Specifically, the image features are used as input data to train a support vector machine model for classification, wherein the SVM model is trained using a linear kernel function.
[0079] In the process of model training, the genetic algorithm (GA) is used to optimize the hyperparameters of SVM. Among them, the genetic algorithm iteratively searches for the optimal parameter combination through operations such as selection, crossover, and mutation, avoiding the drawbacks of manual parameter adjustment and improving the generalization ability and classification accuracy of the model.
[0080] The defect recognition steps of support vector machine (SVM) optimized by genetic algorithm (GA) are as follows:
[0081] 1. Initial hyperparameter setting:
[0082] In the process of optimizing SVM with genetic algorithm, the initial hyperparameters include: C (penalty coefficient): controls the model's tolerance for misclassified samples. If the C value is too large, the model tends to overfit; if the C value is too small, the model may underfit. γ (kernel function parameter): determines the complexity of the high-dimensional feature mapping of the support vector machine, especially for nonlinear kernel functions.
[0083] The initial hyperparameters C and γ are randomly selected in a large range:
[0084] Initial range of C: [0.1,1000]
[0085] Initial range of γ: [0.0001, 1]
[0086] These values will be used as the initial population of the GA algorithm, and each individual in the population represents a specific (C, γ) combination.
[0087] 2. The workflow of genetic algorithm:
[0088] Population initialization:
[0089] The genetic algorithm starts with a set of randomly generated initial populations, each of which represents a combination of C and γ. The size of the initial population can be set as needed (50 individuals).
[0090] Fitness calculation:
[0091] Each individual (i.e., hyperparameter combination) is trained through the SVM model and its classification accuracy is evaluated on the validation set. This accuracy is used as the fitness value of the GA to measure the performance of this individual in the current population. The definition of the fitness function is usually the same as the objective function, such as classification accuracy or cross-validation error.
[0092] Selection operation:
[0093] The selection operation selects individuals with high fitness from the population to enter the next generation. Common methods include roulette wheel selection (random selection based on fitness ratio) or tournament selection (selecting the winner by comparing the fitness between individuals). This selection mechanism ensures that excellent hyperparameter combinations can be inherited to the next generation.
[0094] Crossover operation:
[0095] The crossover operation simulates the genetic recombination of organisms. It randomly selects some genes (i.e., the values of C and γ) of two individuals to exchange to generate new offspring individuals. This method can explore new parameter combinations and may produce better hyperparameters.
[0096] Mutation operation:
[0097] The mutation operation randomly changes the gene values of some individuals (i.e., C or γ), thereby introducing new exploration directions and avoiding local optimal solutions. The probability of mutation is usually low, but it plays an important role in maintaining diversity in genetic algorithms.
[0098] Iteration and termination conditions:
[0099] The genetic algorithm continuously iterates through the above operations, and each generation generates a new parameter combination. This process will continue for a certain number of generations (50 generations) until the change in fitness value is less than a certain threshold, indicating that the model performance has reached the optimal level.
[0100] 3. Optimized parameters:
[0101] After several generations of iterations, GA finds the optimal combination of C and γ, which enables the SVM model to perform best on the validation set.
[0102] This application uses a cross-validation method to adjust the model's hyperparameters (such as the penalty parameter C and the kernel parameter γ) to improve the accuracy and generalization ability of classification. In addition, GA is used to automatically optimize the hyperparameter selection of SVM, making the model more accurate in coating defect recognition. Among them, the genetic algorithm continuously optimizes the SVM model through selection, crossover, mutation and other operations to achieve the optimal classification score.
[0103] Step S104: input the image features into the target SVM model, and output the scoring result of the coated surface image to be tested.
[0104] After the image of the coated surface to be tested is processed to obtain image features, the image features are input into the SVM model optimized by GA (i.e., the target SVM model). The target SVM model automatically calculates the classification results according to the image features, evaluates the degree of defects on the coated surface, gives corresponding classification scores, and outputs the evaluation results, where the score results are scores from 1 to 3, where 1 indicates serious defects, 2 indicates average quality, and 3 indicates excellent quality.
[0105] In one embodiment, the present application also provides a verification method, the specific steps are as follows:
[0106] Specifically, the training data includes: 100 pieces of 70-point parameter data, 100 pieces of 80-point parameter data, 150 pieces of 90-point parameter data, that is, 200 pieces of failed data and 150 pieces of passed data, a total of 350 pieces of data. The test data includes: 50 pieces of 70-point parameter data, 50 pieces of 80-point parameter data, 50 pieces of 90-point passed parameter data, that is, 100 pieces of failed data and 50 pieces of passed data, a total of 150 pieces of data.
[0107] By extracting the feature values of the image, Figure 3 The following are examples of feature values for some training data, where 70 is class 1, 80 is class 2, and 90 is class 3.
[0108] The extracted feature values, such as length, roughness, entropy mean, entropy variance, density, energy mean, energy variance, etc., are used as input data, and the SVM model is trained using a linear kernel function. In order to improve the accuracy and generalization ability of classification, the cross-validation method is used to adjust the model's hyperparameters (such as the penalty parameter C and the kernel parameter γ).
[0109] Genetic Algorithm (GA) Optimization: GA automatically optimizes the hyperparameter selection of SVM, making the SVM model more accurate in identifying coating defects. The genetic algorithm continuously optimizes the SVM model through selection, crossover, mutation and other operations, so that the classification score is optimal.
[0110] pass Figure 4 From the chaotic matrix of training data and test data, we can see that the accuracy is higher in category 1 and category 3 (70 points and 90 points), and the accuracy of training data in category 1 and category 3 is 100% and 95.5%. The accuracy of test data in category 1 and category 3 is 100% and 93.7%. Finally, the trained GA-SVM model is saved.
[0111] The embodiment of the present application provides an appearance evaluation method, including: obtaining a coating surface image to be tested, then processing the coating surface image to be tested, obtaining image features corresponding to the coating surface image to be tested, wherein the image features are represented by image feature values, and the image feature values at least include entropy mean and variance, roughness and energy mean, and then obtaining a target SVM model, wherein the target SVM model is obtained by optimizing the hyperparameters of SVM through a genetic algorithm, and finally inputting the image features into the target SVM model, and outputting the scoring result of the coating surface image to be tested. The present application automatically optimizes the hyperparameters of the SVM model through a genetic algorithm, reduces the complexity and time consumption of manual parameter adjustment, and can maintain a high classification accuracy in complex industrial scenarios. In addition, the optimized SVM model (target SVM model) has stronger robustness, effectively improves the training and reasoning efficiency of the model, reduces the occupation of computing resources, and improves the evaluation accuracy. The present application also captures the defect information in the image more accurately through the image processing process, especially performs well when processing small or complex defects, and the recognition accuracy is significantly improved.
[0112] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0113] The following is an embodiment of the device of the present application. For details not described in detail, please refer to the corresponding method embodiment described above.
[0114] Figure 5The schematic diagram of the structure of an appearance evaluation device provided by an embodiment of the present application is shown. For the convenience of explanation, only the part related to the embodiment of the present application is shown. An appearance evaluation device includes an image acquisition module 501, an image processing module 502, a model acquisition module 503 and a model evaluation module 504, which are as follows:
[0115] An image acquisition module 501 is used to acquire an image of a coating surface to be tested;
[0116] An image processing module 502 is used to process the coated surface image to be tested to obtain image features corresponding to the coated surface image to be tested, wherein the image features are represented by image feature values, and the image feature values at least include entropy mean and variance, roughness, and energy mean;
[0117] A model acquisition module 503 is used to acquire a target SVM model, wherein the target SVM model is acquired by optimizing the hyperparameters of the SVM using a genetic algorithm;
[0118] The model evaluation module 504 is used to input the image features into the target SVM model and output the scoring result of the coated surface image to be tested.
[0119] In one embodiment, the image processing module 502 is further used to preprocess the coating surface image to be tested to obtain a preprocessed coating surface image;
[0120] Feature extraction is performed on the preprocessed coated surface image to obtain image features corresponding to the coated surface image to be tested.
[0121] In one embodiment, the image processing module 502 is further used to perform grayscale conversion on the coated surface image to be tested to obtain a grayscale image;
[0122] Perform image denoising on the grayscale image to obtain a denoised image;
[0123] Performing image sharpening on the denoised image to obtain a sharpened image;
[0124] The sharpened image is subjected to image segmentation and edge detection to obtain the preprocessed coated surface image.
[0125] In one embodiment, the model acquisition module 503 is further used to acquire an initial SVM model and training data, wherein the training data is composed of image features acquired after processing the coated surface image to be trained;
[0126] The initial SVM model is trained using the training data to obtain the target SVM model.
[0127] In one embodiment, the model acquisition module 503 is also used to input training data into the initial SVM model, train the initial SVM model for classification using the training data, and use a genetic algorithm to optimize the hyperparameters of the initial SVM model until the change in the fitness value of the target parameter combination is less than a preset threshold, thereby obtaining a target SVM model.
[0128] In one embodiment, the model acquisition module 503 is further used to acquire hyperparameters of the initial SVM model, wherein the hyperparameters include a penalty coefficient and a kernel function parameter;
[0129] The hyperparameter combination consisting of the penalty coefficient and the kernel function parameter is used as the initial population of the genetic algorithm;
[0130] The initial population is iteratively processed by a genetic algorithm to find the target hyperparameter combination until the change in the fitness value of the target parameter combination is less than a preset threshold, thereby obtaining the target SVM model.
[0131] In one embodiment, the model acquisition module 503 is also used to iteratively perform initialization, fitness calculation, selection operation, crossover operation and mutation operation on the initial population through a genetic algorithm until the change in the fitness value of the target parameter combination is less than a preset threshold, thereby obtaining a target SVM model.
[0132] The embodiment of the present application provides an appearance evaluation device, which is specifically used for: obtaining a coating surface image to be tested, then processing the coating surface image to be tested, obtaining the image features corresponding to the coating surface image to be tested, wherein the image features are represented by image feature values, and the image feature values at least include entropy mean and variance, roughness and energy mean, and then obtaining a target SVM model, wherein the target SVM model is obtained by optimizing the hyperparameters of the SVM through a genetic algorithm, and finally the image features are input into the target SVM model, and the scoring result of the coating surface image to be tested is output. The present application automatically optimizes the hyperparameters of the SVM model through a genetic algorithm, reduces the complexity and time consumption of manual parameter adjustment, and can maintain a high classification accuracy in complex industrial scenarios. In addition, the optimized SVM model (target SVM model) has stronger robustness, effectively improves the training and reasoning efficiency of the model, reduces the occupation of computing resources, and improves the evaluation accuracy. The present application also captures the defect information in the image more accurately through the image processing process, especially when processing small or complex defects, and the recognition accuracy is significantly improved.
[0133] This application Figure 6 A schematic diagram of a computer device is provided. Figure 6As shown, the computer device 6 of this embodiment includes: a processor 601, a memory 602, and a computer program 603 stored in the memory 602 and executable on the processor 601. When the processor 601 executes the computer program 603, the steps in the above-mentioned various appearance evaluation method embodiments are implemented, for example Figure 1 Alternatively, when the processor 601 executes the computer program 603, the functions of each module / unit in the above-mentioned embodiment of the appearance evaluation device are realized, for example Figure 5 Functionality of modules / units 501 to 504 is shown.
[0134] The present application also provides a readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, it is used to implement the appearance evaluation method provided by the various embodiments described above.
[0135] Among them, the readable storage medium can be a computer storage medium or a communication medium. The communication medium includes any medium that facilitates the transmission of a computer program from one place to another. The computer storage medium can be any available medium that can be accessed by a general or special-purpose computer. For example, a readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application-specific integrated circuit (ASIC). In addition, the ASIC can be located in a user device. Of course, the processor and the readable storage medium can also exist in a communication device as discrete components. The readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device, etc.
[0136] The present application also provides a program product, which includes an execution instruction, which is stored in a readable storage medium. At least one processor of the device can read the execution instruction from the readable storage medium, and at least one processor executes the execution instruction so that the device implements the appearance evaluation method provided by the various embodiments described above.
[0137] In the embodiments of the above-mentioned devices, it should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. The general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc. The steps of the method disclosed in the present application may be directly embodied as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.
[0138] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for evaluating appearance, characterized in that: include: Acquiring an image of a coated surface to be tested; Processing the coated surface image to be tested to obtain image features corresponding to the coated surface image to be tested, wherein the image features are represented by image feature values, and the image feature values at least include entropy mean and variance, roughness, and energy mean; Obtaining a target SVM model, wherein the target SVM model is obtained by optimizing the hyperparameters of the SVM through a genetic algorithm; The image features are input into the target SVM model, and the scoring result of the coated surface image to be tested is output.
2. The appearance evaluation method according to claim 1, characterized in that: The step of processing the coated surface image to be tested to obtain image features corresponding to the coated surface image to be tested includes: Preprocessing the coated surface image to be tested to obtain a preprocessed coated surface image; Feature extraction is performed on the preprocessed coated surface image to obtain image features corresponding to the coated surface image to be tested.
3. The appearance evaluation method according to claim 2, characterized in that: The preprocessing of the coated surface image to be tested to obtain the preprocessed coated surface image comprises: Performing grayscale conversion on the coated surface image to be tested to obtain a grayscale image; Performing image denoising on the grayscale image to obtain a denoised image; Performing image sharpening on the denoised image to obtain a sharpened image; The sharpened image is subjected to image segmentation and edge detection to obtain the pre-processed coated surface image.
4. The appearance evaluation method according to claim 1, characterized in that: The step of obtaining a target SVM model comprises: Obtaining an initial SVM model and training data, wherein the training data is composed of image features obtained after processing the coated surface image to be trained; The initial SVM model is trained using the training data to obtain the target SVM model.
5. The appearance evaluation method according to claim 4, characterized in that: The step of training the initial SVM model by using the training data to obtain the target SVM model includes: The training data is input into the initial SVM model, the initial SVM model is trained for classification using the training data, and the hyperparameters of the initial SVM model are optimized using a genetic algorithm until the change in the fitness value of the target parameter combination is less than a preset threshold, thereby obtaining the target SVM model.
6. The appearance evaluation method according to claim 5, characterized in that: The method of optimizing the hyperparameters of the initial SVM model by using a genetic algorithm until the change in the fitness value of the target parameter combination is less than a preset threshold value, thereby obtaining the target SVM model, comprises: Obtaining hyperparameters of the initial SVM model, wherein the hyperparameters include a penalty coefficient and a kernel function parameter; Using the hyperparameter combination consisting of the penalty coefficient and the kernel function parameter as the initial population of the genetic algorithm; The target hyperparameter combination is found by iteratively processing the initial population through the genetic algorithm until the change in the fitness value of the target parameter combination is less than a preset threshold, thereby obtaining the target SVM model.
7. The appearance evaluation method according to claim 6, characterized in that: The iterative processing operation of the initial population by the genetic algorithm to find the target hyperparameter combination until the change of the fitness value of the target parameter combination is less than a preset threshold value, and the target SVM model is obtained, including: The genetic algorithm is used to iteratively perform initialization, fitness calculation, selection operation, crossover operation and mutation operation on the initial population until the change in the fitness value of the target parameter combination is less than a preset threshold, thereby obtaining the target SVM model.
8. An appearance evaluation device, characterized in that: include: An image acquisition module, used to acquire an image of the coating surface to be tested; An image processing module, used for processing the coated surface image to be tested to obtain image features corresponding to the coated surface image to be tested, wherein the image features are represented by image feature values, and the image feature values at least include entropy mean and variance, roughness and energy mean; A model acquisition module is used to acquire a target SVM model, wherein the target SVM model is acquired by optimizing the hyperparameters of the SVM using a genetic algorithm; The model evaluation module is used to input the image features into the target SVM model and output the scoring result of the coated surface image to be tested.
9. A computer device, characterized in that: comprising a memory, and one or more processors communicatively connected to the memory; The memory stores instructions that can be executed by the one or more processors, and the instructions are executed by the one or more processors to enable the one or more processors to implement the appearance evaluation method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The invention comprises a program or an instruction, and when the program or the instruction is executed on a computer, the appearance evaluation method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
An SVM-based wheel speed sensor gear ring surface defect detection method
CN109886932A
Omnibearing multi-angle optimization method based on deformation prediction
CN114880792A
Coating weight monitoring system based on online monitoring
CN117619676A
