Injection mold surface defect detection method and system

Through image segmentation and polynomial naive Bayes classifier combined with neural network model, the surface defects of injection molds are detected, which solves the problems of low detection efficiency and low accuracy in the prior art, and achieves more efficient defect recognition.

CN118329770BActive Publication Date: 2025-01-07深圳市星凯科技有限公司
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202410440149.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-12
Publication Date
2025-01-07
Estimated Expiration
2044-04-12

AI Technical Summary

Technical Problem

Existing injection mold detection methods are inefficient and cannot be guaranteed for inspection. Especially in large-scale production, artificial visual inspection and single model detection are difficult to accurately identify small or complex defects, resulting in missed or missed inspections.

Method used

Image segmentation and prediction mask binarization are used to obtain defect images, and combined with polynomial naive Bayes classifier and neural network-based defect recognition model, multi-angle and multi-model analysis of defect images is performed to generate target defect recognition results.

Benefits of technology

The accuracy and efficiency of surface defect detection of injection molds is improved, and the problem of low model recognition accuracy caused by localization of training samples is overcome, and multiple defect types can be more accurately identified.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118329770B_ABST
    Figure CN118329770B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and system for detecting surface defects of injection molds, including obtaining a surface image of an injection mold to be tested, performing image segmentation on the surface image, locating defect areas and generating defect images, including converting the surface image into a prediction mask, obtaining defect contours after binarization processing, extracting closed rectangular areas and cropping to obtain defect images; matching the defect image with a preset knowledge graph, inputting the matching result into a polynomial naive Bayes classifier, and generating a first analysis result; inputting the defect image into a defect recognition model based on neural network training, and outputting a second analysis result; generating a target defect recognition result based on the first analysis result and the second analysis result. The present invention comprehensively detects surface defects of injection molds based on knowledge graphs and defect recognition models, and can accurately detect mold surface defects through multi-angle and multi-model analysis. Compared with existing detection methods, it has the advantages of high efficiency and high detection accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of injection mold detection, and in particular to a method and system for detecting surface defects of an injection mold. Background Art

[0002] In the injection mold manufacturing industry, due to the particularity and irregularity of different products and molds, it is time-consuming and laborious to detect the production status of products, and mold defects cannot be accurately and quickly detected, resulting in reduced production efficiency. At present, mold detection methods usually rely on manual inspection or model inspection. Although manual visual inspection can identify some obvious defects, it may not accurately identify small or complex defects, and it is easy to miss or misdetect. The detection accuracy cannot be guaranteed, and the efficiency is low, which cannot meet the needs of large-scale production. Model detection usually cannot fully cover all types of mold defects due to the limitations of model design and training data, which also affects the detection accuracy. Summary of the invention

[0003] In order to solve at least one of the above-mentioned technical problems, the present invention provides a method and system for detecting surface defects of an injection mold.

[0004] In a first aspect, the present invention provides a method for detecting surface defects of an injection mold, the method comprising:

[0005] Acquire a surface image of the injection mold to be tested, perform image segmentation on the surface image, locate the defect area and generate a defect image, including converting the surface image into a prediction mask, binarizing the prediction mask to obtain a defect contour; extract a closed rectangular area from the defect contour, and crop the closed rectangular area to obtain a defect image;

[0006] Matching the defect image with a preset knowledge graph, inputting the matching result into a multinomial naive Bayes classifier, and generating a first analysis result;

[0007] Inputting the defect image into a defect recognition model obtained by neural network training, and outputting a second analysis result;

[0008] A target defect recognition result is generated according to the first analysis result and the second analysis result.

[0009] Preferably, the binarization of the prediction mask to obtain the defect contour includes:

[0010] Divide the image into multiple windows, set a preset amplitude for ending iteration, select a window as the target window, and set the grayscale threshold to the average of the maximum grayscale value and the minimum grayscale value in the target window;

[0011] The pixels in the target window are divided into two categories according to the grayscale threshold. The first category is the background area with pixel values ​​less than the grayscale threshold, and the second category is the foreground area with pixel values ​​greater than the grayscale threshold.

[0012] Calculate the magnitude of the change based on the background area and the foreground area:

[0013]

[0014] In the formula, is the average grayscale value of the background area, is the grayscale average value of the foreground area, G is the grayscale threshold, and s is the change amplitude;

[0015] Determine whether the change range is greater than the preset range; if so, As the new grayscale threshold, and process the remaining windows; if not, As the local threshold of the target window, and process the remaining windows.

[0016] Preferably, the step of inputting the matching result into a multinomial naive Bayes classifier to generate a first analysis result includes:

[0017] Identify all candidate defect types in the matching results, vectorize the data of all candidate defect types, and obtain a first feature vector;

[0018] Vectorize the data of all defect types stored in the local database to obtain a second feature vector;

[0019] The posterior probability of each candidate defect type is calculated according to the first eigenvector and the second eigenvector, and the candidate defect type with the largest posterior probability is taken as the first analysis result.

[0020] Preferably, the method further comprises training a defect recognition model, comprising:

[0021] Acquire a plurality of surface image samples of a plurality of injection molds, and input them into a first defect detection network and a second defect detection network respectively to generate a first defect distribution probability and a second defect distribution probability; the first defect detection network and the second defect detection network are base learners of different model architectures;

[0022] Performing image cleaning on the surface image sample according to the first defect distribution probability to obtain a first target sample; performing image cleaning on the surface image sample according to the second defect distribution probability to obtain a second target sample;

[0023] The network weights of the first defect detection network are updated using the second target sample, and the network weights of the second defect detection network are updated using the first target sample. A defect recognition model is generated according to the updated first defect detection network and the second defect detection network.

[0024] Preferably, generating a target defect identification result according to the first analysis result and the second analysis result includes:

[0025] The defect types that appear most frequently in the first analysis result and the second analysis result are respectively screened out to obtain the first defect type and the second defect type;

[0026] The first defect type and the second defect type are matched for similarity, and when it is determined that the similarity is greater than a first preset value, a target defect recognition result is generated.

[0027] Preferably, before acquiring the surface image of the injection mold to be tested, the method further includes:

[0028] The qualified rate of products manufactured by the injection mold within a preset time period is obtained, and the injection mold corresponding to the qualified rate lower than the second preset value is used as the injection mold to be tested.

[0029] In a second aspect, the present invention further provides an injection mold surface defect detection system, the system comprising:

[0030] An image segmentation unit is used to obtain a surface image of the injection mold to be tested, perform image segmentation on the surface image, locate the defect area and generate a defect image, including converting the surface image into a prediction mask, binarizing the prediction mask to obtain a defect contour; extracting a closed rectangular area from the defect contour, and cropping the closed rectangular area to obtain a defect image;

[0031] An image matching unit, used for matching the defect image with a preset knowledge graph, inputting the matching result into a polynomial naive Bayes classifier, and generating a first analysis result;

[0032] An image recognition unit, used for inputting the defect image into a defect recognition model obtained by neural network training, and outputting a second analysis result;

[0033] The target defect recognition unit is used to generate a target defect recognition result according to the first analysis result and the second analysis result.

[0034] Preferably, the image matching unit is further used for:

[0035] Identify all candidate defect types in the matching results, vectorize the data of all candidate defect types, and obtain a first feature vector;

[0036] Vectorize the data of all defect types stored in the local database to obtain a second feature vector;

[0037] The posterior probability of each candidate defect type is calculated according to the first eigenvector and the second eigenvector, and the candidate defect type with the largest posterior probability is taken as the first analysis result.

[0038] In a third aspect, the present invention further provides an electronic device comprising: a processor and a memory, wherein the memory is used to store computer program code, wherein the computer program code comprises computer instructions, and when the processor executes the computer instructions, the electronic device executes the method as described in the first aspect above and any possible implementation thereof.

[0039] In a fourth aspect, the present invention further provides a computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium, wherein the computer program includes program instructions, and when the program instructions are executed by a processor of an electronic device, the processor executes the method as described in the first aspect above and any possible implementation thereof.

[0040] Compared with the prior art, the present invention has the following beneficial effects:

[0041] The present invention obtains the surface image of the injection mold to be tested, performs image segmentation on the surface image, locates the defect area and generates a defect image, including converting the surface image into a prediction mask, binarizing the prediction mask to obtain the defect contour; extracting a closed rectangular area from the defect contour, and cropping the closed rectangular area to obtain the defect image; matching the defect image with a preset knowledge graph, inputting the matching result into a polynomial naive Bayes classifier to generate a first analysis result; inputting the defect image into a defect recognition model obtained based on neural network training, and outputting a second analysis result; generating a target defect recognition result based on the first analysis result and the second analysis result. Compared with the use of a single detection model, the present invention can overcome the disadvantage of low model recognition accuracy caused by the limitation of training samples, and comprehensively identifies the defect type by combining the knowledge graph with the polynomial naive Bayes classifier and the trained defect recognition model. Through multi-angle and multi-model analysis, the defect detection accuracy can be greatly improved.

