CN114202544B - Complex workpiece defect detection method based on self-encoder - Google Patents
Complex workpiece defect detection method based on self-encoder Download PDFInfo
- Publication number
- CN114202544B CN114202544B CN202210156908.6A CN202210156908A CN114202544B CN 114202544 B CN114202544 B CN 114202544B CN 202210156908 A CN202210156908 A CN 202210156908A CN 114202544 B CN114202544 B CN 114202544B
- Authority
- CN
- China
- Prior art keywords
- picture
- similarity
- detected
- scale
- difference
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/0002—Inspection of images, e.g. flaw detection
- G06T7/0004—Industrial image inspection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/22—Matching criteria, e.g. proximity measures
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02P—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
- Y02P90/00—Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
- Y02P90/30—Computing systems specially adapted for manufacturing
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Data Mining & Analysis (AREA)
- General Physics & Mathematics (AREA)
- Physics & Mathematics (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Evolutionary Biology (AREA)
- Evolutionary Computation (AREA)
- Bioinformatics & Computational Biology (AREA)
- General Engineering & Computer Science (AREA)
- Artificial Intelligence (AREA)
- Life Sciences & Earth Sciences (AREA)
- Quality & Reliability (AREA)
- Image Analysis (AREA)
- Investigating Materials By The Use Of Optical Means Adapted For Particular Applications (AREA)
Abstract
The invention relates to the technical field of defect detection, in particular to a complex workpiece defect detection method based on a self-encoder, which comprises the following steps: training a model, calculating the similarity or difference of each segmentation region, and confirming the threshold value of each scale according to the similarity or difference; obtaining a to-be-reconstructed image corresponding to the to-be-detected image according to the to-be-detected image based on the self-encoder reconstructed model; dividing the picture to be detected and the reconstructed picture to be detected in an S4 dividing mode, and calculating the similarity or difference of each divided region; and judging the to-be-detected segmented regions one by one according to the similarity or difference threshold value of each scale, marking the to-be-detected picture block reaching the similarity or difference threshold value as a picture block containing defects, and marking the workpiece as a defective product. The invention has simple logic and needs no other extra information. The defect detection method and device can be suitable for the defect detection of different scales under the complex background, and the problem that the defect detection of complex workpieces cannot be accurately carried out in the prior art is solved.
Description
Technical Field
The invention relates to the technical field of defect detection, in particular to a complex workpiece defect detection method based on an auto-encoder.
Background
In the production of industrial products, workpieces containing defects are often produced, subject to process level. Currently, this part of the defect is usually detected in a manual visual manner. In the process, the missing detection and the over-detection caused by the fatigue of detection workers, the non-uniform standard and the like are inevitable, and the qualification rate of the product is greatly influenced. In order to quickly and efficiently find out defects of such workpieces, optical Automatic Inspection by deploying an AOI (Automatic optical Inspection) apparatus on a production line is required. Due to the fact that the workpiece is complex in shape and poor in consistency of all parts, the defect detection requirement under the scene is difficult to meet through a traditional image algorithm.
In recent years, with the development of deep learning, deep neural networks have been increasingly researched and applied as a model capable of automatically extracting features and outputting results end to end. In the field of defect detection of industrial images, conventional deep learning defect detection methods generally employ supervised models. The training process requires a large number of defective and non-defective samples to be obtained for training. In practical application, due to the reasons that the defect sample acquisition cost is high, the defect type morphology changes greatly, and the defect-free samples account for the majority, it is generally difficult to realize a high-quality defect detection effect by using a supervised model. When the defect form which does not appear in the training process appears in the actual detection, the model can not correctly identify the defect form, so that the missing detection phenomenon of the final product is caused. Therefore, the use of unsupervised deep neural networks for anomaly detection is a conventional option for industrial defect detection.
The current technical routes for industrial defect detection by using an unsupervised network are generally 3:
by learning the defect-free image, a model capable of obtaining a reconstructed input image is generated. The model can output a defect-free image (hereinafter referred to as a "reconstructed image") similar to the input image when the defect image is input. And differentiating the reconstructed image and the input image to obtain a differential image. Extracting a more accurate defect region from the difference image by using a traditional image algorithm;
by learning the non-defective image, the input defective image is obtained to reconstruct a non-defective image (hereinafter referred to as "reconstructed image") similar to the input image. Directly comparing the reconstructed image with the input image through SSIM to obtain a similarity score, and considering that the image has defects when the similarity score is lower than a set threshold;
and extracting a feature set of the non-defective image by using an existing feature extractor, and acquiring the clustering center of the feature set. And after the same features of the defective image are extracted, calculating the distance between the features and the clustering center of the non-defective image feature set, and if the distance is greater than a set threshold value, judging that the image has defects.
The first mode and the second mode can only deal with the conditions that the defect particles are large and the image consistency is high; while the third approach, while applicable to smaller defect particles, requires a higher image uniformity. For complex workpieces, the image has the following characteristics: firstly, the production consistency is weak, and the images of all workpieces cannot be accurately aligned; second, the defect size is usually small or not apparent; there are a large number of edge areas. Therefore, the three methods cannot be used for accurately detecting the defects of the industrial products.
In order to effectively detect complex workpieces, the requirement for image consistency must be reduced and detected on a small scale, thereby reducing the false-detection rate of defects while maintaining the false-detection rate. We propose a method for detecting defects of complex workpieces based on an auto-encoder.
Disclosure of Invention
Based on the technical problems in the background art, the invention provides a complex workpiece defect detection method based on an auto-encoder, which has the advantages of simple implementation logic and no need of other additional information. The need for image consistency may be slightly reduced compared to other schemes. The defect detection method and device can be suitable for the defect detection of different scales under the complex background, and the problem that the defect detection of complex workpieces cannot be accurately carried out in the prior art is solved.
The invention provides the following technical scheme: a method for detecting defects of complex workpieces based on an auto-encoder,
s1, acquiring a sample picture set which comprises a defect-free core body image of the workpiece as a sample;
s2, training the self-encoder according to the sample picture set to obtain a self-encoder reconstruction model;
s3, generating a reconstructed picture set according to the sample picture set and the self-encoder reconstruction model, and establishing a mapping relation between each reconstructed picture and the sample picture;
s4, each pair of reconstructed pictures and the sample picture are segmented at different scales in the same mode;
the minimum dimension of the segmentation is not more than 4 times of the short side of the minimum defect, and each image block after the segmentation is recorded asWhereinThe dimensions are represented by a scale of,representing the row and column coordinates thereof;
s5, after segmentation, calculating the similarity or difference of each segmentation region, and confirming the threshold value of each scale according to the similarity or difference, wherein the threshold value of each scale is the lowest similarity or the largest difference of the scale in all the image pairs;
when the similarity threshold is selected, the lowest similarity of each scale in the image pair isThe threshold value of each scale is the lowest similarity of the scale in all the picture pairsThe similarity calculation adopts an SSIM calculation formula;
when the difference threshold is selected, the maximum difference of each scale in the image pair isThe threshold value of each scale is the maximum difference degree of the scale in all the picture pairsThe difference degree is calculated by an Euclidean distance algorithm;
s6, obtaining a to-be-reconstructed image corresponding to the to-be-detected image according to the to-be-detected image based on the self-encoder reconstructed model;
s7, dividing the picture to be detected and the reconstructed picture to be detected in the S4 dividing mode, and calculating the similarity or difference of each divided region;
and S8, judging the to-be-detected segmentation areas in the step S7 one by one according to the similarity or difference threshold of each scale, marking the to-be-detected picture blocks reaching the similarity or difference threshold as picture blocks containing defects, and marking the workpiece as a defective product.
Preferably, the steps S1-S5 are a training process, the steps S6-S8 are an inference process, and after one training is completed, the steps S6-S8 are repeated to infer the picture to be detected.
The invention provides a complex workpiece defect detection method based on a self-encoder, which is characterized in that a reconstructed image is generated by means of a self-encoder network, similarity evaluation is carried out on the reconstructed image and an input image block by block under different scales, and results under different scales are fused to obtain a final detection result. Compared with the existing method, the method is mainly characterized in that the similarity/difference comparison is carried out on the small image blocks split one by one of the input image and the reconstructed image in a multi-scale mode, and the small image blocks are fused to obtain the detection result. By means of block evaluation, regional differences of the original image and the reconstructed image on different scales can be easily compared, and defect positions can be approximately found. This approach may also slightly reduce the image consistency requirements.
Drawings
FIG. 1 is a schematic diagram of a picture segmentation according to the present invention;
FIG. 2 is a flow chart of an embodiment of the present invention;
FIG. 3 is a defect sample diagram according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The invention provides a technical scheme that: a method for detecting defects of complex workpieces based on an auto-encoder,
s1, acquiring sample picture setThe picture set comprises a defect-free core image of a complex workpiece at each position, and the size of each picture needs to be largeTo be consistent;
s2, training the self-encoder according to the sample picture set to obtain a self-encoder reconstruction model;
s3, generating a reconstructed picture set according to the sample picture set and the self-encoder reconstruction modelAnd creating each reconstructed pictureAnd sample pictureThe mapping relationship of (c);
s4, each pair of reconstructed pictures is segmented at different scales in the same way as the sample picture. The scale and segmentation used here are shown in fig. 1. The minimum dimension of the segmentation is not more than 4 times of the short side of the minimum defect, and each image block after the segmentation is recorded asWhereinThe dimensions are represented by a scale of,representing the row and column coordinates thereof;
s5, calculating the similarity or difference of each divided area after divisionDetermining the threshold value of each scale according to the above, wherein the threshold value of each scale is the lowest similarity or the maximum difference of the scale in all the image pairs;
when the similarity threshold is selected, the lowest similarity of each scale in the image pair isThe threshold value of each scale isLowest similarity of the scale among all the pairsThe similarity calculation adopts an SSIM calculation formula;
when the difference threshold is selected, the maximum difference of each scale in the image pair isThe threshold value of each scale is the maximum difference degree of the scale in all the picture pairsThe difference degree is calculated by an Euclidean distance algorithm;
s6, based on the reconstructed model of the self-encoder, according to the picture to be detectedTo obtain the corresponding to-be-detected reconstructed picture of the to-be-detected picture;
S7, dividing the picture to be detected and the reconstructed picture to be detected by the dividing mode of S4, and calculating the similarity or difference of each divided region;
S8, according to the similarity or difference threshold value of each scaleAnd judging the to-be-detected divided areas in the step S7 one by one, marking the to-be-detected picture block reaching the similarity or difference threshold as a picture block containing the defect, and marking the workpiece as a defective product.
Steps S1-S5 are training procedures, and steps S6-S8 are reasoning procedures. After finishing one training, the steps S6-S8 can be repeated to reason about the picture to be detected, and determine whether the picture is a defective product.
Example (b):
a flow chart as shown in fig. 2, and an example of a defect pattern in the scene as shown in fig. 3. The following is a detailed description of the steps:
in step 401, all picture samples without defects are obtained, and a sample picture set is obtained;
in step 402, training an autoencoder network using a sample picture set to obtain a reconstructed model;
in step 403, acquiring reconstructed pictures of all sample pictures in step 401 based on the self-encoder reconstruction model;
in step 404, the sample picture and the reconstructed picture are partitioned at different scales in the manner of fig. 1;
in step 405, the similarity/difference between the sample picture block and the reconstructed picture block at each scale is calculated. When the similarity is selected, the minimum value of the similarity under each scale is selected as a threshold value; when the difference is selected, the maximum value of the difference under each scale is selected as a threshold value;
in step 406, acquiring a reconstructed picture of the picture to be detected based on the self-encoder reconstruction model;
in step 407, the picture to be detected and the reconstructed picture thereof are blocked at different scales in the manner of fig. 1;
in step 408, calculating the similarity/difference between the picture block to be detected and the reconstructed picture block thereof at each scale;
in step 409, according to the threshold values of the scales obtained in step 405, it is determined whether the similarity/difference of the picture blocks in step 408 meets the defect determination condition, the picture block to be detected meeting the determination condition is marked as a picture block containing a defect, and the workpiece is marked as a defective product.
In the above steps, step 401 and 405 are training processes, and step 406 and 409 are reasoning processes. After completing the training, the steps 406 and 409 can be repeated to reason the picture to be detected, so as to determine whether the picture is a defective product.
The invention has simple logic and needs no other extra information. Compared with other schemes, the requirement of image consistency can be slightly reduced. The method can be suitable for detecting the defects with different scales under the complex background.
The above description is only for the preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art should be considered as the technical solutions and the inventive concepts of the present invention within the technical scope of the present invention.
Claims (2)
1. A method for detecting defects of a complex workpiece based on a self-encoder is characterized by comprising the following steps: the method comprises the following steps:
s1, acquiring a sample picture set which comprises a defect-free core body image of the workpiece as a sample;
s2, training the self-encoder according to the sample picture set to obtain a self-encoder reconstruction model;
s3, generating a reconstructed picture set according to the sample picture set and the self-encoder reconstruction model, and establishing a mapping relation between each reconstructed picture and the sample picture;
s4, each pair of reconstructed pictures and the sample picture are segmented at different scales in the same mode;
the minimum dimension of the segmentation is not more than 4 times of the short side of the minimum defect, and each image block after the segmentation is recorded asWhereinThe dimensions are represented by a scale of,representing the row and column coordinates thereof;
s5, after segmentation, calculating the similarity or difference of each segmentation region, and confirming the threshold value of each scale according to the similarity or difference, wherein the threshold value of each scale is the lowest similarity or the largest difference of the scale in all the image pairs;
when selecting the similarity threshold, the image is centered on each rulerThe lowest degree of similarity isThe threshold value of each scale is the lowest similarity of the scale in all the picture pairsThe similarity calculation adopts an SSIM calculation formula;
when the difference threshold is selected, the maximum difference of each scale in the image pair isThe threshold value of each scale is the maximum difference degree of the scale in all the picture pairsThe difference degree is calculated by an Euclidean distance algorithm;
s6, obtaining a to-be-detected reconstructed picture corresponding to the to-be-detected picture according to the to-be-detected picture based on the self-encoder reconstructed model;
s7, segmenting the picture to be detected and the reconstructed picture to be detected by the segmentation mode of S4, and calculating the similarity or difference of each segmentation region;
and S8, judging the to-be-detected segmentation areas in the step S7 one by one according to the similarity or difference threshold value of each scale, marking the picture blocks to be detected reaching the similarity or difference threshold value as picture blocks containing defects, and marking the workpiece as a defective product.
2. The method for detecting the defects of the complex workpiece based on the self-encoder as claimed in claim 1, wherein: the steps S1-S5 are training processes, the steps S6-S8 are reasoning processes, and after one training, the steps S6-S8 are repeated to reason the picture to be detected.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210156908.6A CN114202544B (en) | 2022-02-21 | 2022-02-21 | Complex workpiece defect detection method based on self-encoder |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210156908.6A CN114202544B (en) | 2022-02-21 | 2022-02-21 | Complex workpiece defect detection method based on self-encoder |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114202544A CN114202544A (en) | 2022-03-18 |
CN114202544B true CN114202544B (en) | 2022-07-05 |
Family
ID=80645740
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210156908.6A Active CN114202544B (en) | 2022-02-21 | 2022-02-21 | Complex workpiece defect detection method based on self-encoder |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114202544B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115170890B (en) * | 2022-07-28 | 2023-03-14 | 哈尔滨市科佳通用机电股份有限公司 | Method for identifying breakage fault of connecting pull rod chain of railway wagon |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113256602A (en) * | 2021-06-10 | 2021-08-13 | 中科云尚(南京)智能技术有限公司 | Unsupervised fan blade defect detection method and system based on self-encoder |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP6043662B2 (en) * | 2013-03-18 | 2016-12-14 | 株式会社ニューフレアテクノロジー | Inspection method and inspection apparatus |
-
2022
- 2022-02-21 CN CN202210156908.6A patent/CN114202544B/en active Active
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113256602A (en) * | 2021-06-10 | 2021-08-13 | 中科云尚(南京)智能技术有限公司 | Unsupervised fan blade defect detection method and system based on self-encoder |
Non-Patent Citations (1)
Title |
---|
深度学习在钢板表面缺陷与字符识别中的应用;贺笛;《中国优秀博硕士学位论文全文数据库(博士)工程科技I辑》;20210215;第74-91页 * |
Also Published As
Publication number | Publication date |
---|---|
CN114202544A (en) | 2022-03-18 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP6879431B2 (en) | Image processing equipment, image processing method and image processing program | |
CN109191459B (en) | Automatic identification and rating method for continuous casting billet macrostructure center segregation defect | |
CN108961217B (en) | Surface defect detection method based on regular training | |
CN114549522B (en) | Textile quality detection method based on target detection | |
CN107833220B (en) | Fabric defect detection method based on deep convolutional neural network and visual saliency | |
CN106650770B (en) | Mura defect detection method based on sample learning and human eye visual characteristics | |
CN105334219B (en) | A kind of bottle mouth defect detection method of residual analysis dynamic threshold segmentation | |
WO2021143343A1 (en) | Method and device for testing product quality | |
CN114757900B (en) | Artificial intelligence-based textile defect type identification method | |
CN115082683A (en) | Injection molding defect detection method based on image processing | |
CN115345885A (en) | Method for detecting appearance quality of metal fitness equipment | |
KR20190063839A (en) | Method and System for Machine Vision based Quality Inspection using Deep Learning in Manufacturing Process | |
CN115880248B (en) | Surface scratch defect identification method and visual detection equipment | |
CN107240086B (en) | A kind of fabric defects detection method based on integral nomography | |
US12094098B2 (en) | Defect management apparatus, method and non-transitory computer readable medium | |
CN114266743B (en) | FPC defect detection method, system and storage medium based on HSV and CNN | |
CN114897908B (en) | Machine vision-based method and system for analyzing defects of selective laser powder spreading sintering surface | |
CN114612472A (en) | SegNet improvement-based leather defect segmentation network algorithm | |
CN115018790A (en) | Workpiece surface defect detection method based on anomaly detection | |
CN115631146A (en) | Image-based pantograph carbon slide strip defect detection method | |
CN114202544B (en) | Complex workpiece defect detection method based on self-encoder | |
CN117975175B (en) | Plastic pipeline appearance defect detection method based on machine vision | |
CN115222732B (en) | Injection molding process anomaly detection method based on big data analysis and color difference detection | |
Aydin et al. | A vision based inspection system using gaussian mixture model based interactive segmentation | |
Yu et al. | A Machine vision method for non-contact Tool Wear Inspection |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |