A kind of FPCB open defect automatic detection algorithm based on deep learningTechnical field
The present invention relates to deep learning and industrial automatic measurement technique field, specially a kind of FPCB based on deep learningOpen defect automatic detection algorithm.
Background technique
Flexible circuit board abbreviation FPCB, with light weight, thickness it is thin, can the excellent performances such as free bend by electronics industry bluenessLook at, the quality testing of domestic FPCB product relies primarily on artificial range estimation or traditional shortcoming detection algorithm, it is artificial estimate real-time it is poor,It is costly and inefficient, with unmanned intelligent and board design high-precision, the densification of field of industrial manufacturing, peopleWork visual inspection mode is gradually difficult to meet production requirement.
Traditional shortcoming detection generally carries out industry defects detection, key step with mode identification method are as follows: 1., image adoptsCollection: the original image containing product to be measured is collected based on a set of NI Vision Builder for Automated Inspection;2., image preprocessing: removal imageNoise carries out image segmentation to whole figure, obtains part component subgraph;3., image rectification registration: according to pre-processed results to everyIt opens part subgraph and carries out picture position calibration;4., feature extraction: based on algorithm for pattern recognition to step 3. in picture extract it is specialSign, obtains the textural characteristics figure of image;5., the textural characteristics figure of part to be detected carry out similarity mode;6., according to similarityMatched result output test result.
For flexible circuit panel products, the case where circuit board bending, deformation, is more universal in practical producing line, and it is fixed to be easy to causePosition and template matching inaccuracy, and then missing inspection and erroneous detection are formed, in addition, the diversity complexity of defect type is also to traditional algorithmLarger challenge is proposed, for this purpose, it is proposed that a kind of FPCB open defect automatic detection algorithm based on deep learning.
Summary of the invention
The purpose of the present invention is to provide a kind of FPCB open defect automatic detection algorithm based on deep learning, to solveThe problems mentioned above in the background art.
To achieve the above object, the invention provides the following technical scheme: a kind of FPCB open defect based on deep learningAutomatic detection algorithm, comprising the following steps:
A, in mating machine vision hardware system-based, defect sample color RGB image is acquired and according to part dimensionSample image is divided into a series of discrete component subgraph of fixed sizes;
B, sample image degree of comparing is enhanced before mark and laplacian spectral radius is to protrude defect characteristic;
C, the component defects sample image in step B is labeled using marking software;
D, structure improvement is carried out to fasterrcnn and is instructed on GPU or GPU server based on Detectron framePractice;
E, update and optimization training parameter, and false detection rate and omission factor of the statistical model on target verification collection, according to realityBorder demand comprehensive assessment false detection rate and omission factor obtain optimal models, and are detected using optimal models;
F, error detection sample is collected according to testing result and original model is added and is trained and double optimization, and specific excellentChange process is the same as step E;
G, 5 are repeated as needed several times, are obtained the final mask detected for FPCB appearance and are carried out with final maskDetection.
Preferably, the specific size of element subgraph is different because of component size and camera resolution in the step A, preferably1600*2200。
Preferably, the defect upper left corner and lower right corner pixel coordinate are mainly marked in the step C in a manner of rectangle frameAnd defect generic.
Preferably, main to improve are as follows: 1., using convolutional network Resnet series+feature pyramid knot in the step DStructure is as feature extraction network;2., training process using data enhance technology, be added according to sample size 1:1 flip horizontal,Flip vertical, 90 ° of rotations, 270 ° of rotations, translation, color jitter, luminance contrast adjustment totally 7 kinds of data enhancings;3., consider lackThe more extreme situation of sunken shape increases 2 kinds of length-width ratios newly on the basis of original anchor length-width ratio (1:2,1:1,2:1);4., will be formerThere is the common convolution of the 3*3 of rpn network to be improved to the cavity 3*3 convolution.
Preferably, in the step E, when being detected using optimal models, it is specific on picture that algorithm exports defectPosition and defect classification.
Compared with prior art, beneficial effects of the present invention are as follows:
The present invention highlights defect part to the enhancing of image degree of comparing and Edge contrast before mark, effectively reducesData mark difficulty, and carry out open defect detection to FPCB using the fasterrcnn algorithm in deep learning, from principleEvade the adverse effect of deformation and defect diversification to detection performance of flexible circuit board in conventional template matching detection technology,Meanwhile fasterrcnn algorithm is improved and optimized in conjunction with FPCB appearance detection practical application scene, improve defectPositive inspection rate and recall rate, compared to Manual Visual Inspection, the technical program is highly efficient, accuracy rate is higher, be substituted part repetitionMachinery labour is more conducive to promote the unmanned degree of production line automation, compared to tradition in the case where industry manufactures intelligent backgroundTemplate matching technique scheme or appearance detection scheme based on feature, the technical program adapt to flexible circuit board in deformation, curvedDetection in the defects of folding more complicated situation, and number of drawbacks can be identified simultaneously, the detection effect of defect is more excellentIt is different.
Specific embodiment
Below in conjunction with the embodiment of the present invention, technical solution in the embodiment of the present invention is clearly and completely retouchedIt states, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.Based on the present inventionIn embodiment, every other implementation obtained by those of ordinary skill in the art without making creative effortsExample, shall fall within the protection scope of the present invention.
A kind of FPCB open defect automatic detection algorithm based on deep learning, comprising the following steps:
A, in mating machine vision hardware system-based, defect sample color RGB image is acquired and according to part dimensionSample image is divided into a series of discrete component subgraph of fixed sizes;
B, sample image degree of comparing is enhanced before mark and laplacian spectral radius is to protrude defect characteristic, reduce peopleThe mistake mark and spill tag note of work annotation process;
C, the component defects sample image in step B is labeled using marking software;
D, structure improvement is carried out to fasterrcnn and is instructed on GPU or GPU server based on Detectron framePractice;
E, update and optimization training parameter, and false detection rate and omission factor of the statistical model on target verification collection, according to realityBorder demand comprehensive assessment false detection rate and omission factor obtain optimal models, and are detected using optimal models;
F, error detection sample is collected according to testing result and original model is added and is trained and double optimization, and specific excellentChange process is the same as step E;
G, 5 are repeated as needed several times, are obtained the final mask detected for FPCB appearance and are carried out with final maskDetection.
Defect part is highlighted to the enhancing of image degree of comparing and Edge contrast before mark, effectively reduces data markDifficulty is infused, and open defect detection is carried out to FPCB using the fasterrcnn algorithm in deep learning, is evaded from principleThe deformation and defect diversification of flexible circuit board be to the adverse effect of detection performance in conventional template matching detection technology, meanwhile,Fasterrcnn algorithm is improved and optimized in conjunction with FPCB appearance detection practical application scene, improves the positive inspection of defectRate and recall rate, compared to Manual Visual Inspection, the technical program is highly efficient, accuracy rate is higher, part is substituted repeats mechanical laborIt is dynamic, it is more conducive to promote the unmanned degree of production line automation in the case where industry manufactures intelligent background, compared to conventional templateAppearance detection scheme with technical solution or based on feature, the technical program adapt to flexible circuit board and lack in deformation, bending etc.The detection in more complicated situation is fallen into, and number of drawbacks can be identified simultaneously, the detection effect of defect is more excellent.
The specific size of element subgraph is different because of component size and camera resolution in step A, preferably 1600*2200.
It is mainly marked in a manner of rectangle frame belonging to the defect upper left corner and lower right corner pixel coordinate and defect in step CClassification.
It is main to improve are as follows: 1., using convolutional network Resnet series+feature pyramid structure as feature to mention in step DNetwork is taken, improves ratio of the low layer simple semantic information beneficial for defects detection in entire characteristic pattern, and reinforceEach layer of Fusion Features, improve the recall rate of small-sized defect (such as bright spot, dim spot);2., training process increased using dataStrong technology, be added according to sample size 1:1 flip horizontal, flip vertical, 90 ° of rotations, 270 ° of rotations, translation, color jitter,Luminance contrast adjustment totally 7 kinds of data enhancings, so that model in the case where defect sample limited amount, is efficiently utilized existingData improve algorithm Generalization Capability and the stability to unknown sample;3., consider the more extreme situation of defect shape, in originalHave and increase 2 kinds of length-width ratios on the basis of anchor length-width ratio (1:2,1:1,2:1) newly, enriches candidate frame form, improve long strip typeThe detection effect of defect;4., the common convolution of 3*3 of original rpn network is improved to the cavity 3*3 convolution, keep calculation amount not increaseThe receptive field that rpn network is improved in the case where adding improves the performance of model.
In step E, when being detected using optimal models, algorithm exports specific location and defect class of the defect on pictureNot.
In use, highlighting defect part to the enhancing of image degree of comparing and Edge contrast before mark, it is effectively reducedData mark difficulty, and using fasterrcnn algorithm in deep learning to FPCB progress open defect detection, from principleOn evaded the unfavorable shadow of deformation and defect diversification to detection performance of flexible circuit board in conventional template matching detection technologyIt rings, meanwhile, fasterrcnn algorithm is improved and optimized in conjunction with FPCB appearance detection practical application scene, is improved scarceSunken positive inspection rate and recall rate, compared to Manual Visual Inspection, the technical program is highly efficient, accuracy rate is higher, part weight is substitutedTool of answering a pager's call labour is more conducive to promote the unmanned degree of production line automation, compared to biography in the case where industry manufactures intelligent backgroundUnite template matching technique scheme or the appearance detection scheme based on feature, the technical program adapt to flexible circuit board deformation,Detection in the defects of bending more complicated situation, and number of drawbacks can be identified simultaneously, the detection effect of defect is moreIt is excellent.
It although an embodiment of the present invention has been shown and described, for the ordinary skill in the art, can be withA variety of variations, modification, replacement can be carried out to these embodiments without departing from the principles and spirit of the present invention by understandingAnd modification, the scope of the present invention is defined by the appended.