[0042] It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the background technology, the drawings required for use in the embodiments of the present invention or the background technology will be described below.

[0044] The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and are used to illustrate the technical solutions of the present disclosure together with the specification.

[0045] Figure 1 A schematic flow chart of a method for detecting surface defects of an injection mold provided by an embodiment of the present invention;

[0046] Figure 2 A schematic structural diagram of an injection mold surface defect testing system provided by an embodiment of the present invention;

[0047] Figure 3 A schematic diagram of the hardware structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0048] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0049] The terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units that are not listed, or may optionally include other steps or units that are inherent to these processes, methods, products or devices.

[0050] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present invention. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0051] In addition, in order to better illustrate the present invention, numerous specific details are provided in the following specific embodiments. It should be understood by those skilled in the art that the present invention can be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the subject matter of the present invention.

[0052] At present, defect detection for injection molds usually relies on manual visual inspection or single model recognition. The former is not only inefficient but also prone to missed detection and false detection. The latter cannot fully cover all defect types due to insufficient training samples, and the detection accuracy cannot be guaranteed. To this end, the present invention provides a method for detecting surface defects of injection molds, which obtains an analysis result by combining a knowledge graph with a polynomial naive Bayes classifier, obtains another analysis result by a trained defect recognition model, and finally combines the two analysis results to obtain the target defect type, which can greatly improve the defect detection accuracy while improving the detection efficiency.

[0053] See also Figure 1 , Figure 1 The following is a flow chart of a method for detecting surface defects of an injection mold provided by an embodiment of the present invention. Figure 1 As shown, a method for detecting surface defects of an injection mold comprises the following steps:

[0054] S10, obtaining a surface image of the injection mold to be tested, performing image segmentation on the surface image, locating the defect area and generating a defect image, including converting the surface image into a prediction mask, binarizing the prediction mask to obtain a defect contour; extracting a closed rectangular area from the defect contour, and cropping the closed rectangular area to obtain a defect image.

[0055] When acquiring the surface image of the injection mold to be tested, in order to obtain a high-quality image, the surface image of the mold can be captured by a high-resolution camera, and then analyzed using image processing software. You can also use photographic 3D scanning to capture the surface of the injection mold with a high-precision camera to obtain 3D data and surface images from multiple angles of the surface.

[0056] After obtaining the surface image, the surface image is segmented, the defect area is located and the defect image is generated, which includes:

[0057] 1) Convert the surface image into a prediction mask, and perform binarization on the prediction mask to obtain the defect contour;

[0058] In this step, the main purpose of the prediction mask is to determine the attributes or categories of each part of the image in order to better understand the content of the image. The prediction mask is regarded as a binary image, where the 1-value area is processed and the masked 0-value area is not included in the calculation. Therefore, the prediction mask can be used to extract the area of ​​interest and mask the area that does not need to be processed, thereby extracting the structural features of the image.

[0059] In one embodiment, binarizing the predicted mask to obtain a defect contour includes:

[0060] 1.1) Divide the image into multiple windows, set a preset amplitude for ending the iteration, and select a window as the target window;

[0061] 1.2) Set the grayscale threshold to the average of the maximum and minimum grayscale values ​​in the target window;

[0062] 1.3) The pixels in the target window are divided into two categories according to the grayscale threshold. The first category is the background area with pixel values ​​less than the grayscale threshold, and the second category is the foreground area with pixel values ​​greater than the grayscale threshold.

[0063] 1.4) Calculate the change range based on the background area and foreground area:

[0064]

[0065] In the formula, is the average grayscale value of the background area, is the grayscale average value of the foreground area, G is the grayscale threshold, and s is the change amplitude;

[0066] In this step, the grayscale average value of the background area is first calculated to obtain the background grayscale value, the grayscale average value of the foreground area is calculated to obtain the foreground grayscale value, and then the average value of the background grayscale value and the foreground grayscale value is taken to obtain the result average value; further, the difference between the result average value and the grayscale threshold set in step 1.2) is calculated, and then the ratio of the absolute value of the difference to the grayscale threshold is taken as the variation amplitude;

