Product appearance defect detection method and device, electronic equipment and storage medium

By identifying product appearance defects through feature extraction and similarity calculation, and combining template matching and adaptive learning mechanisms, the problem of low efficiency and insufficient accuracy in product appearance defect detection is solved, achieving efficient and accurate automated detection.

CN118967616APending Publication Date: 2024-11-15GEER TECH CO LTD
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202411028396.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-29
Publication Date
2024-11-15

AI Technical Summary

Technical Problem

Existing technologies for detecting product appearance defects are inefficient and inaccurate, especially in identifying complex defects.

Method used

Feature extraction models are used to extract feature vectors from product appearance images. Defective products are identified through similarity calculations, and defect types and regions are identified. Template matching and adaptive learning mechanisms are combined to optimize the detection results.

Benefits of technology

It improves the efficiency and accuracy of product appearance defect detection, reduces missed detections and false judgments, and realizes an automated and rapid detection process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118967616A_ABST
    Figure CN118967616A_ABST
Patent Text Reader

Abstract

The invention discloses a product appearance defect detection method and device, electronic equipment and a storage medium, and relates to the technical field of image detection.The product appearance defect detection method comprises the steps that all appearance pictures of a target product are input into a preset feature extraction model, and all feature vectors of all the appearance pictures are obtained; respectively calculating a similarity value between each feature vector and a corresponding standard feature vector, and determining whether the target product is a defective product or not based on each similarity value; and when determining that the target product is the defective product, identifying the defect type and the defect area of the defect in the target product to obtain an appearance defect detection result of the target product. According to the invention, the detection efficiency and accuracy of product appearance defect detection can be guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image detection technology, and in particular to a method, device, electronic device and storage medium for detecting product appearance defects. Background Art

[0002] During the production process, the surface of the product and its components will inevitably produce various types of defects, such as misalignment, scratches, contamination, etc. Therefore, product surface defect detection has become an indispensable part of the quality inspection process in the product production process.

[0003] At present, product appearance defect detection mainly includes two methods: manual inspection and machine vision inspection. The manual inspection method has problems such as low detection efficiency and low reliability of detection results. The machine vision inspection method can realize the automation of surface defect detection, but the identification of complex product appearance defects still needs to be improved.

[0004] In summary, how to improve the detection efficiency and accuracy of product appearance defect detection has become a technical problem that needs to be urgently solved in this field. Summary of the invention

[0005] The main purpose of this application is to provide a product appearance defect detection method, device, electronic device and storage medium, aiming to improve the detection efficiency and accuracy of product appearance defect detection.

[0006] To achieve the above objectives, the present application proposes a product appearance defect detection method, which includes:

[0007] Input each appearance picture of the target product into a preset feature extraction model to obtain each feature vector of each appearance picture;

[0008] Calculating the similarity value between each of the feature vectors and the corresponding standard feature vector respectively, and determining whether the target product is a defective product based on each of the similarity values;

[0009] When it is determined that the target product is the defective product, the defect type and defect area of ​​the defect in the target product are identified to obtain an appearance defect detection result of the target product.

[0010] In one embodiment, the step of inputting each appearance picture of the target product into a preset feature extraction model to obtain each feature vector of each appearance picture includes:

[0011] Inputting each of the appearance images into a preset feature extraction model in sequence, and encoding each of the appearance images into feature maps through a convolutional layer and a residual block in the feature extraction model;

[0012] Each feature map is average pooled through the global average pooling layer in the feature extraction model to obtain each feature vector of each appearance image.

[0013] In one embodiment, before the step of inputting each appearance picture of the target product into a preset feature extraction model to obtain each feature vector of each appearance picture, the step further includes:

[0014] Acquire each initial appearance picture of the target product, wherein each of the initial appearance pictures is a picture captured by a preset image acquisition device from preset multiple angles;

[0015] Performing shading correction processing on each of the initial appearance pictures to adjust the brightness and contrast of each of the initial appearance pictures;

[0016] and / or, performing a speckle filtering process on each of the initial appearance images to eliminate environmental interference noise of the initial appearance images;

[0017] And / or, performing directional gradient processing on each of the initial appearance pictures to remove the background pattern of the initial appearance picture to obtain each of the appearance pictures.

[0018] In one embodiment, the step of respectively calculating the similarity values ​​between each of the feature vectors and the corresponding standard feature vector, and determining whether the target product is a defective product based on each of the similarity values, includes:

[0019] Determine the standard feature vector corresponding to each of the appearance pictures according to the acquisition angle;

[0020] Respectively calculating the similarity value between each of the feature vectors and the corresponding standard vector, and comparing each of the similarity values ​​with a preset similarity threshold;

[0021] When each of the similarity values ​​is greater than the similarity threshold, determining that the target product is a non-defective product;

[0022] If there is a similarity value among the similarity values ​​that is less than the similarity threshold, it is determined that the target product is a defective product.

[0023] In one embodiment, when determining that the target product is the defective product, the step of identifying the defect type and defect area of ​​the defect in the target product and obtaining the appearance defect detection result of the target product includes:

[0024] When it is determined that the target product is the defective product, the appearance pictures are spliced ​​to obtain a composite appearance picture of the target product;

[0025] Determine the defect area and defect type of the target product in the appearance composite image using a template matching model;

[0026] An appearance defect detection result of the target product is generated based on the defect area and the defect type.

[0027] In one embodiment, when determining that the target product is the defective product, identifying the defect type and defect area of ​​the defect in the target product, and obtaining the appearance defect detection result of the target product further includes:

[0028] Verifying the appearance defect detection result to obtain a verification result;

[0029] Based on an adaptive learning mechanism, the similarity threshold and / or the model parameters of the template matching model are dynamically adjusted according to the verification result.

[0030] In one embodiment, the method further comprises:

[0031] The number of products determined to be defective within a preset period is counted, and an alarm is triggered when the number of products exceeds a preset value.

[0032] In addition, to achieve the above-mentioned purpose, the present application also proposes a product appearance defect detection device, which includes:

[0033] A feature extraction module, used to input each appearance picture of the target product into a preset feature extraction model to obtain each feature vector of each appearance picture;

[0034] A similarity calculation module, used to calculate the similarity value between each of the feature vectors and the corresponding standard feature vector, and determine whether the target product is a defective product based on each of the similarity values;

[0035] The defect detection module is used to identify the defect type and defect area of ​​the defect in the target product when determining that the target product is the defective product, and obtain the appearance defect detection result of the target product.

[0036] In addition, to achieve the above-mentioned purpose, the present application also proposes an electronic device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the product appearance defect detection method as described above.

[0037] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium. A computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the product appearance defect detection method as described above are implemented.

[0038] The present application proposes a method for detecting product appearance defects. The present application first inputs each appearance picture of the target product into a pre-built feature extraction model, which can generate each feature vector of each appearance picture. Subsequently, these feature vectors are compared with the corresponding standard feature vectors for similarity, and the similarity value between the two is calculated to determine whether the target product is a defective product. After determining that the target product is a defective product, the defect type and defect area of ​​the defect in the target product are automatically identified, and finally an appearance defect detection report for the target product is generated.

[0039] In summary, this application not only improves the detection efficiency of product appearance defects by integrating feature extraction, similarity comparison and defect recognition technology, realizes the automation and acceleration of the detection process, but also improves the accuracy of detection, reduces missed detections and misjudgments, and ensures the detection efficiency and accuracy of product appearance defect detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0041] 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, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0042] Figure 1 A flowchart of the first embodiment of the product appearance defect detection method of the present application is provided;

[0043] Figure 2 A schematic diagram of a defective product determination process provided in Example 2 of the product appearance defect detection method of the present application;

[0044] Figure 3 A brief flow chart of the second embodiment of the product appearance defect detection method of the present application;

[0045] Figure 4 This is a schematic diagram of the module structure of the product appearance defect detection device according to the embodiment of the present application;

[0046] Figure 5 Schematic diagram of the device structure of the hardware operating environment involved in the product appearance defect detection method in the embodiment of the present application.

[0047] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0048] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.

[0049] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.

[0050] The main solution of the embodiment of the present application is: input each appearance picture of the target product into a preset feature extraction model to obtain each feature vector of each appearance picture; respectively calculate the similarity value between each feature vector and the corresponding standard feature vector, and determine whether the target product is a defective product based on each similarity value; when it is determined that the target product is the defective product, identify the defect type and defect area of ​​the defect in the target product to obtain the appearance defect detection result of the target product.

[0051] Since product appearance defect detection mainly includes manual inspection and machine vision inspection, the manual inspection method has problems such as low detection efficiency and low reliability of detection results. The machine vision inspection method can realize the automation of surface defect detection, but the identification of complex product appearance defects still needs to be improved.

[0052] The embodiment of the present application provides a solution, which not only improves the detection efficiency of product appearance defects and realizes the automation and acceleration of the detection process by integrating feature extraction, similarity comparison and defect recognition technology, but also improves the accuracy of detection, reduces missed detections and misjudgments, and ensures the detection efficiency and accuracy of product appearance defect detection.

[0053] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a vehicle terminal, etc., or an electronic device capable of realizing the above functions, etc. The following takes a test machine as an example to illustrate this embodiment and the following embodiments.

[0054] Based on this, the present application embodiment provides a method for detecting product appearance defects. Figure 1 , Figure 1 This is a flow chart of the first embodiment of the product appearance defect detection method of the present application.

[0055] In this embodiment, the product appearance defect detection method includes steps S10 to S30:

[0056] Step S10, inputting each appearance picture of the target product into a preset feature extraction model to obtain each feature vector of each appearance picture;

[0057] It should be noted that the target product is the product whose appearance is to be inspected, which can be headphones, mobile phones, tablets, etc. that need to undergo product quality inspection before leaving the factory; the feature extraction model is usually a deep learning model, such as a convolutional neural network (CNN), which can effectively extract representative feature information from the image. The model processes the input image layer by layer through its internal convolutional layer, activation layer, pooling layer, and possible residual block structures, gradually abstracts the high-level features of the image, and finally encodes these features into a series of feature vectors.

[0058] The appearance pictures of the target products are taken as input and sent to the pre-trained feature extraction model. In order to obtain a more accurate and comprehensive feature representation, a series of preprocessing operations can be performed on the input pictures, such as adjusting the image size, normalizing the pixel values, performing shading correction to adjust the brightness and contrast, applying speckle filtering to eliminate environmental noise, and directional gradient processing to remove background patterns. These preprocessing steps help improve the feature extraction model's ability to understand the image content and its robustness.

[0059] Step S20, respectively calculating the similarity value between each of the feature vectors and the corresponding standard feature vector, and determining whether the target product is a defective product based on each of the similarity values;

[0060] For each extracted feature vector, it is necessary to calculate the similarity value between it and the standard feature vector at the corresponding angle. The standard feature vector represents the ideal feature representation of a non-defective product at the same acquisition angle. The calculation of the similarity value can be achieved by a variety of methods, such as cosine similarity, Euclidean distance, etc. The specific method to be selected depends on the nature of the feature vector and the needs of the actual application, and is not specifically limited in this embodiment. After obtaining the similarity values ​​of all feature vectors and the corresponding standard feature vectors, it is determined whether the target product is a defective product based on these similarity values.

[0061] Step S30, when it is determined that the target product is the defective product, the defect type and defect area of ​​the defect in the target product are identified to obtain the appearance defect detection result of the target product.

[0062] After determining that the target product is a defective product, further identify the specific type and area of ​​the defect. After identifying the defect type and area, mark this information in an appropriate manner so that production personnel or quality inspectors can intuitively see the defects of the product.

[0063] The marking method can be to draw a rectangular box, a circle or other shaped mark on the picture to indicate the defect area, and mark the defect type with a text description next to it, or draw a mark box in different colors to represent different defect types. Finally, the marked picture and defect information are integrated into a complete appearance defect detection result report for subsequent processing and analysis.

[0064] In a feasible embodiment, before step S10, steps A10 to A40 may be further included:

[0065] Step A10, obtaining each initial appearance picture of the target product, wherein each of the initial appearance pictures is a picture captured by a preset image acquisition device from preset multiple angles;

[0066] The initial appearance picture of the target product is taken at a preset angle and lighting conditions by installing an image acquisition device to ensure that the appearance characteristics of the target product can be fully and meticulously captured. Among them, the image acquisition device is usually installed in a fixed position and is accurately calibrated to ensure that it can be operated at the preset angle and lighting conditions each time it is taken, ensuring that the quality of the captured pictures is consistent and can clearly and accurately show every detail of the target product.

[0067] During the shooting process, in order to ensure that each picture can clearly show the overall and local features of the target product, production personnel or quality inspectors also need to reasonably set the shooting parameters of the image acquisition equipment according to the product appearance characteristics and appearance quality inspection requirements of the target product, such as exposure time, aperture size, etc., to adapt to different lighting conditions and material characteristics of the target product.

[0068] Step A20, performing a shading correction process on each of the initial appearance pictures to adjust the brightness and contrast of each of the initial appearance pictures;

[0069] In order to eliminate the image brightness or color differences caused by factors such as uneven lighting and reflective surface materials of the product appearance, each initial appearance image is first subjected to light and dark correction processing, which is specifically achieved through image enhancement technology such as histogram equalization, gamma correction or more complex local adaptive brightness adjustment algorithms.

[0070] Step A30, performing a speckle filtering process on each of the initial appearance images to eliminate environmental interference noise of the initial appearance images;

