Disclosure of Invention
The invention aims to provide an automatic defect identification method for an LED circuit board based on machine learning.
The aim of the invention can be achieved by the following technical scheme: an automatic defect identification method of an LED circuit board based on machine learning comprises the following steps:
Step S1: acquiring a welding surface image of the LED circuit board, and preprocessing the acquired welding surface image to obtain a corresponding available welding surface image;
step S2: obtaining a welding point image of each welding point in the available welding surface image, respectively obtaining a welding point center coordinate and a welding point edge coordinate in the obtained welding point image, evaluating the welding point form of each welding point according to the obtained welding point center coordinate and the obtained welding point edge coordinate, and judging whether a form abnormal welding point exists or not;
Step S3: obtaining the welding point position information of each welding point in the available welding surface image, constructing a corresponding welding point distribution diagram according to the obtained welding point position information, dividing each welding point into different dense areas in the constructed welding point distribution diagram, respectively obtaining the adjacent distances between adjacent welding points in the different dense areas, and judging whether the distance abnormal welding points exist or not;
step S4: collecting defect data of the scrapped LED circuit board, constructing a corresponding defect prediction model according to the collected defect data, predicting defects of the current LED circuit board according to the constructed defect prediction model, generating a corresponding defect prediction signal and feeding back the corresponding defect prediction signal.
Further, the process of acquiring the welding surface image of the LED circuit board and preprocessing the acquired welding surface image to obtain a corresponding available welding surface image includes:
And acquiring a welding surface image of the LED circuit board, and preprocessing the acquired welding surface image, wherein the preprocessing comprises denoising, graying and size adjustment, and the welding surface image after the preprocessing is marked as an available welding surface image.
Further, the process of obtaining the welding point image of each welding point in the available welding surface image and obtaining the center coordinates and the edge coordinates of the welding point in the obtained welding point image respectively includes:
and identifying the welding point in the available welding surface image by utilizing an edge detection algorithm, intercepting a partial image of the welding point to obtain a welding point image, obtaining the center of the welding point, constructing a welding point coordinate system, obtaining the center coordinate of the welding point, identifying the welding point edge of the welding point, obtaining a plurality of edge points on the welding point edge, and taking the coordinates of each edge point in the welding point coordinate system as the welding point edge coordinate.
Further, the process of evaluating the welding point form of each welding point according to the obtained central coordinate and the obtained edge coordinate of the welding point and judging whether the welding point with abnormal form exists comprises the following steps:
in a welding point coordinate system, obtaining edge distances between the edge coordinates of each welding point and the center coordinates of the welding point, obtaining edge standards of the welding point according to the edge distances of the same welding point, comparing the edge distances with the edge standards, and evaluating the welding point form of the welding point according to a comparison result to obtain an evaluation coefficient;
Setting an evaluation standard, comparing the evaluation coefficient with the evaluation standard, obtaining a morphological abnormality welding point according to a comparison result, generating a morphological abnormality signal and feeding the morphological abnormality signal back to related personnel.
Further, the process of obtaining the welding point position information of each welding point in the available welding surface image and constructing a corresponding welding point distribution map according to the obtained welding point position information includes:
Constructing a welding surface coordinate system in an available welding surface image, and obtaining welding point position information of each welding point in the welding surface coordinate system, wherein the welding point position information refers to coordinate information of the center of each welding point and corresponding edge points in the welding surface coordinate system;
and constructing a welding point distribution diagram of the LED circuit board according to the welding point position information, wherein the welding point distribution diagram is used for reflecting the distribution situation of the center and the edge points of each welding point on the LED circuit board.
Further, dividing each welding point into different dense areas in the constructed welding point distribution diagram, respectively obtaining adjacent distances between adjacent welding points in the different dense areas, and judging whether the abnormal welding points exist or not, wherein the process comprises the following steps:
In the welding point distribution map, the center and the edge points of each welding point are treated as one point, and clustering treatment is carried out on each point in the welding point distribution map by using a K-Means algorithm so as to divide the welding point distribution map into a plurality of different dense areas;
the coordinate information of each point in the dense area with the same degree of density is incorporated into the same dense coordinate set, the shortest distance between each point in the dense coordinate set is obtained, and the shortest distance between adjacent welding points is used as the adjacent distance according to the shortest distance;
and obtaining the adjacent coefficients between each adjacent welding point according to all adjacent distances in the dense coordinate set, setting an adjacent standard, comparing the adjacent coefficients with the adjacent standard, obtaining the distance abnormal welding point according to the comparison result, generating a distance abnormal signal and feeding the distance abnormal signal back to related personnel.
Further, the process of collecting the defect data of the scrapped LED circuit board and constructing a corresponding defect prediction model according to the collected defect data comprises the following steps:
collecting defect data of the scrapped LED circuit board, wherein the defect data refers to defect proportion of morphologically abnormal welding points and distance abnormal welding points in the LED circuit board to all points and working time of the LED circuit board;
The method comprises the steps of selecting a machine learning model as an initial defect prediction model, training and evaluating the initial defect prediction model by using defect data to obtain a latest defect prediction model, wherein the defect prediction model is used for predicting the working time of the defect prediction model according to the input defect data.
Further, the process of performing defect prediction on the current LED circuit board according to the constructed defect prediction model, generating a corresponding defect prediction signal and feeding back the signal comprises the following steps:
Obtaining defect data of a current LED circuit board, inputting the defect data into a defect identification model, predicting the working time length of the LED circuit board by using the defect identification model, obtaining the working time length of the current LED circuit board, comparing the working time length with the working time length, obtaining the LED circuit board in a potential fault state according to a comparison result, generating a defect prediction signal and feeding back the defect prediction signal to related personnel.
Compared with the prior art, the invention has the beneficial effects that:
1. The method and the device can evaluate the welding point form of each welding point by obtaining the central coordinate of the welding point and the edge coordinate of the welding point, are favorable for finding the abnormal welding point and feeding back in time, and can judge whether the distance between the adjacent welding points is too far or too near by classifying the distribution situation of the welding points to obtain the adjacent distance between the adjacent welding points in dense areas with different densities, so as to be favorable for finding the abnormal welding point and feeding back in time;
2. The defect proportion and the working time length occupied by the morphological abnormal welding points and the distance abnormal welding points in the scrapped LED circuit board are obtained, a corresponding defect identification model is constructed according to the corresponding relation between the obtained defect proportion and the working time length, whether the current LED circuit board has potential fault conditions or not can be judged according to the defect identification model, an effective defect prediction mechanism is formed, and defect identification of the LED circuit board can be better achieved.
Detailed Description
As shown in fig. 1, the automatic defect recognition method for the LED circuit board based on machine learning comprises the following steps:
Step S1: acquiring a welding surface image of the LED circuit board, and preprocessing the acquired welding surface image to obtain a corresponding available welding surface image;
step S2: obtaining a welding point image of each welding point in the available welding surface image, respectively obtaining a welding point center coordinate and a welding point edge coordinate in the obtained welding point image, evaluating the welding point form of each welding point according to the obtained welding point center coordinate and the obtained welding point edge coordinate, and judging whether a form abnormal welding point exists or not;
Step S3: obtaining the welding point position information of each welding point in the available welding surface image, constructing a corresponding welding point distribution diagram according to the obtained welding point position information, dividing each welding point into different dense areas in the constructed welding point distribution diagram, respectively obtaining the adjacent distances between adjacent welding points in the different dense areas, and judging whether the distance abnormal welding points exist or not;
step S4: collecting defect data of the scrapped LED circuit board, constructing a corresponding defect prediction model according to the collected defect data, predicting defects of the current LED circuit board according to the constructed defect prediction model, generating a corresponding defect prediction signal and feeding back the corresponding defect prediction signal.
It should be further noted that, in the implementation process, the process of collecting the soldering surface image of the LED circuit board and preprocessing the collected soldering surface image to obtain the corresponding available soldering surface image includes:
Collecting a welding surface image of an LED circuit board, wherein the welding surface generally refers to a copper foil area used for welding an LED element or other electronic elements, and the welding surface image refers to an original image of one side of the welding surface of the welded LED circuit board;
The acquired welding surface image is preprocessed, the preprocessing is used for optimizing the welding surface image so as to facilitate subsequent analysis and processing, the preprocessing comprises denoising, graying and size adjustment, and the welding surface image after the preprocessing is marked as an available welding surface image.
It should be further noted that, in the specific implementation process, a welding point image of each welding point is obtained from the available welding surface image, and the process of respectively obtaining the center coordinates of the welding point and the edge coordinates of the welding point in the obtained welding point image includes:
In the embodiment of the invention, the form of the welding point on the LED circuit board needs to be analyzed, wherein the welding point generally refers to the physical connection point of the LED element or other electronic elements and the LED circuit board;
In the obtained available welding surface image, each welding point is identified by utilizing an edge detection algorithm, partial images of each welding point and the peripheral area of each welding point are intercepted to obtain corresponding welding point images, each welding point is bound with the corresponding welding point image, and the welding point images only comprise single and complete welding points;
Taking a welding point image of any welding point as an example, marking the position of a welding hole corresponding to the welding point as a welding point center, constructing a welding point coordinate system of the welding point by taking the welding point center as a coordinate origin, marking the welding point center coordinate as (0, 0), identifying the welding point edge of the welding point by utilizing an edge detection algorithm, sequentially obtaining a plurality of edge points on the obtained welding point edge according to a fixed distance, marking the coordinate of each edge point in the welding point coordinate system as the welding point edge coordinate, and marking the coordinates as (x i,yi) respectively, wherein i=1, 2, … … and n, wherein n represents the number of the edge points.
It should be further noted that, in the specific implementation process, the process of evaluating the welding point form of each welding point according to the obtained center coordinates and the obtained edge coordinates of the welding point and judging whether the welding point with abnormal form exists includes:
The welding point shape is a shape surrounded by the welding point edges of each welding point, and most of the welding point shape is approximate to a circle under normal conditions, so in the embodiment of the invention, the welding point shape is defaulted to be a circle for evaluation, taking any welding point as an example, in a welding point coordinate system of the welding point, the edge distance between the edge coordinates of each welding point and the center coordinates of the welding point is obtained, and the obtained edge distance is marked as B i;
Taking the average value of the edge distances of the same welding point as the edge standard of the welding point, marking the average value as B 0, comparing the obtained edge distances with the edge standard, marking the obtained edge distances as a normal state if B i≤B0, marking the obtained edge distances as an abnormal state if B i>B0, evaluating the welding point form of the welding point according to the comparison result, taking the ratio of the number of the edge distances marked as the normal state in the welding point to the number of all the edge distances as an evaluation coefficient of the welding point, and marking the obtained evaluation coefficient as P i;
Setting an evaluation standard P 0, comparing the obtained evaluation coefficient with the evaluation standard, if P i≥P0, marking the welding point as a morphological normal welding point, if P i<P0, marking the welding point as a morphological abnormal welding point, generating a corresponding morphological abnormal signal, and feeding back the generated morphological abnormal signal to related personnel.
It should be further noted that, in the implementation process, the process of obtaining the welding point position information of each welding point in the available welding surface image and constructing the corresponding welding point distribution diagram according to the obtained welding point position information includes:
in the embodiment of the invention, the adjacent distance between the adjacent welding points on the LED circuit board is required to be analyzed, and whether the adjacent distance between the adjacent welding points is too far or too close is judged to realize another defect identification mode of the welding points on the LED circuit board;
In the obtained available welding surface image, constructing a welding surface coordinate system of the welding surface by taking any vertex as a coordinate origin, and obtaining welding point position information of each welding point in the constructed welding surface coordinate system, wherein the welding point position information refers to coordinate information of the center of each welding point and corresponding edge points in the welding surface coordinate system;
And constructing a welding point distribution diagram of the LED circuit board according to the obtained welding point position information, wherein the constructed welding point distribution diagram only comprises the welding point center and the edge point of each welding point and is used for reflecting the distribution condition of each welding point center and the edge point on the LED circuit board.
It should be further noted that, in the implementation process, dividing each welding point into different dense areas in the constructed welding point distribution diagram, and respectively obtaining the adjacent distances between adjacent welding points in the different dense areas and judging whether the distance abnormal welding points exist includes:
in the constructed welding point distribution diagram, the center and the edge points of each welding point are treated as one point, each point in the welding point distribution diagram is clustered by using a K-Means algorithm to divide the welding point distribution diagram into a plurality of different dense areas, the dense degree of each dense area is different, and each dense area is ordered according to the dense degree from high to low;
The coordinate information of each point in the dense area with the same dense degree is brought into the same dense coordinate set, any point in any dense coordinate set is taken as an example, the shortest distance between the point and other points in the dense coordinate set is obtained, the point corresponding to the smallest shortest distance is taken as the nearest welding point of the point, the nearest welding point of the point and the point are marked as adjacent welding points, and the shortest distance between the adjacent welding points is marked as an adjacent distance;
Obtaining all adjacent distances in the dense coordinate set by adopting the same method, numbering the obtained adjacent distances, and marking the adjacent distances as L j, wherein j=1, 2, … … and m, wherein m represents the number of the adjacent distances in the dense coordinate set, and obtaining the adjacent coefficient of each adjacent welding point according to the obtained adjacent distances, and marking the adjacent coefficient as R j;
Setting a proximity standard R 0, comparing the obtained proximity coefficient with the proximity standard, marking the proximity standard as a distance normal welding point if R j≤R0, marking the proximity standard as a distance abnormal welding point if R j>R0, generating a corresponding distance abnormal signal, and feeding back the generated distance abnormal signal to related personnel.
It should be further noted that, in the implementation process, the process of collecting the defect data of the scrapped LED circuit board and constructing the corresponding defect prediction model according to the collected defect data includes:
Collecting defect data of the scrapped LED circuit board, wherein the defect data refers to the proportion of morphological abnormal welding points and distance abnormal welding points in the LED circuit board to all points, and the defect data is marked as defect proportion, and the defect data also comprises the working time of the LED circuit board, namely the time interval from delivery to scrapping of the LED circuit board;
Selecting a machine learning model as an initial defect prediction model, dividing the obtained defect data into a training set and a testing set, training the initial defect prediction model by using the training set, and obtaining a trained defect prediction model by learning the corresponding relation between the defect proportion and the working time;
and evaluating the trained defect prediction model by using a test set, tuning the trained defect prediction model according to an evaluation result to obtain a tuned defect prediction model, and taking the latest tuned defect prediction model as the latest defect prediction model, wherein the defect prediction model is used for predicting the working time of the defect prediction model according to the input defect data.
It should be further noted that, in the implementation process, the process of performing defect prediction on the current LED circuit board according to the constructed defect prediction model, generating a corresponding defect prediction signal and feeding back the signal includes:
obtaining defect data of a current LED circuit board, inputting the obtained defect data into a constructed defect identification model, and predicting the working time of the LED circuit board according to the input defect data by using the defect identification model;
The method comprises the steps of obtaining the current working time length of the LED circuit board, comparing the obtained working time length with the corresponding working time length, if the working time length is smaller than or equal to the working time length, not performing any other operation on the LED circuit board, if the working time length is larger than the working time length, marking the LED circuit board as a potential fault state, generating a corresponding defect prediction signal, and feeding the defect prediction signal back to related personnel.
The above embodiments are only for illustrating the technical method of the present invention and not for limiting the same, and it should be understood by those skilled in the art that the technical method of the present invention may be modified or substituted without departing from the spirit and scope of the technical method of the present invention.