[0067] 1.5) Determine whether the change range is greater than the preset range;

[0068] 1.6) If yes, average the results As the new grayscale threshold, and return to step 1.3) to iterate to process the remaining windows;

[0069] 1.7) If not, average the results As the local threshold of the target window, then select the next unprocessed window as the target window, and return to step 1.2) to process the remaining windows;

[0070] 1.8) When all windows have been processed, the iteration process ends.

[0071] 2) Extract a closed rectangular area from the defect contour and crop the closed rectangular area to obtain the defect image.

[0072] This step can be implemented by using an image processing library, such as OpenCV, to detect and implement. First, find the contours in the image. Each contour is a sequence of points used to describe the shape of the contour. Then check the shape and size of the contour, and filter out the closed rectangular contours from the detected contours. For each closed rectangular contour, calculate its minimum closed rectangle, and finally use the calculated minimum closed rectangular bounding box to crop the image, so that only the area containing the defect can be cropped from the original image. Preferably, in order to improve the image quality of the defect image, the cropped defect image can be subjected to denoising and image enhancement operations, such as contrast and brightness enhancement.

[0073] In a preferred embodiment, before acquiring the surface image of the injection mold to be tested, the method further includes:

[0074] The qualified rate of products manufactured by the injection mold within a preset time period is obtained, and the injection mold corresponding to the qualified rate lower than the second preset value is used as the injection mold to be tested.

[0075] It is understandable that there are a huge number of types of injection molds. Before they are put into production and processing, the injection molds are usually subject to quality inspections, such as random sampling. In this embodiment, the injection molds mainly targeted are the injection molds that have been put into use. In order to avoid large-scale inspections affecting the detection efficiency and causing waste of manpower and material resources, when performing defect detection on the injection molds that have been put into use, it is necessary to obtain the qualified rate of the products manufactured by the injection molds within a preset time period. Assuming that the qualified rate is lower than a certain preset value, that is, the second preset value, it means that the injection mold may have defects, so it is necessary to screen out these molds as the injection molds to be tested for subsequent defect detection.

[0076] S20, matching the defect image with a preset knowledge graph, inputting the matching result into a multinomial naive Bayes classifier, and generating a first analysis result.

[0077] In this step, first load the preset knowledge graph, which is usually a database containing multiple categories and attributes, used to represent entities and their relationships. The preset knowledge graph here mainly contains the names, characteristics, shapes and other information of various defect types related to injection molds, which can be presented in the form of text or image data. By matching the defect image with the preset knowledge graph, the corresponding matching result can be obtained first in order to identify the defect type.

[0078] In a specific embodiment, the matching result is input into a multinomial naive Bayes classifier to generate a first analysis result, including:

[0079] 2.1) Identify all candidate defect types in the matching results, and vectorize the data of all candidate defect types to obtain the first feature vector;

[0080] The matching results include multiple candidate defect types obtained by matching with the knowledge graph. In order to further distinguish them through the multinomial naive Bayes classifier, the data of all candidate defect types are first vectorized to obtain the first feature vector.

[0081] For example, a feature extraction algorithm is used to extract relevant features from defect types, convert them into numerical data, and then the relevant features converted into numerical data are converted into vector form using a feature encoding method to obtain a feature vector; then the encoded feature vectors are combined into a first feature vector in a certain order. In this way, multiple candidate defect types can be converted into vectors with fixed dimensions for subsequent classifier processing operations.

[0082] 2.2) Vectorize the data of all defect types stored in the local database to obtain a second feature vector. Similarly, here, the data of all defect types stored in the local database can be vectorized in the same manner as in step 2.1) to obtain a second feature vector.

[0083] 2.3) Calculate the posterior probability of each candidate defect type based on the first eigenvector and the second eigenvector, and take the candidate defect type with the largest posterior probability as the first analysis result.

[0084] Among them, the expression for calculating the posterior probability is:

[0085]

[0086] In the formula, X represents the first eigenvector, C represents the second eigenvector, P(C|X) represents the posterior probability that the defect type belongs to the candidate defect type under the condition that the defect type belongs to all defect types stored in the local database, P(X) represents the prior probability that the defect type belongs to the current candidate defect type independently, P(C) represents the prior probability that the defect type belongs to all defect types stored in the local database independently, and P(X|C) represents the prior probability that the defect type belongs to all defect types stored in the local database under the condition that the defect type belongs to the candidate defect type.