[0071] After adjusting the brightness and contrast of the initial appearance image, further remove the noise such as spots, small particles, subtle gloss or shadows in the image. These noises may be caused by various factors such as the shooting environment and the surface material of the workpiece, affecting the clarity of the image and the accuracy of subsequent analysis. Specifically, based on the speckle filter, the speckle filtering process is implemented through median filtering, Gaussian filtering, bilateral filtering and other methods. These methods can smooth the image while retaining the edge information of the image as much as possible.

[0072] Step A40, performing directional gradient processing on each of the initial appearance pictures to remove the background pattern of the initial appearance picture to obtain each of the appearance pictures.

[0073] After eliminating the local noise of the image, the complex patterns or textures in the background of the image are further processed. These patterns may interfere with the recognition and analysis of the product itself. Specifically, directional filters (such as Gabor filters, Sobel operators, etc.) can be used to identify and suppress textures in specific directions. These filters can be customized according to the directional characteristics of the texture to more effectively remove background patterns.

[0074] It should be noted that at least one of the above steps A20, A30 and A40 can be executed to complete the initialization of the initial appearance image, obtain a higher quality appearance image for product appearance defect detection, and provide more accurate and reliable input data for subsequent feature extraction, similarity calculation and other steps.

[0075] In summary, the embodiments of the present application not only improve the detection efficiency of product appearance defects by integrating feature extraction, similarity comparison and defect recognition technology, realize the automation and acceleration of the detection process, but also improve the accuracy of detection, reduce missed detections and misjudgments, and ensure the detection efficiency and accuracy of product appearance defect detection.

[0076] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can be referred to the above introduction, and will not be repeated in the following. On this basis, step S10 can include steps S101 to S102:

[0077] Step S101, inputting each of the appearance pictures into a preset feature extraction model in sequence, and encoding each of the appearance pictures into feature maps through a convolutional layer and a residual block in the feature extraction model;

[0078] It should be noted that, in this embodiment, the feature extraction model is preferably a model generated using a ResNet architecture, which includes multiple convolutional layers and residual blocks.

[0079] Each appearance image is input into the feature extraction model in turn. The convolution layer in the model is responsible for extracting local features from the input appearance image. Through the operation of sliding window and convolution kernel, a series of feature maps (FeatureMaps) are generated. These feature maps capture the basic information such as edges and textures in the image. The residual block introduces skip connections to help the model maintain the flow of information in the deep network, avoid the problem of gradient disappearance or explosion, and thus improve the effect of feature extraction of appearance images.

[0080] Step S102, performing average pooling on each of the feature maps through a global average pooling layer in the feature extraction model to obtain feature vectors of each of the appearance images.

[0081] After being processed by the convolutional layer and the residual block, the feature map needs to be further converted into a feature vector for subsequent similarity calculation and classification decision. This conversion process is usually achieved through the Global Average Pooling (GAP) layer. The global average pooling layer performs an average pooling operation on each channel of the feature map, that is, all values ​​in each channel are added and averaged to obtain a single value. This process not only reduces the dimension of the feature vector, but also enhances the model's robustness to changes in spatial position. Ultimately, each appearance image is encoded as a feature vector containing rich feature information.

[0082] In a possible embodiment, Figure 2 As shown, step S20 may include steps S201 to S204:

[0083] Step S201, determining a standard feature vector corresponding to each appearance picture according to a collection angle;

[0084] According to different acquisition angles, corresponding standard feature vectors are determined for each appearance image. These standard feature vectors represent the ideal feature representation of non-defective products at the same acquisition angle, and are usually obtained through training with a large amount of sample data of non-defective products.

[0085] Step S202, respectively calculating the similarity value between each of the feature vectors and the corresponding standard vector, and comparing each of the similarity values ​​with a preset similarity threshold;

[0086] The similarity value between each feature vector and the corresponding standard feature vector is calculated respectively. There are various methods for calculating the similarity value, and the common ones are cosine similarity, Euclidean distance, etc. After the calculation is completed, the obtained similarity value is compared with the preset similarity threshold.

[0087] For example, taking the calculation of the similarity value by cosine similarity as an example, for each pair of feature vectors (the feature vector of the appearance image and the corresponding standard feature vector), the calculation formula of cosine similarity is used to calculate the similarity between them. The calculation formula of cosine similarity is as follows:

[0088] S=(A·B) / (||A||*||B||)

[0089] Among them, A and B represent two vectors respectively, · represents the dot product of the vectors, and ||A|| and ||B|| represent the norms of the vectors (i.e., the lengths of the vectors).

