A vision-based method for detecting appearance defects of earphone silicone gaskets
Through visual inspection methods and YOLO V3 algorithms combined with HOG features, the defect type and location of the earphone silicone gasket are automatically marked, which solves the problems of subjectivity and low accuracy of manual feature extraction in the existing technology, and improves the accuracy and versatility of detection. sex.
Patent Information
- Application Number
- CN202111167524.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-07
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2041-10-07
AI Technical Summary
The existing technology relies on manual extraction of features in the surface defect detection of earphone silicone gaskets, and has problems such as strong subjectivity, low accuracy, and poor robustness and versatility.
Using a vision-based detection method, we collect product images for preprocessing, extract the outer contour and minimum circumscribed rectangle, use the YOLO V3 algorithm to establish a surface defect detection model, combine HOG features and support vector machines for re-inspection, and automatically mark defect types and locations. .
It improves the accuracy and versatility of detection, reduces manual intervention, and enhances the algorithm's robustness and ability to adapt to complex environments.
Smart Images

Figure CN113989196B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer vision recognition, and in particular to a vision-based appearance defect detection method for earphone silicone gaskets. Background Art
[0002] As an industrial basic component, silicone gaskets are widely used in both military and civilian fields. The production process of silicone gaskets determines that defects such as burrs, lack of rubber, and blocked holes will occur during the production process. These defective products will pose a safety hazard when used, which may cause economic and even life and property losses. Therefore, they need to be picked out in time to prevent them from entering the market. At present, manufacturers mainly use manual methods to detect surface defects of silicone gaskets for headphones, which has problems such as reliance on manual experience, high false detection and missed detection rates, and low detection efficiency.
[0003] The existing methods for computer vision recognition of product surface defects include:
[0004] Zhang Wei et al. proposed to use the total variation model and conjugate matrix method to suppress texture for complex texture defects, and then use Roberts edge detection to obtain the defect contour and locate the defect position.
[0005] Sun Shifan et al. first used Hough transform and anisotropic diffusion filtering to preprocess the image, then used the Simple Linear Iterative Clustering (SLIC) algorithm based on superpixel segmentation to extract the defect contour, and finally identified and classified the defects through the random forest algorithm.
[0006] Shen Qi et al. based on the image features extracted by Gabor filters of different scales and directions, combined them with support vector machines (SVM), assisted by image preprocessing technology and feature dimensionality reduction, and trained a classifier that can identify surface defects of O-ring rubber sealing rings.
[0007] Existing technologies rely on manual feature extraction. The feature extraction process relies on prior knowledge and is highly subjective. The accuracy of detection is affected by the designer's personal experience. The steps for manual feature extraction are cumbersome, and when the detection environment changes, more cumbersome parameter settings are required or the features may become unavailable directly. The robustness and versatility of the algorithm are poor. Summary of the invention
[0008] In order to solve the above technical problems, an embodiment of the present invention provides a vision-based method for detecting appearance defects of earphone silicone gaskets.
[0009] A method for detecting appearance defects of earphone silicone gaskets based on vision comprises the following steps:
[0010] Collect product images of the upper and lower wide surfaces and two hole surfaces of the silicone gasket of the headset to be tested;
[0011] Preprocess the collected product images;
[0012] Extract the outer contour of the earphone silicone gasket in the product image, check whether the product area is within the set range, and recycle products that are not within the set range;
[0013] For product images whose product area is within the set range, extract the minimum circumscribed rectangle of its wide outline, check whether the product angle is within the set range, and recycle products that are not within the set range;
[0014] For product images with product angles within the set range, the corresponding surface defect images of the product to be tested are input into the pre-trained earphone silicone gasket surface defect detection model, and the defect type and bounding box are output;
[0015] Cut and extract the image of the defect area on the product surface defect image according to the bounding box;
[0016] The HOG method is used to extract the feature vector of the defect area image, and the feature vector is input into the trained defect re-inspection model for re-inspection. If the re-inspection result is still a defect, the type and location of the defect are marked on the defect image on the product surface, and the product is judged to be unqualified. If the re-inspection is not a defect, the re-inspection of the remaining defect boundary boxes will continue. If all defect boundary boxes are re-inspected as non-defective, the product is judged to be qualified.
[0017] Preferably, in the above-mentioned vision-based appearance defect detection method for earphone silicone gaskets, the product images of the upper and lower wide surfaces include a wide surface bright field image and a wide surface dark field image.
[0018] Preferably, in the above-mentioned vision-based appearance defect detection method for earphone silicone gasket, the preprocessing of the collected product image includes:
[0019] The four product images of the upper and lower wide surfaces and two hole surfaces of the silicone gasket of the headphone to be tested are fused to obtain defect images of different surfaces of the product.
[0020] Preferably, in the above-mentioned visual-based appearance defect detection method for earphone silicone gaskets, the step of inspecting whether the product area is within a set range includes:
[0021] Based on the contour area, it is determined whether there is a product in the image, whether the product is complete in the image, and whether only one product appears in the image.
[0022] Preferably, in the above-mentioned visual-based appearance defect detection method for earphone silicone gaskets, the step of inspecting whether the product angle is within a set range includes:
[0023] For the minimum circumscribed rectangle of the extracted product wide surface contour, calculate the angle between its major axis and the horizontal direction to determine whether the angle is within the set range.
[0024] Preferably, in the above-mentioned vision-based appearance defect detection method for earphone silicone gaskets, the pre-training process of the earphone silicone gasket surface defect detection model comprises the following steps:
[0025] A surface image is collected from the upper and lower wide surfaces and the two side hole surfaces of the earphone silicone gasket product, for a total of four images. After preprocessing, images of different surface defects of the product are obtained;
[0026] The types and locations of defects on the product surface defect images are annotated, and the product surface defect images and annotated images are used as data sets to obtain a total of four surface data sets;
[0027] The product surface defect image dataset is used as input, and a surface defect detection model for earphone silicone gaskets on different surfaces is established using the YOLO V3 algorithm;
[0028] The product surface defect image data is input into the trained corresponding earphone silicone gasket surface defect detection model, the defect type and bounding box are output, the corresponding defect area is cut and extracted on the product surface defect image according to the bounding box information, and the defect area image is output according to the type;
[0029] Manually classify defect area images of the same type into two categories: images with correctly detected defect areas and images with incorrectly detected defect areas, create corresponding label files, and use the defect area images and label files as defect area image classification datasets;
[0030] The obtained defect area image data classification dataset is used as input, and the feature vector is extracted using the directional gradient histogram HOG;
[0031] The HOG description features of the defect area image are taken as feature vectors and label files as input, and a defect re-inspection model of support vector machine (SVM) for defect re-inspection is established according to the defect type.
[0032] Preferably, in the above-mentioned vision-based appearance defect detection method for earphone silicone gaskets, the surface defect detection model of earphone silicone gaskets on different surfaces established by using the product surface defect image dataset as input through the YOLO V3 algorithm comprises the following steps:
[0033] The network extracts features in a convolutional manner to obtain feature maps of three scales: 13*13, 26*26, and 52*52. It then fuses the three feature maps and outputs three tensors for predicting the bounding box of the defect target.
[0034] Set the confidence threshold to perform non-maximum suppression on the predicted bounding box. The expression is:
[0035] Among them, i represents the category label, M is the candidate box with a large confidence score, and b i is the predicted box to be compared, I is the intersection-over-union ratio, and Nt is the threshold;
[0036] Set the loss function. The loss function mainly includes bounding box coordinate loss, target confidence loss and target classification loss. Set the maximum iteration i generations until the loss function value is not greater than the threshold or reaches the maximum number of iterations. The expression of the loss function is:
[0037]
[0038] Among them, Loss represents the mean square error, a loss cost calculation method; CoorErr represents the coordinate error, which calculates the cumulative error between the bounding box and the actual label; IOUErr represents the target error, which is used to accumulate the confidence weight of the box when there is no target and the confidence weight of the box containing the object; classErr represents the classification error, which is the error between the calculated value of the classifier and the label value, and the output of the activation function;
[0039] The product surface defect image data is input into the trained corresponding earphone silicone gasket surface defect detection model, and the defect type and bounding box are output. The corresponding defect area is cut and extracted from the product surface defect image according to the bounding box information, and the defect area image is output according to the type.
[0040] Manually classify defect area images of the same type into two categories: images with correctly detected defect areas and images with incorrectly detected defect areas, create corresponding label files, and use the defect area images and label files as defect area image classification datasets;
[0041] The obtained defect area image data classification dataset is used as input, HOG features are extracted, and a defect re-inspection model of support vector machine (SVM) is established.
[0042] Preferably, in the above-mentioned vision-based appearance defect detection method for earphone silicone gaskets, the extraction of HOG features and establishment of a defect re-inspection model of a support vector machine (SVM) include the following steps:
[0043] Use gamma correction to normalize the image contrast and reduce the impact of local illumination and shadows;
[0044] Use the formula to calculate the magnitude and direction of the gradient;
[0045] Divide the image into small units, obtain the gradient direction histogram statistically, and use the gradient direction histogram as the descriptor of each unit;
[0046] Every few units are grouped into a block, and the descriptors of all units in a block are connected in series to obtain the feature descriptor of the block;
[0047] The feature descriptors of all blocks in the defect area image are connected in series to obtain the HOG descriptor of the defect area;
[0048] The HOG descriptor of the defect area image is used as a feature vector and a label file as input, and a defect re-inspection model of a support vector machine (SVM) for defect re-inspection is established according to the defect type.
[0049] Preferably, in the above-mentioned visual-based appearance defect detection method for earphone silicone gasket, the amplitude and direction of the gradient are expressed as:
[0050] G x (x,y)=H(x+1,y)-H(x-1,y),
[0051] G y (x,y)=H(x,y+1)-H(x,y-1);
[0052]
[0053]
[0054] Among them, G x (x,y),G y (x, y), H(x, y) represent the horizontal gradient, vertical gradient and pixel value at the pixel point (x, y) in the input image respectively. represents the magnitude of the gradient, and θ(x,y) represents the direction of the gradient.
[0055] The beneficial effects of the present invention are as follows: the appearance defect detection method of the present invention provides a universal training process, and the algorithm can "learn" the characteristics of various defects from the training data, eliminating the step of manually extracting features, ensuring the accuracy of the algorithm, and improving the universality and intelligence of the defect detection method. By increasing the training samples in complex environments, it can also adapt to complex detection environments, thereby improving the robustness of the algorithm. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0057] Figure 1 It is a flow chart of the present invention in the detection stage;
[0058] Figure 2 Flow chart of the model training phase of the present invention. DETAILED DESCRIPTION
[0059] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0060] like Figure 1 As shown, an embodiment of the present invention provides a method for detecting appearance defects of a silicone gasket of an earphone based on vision, comprising the following steps:
[0061] Collect product images of the upper and lower wide surfaces and two hole surfaces of the silicone gasket of the headset to be tested;
[0062] Preprocess the collected product images;
[0063] Extract the outer contour of the earphone silicone gasket in the product image, check whether the product area is within the set range, and recycle products that are not within the set range;
[0064] For product images whose product area is within the set range, extract the minimum circumscribed rectangle of its wide outline, check whether the product angle is within the set range, and recycle products that are not within the set range;
[0065] For product images with product angles within the set range, the corresponding surface defect images of the product to be tested are input into the pre-trained earphone silicone gasket surface defect detection model, and the defect type and bounding box are output;
[0066] Cut and extract the image of the defect area on the product surface defect image according to the bounding box;
[0067] The HOG method is used to extract the feature vector of the defect area image, and the feature vector is input into the trained defect re-inspection model for re-inspection. If the re-inspection result is still a defect, the type and location of the defect are marked on the defect image on the product surface, and the product is judged to be unqualified. If the re-inspection is not a defect, the re-inspection of the remaining defect boundary boxes will continue. If all defect boundary boxes are re-inspected as non-defective, the product is judged to be qualified.
[0068] Preferably, in the above-mentioned vision-based appearance defect detection method for earphone silicone gaskets, the product images of the upper and lower wide surfaces include a wide surface bright field image and a wide surface dark field image.
[0069] Preferably, in the above-mentioned vision-based appearance defect detection method for earphone silicone gasket, the preprocessing of the collected product image includes:
[0070] The four product images of the upper and lower wide surfaces and two hole surfaces of the silicone gasket of the headphone to be tested are respectively subjected to processing including but not limited to grayscale, histogram equalization and Gaussian smoothing to obtain four images with a high signal-to-noise ratio and defect images of different surfaces of the product.
[0071] Preferably, in the above-mentioned visual-based appearance defect detection method for earphone silicone gaskets, the step of inspecting whether the product area is within a set range includes:
[0072] The contour area is used to determine whether there is a product in the image, whether the product is complete in the image, and whether there is only one product in the image. The purpose of determining whether there is only one product in the image is to ensure that there is only one product on a single imaging surface, otherwise the algorithm logic will determine recycling instead of detecting defects.
[0073] Preferably, in the above-mentioned visual-based appearance defect detection method for earphone silicone gaskets, the step of inspecting whether the product angle is within a set range includes:
[0074] For the minimum circumscribed rectangle of the extracted product wide surface contour, calculate the angle between its major axis and the horizontal direction to determine whether the angle is within the set range.
[0075] Furthermore, if Figure 2 As shown, the pre-training process of the headphone silicone gasket surface defect detection model includes the following steps:
[0076] A surface image is collected from the upper and lower wide surfaces and the two side hole surfaces of the earphone silicone gasket product, for a total of four images. After preprocessing, images of different surface defects of the product are obtained;
[0077] The types and locations of defects on the product surface defect images are annotated, and the product surface defect images and annotated images are used as data sets to obtain a total of four surface data sets;
[0078] The product surface defect image dataset is used as input, and a surface defect detection model for earphone silicone gaskets on different surfaces is established using the YOLO V3 algorithm;
[0079] The product surface defect image data is input into the trained corresponding earphone silicone gasket surface defect detection model, the defect type and bounding box are output, the corresponding defect area is cut and extracted on the product surface defect image according to the bounding box information, and the defect area image is output according to the type;
[0080] Manually classify defect area images of the same type into two categories: images with correctly detected defect areas and images with incorrectly detected defect areas, create corresponding label files, and use the defect area images and label files as defect area image classification datasets;
[0081] The obtained defect area image data classification dataset is used as input, and the feature vector is extracted using the directional gradient histogram HOG;
[0082] The HOG description features of the defect area image are taken as feature vectors and label files as input, and a defect re-inspection model of support vector machine (SVM) for defect re-inspection is established according to the defect type.
[0083] Preferably, in the above-mentioned vision-based appearance defect detection method for earphone silicone gaskets, the surface defect detection model of earphone silicone gaskets on different surfaces established by using the product surface defect image dataset as input through the YOLO V3 algorithm comprises the following steps:
[0084] The network extracts features in a convolutional manner to obtain feature maps of three scales: 13*13, 26*26, and 52*52. It then fuses the three feature maps and outputs three tensors for predicting the bounding box of the defect target.
[0085] Set the confidence threshold to perform non-maximum suppression on the predicted bounding box. The expression is:
[0086] Among them, i represents the category label, M is the candidate box with a large confidence score, and b i is the predicted box to be compared, I is the intersection-over-union ratio, and Nt is the threshold;
[0087] Set the loss function. The loss function mainly includes bounding box coordinate loss, target confidence loss and target classification loss. Set the maximum iteration i generations until the loss function value is not greater than the threshold or reaches the maximum number of iterations. The expression of the loss function is:
[0088]
[0089] Among them, Loss represents the mean square error, a loss cost calculation method; CoorErr represents the coordinate error, which calculates the cumulative error between the bounding box and the actual label; IOUErr represents the target error, which is used to accumulate the confidence weight of the box when there is no target and the confidence weight of the box containing the object; classErr represents the classification error, which is the error between the calculated value of the classifier and the label value, and the output of the activation function;
[0090] The product surface defect image data is input into the trained corresponding earphone silicone gasket surface defect detection model, and the defect type and bounding box are output. The corresponding defect area is cut and extracted from the product surface defect image according to the bounding box information, and the defect area image is output according to the type.
[0091] Manually classify defect area images of the same type into two categories: images with correctly detected defect areas and images with incorrectly detected defect areas, create corresponding label files, and use the defect area images and label files as defect area image classification datasets;
[0092] The obtained defect area image data classification dataset is used as input, HOG features are extracted, and a defect re-inspection model of support vector machine (SVM) is established.
[0093] Preferably, in the above-mentioned vision-based appearance defect detection method for earphone silicone gaskets, the extraction of HOG features and establishment of a defect re-inspection model of a support vector machine (SVM) include the steps of:
[0094] Use gamma correction to normalize the image contrast and reduce the impact of local illumination and shadows;
[0095] Use the formula to calculate the magnitude and direction of the gradient;
[0096] Divide the image into small units, obtain the gradient direction histogram statistically, and use the gradient direction histogram as the descriptor of each unit;
[0097] Every few units are grouped into a block, and the descriptors of all units in a block are connected in series to obtain the feature descriptor of the block;
[0098] The feature descriptors of all blocks in the defect area image are connected in series to obtain the HOG descriptor of the defect area;
[0099] The HOG descriptor of the defect area image is used as a feature vector and a label file as input, and a defect re-inspection model of a support vector machine (SVM) for defect re-inspection is established according to the defect type.
[0100] Preferably, in the above-mentioned visual-based appearance defect detection method for earphone silicone gasket, the amplitude and direction of the gradient are expressed as:
[0101] G x (x,y)=H(x+1,y)-H(x-1,y),
[0102] G y (x,y)=H(x,y+1)-H(x,y-1);
[0103]
[0104]
[0105] Among them, G x (x,y),G y (x, y), H(x, y) represent the horizontal gradient, vertical gradient and pixel value at the pixel point (x, y) in the input image respectively. represents the magnitude of the gradient, and θ(x,y) represents the direction of the gradient.
[0106] The present invention proposes a new method for detecting surface defects of earphone silicone gaskets, which improves the accuracy and versatility of appearance defect detection of earphone silicone gaskets. The method provides a universal training process, and the algorithm can "learn" the characteristics of various defects from the training data, eliminating the step of manual feature extraction, thereby improving the versatility and intelligence of the defect detection method. By increasing the learning of samples in complex environments, the detection accuracy in complex environments can be improved. During the detection process, there is no need for complex manual feature extraction steps, and a universal training process can be used to establish a model for all defect types, which has stronger versatility. The present method can detect multiple defects on an image, not only can it detect the type of defects, but also can locate the position of the defects on the image, and the detection accuracy is higher.
[0107] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.
Claims
1. A visual-based method for detecting appearance defects of earphone silicone gaskets, characterized in that: The steps include: Collect product images of the upper and lower wide surfaces and two hole surfaces of the silicone gasket of the headset to be tested; Preprocess the collected product images; Extract the outer contour of the earphone silicone gasket in the product image, check whether the product area is within the set range, and recycle products that are not within the set range; For product images whose product area is within the set range, extract the minimum circumscribed rectangle of its wide outline, check whether the product angle is within the set range, and recycle products that are not within the set range; For product images with product angles within the set range, the corresponding surface defect images of the product to be tested are input into the pre-trained earphone silicone gasket surface defect detection model, and the defect type and bounding box are output; Cut and extract the image of the defect area on the product surface defect image according to the bounding box; The HOG method is used to extract the feature vector of the defect area image, and the feature vector is input into the trained defect re-inspection model for re-inspection. If the re-inspection result is still a defect, the type and location of the defect are marked on the defect image on the product surface, and the product is judged to be unqualified. If the re-inspection is not a defect, the re-inspection of the remaining defect boundary boxes will continue. If all defect boundary boxes are re-inspected as non-defective, the product is judged to be qualified.
2. The visual-based appearance defect detection method for earphone silicone gaskets according to claim 1 is characterized in that: The product images of the upper and lower wide surfaces include a wide surface bright field image and a wide surface dark field image.
3. The visual-based appearance defect detection method for earphone silicone gaskets according to claim 1 is characterized in that: The preprocessing of the collected product images includes: The four product images of the upper and lower wide surfaces and two hole surfaces of the silicone gasket of the headphone to be tested are respectively subjected to processing including but not limited to grayscale, histogram equalization and Gaussian smoothing to obtain four images with a high signal-to-noise ratio and defect images of different surfaces of the product.
4. The visual-based appearance defect detection method for earphone silicone gaskets according to claim 1 is characterized in that: The inspection of whether the product area is within the set range includes: Based on the contour area, it is determined whether there is a product in the image, whether the product is complete in the image, and whether only one product appears in the image.
5. The visual-based appearance defect detection method for earphone silicone gaskets according to claim 1 is characterized in that: The checking whether the product angle is within the set range includes: For the minimum circumscribed rectangle of the extracted product wide surface contour, calculate the angle between its major axis and the horizontal direction to determine whether the angle is within the set range.
6. The visual-based appearance defect detection method for earphone silicone gaskets according to claim 1 is characterized in that: The pre-training process of the headphone silicone gasket surface defect detection model includes the following steps: A surface image is collected from the upper and lower wide surfaces and the two side hole surfaces of the earphone silicone gasket product, for a total of four images. After preprocessing, images of different surface defects of the product are obtained; The types and locations of defects on the product surface defect images are annotated, and the product surface defect images and annotated images are used as data sets to obtain a total of four surface data sets; The product surface defect image dataset is used as input, and a surface defect detection model for earphone silicone gaskets on different surfaces is established using the YOLO V3 algorithm; The product surface defect image data is input into the trained corresponding earphone silicone gasket surface defect detection model, the defect type and bounding box are output, the corresponding defect area is cut and extracted on the product surface defect image according to the bounding box information, and the defect area image is output according to the type; Manually classify defect area images of the same type into two categories: images with correctly detected defect areas and images with incorrectly detected defect areas, create corresponding label files, and use the defect area images and label files as defect area image classification datasets; The obtained defect area image data classification dataset is used as input, and the feature vector is extracted using the directional gradient histogram HOG; The HOG description features of the defect area image are taken as feature vectors and label files as input, and a defect re-inspection model of support vector machine (SVM) for defect re-inspection is established according to the defect type.
7. The visual-based appearance defect detection method for earphone silicone gaskets according to claim 6 is characterized in that: The surface defect detection model of earphone silicone gaskets on different surfaces is established by using the product surface defect image dataset as input through the YOLO V3 algorithm, including the following steps: The network extracts features in a convolutional manner to obtain feature maps of three scales: 13*13, 26*26, and 52*52. It then fuses the three feature maps and outputs three tensors for predicting the bounding box of the defect target. Set the confidence threshold to perform non-maximum suppression on the predicted bounding box. The expression is: Among them, i represents the category label, M is the candidate box with a large confidence score, and b i is the predicted box to be compared, I is the intersection-over-union ratio, and Nt is the threshold; Set the loss function. The loss function mainly includes bounding box coordinate loss, target confidence loss and target classification loss. Set the maximum iteration i generations until the loss function value is not greater than the threshold or reaches the maximum number of iterations. The expression of the loss function is: Among them, Loss represents the mean square error, a loss cost calculation method; coorErr represents the coordinate error, which calculates the cumulative error between the bounding box and the actual label; IOUErr represents the target error, which is used to accumulate the confidence weight of the box when there is no target and the confidence weight of the box containing the object; classErr represents the classification error, which is the error between the calculated value of the classifier and the label value, and the output of the activation function; The product surface defect image data is input into the trained corresponding earphone silicone gasket surface defect detection model, and the defect type and bounding box are output. The corresponding defect area is cut and extracted from the product surface defect image according to the bounding box information, and the defect area image is output according to the type. Manually classify defect area images of the same type into two categories: images with correctly detected defect areas and images with incorrectly detected defect areas, create corresponding label files, and use the defect area images and label files as defect area image classification datasets; The obtained defect area image data classification dataset is used as input, HOG features are extracted, and a defect re-inspection model of support vector machine (SVM) is established.
8. The visual-based appearance defect detection method for earphone silicone gaskets according to claim 7, characterized in that: The extraction of HOG features and establishment of a defect re-inspection model of a support vector machine (SVM) include the following steps: Use gamma correction to normalize the image contrast and reduce the impact of local illumination and shadows; Use the formula to calculate the magnitude and direction of the gradient; Divide the image into small units, obtain the gradient direction histogram statistically, and use the gradient direction histogram as the descriptor of each unit; Every few units are grouped into a block, and the descriptors of all units in a block are connected in series to obtain the feature descriptor of the block; The feature descriptors of all blocks in the defect area image are connected in series to obtain the HOG descriptor of the defect area; The HOG descriptor of the defect area image is used as a feature vector and a label file as input, and a defect re-inspection model of a support vector machine (SVM) for defect re-inspection is established according to the defect type.
9. The visual-based appearance defect detection method for earphone silicone gaskets according to claim 8, characterized in that: The magnitude and direction of the gradient are expressed as: G x (x,y)=H(x+1,y)-H(x-1,y), G y (x,y)=H(x,y+1)-H(x,y-1); Among them, G x (x,y),G y (x, y), H(x, y) represent the horizontal gradient, vertical gradient and pixel value at the pixel point (x, y) in the input image respectively. represents the magnitude of the gradient, and θ(x,y) represents the direction of the gradient.
Citation Information
Patent Citations
Insulation terminal defect recognition method based on patrol robot
CN109447949A
Wireless earphone appearance surface glue overflow detection method and detection system
CN111812106A