[0087] Finally, after calculating the value of P(C|X), the candidate defect type with the largest P(C|X) is taken as the first analysis result.

[0088] This embodiment uses a multinomial naive Bayes classifier to calculate the posterior probability. Given all defect types in a database, it can calculate the posterior probability that the identified defect type occurs for each candidate defect type obtained by knowledge graph matching. Then, by comparing these posterior probabilities, the candidate defect type with the highest posterior probability is selected as the first analysis result. In this way, the possibility of a specific defect type can be evaluated based on probability, thereby providing more accurate analysis data for subsequent combined model prediction.

[0089] S30, inputting the defect image into a defect recognition model obtained based on neural network training, and outputting a second analysis result.

[0090] In one embodiment, before the defect image is input into the defect recognition model obtained by training based on the neural network, the defect recognition model is trained, which specifically includes the following steps:

[0091] 3.1) Obtain several surface image samples of multiple injection molds, and input them into the first defect detection network and the second defect detection network respectively to generate a first defect distribution probability and a second defect distribution probability; the first defect detection network and the second defect detection network are base learners with different model architectures.

[0092] For example, in a manufacturing plant, workers are using injection molds and thermoforming technology to manufacture parts. Therefore, several surface image samples can be collected from the initial injection mold process to form a set of continuous image sequences. The process usually includes multiple injection molds, and one injection mold usually corresponds to multiple surface image samples.

[0093] Furthermore, several surface image samples are input into the first defect detection network and the second defect detection network respectively, and the defects on the mold surface are detected by visualizing the probability distribution of mold defects, which can help to better understand the performance of the mold, find out the defect type (the mold may have cracks, scratches or other forms of defects), the cause of the defect and formulate solutions.

[0094] It is understandable that extracting a large number of comprehensive injection mold surface image samples will be relatively time-consuming, and the defect types included are usually limited. For example, in assembly line manufacturing, the qualified rate of most injection molds to generate products can meet the standards, so the number of defective injection molds that appear at this time will be small, and the defect types are also relatively limited. To this end, in a preferred embodiment, in order to obtain more comprehensive training image samples containing various defect types, in addition to extracting several surface image samples of multiple injection molds as training samples, defect samples can also be constructed based on normal surface images of injection molds in the database. For example, 100 normal images are screened out, and then these 100 images are used to construct defect samples. Finally, the constructed samples and the obtained several surface image samples of multiple injection molds are used as training samples and input into the defect detection network for identification. This can improve the efficiency of constructing samples and ensure that the trained models can identify more comprehensive defect types.

[0095] Specifically, several surface image samples are input into the first defect detection network to generate a first defect distribution probability, in which different colors represent different quality levels of the mold surface. For example, assume that the size of the mold training image sample is 200x200 pixels. After being processed by the first defect detection network, a probability distribution map of the same size is obtained, that is, a 200x200 matrix. The value of each cell (corresponding to a pixel or pixel area in the original image) represents the probability of a defect at the pixel. For example, if the value of a cell is 0.8 and the defect label is crack, it means that there is an 80% probability that a crack exists at this location; if the value of another cell is 0.1 and the defect label is scratch, it means that there is a 10% probability that a scratch exists at this location. The first defect probability distribution can help understand the overall quality status of the mold and identify areas where there may be problems. It can also provide a basis for cleaning training data and updating network weights.

[0096] The second defect detection network and the first defect detection network are base learners of different model architectures. For example, the first defect detection network can adopt a convolutional neural network, and the second defect detection network can adopt a residual network. Thus, the second defect probability distribution corresponding to the mold training image sample can be generated based on the second defect detection network.

[0097] 3.2) Perform image cleaning on the surface image sample according to the first defect distribution probability to obtain a first target sample; perform image cleaning on the surface image sample according to the second defect distribution probability to obtain a second target sample.