[0090] The value range of cosine similarity is between -1 and 1. The closer the value is to 1, the more similar the two vectors are. The closer the value is to -1, the less similar the two vectors are. The closer the value is to 0, the more similar or different the two vectors are.

[0091] Step S203, when all the similarity values ​​are greater than the similarity threshold, determining that the target product is a non-defective product;

[0092] If the similarity values ​​between all feature vectors and the corresponding standard feature vectors are greater than the similarity threshold, it is considered that the appearance of the target product at different angles meets the standard of a non-defective product, and the target product is therefore determined to be a non-defective product.

[0093] Step S204: if there is a similarity value among the similarity values ​​that is less than the similarity threshold, it is determined that the target product is a defective product.

[0094] If any of the similarity values ​​is less than the similarity threshold, it means that the appearance of the target product at one or some acquisition angles is significantly different from the standard of a non-defective product, and therefore the target product is determined to be a defective product.

[0095] In addition, in practical applications, since the appearance characteristics of the target product may show different complexity and variability at different angles, the use of a unified similarity threshold for each appearance image taken from different angles may not accurately reflect the true quality status of the product at different viewing angles. In order to more accurately determine whether the target product has defects, different similarity thresholds can be set for each type of appearance image according to the characteristics of different acquisition angles.

[0096] Exemplarily, according to different acquisition angles, corresponding standard feature vectors are determined for each type of appearance image, and different similarity thresholds are pre-set according to the importance and complexity of each acquisition angle. For example, for the front view (usually containing the main features and brand logo of the product), a higher similarity threshold is set to ensure accurate matching of key features; while for the side or edge view (which may contain fewer significant features or more background noise), a relatively lower similarity threshold is set to accommodate more subtle differences.

[0097] Then, the similarity between each feature vector and the corresponding standard feature vector is calculated, and the similarity thresholds at different angles are used for comparison. For each angle, if the similarity value is greater than or equal to the similarity threshold at that angle, the appearance image at that angle is considered to be sufficiently similar to the standard image and has no significant defects.

[0098] Finally, the overall quality of the target product is determined by comprehensively comparing the similarity results at all angles. If the similarity at all angles meets the threshold requirements at each angle, the target product is determined to be a non-defective product; if the similarity at any angle does not meet the requirements, it is determined to be a defective product.

[0099] In this way, this method of differentially setting the similarity threshold can more flexibly adapt to the differences in appearance features at different angles and improve the accuracy and reliability of defect judgment.

[0100] In a feasible embodiment, step S30 may include steps S301 to S303:

[0101] Step S301, when it is determined that the target product is the defective product, the appearance pictures are spliced ​​to obtain a composite appearance picture of the target product;

[0102] The appearance pictures collected at each angle are stitched together to obtain a complete composite image of the target product appearance, so as to examine the product appearance from a global perspective and facilitate the subsequent positioning of defective areas.

[0103] Step S302, using a template matching model to determine the defect area and defect type of the target product in the appearance composite image;

[0104] The template matching model is used to search and match in the appearance composite image to determine the defect area and defect type of the target product. The template matching model usually contains a series of preset defect templates. By comparing with the composite image, the defect area similar to the template can be identified and the type of defect can be determined accordingly.

[0105] Step S303: generating an appearance defect detection result of the target product based on the defect area and the defect type.

[0106] Based on the results of template matching, an appearance defect detection report of the target product is generated, which lists in detail the location, size, type and other information of the defect area, providing a basis for subsequent processing and repair.

[0107] Exemplarily, in a feasible embodiment, a template library containing various common types of product appearance defects is pre-established. The template library contains sample images based on actual product defects, and may also be idealized defect images that are manually designed or generated by algorithms. The template library should cover various types of defects that may appear in the product appearance, such as scratches, pits, stains, etc., and try to maintain the diversity and representativeness of the templates.

[0108] Based on template matching algorithms, such as feature point-based matching, grayscale value-based matching, or shape-based matching, the appearance image of the target product determined to be a defective product is matched with the sample image in the template library. Based on the location information of the successful match, the specific location of the defect is marked in the image, and based on the type of the successfully matched template, the specific type of the product defect is identified. Finally, the detection results are output in the form of images, texts, or tables to display the location, type, and related statistical data of the defect.

[0109] In this way, through the preset template library and matching algorithm, this embodiment can unify the detection standards, eliminate individual differences in manual detection, and ensure the objectivity and consistency of the detection results.

[0110] In a feasible embodiment, step S30 may further include steps S40 to S50:

