CN117664984A - Defect detection method, device, system and storage medium - Google Patents
Defect detection method, device, system and storage medium Download PDFInfo
- Publication number
- CN117664984A CN117664984A CN202311640332.1A CN202311640332A CN117664984A CN 117664984 A CN117664984 A CN 117664984A CN 202311640332 A CN202311640332 A CN 202311640332A CN 117664984 A CN117664984 A CN 117664984A
- Authority
- CN
- China
- Prior art keywords
- electrode
- image
- block
- template
- spectrum
- 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.)
- Pending
Links
- 230000007547 defect Effects 0.000 title claims abstract description 82
- 238000001514 detection method Methods 0.000 title claims abstract description 58
- 238000003860 storage Methods 0.000 title claims abstract description 9
- 238000001228 spectrum Methods 0.000 claims abstract description 26
- 238000000103 photoluminescence spectrum Methods 0.000 claims abstract description 23
- 238000001194 electroluminescence spectrum Methods 0.000 claims abstract description 21
- 230000000007 visual effect Effects 0.000 claims abstract description 19
- 230000004927 fusion Effects 0.000 claims abstract description 18
- 238000004422 calculation algorithm Methods 0.000 claims description 49
- 238000004458 analytical method Methods 0.000 claims description 29
- 239000013598 vector Substances 0.000 claims description 23
- 238000012545 processing Methods 0.000 claims description 22
- 238000012549 training Methods 0.000 claims description 22
- 238000005424 photoluminescence Methods 0.000 claims description 21
- 238000000034 method Methods 0.000 claims description 16
- 238000012706 support-vector machine Methods 0.000 claims description 15
- 238000004364 calculation method Methods 0.000 claims description 12
- 230000002950 deficient Effects 0.000 claims description 9
- 238000003708 edge detection Methods 0.000 claims description 9
- 238000005401 electroluminescence Methods 0.000 claims description 9
- 238000002360 preparation method Methods 0.000 claims description 9
- 230000003595 spectral effect Effects 0.000 claims description 9
- 238000004043 dyeing Methods 0.000 claims description 6
- 238000005516 engineering process Methods 0.000 claims description 5
- 238000005259 measurement Methods 0.000 claims description 5
- 238000004070 electrodeposition Methods 0.000 claims description 4
- 238000009499 grossing Methods 0.000 claims description 4
- 238000010606 normalization Methods 0.000 claims description 4
- 238000004590 computer program Methods 0.000 claims description 3
- 239000000284 extract Substances 0.000 claims description 3
- 238000000605 extraction Methods 0.000 claims description 3
- 230000001678 irradiating effect Effects 0.000 claims description 3
- 238000012544 monitoring process Methods 0.000 claims description 3
- 230000003287 optical effect Effects 0.000 claims description 3
- 238000000628 photoluminescence spectroscopy Methods 0.000 claims description 3
- 238000001303 quality assessment method Methods 0.000 claims description 3
- 230000004936 stimulating effect Effects 0.000 claims description 3
- 230000001276 controlling effect Effects 0.000 claims 6
- 238000003909 pattern recognition Methods 0.000 description 2
- 230000004075 alteration Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000003672 processing method Methods 0.000 description 1
- 238000003908 quality control method Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000011179 visual inspection Methods 0.000 description 1
Abstract
The invention relates to the field of defect detection, in particular to a defect detection method, a device, a system and a storage medium, which achieve the detection purpose through the following steps: obtaining a block to be tested of the plastic product to be tested; controlling a laser emitter to irradiate a block to be detected to obtain a visual image and a photoluminescence spectrum of the block to be detected; determining the position of a first electrode on the block to be detected according to the visual image; according to the position of the first electrode, controlling a second electrode on the mechanical arm to be in contact with the first electrode, and obtaining an electroluminescent spectrum of a block to be detected; and carrying out defect identification and result fusion according to the visual image, the photoluminescence spectrum and the electroluminescence spectrum to obtain a defect detection result of the plastic product to be detected.
Description
Technical Field
The invention relates to the field of defect detection, in particular to a defect detection method, device and system and a storage medium.
Background
At present, plastic products are widely applied to various industries, and the quality and reliability of the plastic products play an important role in the performance and safety of the products. However, due to the special properties of plastic products, such as transparency or translucency, complex geometry, etc., the existing defect detection methods have certain limitations.
The traditional defect detection method mainly depends on visual inspection and manual analysis, is time-consuming and labor-intensive, is easily affected by subjective factors, and cannot realize rapid and accurate detection. The application of sensor technology, while providing some solutions, provides limited information from a single sensor, making it difficult to meet the detection needs of complex defects.
Disclosure of Invention
The present invention is directed to a defect detecting method, device, system and storage medium, which solve the above-mentioned problems in the prior art.
In order to achieve the above purpose, the present invention provides the following technical solutions: a defect detection method comprising the steps of:
step S1, obtaining a block to be tested of a plastic product to be tested, obtaining an image of the block to be tested, extracting boundary information of the block to be tested by applying an edge detection algorithm, and analyzing color characteristics of the block to be tested by using a color analysis algorithm to obtain surface information and optical characteristics of the block to be tested;
s2, controlling a laser emitter to irradiate the block to be measured to obtain a visual image and a photoluminescence spectrum of the block to be measured, specifically, exciting a photoluminescence phenomenon of the block to be measured through laser irradiation, capturing a photoluminescence signal by utilizing a corresponding spectrum instrument, and obtaining the photoluminescence spectrum;
step S3, determining the position of the first electrode on the block to be detected according to the visual image in the surface information of the block to be detected in the step S1, and particularly, accurately positioning the position of the first electrode on the block to be detected according to an image processing algorithm;
step S4, according to the position of the first electrode in the step S3, controlling the second electrode on the mechanical arm to be in contact with the first electrode, obtaining an electroluminescence spectrum of the block to be tested, specifically stimulating the block to be tested to generate an electroluminescence phenomenon by an electroluminescence method, and collecting corresponding electroluminescence spectrum signals;
and S5, performing defect identification and result fusion by adopting a pattern identification algorithm according to the visual image, the photoluminescence spectrum and the electroluminescence spectrum to obtain a defect detection result of the plastic product to be detected.
Preferably, the edge detection algorithm and the color analysis algorithm applied in the machine vision specifically include the following:
the edge detection algorithm detector captures boundary information of the plastic product, so as to judge whether defects or anomalies exist or not: assuming that a gray level image L (x, y) of a plastic product is acquired through a sensor, wherein (x, y) represents pixel coordinates on the image, and the image is convolved by using a Sobel operator to obtain gradient values in a horizontal direction (Gx) and a vertical direction (Gy):
for the Sobel operator in the horizontal direction, the calculation formula is as follows:
for the Sobel operator in the vertical direction, the calculation formula is as follows:
according to Gx and Gy, calculating the gradient amplitude and direction of each pixel point, and detecting the edge of the plastic product:
Gradient_magnitude=sqrt(Gx 2 +Gy 2 );
Gradient_direction=atan2(Gy,Gx);
by setting a proper threshold value, dividing pixel points into strong edges or weak boundaries according to gradient amplitude and direction, and extracting edge information of plastic products;
the color analysis algorithm extracts color features in the image and is used for identifying the dyeing quality of plastic products or detecting foreign matters on the surface: assuming that a color image I (x, y) is acquired by a sensor, wherein (x, y) represents pixel coordinates on the image, converting the color image into HSV color space for color analysis;
the HSV color space consists of three components of hue, saturation and brightness, firstly, RGB images are converted into HSV images, which are converted according to the following formula:
V=max(R,G,B);
S=(V-min(R,G,B)/V);
H=0if V==0;
60*(G-B)/(6*(V-min(R,G,B)))if V==R;
60*(B-G)/(6*(V-min(R,G,B)))+120if V==G;
60*(R-G)/(6*(V-min(R,G,B)))+240if V==B;
and calculating the hue, saturation and brightness value of each pixel point in the HSV color space through a color analysis algorithm, and determining the dyeing quality and foreign matters of the plastic product according to a preset standard or threshold value.
Preferably, the image processing algorithm adopted in the step S3 is a template matching method, and the specific steps are as follows:
step S31, assuming an electrode template F (x, y), wherein (x, y) represents pixel coordinates on the template, the template is the shape or feature of the first electrode;
step S32, a template matching algorithm is used for sliding the template in the image of the block to be detected, the similarity or matching degree of the template and the image local area is calculated, and the difference degree of pixel level is compared between the template and the image local area;
and step S33, determining the region which is the most matched with the template, namely the position of the first electrode on the block to be tested, according to the calculation result of the difference degree.
Preferably, the specific content of the template matching method used in the step S32 is:
step a, preparation work: block image to be measured (F): carrying out electrode detection on the plastic product image; template image (T): a template image comprising a first electrode shape;
step b, a template matching algorithm step: sliding the template (T) from the upper left corner to each possible position of the block image (F) to be tested in turn; at each position, calculating the similarity or matching degree of the template (T) and the image local area (F') under the current sliding position;
step c, calculating the similarity: in the template similarity algorithm, the mean square error is used for calculation:
MSE(T,F ′ )=Σ(T(x,y)-F ′ (x,y)) 2 /(M×N);
wherein F (x, y) is a pixel value on the template image, F' (x, y) is a pixel value on a local area of the image in the sliding position, and M and N are the width and the height of the template image, respectively;
step d, determining the matching degree: and checking the mean square error, wherein a smaller value represents that the similarity between the template and the local area of the image is higher, and the position of the minimum mean square error is the position of the first electrode on the block to be tested.
Preferably, in the step S4, the specific step of controlling the contact between the second electrode and the first electrode on the mechanical arm to obtain the electroluminescence spectrum of the area to be measured includes:
step S41, preparation work: a first electrode: this is an electrode on the plastic where the position has been determined, a possible defect is detected or a region where photoluminescence spectroscopy is required; a second electrode: the electrode on the mechanical arm is contacted with the first electrode through control; spectroscopic instrument: obtaining photoluminescence spectrum data by using a fluorescence spectrophotometer;
step S42, the mechanical arm controls the second electrode to contact the first electrode: according to the position information of the first electrode, the second electrode is accurately contacted with the first electrode by accurately controlling the movement of the mechanical arm;
step S43, obtaining an electroluminescence spectrum: through the contact between the first electrode and the second electrode, a circuit connection is established, so that electric charges flow in the plastic product; collecting spectral data of the photoluminescence phenomenon by using a fluorescence spectrophotometer; determining a photoluminescence wavelength range of interest, specifically setting a start wavelength and a stop wavelength of a spectroscopic instrument; recording data of the electroluminescent spectrum by a spectroscopic instrument;
step S44, analysis and processing of spectrum data: further analyzing and processing the recorded electroluminescent spectrum data, wherein the specific analysis and processing steps comprise peak value positioning, spectrum smoothing and data normalization; and performing fault detection, quality assessment and analysis operation according to the analysis and processing results of the spectrum data, and determining the performance and defects of the plastic product.
Preferably, the specific method for controlling the second electrode to contact the first electrode by the mechanical arm in step S42 is as follows:
step I, pre-developing or acquiring a three-dimensional model or CAD data of a plastic product so as to establish a coordinate system of a block to be tested and a model of an electrode position;
step II, designing an inverse kinematics model based on the geometric shapes of the mechanical arm and the plastic product, and calculating the joint angle of the mechanical arm so as to realize the required position and posture of the second electrode;
step III, monitoring the contact force between the second electrode and the first electrode in real time by using a sensor, and adjusting the gesture and the position of the mechanical arm by a control algorithm according to force feedback so as to keep the contact force in a proper range;
and IV, acquiring image information through a vision sensor, detecting and tracking the position of the first electrode through an image processing algorithm, and accurately positioning and adjusting by utilizing a machine vision technology.
Preferably, in the step S5, the specific steps of performing defect recognition and result fusion by using a pattern recognition algorithm are as follows:
step S51, feature extraction: extracting meaningful features from the collected electroluminescence spectrum data of the plastic product as input feature vectors; assume that two features are extracted: spectral peak position and peak intensity, then the eigenvector of one sample can be expressed as p= [ P ] 1 ,p 2 ]Wherein p is 1 Representing the spectral peak position, p 2 Representing peak intensity;
step S52, training data preparation: preparing a training data set with labels, wherein the data set comprises feature vectors of known normal samples and known defect samples and the labels corresponding to the feature vectors; let the training dataset be D = { (p) 1 ,q 1 ),(p 2 ,q 2 ),…,(p n ,q n ) Wherein p is 1 Is a feature vector, q 1 Is a label (normally 1, defect-1);
step S53, model training: training a support vector machine model using the training dataset D; the support vector machine separates normal samples from defective samples by finding an optimal hyperplane (decision boundary), where the support vector machine is:
f(p)=sign(W·P+b);
wherein W is a weight vector, P is an input feature vector, b is a bias, sign is a sign function;
step S54, defect identification: extracting photoluminescence spectrum data and feature vectors of a plastic sample to be detected; inputting the feature vector of the sample into a trained support vector machine model to obtain a prediction label of the sample, and if the prediction label is 1, indicating that the sample is classified as normal; if the predictive label is-1, then the specimen is classified as defective;
step S55, result fusion: in order to further improve the accuracy of defect detection, a voting mode is adopted to conduct result fusion; using a plurality of trained support vector machine models, each model classifying and predicting samples based on different training data or parameter settings; and determining a final defect detection result by a voting mode according to the prediction results of the models, specifically, judging that the majority vote is normal, and judging that the majority vote is defective.
Preferably, the defect detection device comprises a laser emitter, a mechanical arm, a first electrode and a second motor, wherein the laser emitter is used for irradiating a block to be detected of a plastic product to be detected, and the mechanical arm is provided with the second electrode which is used for being in contact with the first electrode on the block to be detected to obtain an electroluminescent spectrum of the block to be detected.
Preferably, the defect detection system comprises an image collector, a photoluminescence measurement instrument, a control module and a defect identification module, wherein the image collector is used for obtaining a visual image, the photoluminescence measurement instrument is used for obtaining a photoluminescence spectrum of a block to be detected, the control module is used for controlling the action of the mechanical arm, and the defect identification module is used for carrying out defect identification and result fusion.
Preferably, a defect detection storage medium has stored thereon a computer program which is executed by a processor to perform the steps of a defect detection method in a defect detection system.
Compared with the prior art, the invention has the beneficial effects that: the invention adopts a method combining photoluminescence and electroluminescence, and improves the accuracy and efficiency of detecting defects of plastic products by comprehensively utilizing information of visual images, photoluminescence spectrums and electroluminescence spectrums. Compared with the traditional method, the invention has the following advantages:
1. and the defect detection is carried out by combining various information sources, so that the detection accuracy is improved.
2. And the photoluminescence and electroluminescence characteristics are utilized to comprehensively detect the to-be-detected blocks.
3. And by adopting an image processing and analysis algorithm, the electrode position is accurately positioned, and the acquisition accuracy of the electroluminescent spectrum is improved.
4. And a result fusion technology is applied to obtain a more reliable defect detection result.
5. Is suitable for the fields of production and quality control of various plastic products, and has better practicability.
Drawings
FIG. 1 is a schematic flow chart of a defect detection method according to the present invention;
FIG. 2 is a schematic diagram of a defect detection system according to the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
In the description of the present invention, it should be noted that the azimuth or positional relationship indicated by the terms "vertical", "upper", "lower", "horizontal", etc. are based on the azimuth or positional relationship shown in the drawings, and are merely for convenience of describing the present invention and simplifying the description, and do not indicate or imply that the apparatus or element referred to must have a specific azimuth, be constructed and operated in a specific azimuth, and thus should not be construed as limiting the present invention.
In the description of the present invention, it should also be noted that, unless explicitly specified and limited otherwise, the terms "disposed," "mounted," "connected," and "connected" are to be construed broadly, and may be, for example, fixedly connected, detachably connected, or integrally connected; can be mechanically or electrically connected; can be directly connected or indirectly connected through an intermediate medium, and can be communication between two elements. The specific meaning of the above terms in the present invention can be understood by those of ordinary skill in the art according to the specific circumstances.
Referring to fig. 1-2, the present invention provides a technical solution: a defect detection method comprising the steps of:
step S1, obtaining a block to be tested of a plastic product to be tested, obtaining an image of the block to be tested, extracting boundary information of the block to be tested by applying an edge detection algorithm, and analyzing color characteristics of the block to be tested by using a color analysis algorithm to obtain surface information and optical characteristics of the block to be tested;
s2, controlling a laser emitter to irradiate the block to be measured to obtain a visual image and a photoluminescence spectrum of the block to be measured, specifically, exciting a photoluminescence phenomenon of the block to be measured through laser irradiation, capturing a photoluminescence signal by utilizing a corresponding spectrum instrument, and obtaining the photoluminescence spectrum;
step S3, determining the position of the first electrode on the block to be detected according to the visual image in the surface information of the block to be detected in the step S1, and particularly, accurately positioning the position of the first electrode on the block to be detected according to an image processing algorithm;
step S4, according to the position of the first electrode in the step S3, controlling the second electrode on the mechanical arm to be in contact with the first electrode, obtaining an electroluminescence spectrum of the block to be tested, specifically stimulating the block to be tested to generate an electroluminescence phenomenon by an electroluminescence method, and collecting corresponding electroluminescence spectrum signals;
and S5, performing defect identification and result fusion by adopting a pattern identification algorithm according to the visual image, the photoluminescence spectrum and the electroluminescence spectrum to obtain a defect detection result of the plastic product to be detected.
Further, the edge detection algorithm and the color analysis algorithm applied in the machine vision specifically include the following:
the edge detection algorithm detector captures boundary information of the plastic product, so as to judge whether defects or anomalies exist or not: assuming that a gray level image L (x, y) of a plastic product is acquired through a sensor, wherein (x, y) represents pixel coordinates on the image, and the image is convolved by using a Sobel operator to obtain gradient values in a horizontal direction (Gx) and a vertical direction (Gy):
for the Sobel operator in the horizontal direction, the calculation formula is as follows:
for the Sobel operator in the vertical direction, the calculation formula is as follows:
according to Gx and Gy, calculating the gradient amplitude and direction of each pixel point, and detecting the edge of the plastic product:
Gradient_magnitude=sqrt(Gx 2 +Gy 2 );
Gradient_direction=atan2(Gy,Gx);
by setting a proper threshold value, dividing pixel points into strong edges or weak boundaries according to gradient amplitude and direction, and extracting edge information of plastic products;
the color analysis algorithm extracts color features in the image and is used for identifying the dyeing quality of plastic products or detecting foreign matters on the surface: assuming that a color image I (x, y) is acquired by a sensor, wherein (x, y) represents pixel coordinates on the image, converting the color image into HSV color space for color analysis;
the HSV color space consists of three components of hue, saturation and brightness, firstly, RGB images are converted into HSV images, which are converted according to the following formula:
V=max(R,G,B);
S=(V-min(R,G,B)/V);
H=0if V==0;
60*(G-B)/(6*(V-min(R,G,B)))if V==R;
60*(B-G)/(6*(V-min(R,G,B)))+120if V==G;
60*(R-G)/(6*(V-min(R,G,B)))+240if V==B;
and calculating the hue, saturation and brightness value of each pixel point in the HSV color space through a color analysis algorithm, and determining the dyeing quality and foreign matters of the plastic product according to a preset standard or threshold value.
Further, the image processing algorithm adopted in step S3 is a template matching method, which specifically includes the following steps:
step S31, assuming an electrode template F (x, y), wherein (x, y) represents pixel coordinates on the template, the template is the shape or feature of the first electrode;
step S32, a template matching algorithm is used for sliding the template in the image of the block to be detected, the similarity or matching degree of the template and the image local area is calculated, and the difference degree of pixel level is compared between the template and the image local area;
step S33, determining the most matched area with the template, i.e. the position of the first electrode on the block to be tested, according to the calculation result of the difference degree
Further, the specific contents of the template matching method used in step S32 are:
step a, preparation work: block image to be measured (F): carrying out electrode detection on the plastic product image; template image (T): a template image comprising a first electrode shape;
step b, a template matching algorithm step: sliding the template (T) from the upper left corner to each possible position of the block image (F) to be tested in turn; at each position, calculating the similarity or matching degree of the template (T) and the image local area (F') under the current sliding position;
step c, calculating the similarity: in the template similarity algorithm, the mean square error is used for calculation:
MSE(T,F ′ )=Σ(T(x,y)-F ′ (x,y)) 2 /(M×N);
wherein F (x, y) is a pixel value on the template image, F' (x, y) is a pixel value on a local area of the image in the sliding position, and M and N are the width and the height of the template image, respectively;
step d, determining the matching degree: checking the mean square error, wherein a smaller value represents that the similarity between the template and the local area of the image is higher, and the position of the minimum mean square error is the position of the first electrode on the block to be tested
Further, in step S4, the specific step of controlling the contact between the second electrode and the first electrode on the mechanical arm to obtain the electroluminescence spectrum of the block to be measured is as follows:
step S41, preparation work: a first electrode: this is an electrode on the plastic where the position has been determined, a possible defect is detected or a region where photoluminescence spectroscopy is required; a second electrode: the electrode on the mechanical arm is contacted with the first electrode through control; spectroscopic instrument: obtaining photoluminescence spectrum data by using a fluorescence spectrophotometer;
step S42, the mechanical arm controls the second electrode to contact the first electrode: according to the position information of the first electrode, the second electrode is accurately contacted with the first electrode by accurately controlling the movement of the mechanical arm;
step S43, obtaining an electroluminescence spectrum: through the contact between the first electrode and the second electrode, a circuit connection is established, so that electric charges flow in the plastic product; collecting spectral data of the photoluminescence phenomenon by using a fluorescence spectrophotometer; determining a photoluminescence wavelength range of interest, specifically setting a start wavelength and a stop wavelength of a spectroscopic instrument; recording data of the electroluminescent spectrum by a spectroscopic instrument;
step S44, analysis and processing of spectrum data: further analyzing and processing the recorded electroluminescent spectrum data, wherein the specific analysis and processing steps comprise peak value positioning, spectrum smoothing and data normalization; and performing fault detection, quality assessment and analysis operation according to the analysis and processing results of the spectrum data, and determining the performance and defects of the plastic product.
In step S44, peak positioning, spectrum smoothing and data normalization are performed on the electroluminescence spectrum data, and the technique common to the data processing method is not described in detail here.
Further, the specific method for controlling the second electrode to contact the first electrode by the mechanical arm in step S42 is as follows:
step I, pre-developing or acquiring a three-dimensional model or CAD data of a plastic product so as to establish a coordinate system of a block to be tested and a model of an electrode position;
step II, designing an inverse kinematics model based on the geometric shapes of the mechanical arm and the plastic product, and calculating the joint angle of the mechanical arm so as to realize the required position and posture of the second electrode;
step III, monitoring the contact force between the second electrode and the first electrode in real time by using a sensor, and adjusting the gesture and the position of the mechanical arm by a control algorithm according to force feedback so as to keep the contact force in a proper range;
and IV, acquiring image information through a vision sensor, detecting and tracking the position of the first electrode through an image processing algorithm, and accurately positioning and adjusting by utilizing a machine vision technology.
Further, in step S5, the specific steps of performing defect recognition and result fusion by using a pattern recognition algorithm are as follows:
step S51, feature extraction: extracting meaningful features from the collected electroluminescence spectrum data of the plastic product as input feature vectors; assume that two features are extracted: spectral peak position and peak intensity, then the eigenvector of one sample can be expressed as p= [ P ] 1 ,p 2 ]Wherein p is 1 Representing the spectral peak position, p 2 Representing peak intensity;
step S52, training data preparation: preparing a labeled training dataset comprising known normal samplesFeature vectors of the present and known defect samples and their corresponding labels; let the training dataset be D = { (p) 1 ,q 1 ),(p 2 ,q 2 ),…,(p n ,q n ) Wherein p is 1 Is a feature vector, q 1 Is a label (normally 1, defect-1);
step S53, model training: training a support vector machine model using the training dataset D; the support vector machine separates normal samples from defective samples by finding an optimal hyperplane (decision boundary), where the support vector machine is:
f(p)=sign(W·P+b);
wherein W is a weight vector, P is an input feature vector, b is a bias, sign is a sign function;
step S54, defect identification: extracting photoluminescence spectrum data and feature vectors of a plastic sample to be detected; inputting the feature vector of the sample into a trained support vector machine model to obtain a prediction label of the sample, and if the prediction label is 1, indicating that the sample is classified as normal; if the predictive label is-1, then the specimen is classified as defective;
step S55, result fusion: in order to further improve the accuracy of defect detection, a voting mode is adopted to conduct result fusion; using a plurality of trained support vector machine models, each model classifying and predicting samples based on different training data or parameter settings; and determining a final defect detection result by a voting mode according to the prediction results of the models, specifically, judging that the majority vote is normal, and judging that the majority vote is defective.
Further, a defect detection device comprises a laser emitter, a mechanical arm, a first electrode and a second motor, wherein the laser emitter is used for irradiating a block to be detected of a plastic product to be detected, and the mechanical arm is provided with the second electrode which is used for being in contact with the first electrode on the block to be detected to obtain an electroluminescent spectrum of the block to be detected.
Further, the defect detection system comprises an image collector, a photoluminescence measurement instrument, a control module and a defect identification module, wherein the image collector is used for obtaining a visual image, the photoluminescence measurement instrument is used for obtaining a photoluminescence spectrum of a block to be detected, the control module is used for controlling the action of the mechanical arm, and the defect identification module is used for carrying out defect identification and result fusion.
Further, a defect detection storage medium has stored thereon a computer program which is executed by a processor to perform the steps of a defect detection method in a defect detection system.
Working principle: the invention provides a plastic product defect detection method, device, system and storage medium based on photoluminescence and electroluminescence, which achieves the detection purpose through the following steps: obtaining a block to be tested of the plastic product to be tested; controlling a laser emitter to irradiate a block to be detected to obtain a visual image and a photoluminescence spectrum of the block to be detected; determining the position of a first electrode on the block to be detected according to the visual image; according to the position of the first electrode, controlling a second electrode on the mechanical arm to be in contact with the first electrode, and obtaining an electroluminescent spectrum of a block to be detected; and carrying out defect identification and result fusion according to the visual image, the photoluminescence spectrum and the electroluminescence spectrum to obtain a defect detection result of the plastic product to be detected.
Although embodiments of the present invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made therein without departing from the principles and spirit of the invention, the scope of which is defined in the appended claims and their equivalents.
Claims (10)
1. A defect detection method, comprising the steps of:
step S1, obtaining a block to be tested of a plastic product to be tested, obtaining an image of the block to be tested, extracting boundary information of the block to be tested by applying an edge detection algorithm, and analyzing color characteristics of the block to be tested by using a color analysis algorithm to obtain surface information and optical characteristics of the block to be tested;
s2, controlling a laser emitter to irradiate the block to be measured to obtain a visual image and a photoluminescence spectrum of the block to be measured, specifically, exciting a photoluminescence phenomenon of the block to be measured through laser irradiation, capturing a photoluminescence signal by utilizing a corresponding spectrum instrument, and obtaining the photoluminescence spectrum;
step S3, determining the position of the first electrode on the block to be detected according to the visual image in the surface information of the block to be detected in the step S1, and particularly, accurately positioning the position of the first electrode on the block to be detected according to an image processing algorithm;
step S4, according to the position of the first electrode in the step S3, controlling the second electrode on the mechanical arm to be in contact with the first electrode, obtaining an electroluminescence spectrum of the block to be tested, specifically stimulating the block to be tested to generate an electroluminescence phenomenon by an electroluminescence method, and collecting corresponding electroluminescence spectrum signals;
and S5, performing defect identification and result fusion by adopting a pattern identification algorithm according to the visual image, the photoluminescence spectrum and the electroluminescence spectrum to obtain a defect detection result of the plastic product to be detected.
2. A defect detection method according to claim 1, wherein: the edge detection algorithm and the color analysis algorithm applied in the machine vision specifically comprise the following contents:
the edge detection algorithm detector captures boundary information of the plastic product, so as to judge whether defects or anomalies exist or not: assuming that a gray level image L (x, y) of a plastic product is acquired through a sensor, wherein (x, y) represents pixel coordinates on the image, and the image is convolved by using a Sobel operator to obtain gradient values in a horizontal direction (Gx) and a vertical direction (Gy):
for the Sobel operator in the horizontal direction, the calculation formula is as follows:
for the Sobel operator in the vertical direction, the calculation formula is as follows:
according to Gx and Gy, calculating the gradient amplitude and direction of each pixel point, and detecting the edge of the plastic product:
Gradient_magnitude=sqrt(Gx 2 +Gy 2 );
Gradient_direction=atan2(Gy,Gx);
by setting a proper threshold value, dividing pixel points into strong edges or weak boundaries according to gradient amplitude and direction, and extracting edge information of plastic products;
the color analysis algorithm extracts color features in the image and is used for identifying the dyeing quality of plastic products or detecting foreign matters on the surface: assuming that a color image I (x, y) is acquired by a sensor, wherein (x, y) represents pixel coordinates on the image, converting the color image into HSV color space for color analysis;
the HSV color space consists of three components of hue, saturation and brightness, firstly, RGB images are converted into HSV images, which are converted according to the following formula:
V=max(R,G,B);
S=(V-min(R,G,B)/V);
H=0 if V==0;
60*(G-B)/(6*(V-min(R,G,B)))if V==R;
60*(B-G)/(6*(V-min(R,G,B)))+120 if V==G;
60*(R-G)/(6*(V-min(R,G,B)))+240 if V==B;
and calculating the hue, saturation and brightness value of each pixel point in the HSV color space through a color analysis algorithm, and determining the dyeing quality and foreign matters of the plastic product according to a preset standard or threshold value.
3. A defect detection method according to claim 1, wherein: the image processing algorithm adopted in the step S3 is a template matching method, and the specific steps are as follows:
step S31, assuming an electrode template F (x, y), wherein (x, y) represents pixel coordinates on the template, the template is the shape or feature of the first electrode;
step S32, a template matching algorithm is used for sliding the template in the image of the block to be detected, the similarity or matching degree of the template and the image local area is calculated, and the difference degree of pixel level is compared between the template and the image local area;
and step S33, determining the region which is the most matched with the template, namely the position of the first electrode on the block to be tested, according to the calculation result of the difference degree.
4. A defect detection method according to claim 3, wherein: the specific content of the template matching method used in the step S32 is as follows:
step a, preparation work: block image to be measured (F): carrying out electrode detection on the plastic product image; template image (T): a template image comprising a first electrode shape;
step b, a template matching algorithm step: sliding the template (T) from the upper left corner to each possible position of the block image (F) to be tested in turn; at each position, calculating the similarity or matching degree of the template (T) and the image local area (F') under the current sliding position;
step c, calculating the similarity: in the template similarity algorithm, the mean square error is used for calculation:
MSE(T,F ′ )=Σ(T(x,y)-F ′ (x,y)) 2 /(M×N);
wherein F (x, y) is a pixel value on the template image, F' (x, y) is a pixel value on a local area of the image in the sliding position, and M and N are the width and the height of the template image, respectively;
step d, determining the matching degree: and checking the mean square error, wherein a smaller value represents that the similarity between the template and the local area of the image is higher, and the position of the minimum mean square error is the position of the first electrode on the block to be tested.
5. A defect detection method according to claim 1, wherein: in the step S4, the specific step of controlling the contact between the second electrode and the first electrode on the mechanical arm to obtain the electroluminescent spectrum of the block to be tested is as follows:
step S41, preparation work: a first electrode: this is an electrode on the plastic where the position has been determined, a possible defect is detected or a region where photoluminescence spectroscopy is required; a second electrode: the electrode on the mechanical arm is contacted with the first electrode through control; spectroscopic instrument: obtaining photoluminescence spectrum data by using a fluorescence spectrophotometer;
step S42, the mechanical arm controls the second electrode to contact the first electrode: according to the position information of the first electrode, the second electrode is accurately contacted with the first electrode by accurately controlling the movement of the mechanical arm;
step S43, obtaining an electroluminescence spectrum: through the contact between the first electrode and the second electrode, a circuit connection is established, so that electric charges flow in the plastic product; collecting spectral data of the photoluminescence phenomenon by using a fluorescence spectrophotometer; determining a photoluminescence wavelength range of interest, specifically setting a start wavelength and a stop wavelength of a spectroscopic instrument; recording data of the electroluminescent spectrum by a spectroscopic instrument;
step S44, analysis and processing of spectrum data: further analyzing and processing the recorded electroluminescent spectrum data, wherein the specific analysis and processing steps comprise peak value positioning, spectrum smoothing and data normalization; and performing fault detection, quality assessment and analysis operation according to the analysis and processing results of the spectrum data, and determining the performance and defects of the plastic product.
6. The defect detection method of claim 5, wherein: the specific method for controlling the second electrode to contact the first electrode by the mechanical arm in the step S42 is as follows:
step I, pre-developing or acquiring a three-dimensional model or CAD data of a plastic product so as to establish a coordinate system of a block to be tested and a model of an electrode position;
step II, designing an inverse kinematics model based on the geometric shapes of the mechanical arm and the plastic product, and calculating the joint angle of the mechanical arm so as to realize the required position and posture of the second electrode;
step III, monitoring the contact force between the second electrode and the first electrode in real time by using a sensor, and adjusting the gesture and the position of the mechanical arm according to a force feedback control algorithm to keep the contact force in a proper range;
and IV, acquiring image information through a vision sensor, detecting and tracking the position of the first electrode through an image processing algorithm, and accurately positioning and adjusting by utilizing a machine vision technology.
7. A defect detection method according to claim 1, wherein: the specific steps of defect identification and result fusion by adopting a pattern identification algorithm in the step S5 are as follows:
step S51, feature extraction: extracting meaningful features from the collected electroluminescence spectrum data of the plastic product as input feature vectors; assume that two features are extracted: spectral peak position and peak intensity, then the eigenvector of one sample can be expressed as p= [ P ] 1 ,p 2 ]Wherein p is 1 Representing the spectral peak position, p 2 Representing peak intensity;
step S52, training data preparation: preparing a training data set with labels, wherein the data set comprises feature vectors of known normal samples and known defect samples and the labels corresponding to the feature vectors; let the training dataset be D = { (p) 1 ,q 1 ),(p 2 ,q 2 ),…,(p n ,q n ) Wherein p is 1 Is a feature vector, q 1 Is a label (normally 1, defect-1);
step S53, model training: training a support vector machine model using the training dataset D; the support vector machine separates normal samples from defective samples by finding an optimal hyperplane (decision boundary), where the support vector machine is:
f(p)=sign(W·P+b);
wherein W is a weight vector, P is an input feature vector, b is a bias, sign is a sign function;
step S54, defect identification: extracting photoluminescence spectrum data and feature vectors of a plastic sample to be detected; inputting the feature vector of the sample into a support vector machine model after training to obtain a prediction label of the sample, and if the prediction label is 1, indicating that the sample is classified as normal; if the predictive label is-1, then the specimen is classified as defective;
step S55, result fusion: the accuracy of defect detection is improved, and the result fusion is carried out by adopting a voting mode; using a plurality of trained support vector machine models, each model classifying and predicting samples based on different training data or parameter settings; and determining a final defect detection result by a voting mode according to the prediction results of the models, specifically, judging that the majority vote is normal, and judging that the majority vote is defective.
8. The utility model provides a defect detection device, includes laser emitter, arm, first electrode and second motor, its characterized in that: the laser transmitter is used for irradiating a block to be detected of the plastic product to be detected, and the mechanical arm is provided with the second electrode which is used for being in contact with the first electrode on the block to be detected to obtain an electroluminescent spectrum of the block to be detected.
9. The utility model provides a defect detection system, includes image acquisition device, photoluminescence measuring apparatu, control module and defect identification module, its characterized in that: the image acquisition device is used for acquiring visual images, the photoluminescence measurement device is used for acquiring photoluminescence spectra of the block to be measured, the control module is used for controlling actions of the mechanical arm, and the defect identification module is used for carrying out defect identification and result fusion.
10. A defect detection storage medium having stored thereon a computer program, which when executed by a processor performs the steps of the defect detection method of any of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311640332.1A CN117664984A (en) | 2023-12-01 | 2023-12-01 | Defect detection method, device, system and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311640332.1A CN117664984A (en) | 2023-12-01 | 2023-12-01 | Defect detection method, device, system and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117664984A true CN117664984A (en) | 2024-03-08 |
Family
ID=90074579
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311640332.1A Pending CN117664984A (en) | 2023-12-01 | 2023-12-01 | Defect detection method, device, system and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117664984A (en) |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20150070487A1 (en) * | 2012-05-09 | 2015-03-12 | Isra Vision Ag | Method and a device for the purpose of elctroluminescence inspection and/or photoluminescence inspection |
CN108344743A (en) * | 2018-02-02 | 2018-07-31 | 佛山职业技术学院 | One kind being based on machine vision drug blister package defect inspection method and system |
CN110220917A (en) * | 2019-06-11 | 2019-09-10 | 江苏农林职业技术学院 | A kind of crown plug surface defect online test method based on image procossing |
CN113834816A (en) * | 2021-09-30 | 2021-12-24 | 江西省通讯终端产业技术研究院有限公司 | Machine vision-based photovoltaic cell defect online detection method and system |
CN114705698A (en) * | 2022-06-02 | 2022-07-05 | 季华实验室 | Defect detection method, device, system and storage medium |
CN114842011A (en) * | 2022-07-04 | 2022-08-02 | 启东万惠机械制造有限公司 | Bearing wear detection method and system based on image processing |
-
2023
- 2023-12-01 CN CN202311640332.1A patent/CN117664984A/en active Pending
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20150070487A1 (en) * | 2012-05-09 | 2015-03-12 | Isra Vision Ag | Method and a device for the purpose of elctroluminescence inspection and/or photoluminescence inspection |
CN104471383A (en) * | 2012-05-09 | 2015-03-25 | 伊斯拉视像系统股份公司 | Method and apparatus for electroluminescence inspection and/or photoluminescence inspection |
CN108344743A (en) * | 2018-02-02 | 2018-07-31 | 佛山职业技术学院 | One kind being based on machine vision drug blister package defect inspection method and system |
CN110220917A (en) * | 2019-06-11 | 2019-09-10 | 江苏农林职业技术学院 | A kind of crown plug surface defect online test method based on image procossing |
CN113834816A (en) * | 2021-09-30 | 2021-12-24 | 江西省通讯终端产业技术研究院有限公司 | Machine vision-based photovoltaic cell defect online detection method and system |
CN114705698A (en) * | 2022-06-02 | 2022-07-05 | 季华实验室 | Defect detection method, device, system and storage medium |
CN114842011A (en) * | 2022-07-04 | 2022-08-02 | 启东万惠机械制造有限公司 | Bearing wear detection method and system based on image processing |
Non-Patent Citations (1)
Title |
---|
沈红雷: "基于机器视觉技术的塑料制品缺陷检测研究", 塑料科技, vol. 44, no. 08, 31 August 2016 (2016-08-31), pages 89 - 92 * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108355981B (en) | Battery connector quality detection method based on machine vision | |
CN111239158A (en) | Automobile instrument panel detection system and detection method based on machine vision | |
CN100480680C (en) | Multiple spectrum meat freshness artificial intelligence measurement method and system | |
Wu et al. | Train rail defect classification detection and its parameters learning method | |
CN110210448B (en) | Intelligent face skin aging degree identification and evaluation method | |
CN106501272B (en) | Machine vision soldering tin positioning detection system | |
CN107016353B (en) | A kind of integrated method and system of variable resolution target detection and identification | |
CN112862744B (en) | Intelligent detection method for internal defects of capacitor based on ultrasonic image | |
CN110096980A (en) | Character machining identifying system | |
CN1603794A (en) | Method and device for rapidly detecting tenderness of beef utilizing near infrared technology | |
CN107300562B (en) | X-ray nondestructive testing method for measuring contact distance of finished relay product | |
CN111753877A (en) | Product quality detection method based on deep neural network transfer learning | |
CN113269234B (en) | Connecting piece assembly detection method and system based on target detection | |
CN111145168A (en) | Method and system for detecting defects of carbon fiber composite material and storage medium | |
CN117197700B (en) | Intelligent unmanned inspection contact net defect identification system | |
CN102980536B (en) | Brake block steel back flatness detection system and method | |
US11599738B2 (en) | Method for examining distributed objects by segmenting an overview image | |
CN211856402U (en) | Automobile instrument panel detection system based on machine vision | |
CN117664984A (en) | Defect detection method, device, system and storage medium | |
WO2023098187A1 (en) | Processing method, processing apparatus, and processing system | |
US20150130926A1 (en) | Method And Apparatus For Mapping And Analyzing Surface Gradients | |
Limsripraphan et al. | Algorithm for mango classification using image processing and naive bayes classifier | |
Iwata et al. | AI-aided Hammering Test System to Automatically Generate Anomaly Maps. | |
CN102937602B (en) | Intelligent melting point instrument with machine vision and melting point measuring method | |
CN117576093B (en) | EL image-based solar cell piece hidden crack detection method |
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 |