[0098] In this embodiment, the training image samples are cleaned according to the first defect probability distribution or the second defect probability distribution. The main purpose is to remove noise and irrelevant information, so that the training image samples are more accurate and efficient. For example, a threshold of 0.5 can be set, and then in each mold training image, the areas with defect probabilities higher than this threshold are retained, and the areas below this threshold are regarded as defect-free or noise-free and are cleared or ignored. In this way, a new cleaned image set containing only high-probability defect areas can be obtained, namely the first target sample. Similarly, the above steps are repeated and the second target sample can be obtained by cleaning using the second defect probability distribution. Both of these cleaned image sequences contain a large amount of high-probability defect information, which are used as new training data to update the weight parameters of the deep learning model, thereby improving the detection accuracy of the model.

[0099] 3.3) Using the second target sample to update the network weights of the first defect detection network, using the first target sample to update the network weights of the second defect detection network, and generating a defect recognition model based on the updated first defect detection network and the second defect detection network.

[0100] Therefore, based on the above steps, this embodiment first obtains several surface image samples of multiple injection molds, and then loads them into two different defect detection networks respectively to generate a first defect distribution probability and a second defect distribution probability, which can ensure that defect detection is performed from different angles and methods, thereby increasing the comprehensiveness and accuracy of the detection. Then, this embodiment will clean the training image samples according to the defect distribution probability and generate a credible training image sequence as the target sample, which can effectively remove noise and irrelevant information and improve the network learning effect. Finally, this embodiment uses the defect distribution probability to update the weight information of the two defect detection networks, and performs defect detection on the defect image of the injection mold to be tested based on the updated defect detection network, thereby greatly improving the accuracy and stability of mold defect detection.

[0101] S40: Generate a target defect recognition result according to the first analysis result and the second analysis result.

[0102] Specifically, this step includes the following sub-steps:

[0103] 4.1) Filter out the defect types that appear most frequently in the first analysis result and the second analysis result respectively to obtain the first defect type and the second defect type;

[0104] 4.2) performing similarity matching on the first defect type and the second defect type, and generating a target defect recognition result when it is determined that the similarity is greater than a first preset value.

[0105] This embodiment combines the first analysis result and the second analysis result to first screen out the defect types with the highest frequency, and finally matches the defect types by similarity. When the similarity meets the requirements, the final target defect recognition result is obtained.

[0106] In summary, the embodiment of the present invention obtains the surface image of the injection mold to be tested, performs image segmentation on the surface image, locates the defect area and generates a defect image; matches the defect image with the preset knowledge graph, inputs the matching result into the polynomial naive Bayes classifier, and generates a first analysis result; the knowledge graph and the polynomial naive Bayes classifier can accurately and effectively analyze the type of defect to be determined, and then inputs the defect image into the defect recognition model obtained based on neural network training, and outputs the second analysis result; the defect recognition model is obtained based on a large number of data samples and combined with different defect detection network training, and the training samples with high credibility are confirmed through the cleaned images, and the final defect recognition model is obtained by updating the weighted defect detection network, thereby ensuring the accuracy of the second analysis result. Finally, the target defect recognition result is generated based on the first analysis result and the second analysis result. Compared with the use of a single detection model, the present invention can overcome the disadvantage of low model recognition accuracy caused by the limitation of training samples. It combines the knowledge graph with the polynomial naive Bayes classifier and the trained defect recognition model to comprehensively identify the defect type. Through multi-angle and multi-model analysis, the defect detection accuracy can be greatly improved.

[0107] See also Figure 2 In one embodiment, the present invention further provides an injection mold surface defect detection system, the system comprising:

[0108] An image segmentation unit 100 is used to obtain a surface image of the injection mold to be tested, perform image segmentation on the surface image, locate the defect area and generate a defect image;

[0109] An image matching unit 200 is used to match the defect image with a preset knowledge graph, input the matching result into a multinomial naive Bayes classifier, and generate a first analysis result;

[0110] An image recognition unit 300 is used to input the defect image into a defect recognition model obtained based on neural network training, and output a second analysis result;

[0111] The target defect recognition unit 400 is used to generate a target defect recognition result according to the first analysis result and the second analysis result.

[0112] In some embodiments, the image matching unit 200 is further configured to:

[0113] Identify all candidate defect types in the matching results, vectorize the data of all candidate defect types, and obtain a first feature vector;

[0114] Vectorize the data of all defect types stored in the local database to obtain a second feature vector;

[0115] The posterior probability of each candidate defect type is calculated according to the first eigenvector and the second eigenvector, and the candidate defect type with the largest posterior probability is taken as the first analysis result.

[0116] It can be understood that the functions or modules included in the system provided in this embodiment can be used to execute the method described in the above method embodiment. Its specific implementation can refer to the description of the above method embodiment. For the sake of brevity, it will not be repeated here.

[0117] The present invention also provides an electronic device, comprising: a processor, a sending device, an input device, an output device and a memory, wherein the memory is used to store computer program code, and the computer program code includes computer instructions. When the processor executes the computer instructions, the electronic device executes a method as described in any possible implementation manner.

[0118] The present invention also provides a computer-readable storage medium, in which a computer program is stored. The computer program includes program instructions. When the program instructions are executed by a processor of an electronic device, the processor executes a method as described in any possible implementation manner.

[0119] See also Figure 3 , Figure 3 A schematic diagram of the hardware structure of an electronic device provided by an embodiment of the present invention.

[0120] The electronic device 2 includes a processor 21, a memory 22, an input device 23, and an output device 24. The processor 21, the memory 22, the input device 23, and the output device 24 are coupled via a connector, and the connector includes various interfaces, transmission lines, or buses, etc., which are not limited in the embodiments of the present invention. It should be understood that in various embodiments of the present invention, coupling refers to mutual connection in a specific manner, including direct connection or indirect connection through other devices, for example, through various interfaces, transmission lines, buses, etc.

[0121] The processor 21 may be one or more graphics processing units (GPUs). When the processor 21 is a GPU, the GPU may be a single-core GPU or a multi-core GPU. Optionally, the processor 21 may be a processor group consisting of multiple GPUs, and the multiple processors are coupled to each other via one or more buses. Optionally, the processor may also be other types of processors, etc., which are not limited in the embodiments of the present invention.

[0122] The memory 22 can be used to store computer program instructions and various computer program codes including program codes for executing the scheme of the present invention. Optionally, the memory includes but is not limited to random access memory (RAM), read-only memory (ROM), erasable programmable read only memory (EPROM), or portable read only memory (CD-ROM), which is used for related instructions and data.

[0123] The input device 23 is used to input data and / or signals, and the output device 24 is used to output data and / or signals. The input device 23 and the output device 24 can be independent devices or an integrated device.

[0124] It is understandable that in the embodiment of the present invention, the memory 22 is not only used to store related instructions, and the embodiment of the present invention does not limit the specific data stored in the memory.

[0125] Understandably, Figure 3 Only a simplified design of an electronic device is shown. In practical applications, the electronic device may also include other necessary components, including but not limited to any number of input / output devices, processors, memories, etc., and all video analysis devices that can implement the embodiments of the present invention are within the protection scope of the present invention.

[0126] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0127] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. Those skilled in the art can also clearly understand that the descriptions of the various embodiments of the present invention have different focuses. For the convenience and brevity of description, the same or similar parts may not be repeated in different embodiments. Therefore, for parts not described or not described in detail in a certain embodiment, refer to the records of other embodiments.

[0128] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0129] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0130] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0131] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted through the computer-readable storage medium. The computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a digital versatile disc (DVD)), or a semiconductor medium (eg, a solid state disk (SSD)).

[0132] A person skilled in the art can understand that to implement all or part of the processes in the above-mentioned embodiments, the processes can be completed by a computer program to instruct the relevant hardware, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the above-mentioned method embodiments. The aforementioned storage medium includes: a read-only memory (ROM) or a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.

Claims

1. A method for detecting surface defects of an injection mold, characterized in that: The method comprises: Acquire a surface image of the injection mold to be tested, perform image segmentation on the surface image, locate the defect area and generate a defect image, including converting the surface image into a prediction mask, binarizing the prediction mask to obtain a defect contour; extract a closed rectangular area from the defect contour, and crop the closed rectangular area to obtain a defect image; Matching the defect image with a preset knowledge graph, inputting the matching result into a multinomial naive Bayes classifier, and generating a first analysis result; The step of inputting the matching result into a multinomial naive Bayes classifier to generate a first analysis result includes: Identify all candidate defect types in the matching results, vectorize the data of all candidate defect types, and obtain a first feature vector; Vectorize the data of all defect types stored in the local database to obtain a second feature vector; Calculate the posterior probability of each candidate defect type according to the first eigenvector and the second eigenvector, and take the candidate defect type with the largest posterior probability as the first analysis result; Inputting the defect image into a defect recognition model obtained by neural network training, and outputting a second analysis result; According to the first analysis result and the second analysis result, a target defect recognition result is generated, including: The defect types that appear most frequently in the first analysis result and the second analysis result are respectively screened out to obtain the first defect type and the second defect type; The first defect type and the second defect type are matched for similarity, and when it is determined that the similarity is greater than a first preset value, a target defect recognition result is generated.