[0111] Step S40, verifying the appearance defect detection result to obtain a verification result;

[0112] In order to improve the accuracy and adaptability of detection, this embodiment also provides a detection result verification and model parameter dynamic adjustment process. The generated appearance defect detection results are manually or automatically verified to ensure the accuracy and reliability of the detection results, and the verification results are used as feedback information for subsequent detection optimization.

[0113] Step S50: Based on an adaptive learning mechanism, dynamically adjust the similarity threshold and / or the model parameters of the template matching model according to the verification result.

[0114] Based on the verification results, an adaptive learning mechanism is used to dynamically adjust the similarity threshold and / or model parameters of the template matching model to continuously optimize the detection performance according to the actual detection situation and improve the accuracy and efficiency of defect detection.

[0115] In a feasible embodiment, the product appearance defect detection method may further include step B10:

[0116] Step B10, counting the number of products determined to be defective products within a preset period, and triggering an alarm prompt when the number of products exceeds a preset value.

[0117] The number of defective products judged within a preset period is regularly counted. When the number exceeds the preset value, an alarm is triggered to remind relevant personnel to pay attention to quality problems in the production process and take timely measures to improve and optimize. This helps companies to promptly discover and solve potential problems in production and ensure the stability and reliability of product quality.

[0118] In addition, in a feasible embodiment, by building a cloud service platform, providing cloud services such as data storage, model training, and result analysis, the local deployment cost of enterprises can be reduced, the system scalability and flexibility can be improved, and a remote detection system can be developed to allow enterprises to remotely monitor the appearance inspection of production lines, and realize remote fault diagnosis and remote technical support. Big data analysis technology can also be used to perform trend analysis on the detected defect data, predict the types and quantities of defects that may occur in the future, and provide a basis for enterprises to formulate preventive measures. In addition, based on the test results and trend analysis, production optimization suggestions can be provided to the production department, such as adjusting process parameters, changing raw material suppliers, etc., to improve product quality and production efficiency. Thus, product appearance inspection becomes more intelligent and efficient.

[0119] In this way, this embodiment not only improves the detection efficiency of product appearance defects and realizes the automation and acceleration of the detection process by integrating feature extraction, similarity comparison and defect recognition technology, but also improves the accuracy of detection, reduces missed detections and misjudgments, and ensures the detection efficiency and accuracy of product appearance defect detection.

[0120] For example, to help understand the implementation process of the product appearance defect detection method obtained by combining this embodiment with the above-mentioned embodiment 1, please refer to Figure 3 , Figure 3 A brief flow chart of a product appearance defect detection method is provided, specifically:

[0121] After receiving the appearance picture of the target product, the feature vector of the appearance picture is extracted through the feature extraction model, and then the similarity value between the feature vector and the standard feature vector is calculated, and based on the similarity value, it is determined whether the target product is a defective product. If the target product is determined to be a defective product, the defect type and defect area of ​​the defect in the standard target product are identified and standardized, and finally an appearance defect detection report of the target product is obtained. If the target product is determined to be a non-defective product, the corresponding appearance defect detection report is output to determine that the target product is a non-defective product.

[0122] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the product appearance defect detection method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.

[0123] The present application also provides a product appearance defect detection device, please refer to Figure 4 , the product appearance defect detection device includes:

[0124] A feature extraction module 10 is used to input each appearance picture of the target product into a preset feature extraction model to obtain each feature vector of each appearance picture;

[0125] A similarity calculation module 20, used to respectively calculate the similarity value between each of the feature vectors and the corresponding standard feature vector, and determine whether the target product is a defective product based on each of the similarity values;

[0126] The defect detection module 30 is used to identify the defect type and defect area of ​​the defect in the target product when determining that the target product is the defective product, and obtain the appearance defect detection result of the target product.

[0127] Optionally, the feature extraction module 10 is further used for:

[0128] Inputting each of the appearance images into a preset feature extraction model in sequence, and encoding each of the appearance images into feature maps through a convolutional layer and a residual block in the feature extraction model;

[0129] Each feature map is average pooled through the global average pooling layer in the feature extraction model to obtain each feature vector of each appearance image.

[0130] Optionally, the product appearance defect detection device further includes an image initialization module (not shown), which is used to:

[0131] Acquire each initial appearance picture of the target product, wherein each of the initial appearance pictures is a picture captured by a preset image acquisition device from preset multiple angles;

[0132] Performing shading correction processing on each of the initial appearance pictures to adjust the brightness and contrast of each of the initial appearance pictures;

[0133] and / or, performing a speckle filtering process on each of the initial appearance images to eliminate environmental interference noise of the initial appearance images;

[0134] And / or, performing directional gradient processing on each of the initial appearance pictures to remove the background pattern of the initial appearance picture to obtain each of the appearance pictures.

[0135] Optionally, the similarity calculation module 20 is further used for:

[0136] Determine the standard feature vector corresponding to each of the appearance pictures according to the acquisition angle;

[0137] Respectively calculating the similarity value between each of the feature vectors and the corresponding standard vector, and comparing each of the similarity values ​​with a preset similarity threshold;

[0138] When each of the similarity values ​​is greater than the similarity threshold, determining that the target product is a non-defective product;

[0139] If there is a similarity value among the similarity values ​​that is less than the similarity threshold, it is determined that the target product is a defective product.

[0140] Optionally, the defect detection module 30 is further configured to:

[0141] When it is determined that the target product is the defective product, the appearance pictures are spliced ​​to obtain a composite appearance picture of the target product;

[0142] Determine the defect area and defect type of the target product in the appearance composite image using a template matching model;

[0143] An appearance defect detection result of the target product is generated based on the defect area and the defect type.

[0144] Optionally, the product appearance defect detection device further includes a verification module (not shown), which is used to:

[0145] Verifying the appearance defect detection result to obtain a verification result;

[0146] Based on an adaptive learning mechanism, the similarity threshold and / or the model parameters of the template matching model are dynamically adjusted according to the verification result.

[0147] Optionally, the product appearance defect detection device further includes an alarm module (not shown), which is used to:

[0148] The number of products determined to be defective within a preset period is counted, and an alarm is triggered when the number of products exceeds a preset value.

[0149] The product appearance defect detection device provided in the embodiment of the present application adopts the product appearance defect detection method in the above embodiment, which can improve the detection efficiency and accuracy of product appearance defect detection. Compared with the prior art, the beneficial effects of the product appearance defect detection device provided in the embodiment of the present application are the same as the beneficial effects of the product appearance defect detection method provided in the above embodiment, and other technical features in the product appearance defect detection device are the same as the features disclosed in the product appearance defect detection method in the above embodiment, which will not be repeated here.

[0150] An embodiment of the present application provides an electronic device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the product appearance defect detection method in the above-mentioned embodiment one.

[0151] Reference below Figure 5 , which shows a schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present application. The electronic devices in the embodiments of the present application may include but are not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0152] like Figure 5As shown, the electronic device may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the electronic device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows an electronic device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.

[0153] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.

[0154] The electronic device provided in the embodiment of the present application adopts the product appearance defect detection method in the above embodiment, which can improve the detection efficiency and accuracy of product appearance defect detection. Compared with the prior art, the beneficial effects of the electronic device provided in the embodiment of the present application are the same as the beneficial effects of the product appearance defect detection method provided in the above embodiment, and other technical features in the electronic device are the same as the features disclosed in the product appearance defect detection method in the previous embodiment, which will not be repeated here.

[0155] It should be understood that the various parts disclosed in the embodiments of the present application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0156] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0157] An embodiment of the present application provides a computer-readable storage medium having computer-readable program instructions (ie, a computer program) stored thereon, wherein the computer-readable program instructions are used to execute the product appearance defect detection method in the above-mentioned embodiment.

[0158] The computer-readable storage medium provided in the embodiment of the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM: Random Access Memory), a read-only memory (ROM: Read Only Memory), an erasable programmable read-only memory (EPROM: Erasable Programmable Read Only Memory or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM: CD-Read Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium can be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency: Radio Frequency), etc., or any suitable combination of the above.

[0159] The computer-readable storage medium may be included in the electronic device, or may exist independently without being installed in the electronic device.

[0160] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by an electronic device, the electronic device: inputs each appearance picture of the target product into a preset feature extraction model to obtain each feature vector of each appearance picture; respectively calculates the similarity value between each feature vector and the corresponding standard feature vector, and determines whether the target product is a defective product based on each similarity value; when it is determined that the target product is the defective product, identifies the defect type and defect area of ​​the defect in the target product to obtain the appearance defect detection result of the target product.

[0161] The computer program code for performing the operation of the embodiment of the present application can be written in one or more programming languages ​​or a combination thereof, and the above-mentioned programming languages ​​include object-oriented programming languages, such as Java, Smalltalk, C++, and also include conventional procedural programming languages, such as "C" language or similar programming languages. The program code can be executed completely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer, partially on the remote computer, or completely on the remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN: Local Area Network) or a wide area network (WAN: Wide Area Network), or it can be connected to an external computer (for example, using an Internet service provider to connect through the Internet).

