Character recognition and information analysis method for flexible IC substrate
Technical Field
The invention relates to the field of computer vision, in particular to a character recognition and information analysis method for a flexible IC substrate.
Background
Due to the requirement of the precision of the electronic product, all the procedures are buckled in a ring-to-ring manner in the production process of the product, and the quality of each procedure must be ensured. Characters on the flexible IC substrate identify important information such as types, capacity sizes, packaging types and the like of circuit elements such as capacitors, inductors, chips and the like, so that detection of the circuit elements is very important, however, a traditional character recognition algorithm is easily influenced by various factors, and generalization performance is poor.
Disclosure of Invention
The invention mainly aims to overcome the defects of the prior art and provide a character recognition and information analysis method for a flexible IC substrate.
The purpose of the invention is realized by the following technical scheme:
a character recognition and information analysis method for a flexible IC substrate comprises the following steps:
s1, the motion module drives the image acquisition system to move in a uniform speed mode, and meanwhile, the industrial personal computer controls the CCD camera to acquire color images of the flexible IC substrate placed on the adsorption platform;
s2, respectively inputting each collected frame image, and roughly positioning character areas by using the trained optical character positioning model to obtain 4 predicted values of the central position coordinates and the width and height offsets of the character areas in each image; the 4 predicted values are specifically: a row coordinate x, a column coordinate y, a row coordinate offset dx, and a column coordinate offset dy of the center position;
s3, cutting the character area from the original color image according to the 4 predicted values obtained by coarse positioning, and expanding the positioned area in proportion during cutting to prevent incomplete cutting of the character area caused by inaccurate coarse positioning;
s4, binarizing each character area image cut from the original color image, then analyzing a connected domain to find a contour meeting the length-width ratio of the character, and recording the top point of the contour;
s5, calibrating all the detected vertexes to the corresponding cut character area images, and performing straight line fitting to obtain accurate positioning of the upper and lower boundaries of the character area;
s6, counting the sum of pixel values of each row of each character area image, finding out a proper peak value point, and accurately positioning the left and right boundaries of the character area;
s7, inputting the finely positioned image into a convolution network for feature extraction, and outputting a feature map;
s8, dividing the characteristic graph into a series of image sequences, inputting the image sequences into a recurrent neural network based on a long-term and short-term memory unit to obtain a character prediction result sequence;
s9, decoding the character prediction result sequence to obtain a final character recognition result;
s10, comparing all the obtained final character recognition results with a standard file respectively, and judging whether the characters on the flexible IC substrate are printed correctly or not;
s11, dividing each character recognition result into a plurality of sub character strings according to the design rule of the character;
s12, comparing each sub-character string with the character strings in the template library, and identifying the information of the electronic element; the information of the electronic element comprises a type, a capacity size and a packaging type;
and S13, obtaining the final recognition result of the flexible IC substrate characters and the element key information analysis result.
In step S1, the CCD camera collects a color image of the flexible IC substrate placed on the adsorption platform in the following manner: the shooting range size and the shooting specific position of each frame of image are set in advance, and a shooting path is planned, so that circuit elements contained in each frame of shot image are the same.
In step S2, the optical character positioning model is trained by extracting Harr features of the image and using a cascade classifier based on the adaboost algorithm.
In step S4, the binarizing is performed on each text region image cut out from the original color image, specifically: the image is binarized for 15 consecutive times based on Otsu's method.
In step S5, the straight line fitting specifically includes: and adopting a random sampling consistency algorithm to perform linear fitting on the vertexes of the upper part and the lower part of the character area image.
In step S6, the suitable peak points are two peak points closest to the left and right boundaries.
In step S7, the step of inputting the finely positioned image into the convolutional network for feature extraction refers to processing the image using a network obtained by fine adjustment based on the vgg16 network.
In step S8, the image sequence is obtained by dividing the obtained text region image into image slices having the same width in the longitudinal direction, and the divided images are in a strip shape.
In step S9, the decoding of the character prediction result sequence means that redundant characters are recognized and deleted from the character string predicted by the recurrent neural network based on the long-short term memory unit, so as to obtain a prediction result.
In step S10, the incorrect printing of the characters on the flexible IC substrate includes missing characters, misprints, and multiple prints.
In step S12, the template library stores all the standard circuit component name strings, package type strings, and spacer information that may be used.
Compared with the prior art, the invention has the following advantages and beneficial effects:
the invention provides a method for detecting by using a deep learning cyclic neural network, which greatly improves the detection accuracy and the generalization capability of the algorithm and can also effectively analyze character strings to give key information of elements.
Drawings
Fig. 1 is a flowchart of a character recognition and information analysis method for a flexible IC substrate according to the present invention.
FIG. 2 is a flow chart of a random sample consensus algorithm.
Detailed Description
The present invention will be described in further detail with reference to examples and drawings, but the present invention is not limited thereto.
As shown in fig. 1 and 2, a character recognition and information analysis method for a flexible IC substrate includes the following steps:
s1, the motion module drives the image acquisition system to move in a uniform speed mode, and meanwhile, the industrial personal computer controls the CCD camera to acquire color images of the flexible IC substrate placed on the adsorption platform;
s2, respectively inputting each collected frame image, and roughly positioning character areas by using the trained optical character positioning model to obtain 4 predicted values of the central position coordinates and the width and height offsets of the character areas in each image;
s3, cutting the character area from the original color image according to the 4 predicted values obtained by coarse positioning, and expanding the positioned area in proportion during cutting to prevent incomplete cutting of the character area caused by inaccurate coarse positioning;
s4, binarizing each character area image cut from the original color image, then analyzing a connected domain to find a contour meeting the length-width ratio of the character, and recording the top point of the contour;
s5, calibrating all the detected vertexes to the corresponding cut character area images, and performing straight line fitting to obtain accurate positioning of the upper and lower boundaries of the character area;
s6, counting the sum of pixel values of each row of each character area image, finding out a proper peak value point, and accurately positioning the left and right boundaries of the character area;
s7, inputting the finely positioned image into a convolution network for feature extraction, and outputting a feature map;
s8, dividing the characteristic graph into a series of image sequences, inputting the image sequences into a recurrent neural network based on a long-term and short-term memory unit to obtain a character prediction result sequence;
s9, decoding the character prediction result sequence to obtain a final character recognition result;
s10, comparing all the obtained final character recognition results with a standard file respectively, and judging whether the characters on the flexible IC substrate are printed correctly or not;
s11, dividing each character recognition result into a plurality of sub character strings according to the design rule of the character;
s12, comparing each sub-character string with the character strings in the template library, and identifying the information of the electronic element; the information of the electronic element comprises a type, a capacity size and a packaging type;
and S13, obtaining the final recognition result of the flexible IC substrate characters and the element key information analysis result.
In step S1, the CCD camera collects a color image of the flexible IC substrate placed on the adsorption platform in the following manner: the shooting range size and the shooting specific position of each frame of image are set in advance, and a shooting path is planned, so that circuit elements contained in each frame of shot image are the same.
In step S2, the optical character positioning model is trained by extracting Harr features of the image and using a cascade classifier based on the adaboost algorithm.
In step S4, the binarizing is performed on each text region image cut out from the original color image, specifically: the image is binarized for 15 consecutive times based on Otsu's method.
In step S5, the straight line fitting specifically includes: and adopting a random sampling consistency algorithm to perform linear fitting on the vertexes of the upper part and the lower part of the character area image.
In step S6, the suitable peak points are two peak points closest to the left and right boundaries.
In step S7, the step of inputting the finely positioned image into the convolutional network for feature extraction refers to processing the image using a network obtained by fine adjustment based on the vgg16 network.
In step S8, the image sequence is obtained by dividing the obtained text region image into image slices having the same width in the longitudinal direction, and the divided images are in a strip shape.
In step S9, the decoding of the character prediction result sequence means that redundant characters are recognized and deleted from the character string predicted by the recurrent neural network based on the long-short term memory unit, so as to obtain a prediction result.
In step S10, the incorrect printing of the characters on the flexible IC substrate includes missing characters, misprints, and multiple prints.
In step S12, the template library stores all the standard circuit component name strings, package type strings, and spacer information that may be used.
The above embodiments are preferred embodiments of the present invention, but the present invention is not limited to the above embodiments, and any other changes, modifications, substitutions, combinations, and simplifications which do not depart from the spirit and principle of the present invention should be construed as equivalents thereof, and all such changes, modifications, substitutions, combinations, and simplifications are intended to be included in the scope of the present invention.