2. The method for detecting surface defects of injection molds according to claim 1, characterized in that: The step of binarizing the predicted mask to obtain a defect contour includes: Divide the image into multiple windows, set a preset amplitude for ending iteration, select a window as the target window, and set the grayscale threshold to the average of the maximum grayscale value and the minimum grayscale value in the target window; The pixels in the target window are divided into two categories according to the grayscale threshold. The first category is the background area with pixel values ​​less than the grayscale threshold, and the second category is the foreground area with pixel values ​​greater than the grayscale threshold. Calculate the magnitude of the change based on the background area and the foreground area: In the formula, is the average grayscale value of the background area, is the grayscale average value of the foreground area, G is the grayscale threshold, and s is the change amplitude; Determine whether the change range is greater than the preset range; if so, As the new grayscale threshold, and process the remaining windows; if not, As the local threshold of the target window, and process the remaining windows.

3. The method for detecting surface defects of injection molds according to claim 1, characterized in that: The method also includes training a defect recognition model, including: Acquire a plurality of surface image samples of a plurality of injection molds, and input them into a first defect detection network and a second defect detection network respectively to generate a first defect distribution probability and a second defect distribution probability; the first defect detection network and the second defect detection network are base learners of different model architectures; Performing image cleaning on the surface image sample according to the first defect distribution probability to obtain a first target sample; performing image cleaning on the surface image sample according to the second defect distribution probability to obtain a second target sample; The network weights of the first defect detection network are updated using the second target sample, and the network weights of the second defect detection network are updated using the first target sample. A defect recognition model is generated according to the updated first defect detection network and the second defect detection network.

4. The method for detecting surface defects of injection molds according to claim 1, characterized in that: Before obtaining the surface image of the injection mold to be tested, the method further includes: The qualified rate of products manufactured by the injection mold within a preset time period is obtained, and the injection mold corresponding to the qualified rate lower than the second preset value is used as the injection mold to be tested.

5. An injection mold surface defect detection system, characterized in that: The system comprises: An image segmentation unit is used to obtain a surface image of the injection mold to be tested, perform image segmentation on the surface image, locate the defect area and generate a defect image, including converting the surface image into a prediction mask, binarizing the prediction mask to obtain a defect contour; extracting a closed rectangular area from the defect contour, and cropping the closed rectangular area to obtain a defect image; An image matching unit, used for matching the defect image with a preset knowledge graph, inputting the matching result into a polynomial naive Bayes classifier, and generating a first analysis result; The step of inputting the matching result into a multinomial naive Bayes classifier to generate a first analysis result includes: Identify all candidate defect types in the matching results, vectorize the data of all candidate defect types, and obtain a first feature vector; Vectorize the data of all defect types stored in the local database to obtain a second feature vector; Calculate the posterior probability of each candidate defect type according to the first eigenvector and the second eigenvector, and take the candidate defect type with the largest posterior probability as the first analysis result; An image recognition unit, used for inputting the defect image into a defect recognition model obtained by neural network training, and outputting a second analysis result; The target defect recognition unit is used to generate a target defect recognition result according to the first analysis result and the second analysis result, including: The defect types that appear most frequently in the first analysis result and the second analysis result are respectively screened out to obtain the first defect type and the second defect type; The first defect type and the second defect type are matched for similarity, and when it is determined that the similarity is greater than a first preset value, a target defect recognition result is generated.

6. An electronic device, characterized in that: include: A processor and a memory, wherein the memory is used to store computer program codes, wherein the computer program codes include computer instructions, and when the processor executes the computer instructions, the electronic device executes the injection mold surface defect detection method according to any one of claims 1 to 4.

7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which includes program instructions. When the program instructions are executed by a processor of an electronic device, the processor executes the injection mold surface defect detection method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • A concrete surface defect image recognition system and method based on artificial intelligence

    CN109949289A

  • Device suitable for flaw detection of steel wire braided tube and detection method

    CN116228769A

  • Thermal forming mold detection method and system based on artificial intelligence

    CN117557503A