[0162] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0163] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.

[0164] The readable storage medium provided in the embodiment of the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned product appearance defect detection method, and can improve the detection efficiency and accuracy of product appearance defect detection. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in the embodiment of the present application are the same as the beneficial effects of the product appearance defect detection method provided in the above-mentioned embodiment, and will not be repeated here.

[0165] The above are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect application in other related technical fields are included in the patent protection scope of the present application.

Claims

1. A method for detecting product appearance defects, It is characterized in that The method includes: Input each appearance picture of the target product into a preset feature extraction model to obtain each feature vector of each appearance picture; Calculating the similarity value between each of the feature vectors and the corresponding standard feature vector respectively, and determining whether the target product is a defective product based on each of the similarity values; When it is determined that the target product is the defective product, the defect type and defect area of ​​the defect in the target product are identified to obtain an appearance defect detection result of the target product.

2. The method according to claim 1, It is characterized in that The step of inputting each appearance picture of the target product into a preset feature extraction model to obtain each feature vector of each appearance picture includes: Inputting each of the appearance images into a preset feature extraction model in sequence, and encoding each of the appearance images into feature maps through a convolutional layer and a residual block in the feature extraction model; Each feature map is average pooled through the global average pooling layer in the feature extraction model to obtain each feature vector of each appearance image.

3. The method according to claim 1, It is characterized in that Before the step of inputting each appearance picture of the target product into a preset feature extraction model to obtain each feature vector of each appearance picture, the step further includes: Acquire each initial appearance picture of the target product, wherein each of the initial appearance pictures is a picture captured by a preset image acquisition device from preset multiple angles; Performing shading correction processing on each of the initial appearance pictures to adjust the brightness and contrast of each of the initial appearance pictures; and / or, performing a speckle filtering process on each of the initial appearance images to eliminate environmental interference noise of the initial appearance images; And / or, performing directional gradient processing on each of the initial appearance pictures to remove the background pattern of the initial appearance picture to obtain each of the appearance pictures.

4. The method according to claim 1, It is characterized in that The step of respectively calculating the similarity values ​​between each of the feature vectors and the corresponding standard feature vector, and determining whether the target product is a defective product based on each of the similarity values, comprises: Determine the standard feature vector corresponding to each of the appearance pictures according to the acquisition angle; Respectively calculating the similarity value between each of the feature vectors and the corresponding standard vector, and comparing each of the similarity values ​​with a preset similarity threshold; When each of the similarity values ​​is greater than the similarity threshold, determining that the target product is a non-defective product; If there is a similarity value among the similarity values ​​that is less than the similarity threshold, it is determined that the target product is a defective product.

5. The method according to claim 1, It is characterized in that When determining that the target product is the defective product, the step of identifying the defect type and defect area of ​​the defect in the target product and obtaining the appearance defect detection result of the target product includes: When it is determined that the target product is the defective product, the appearance pictures are spliced ​​to obtain a composite appearance picture of the target product; Determine the defect area and defect type of the target product in the appearance composite image using a template matching model; An appearance defect detection result of the target product is generated based on the defect area and the defect type.

6. The method according to claim 5, It is characterized in that After the step of identifying the defect type and defect area of ​​the defect in the target product and obtaining the appearance defect detection result of the target product when determining that the target product is the defective product, the step further includes: Verifying the appearance defect detection result to obtain a verification result; Based on an adaptive learning mechanism, the similarity threshold and / or the model parameters of the template matching model are dynamically adjusted according to the verification result.

7. The method according to claim 6, It is characterized in that The method further comprises: The number of products determined to be defective within a preset period is counted, and an alarm is triggered when the number of products exceeds a preset value.

8. A device for detecting product appearance defects, It is characterized in that The device comprises: A feature extraction module, used to input each appearance picture of the target product into a preset feature extraction model to obtain each feature vector of each appearance picture; A similarity calculation module, used to calculate the similarity value between each of the feature vectors and the corresponding standard feature vector, and determine whether the target product is a defective product based on each of the similarity values; The defect detection module is used to identify the defect type and defect area of ​​the defect in the target product when determining that the target product is the defective product, and obtain the appearance defect detection result of the target product.

9. An electronic device, It is characterized in that The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the method according to any one of claims 1 to 7.

10. A storage medium, It is characterized in that The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Visual inspection method based on workpiece inspection equipment

    CN120198430A

  • Process detection method, device, equipment and medium

    CN120598942A

  • Process detection method, device, equipment and medium

    CN120598942B