PCB earphone electronic component surface identification system and method

By optimizing the YOLO model and combining it with a position loss and confidence screening mechanism, the problems of low efficiency and poor accuracy in the surface inspection of PCB board headphone electronic components are solved, achieving high-precision and automated defect identification that is adaptable to multiple models and environmental conditions.

CN121504855APending Publication Date: 2026-02-10GUANGDONG XINGWEI INTELLIGENT TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511659077.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-13
Publication Date
2026-02-10

AI Technical Summary

Technical Problem

Existing technologies for surface inspection of PCB board headphone electronic components suffer from low efficiency, poor accuracy, and insufficient adaptability. In particular, they are difficult to achieve high-precision defect identification when faced with multiple models, different environments, and changes in lighting.

Method used

By employing the YOLO model combined with location loss and confidence screening mechanisms, and through image enhancement and background subtraction techniques, we constructed a dataset with multiple models, illumination levels, and angles, and optimized the YOLO model to improve detection accuracy and robustness.

Benefits of technology

It enables precise location of minute defects, significantly reduces false detection and missed detection rates, improves detection efficiency and adaptability, meets the needs of high-speed production lines, and achieves full-process automation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121504855A_ABST
    Figure CN121504855A_ABST
Patent Text Reader

Abstract

The invention relates to a PCB earphone electronic component surface identification system and method, and belongs to the technical field of electronic component detection. The method comprises the steps of collecting multi-model PCB earphone images to construct a data set, and performing preprocessing through image enhancement and background segmentation; marking defect areas by using a YOLO model, calculating position loss and setting a judgment threshold value to screen areas with small marking errors; calculating defect confidence, determining defect authenticity through a screening threshold, and optimizing the model; and inputting a to-be-detected image into the optimization model, and outputting defect positions and types. The system comprises a data acquisition module, a preprocessing module, a model training module, a defect detection module and an output module. According to the invention, fine defects can be accurately positioned, the detection efficiency and accuracy are improved, the method adapts to multi-environment changes, and automatic detection is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of electronic component testing technology, specifically to a PCB board headphone electronic component surface identification system and method. Background Technology

[0002] As electronic products trend towards miniaturization and high density, the printed circuit board (PCB), as a core component of electronic devices, directly determines the reliability and performance of the product. Especially in portable audio devices such as headphones, surface defects in electronic components soldered onto the PCB, such as solder balls, cold solder joints, misalignment, and cracks, will severely impact signal transmission quality and product lifespan.

[0003] Currently, quality inspection of electronic components on PCB boards still mainly relies on manual visual inspection or traditional machine vision methods. Manual inspection suffers from low efficiency, strong subjectivity, fatigue, and poor consistency, making it difficult to meet the speed and accuracy requirements of large-scale production. Traditional machine vision methods mostly rely on preset thresholds or rules, which are poorly adaptable to changes in lighting, the diversity of component types, and the complexity of defect morphologies, easily leading to false positives or false negatives.

[0004] In recent years, deep learning-based visual inspection technologies, especially one-stage object detection models represented by the YOLO model, have been increasingly applied in the field of industrial quality inspection due to their efficiency and accuracy. However, in specific PCB headphone component scenarios, the small size of the components and the minute defects make it difficult for the model to accurately locate them; the large differences in images of PCB boards from different production lines and different models result in insufficient model generalization ability; the small number of defect samples and the imbalance of categories affect the model training effect; and the frequent changes in lighting and angles in actual production lines interfere with the stability of detection.

[0005] Therefore, there is an urgent need to develop an intelligent identification system and method for the surface of PCB board headphone electronic components that can adapt to multiple models, multiple environments, and high precision, so as to improve detection efficiency and accuracy and meet the high-quality control requirements of modern electronic manufacturing. Summary of the Invention

[0006] To address the shortcomings of the existing technology, this invention proposes a PCB board headphone electronic component surface identification system and method.

[0007] The technical solution of this invention is implemented as follows:

[0008] A method for surface identification of headphone electronic components on a PCB board, characterized by comprising the following steps:

[0009] Step 1: Collect images of electronic components from different PCB boards to construct a dataset, and perform preprocessing to segment the background image and the electronic component image;

[0010] Step 2: Obtain the YOLO model, analyze the electronic component image, mark the area with surface defects in the electronic component image, define it as the target area, calculate the position loss based on the target area, set the judgment threshold, if the position loss is greater than the judgment threshold, it means that the marking error of the target area being analyzed is small;

[0011] Step 3: Calculate the probability distribution for target areas with small marking errors, determine the confidence level of surface defects, set a screening threshold, and if the confidence level is greater than the screening threshold, the authenticity of the existence of surface defects in the current target area is obtained. The location result of the target area is obtained through the probability distribution, thereby optimizing the YOLO model.

[0012] Step 4: Obtain the image of the electronic component to be inspected, input it into the optimized YOLO model, and obtain the localization result, which includes the location and type of surface defects.

[0013] In this invention, Step 1 includes:

[0014] Image enhancement processing is performed on the images of electronic components in the dataset. The enhancement methods include at least one of rotation, scaling, flipping, and filtering.

[0015] The enhanced image was segmented from the background and the electronic component image using the background subtraction method;

[0016] The segmented electronic component images are scaled and standardized.

[0017] In this invention, during the image enhancement process,

[0018] The rotation angle range is [-30°, 30°], the scaling ratio is [0.8, 1.2], the horizontal flip probability is 0.5, and the vertical flip probability is 0.2.

[0019] Use Gaussian filtering or median filtering for noise suppression;

[0020] Adjust the brightness variation range by ±10% and the contrast variation range by ±15%.

[0021] In this invention, the formula for calculating the position loss in Step 2 is:

[0022]

[0023] in, Indicates the first Location loss in the target area; Indicates the first The weights corresponding to each target region; Represents the actual geometric center coordinates of the target area; This indicates the predicted width and height of the target area.

[0024] In this invention, the judgment threshold is 0.7.

[0025] In this invention, Step 3 includes:

[0026] For target areas with small marking errors, calculate the probability distribution to determine the confidence level of surface defects. The corresponding calculation formula is as follows:

[0027]

[0028] in, Indicates confidence level; Indicates the first Probability distribution of each target region; Indicates the first The geometric center coordinates of the target region; Indicates the number of target regions.

[0029] In this invention, the screening threshold is 0.9.

[0030] In this invention, in Step 1, the dataset includes images of at least 10 different models of PCB board headphones, with no less than 1,000 images for each model. The image acquisition conditions include natural light, fluorescent light, and LED light illumination, and the acquisition angles include 0°, 45°, and 90°.

[0031] A PCB board headphone electronic component surface identification system, characterized in that the surface identification system comprises:

[0032] The data acquisition module is used to acquire images of electronic components and build datasets;

[0033] The preprocessing module is used to enhance, segment, scale, and normalize the image.

[0034] The model training module is used to train the YOLO model and optimize its parameters.

[0035] The defect detection module is used to identify and locate defects in the input image;

[0036] The output module is used to output the location, type, and confidence level of defects.

[0037] The PCB board headphone electronic component surface identification system and method of the present invention have the following beneficial effects:

[0038] By combining the optimized YOLO model with location loss and confidence screening mechanisms, subtle defects can be accurately located, significantly reducing false detection and false negative rates.

[0039] The model is trained using image datasets with multiple models, lighting conditions, and angles, and combined with image enhancement and background subtraction techniques to improve its generalization ability and robustness in different production line environments.

[0040] The YOLO model has real-time processing capabilities. Combined with optimized preprocessing and postprocessing workflows, it can complete defect identification and localization of a single image within milliseconds, meeting the needs of high-speed production lines.

[0041] The system integrates modules for data acquisition, preprocessing, model training, defect detection, and result output, achieving full automation from image input to defect reporting and reducing manual intervention. Attached Figure Description

[0042] Figure 1 This is a flowchart of the PCB board headphone electronic component surface identification method of the present invention;

[0043] Figure 2 This is a flowchart of the PCB board headphone electronic component surface identification method of the present invention;

[0044] Figure 3 This is a structural block diagram of the PCB board headphone electronic component surface identification system of the present invention.

[0045] The attached diagram is labeled as follows: Acquisition module 10, Preprocessing module 20, Model training module 30, Defect detection module 40, and Output module 50. Detailed Implementation

[0046] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.

[0047] Example 1

[0048] Reference Figure 1 As shown, the first embodiment of the present invention proposes a method for surface identification of headphone electronic components on a PCB board, comprising the following steps:

[0049] Step 1: Collect images of electronic components from different PCB boards to construct a dataset, and perform preprocessing to segment the background image and the electronic component image;

[0050] Step 2: Obtain the YOLO model, analyze the electronic component image, mark the area with surface defects in the electronic component image, define it as the target area, calculate the position loss based on the target area, set the judgment threshold, if the position loss is greater than the judgment threshold, it means that the marking error of the target area being analyzed is small;

[0051] Step 3: Calculate the probability distribution for target areas with small marking errors, determine the confidence level of surface defects, set a screening threshold, and if the confidence level is greater than the screening threshold, the authenticity of the existence of surface defects in the current target area is obtained. The location result of the target area is obtained through the probability distribution, thereby optimizing the YOLO model.

[0052] Step 4: Obtain the image of the electronic component to be inspected, input it into the optimized YOLO model, and obtain the localization result, which includes the location and type of surface defects.

[0053] As an optional implementation method, in this embodiment, the YOLO model is YOLOv5, which has higher detection accuracy and faster detection speed. It is suitable for real-time intelligent localization of surface defects in electronic components. Its powerful feature extraction capability can accurately analyze electronic component images and mark the areas of surface defects, making the detection process more efficient and reducing the consumption of computing resources. In addition, the YOLOv5 model also has good generalization ability and can adapt to the detection of electronic component images under different PCB boards and different lighting conditions, improving the accuracy and reliability of detection.

[0054] Furthermore, Step 1 includes:

[0055] Based on the dataset, image enhancement processing is performed on the electronic component images in the dataset using any of the following methods: rotation, scaling, flipping, or filtering. The enhanced electronic component images are then segmented into background and electronic component images using the background subtraction method. Finally, the electronic component images are scaled and standardized.

[0056] Specifically, a dataset is constructed by collecting images of electronic components from different PCB board headphones, i.e., headphones from different production lines and different models. This ensures that the dataset contains diverse electronic components to improve the model's generalization ability. The electronic component images are then preprocessed, including rotation to enhance data diversity; scaling to simulate sample collection effects at different distances; and flipping (horizontal or vertical) to achieve sample effects from various angles. Smoothing filters are applied to the electronic component images to reduce noise. Background subtraction is used to separate the electronic component images from the background images for better identification. Finally, the electronic component images are scaled and standardized to a standard size to unify the size of the electronic component images used in model training, thereby improving the model's processing efficiency.

[0057] Furthermore, Step 2 includes:

[0058] Step 21: Based on the YOLO model, mark the target region in the preprocessed electronic component image and obtain the geometric center coordinates of the target region, denoted as... ,in, Represents the first in the image of electronic components The geometric center coordinates of each target region; These represent the coordinate values ​​corresponding to the coordinates after constructing a coordinate system with the lower left corner of the electronic component image as the center.

[0059] It is explained that by using the geometric center coordinates of the target region, statistical analysis can be performed on the target region in multiple electronic component images to determine the main components or abnormal regions in the image. Furthermore, by using the geometric coordinates as input information, the YOLO model can be trained to more accurately identify and locate the target region in electronic component images.

[0060] Step 22: Calculate the location loss based on the target area. The corresponding calculation formula is as follows:

[0061]

[0062] in, Indicates the first Location loss in the target area; Indicates the first The weights corresponding to each target region; Represents the actual geometric center coordinates of the target area; This indicates the predicted width and height of the target area;

[0063] It should be noted that the actual geometric center coordinates refer to the true position of the target area in the electronic component image; the predicted geometric center coordinates refer to the position of the target area predicted by the YOLO model; and the position loss reflects the degree of deviation between the target area predicted by the model and the actual target area.

[0064] Step 23: Set a judgment threshold. If the position loss is greater than the judgment threshold, it means that the marking error between the current target area marked by the YOLO model and the actual target area is small, indicating that there are surface defects in the current target area.

[0065] Optionally, in this embodiment, the threshold is 0.7.

[0066] The explanation is that by comparing the position loss and the judgment threshold, we can determine whether the labeling error between the predicted target area and the actual target area is acceptable. In other words, we can obtain the overlap between the predicted target area and the actual target area to determine whether the target area currently identified by the YOLO model is effective. This ensures that the labeling error is small and indicates that there are surface defects when predicting and identifying the target area, thereby improving the model's prediction accuracy.

[0067] Furthermore, Step 3 includes:

[0068] Step 31: Calculate the probability distribution for target areas with small marking errors to determine the confidence level of surface defects. The corresponding calculation formula is:

[0069]

[0070] in, Indicates confidence level; Indicates the first Probability distribution of each target region; Indicates the first The geometric center coordinates of the target region; Indicates the number of target regions.

[0071] The confidence level reflects the authenticity of the currently marked target area. The higher the confidence level, the more realistic the surface defect situation in the currently marked area is. By calculating the confidence level, target areas with small marking errors and high confidence in surface defects can be screened out, ensuring the accuracy and reliability of surface defect location. This ensures that the system can more accurately locate defect areas during subsequent operation, thereby achieving better detection results.

[0072] Step 32: Set a filtering threshold. If the confidence level is greater than the filtering threshold, it means that the target area being analyzed has surface defects. The geometric center coordinates of the target area are determined by the input data of the probability distribution, thus realizing the location of the target area.

[0073] It can be noted that in this embodiment, the screening threshold is 0.9. That is, when the confidence level is greater than the screening threshold, it is determined that there must be a surface defect in the target area. Conversely, when the confidence level is less than the screening threshold, it means that some target areas that do not meet the surface defect conditions have been identified. Once the existence of surface defects is confirmed, the geometric center coordinates of the target area are determined using the input data of the probability distribution, so as to achieve accurate positioning of the target area and prepare for subsequent repair or rejection of defective products.

[0074] As explained, in Step 4, the image of the electronic component to be inspected is acquired and input into the optimized YOLO model to obtain the positioning result. The positioning result includes the location and category of surface defects; that is, it can determine the location coordinates of surface defects and cover the category to which the defects belong, such as solder balls, cold solder joints, and offsets, so as to achieve accurate positioning of the electronic component image on the PCB board, which is conducive to subsequent targeted processing by the system and thus improves the efficiency of inspection.

[0075] In the first embodiment of the present invention, in Step 1, images are collected from at least 10 different models of PCB board headphone production lines, covering common electronic components such as resistors, capacitors, and solder joints to ensure data diversity. No fewer than 1000 images are collected for each model, resulting in a total dataset size of over 10,000 images.

[0076] Under natural light, fluorescent light, and LED light illumination, images are captured using an industrial camera with a resolution of at least 5 megapixels. The images are in RGB format and saved as JPG or PNG. Simultaneously, images are captured from different angles (0°, 45°, 90°) to simulate actual inspection scenarios.

[0077] Use annotation tools to manually annotate surface solder balls, cold solder joints, offsets, and cracks in the image, and generate annotation files in YOLO format;

[0078] Furthermore, the random rotation angle range was set to [-30°, 30°] to enhance the model's learning of rotation invariance. The scaling ratio was set to [0.8, 1.2] to simulate image size changes at different acquisition distances. The horizontal flip probability was set to 0.5, and the vertical flip probability was set to 0.2 to enhance angular diversity. Gaussian filtering (kernel size 3×3) or median filtering (kernel size 5×5) was used to reduce image noise while avoiding loss of detail. Random brightness adjustment (brightness variation range ±10%) and contrast adjustment (contrast variation range ±15%) were added to improve the model's robustness to illumination changes.

[0079] A Gaussian Mixture Model (GMM) is used for background modeling, and the background model is dynamically updated to adapt to changes in illumination. After segmentation, the image of the electronic components is used as the foreground, and the background is set to black.

[0080] The images of electronic components are uniformly scaled to 640×640 pixels (the default input size of YOLOv5), and the pixel values ​​are standardized using the formula: pixel value = (pixel value - mean) / standard deviation, where the mean = [0.485, 0.456, 0.406] and the standard deviation = [0.229, 0.224, 0.225].

[0081] Example 2

[0082] Reference Figure 1 As shown, the second embodiment of the present invention proposes a PCB board headphone electronic component surface identification system, which includes a data acquisition module 10, a preprocessing module 20, a model training module 30, a defect detection module 40, and an output module 50.

[0083] Through the data acquisition module 10 and the preprocessing module 20, complex images in the real world are transformed into standardized and clean feature data. Then, the model training module 30 uses this data to train the YOLOv5 neural network to identify and locate various defect patterns. Finally, the defect detection module 40 applies the trained model to the actual production line, analyzes the input electronic component images in real time, accurately finds the location and type of defects, and presents the results to the user in a visualized and structured manner or triggers automated actions through the output module 50.

[0084] The data acquisition module 10 begins with image capture in the physical world. An industrial camera is triggered to capture images when conditions such as a PCB board arriving at the inspection station, ensuring clear images and accurate focus. The acquired raw RGB images are then sent to the data management pipeline. The data annotation unit is the core processing step of this module. Annotators use an interactive interface to precisely draw bounding boxes on the images and associate each box with a defect category label. Annotation information such as image paths, bounding box coordinates, and category IDs are structured and stored in files of a specific format. Through algorithms such as random sampling and annotation consistency checks, the accuracy of the dataset's annotations is ensured, laying a solid foundation for reliable model learning.

[0085] The preprocessing module 20 creates a large number of new training samples by performing a series of affine transformations such as image rotation, scaling, and flipping, and adjusting brightness and contrast, as well as adding noise and filtering at the pixel level, without changing the essential content of the image. This is equivalent to exposing the model to various possible imaging conditions during training, enabling it to learn to grasp the essential features of defects rather than memorizing irrelevant backgrounds or angles. Subsequently, a Gaussian mixture model is used to model the image sequence, distinguishing between static backgrounds and dynamic foregrounds. A background subtraction algorithm is then used to accurately separate the target object, greatly reducing background interference. Finally, the normalization unit scales all processed images to a uniform size and normalizes pixel values ​​to conform to the expected distribution of the neural network input, accelerating the convergence process of model training.

[0086] The model training module 30 inputs the preprocessed image and its corresponding annotation file into the YOLOv5 network structure. Deep feature extraction is performed to generate feature maps at different scales; then feature fusion is performed, combining deep semantic information with shallow location information; finally, bounding boxes, confidence scores, and class probabilities are predicted for each grid cell in the feature map. CIoU Loss is calculated to accurately measure the difference in position and shape between the predicted and ground truth boxes, while classification loss and confidence loss are also calculated. The sum of these loss values ​​is used to adjust the weight parameters of millions of neurons in the network through backpropagation, with the goal of minimizing the total loss, i.e., making the model's predictions infinitely close to the ground truth annotations.

[0087] The defect detection module 40 filters out prediction boxes with excessive overlap targeting the same defect based on a threshold, retaining only the one with the highest confidence. Next, the confidence filtering stage applies a higher threshold (e.g., 0.9) to filter out suspected defects that are noticed by the model but have low certainty, retaining only defect targets with a high degree of confidence.

[0088] The output module 50 converts these structured results (including image ID, timestamp, defect location, category, and confidence level) into machine-readable JSON or CSV format, making it easy to store in a database or be called by other production management systems to achieve quality traceability and analysis.

[0089] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for surface identification of headphone electronic components on a PCB board, characterized in that, Includes the following steps: Step 1: Collect images of electronic components from different PCB boards to construct a dataset, and perform preprocessing to segment the background image and the electronic component image; Step 2: Obtain the YOLO model, analyze the electronic component image, mark the area with surface defects in the electronic component image, define it as the target area, calculate the position loss based on the target area, set the judgment threshold, if the position loss is greater than the judgment threshold, it means that the marking error of the target area being analyzed is small; Step 3: Calculate the probability distribution for target areas with small marking errors, determine the confidence level of surface defects, set a screening threshold, and if the confidence level is greater than the screening threshold, the authenticity of the existence of surface defects in the current target area is obtained. The location result of the target area is obtained through the probability distribution, thereby optimizing the YOLO model. Step 4: Obtain the image of the electronic component to be inspected, input it into the optimized YOLO model, and obtain the localization result, which includes the location and type of surface defects.

2. The PCB board headphone electronic component surface identification method according to claim 1, characterized in that, Step 1 includes: Image enhancement processing is performed on the images of electronic components in the dataset. The enhancement methods include at least one of rotation, scaling, flipping, and filtering. The enhanced image was segmented from the background and the electronic component image using the background subtraction method; The segmented electronic component images are scaled and standardized.

3. The PCB board headphone electronic component surface identification method according to claim 2, characterized in that, In the image enhancement process The rotation angle range is [-30°, 30°], the scaling ratio is [0.8, 1.2], the horizontal flip probability is 0.5, and the vertical flip probability is 0.

2. Use Gaussian filtering or median filtering for noise suppression; Adjust the brightness variation range by ±10% and the contrast variation range by ±15%.

4. The PCB board headphone electronic component surface identification method according to claim 1, characterized in that, In Step 2, the formula for calculating the position loss is: in, Indicates the first Location loss in the target area; Indicates the first The weights corresponding to each target region; Represents the actual geometric center coordinates of the target area; This indicates the predicted width and height of the target area.

5. The PCB board headphone electronic component surface identification method according to claim 1, characterized in that, The threshold for judgment is 0.

7.

6. The PCB board headphone electronic component surface identification method according to claim 1, characterized in that, Step 3 includes: For target areas with small marking errors, calculate the probability distribution to determine the confidence level of surface defects. The corresponding calculation formula is as follows: in, Indicates confidence level; Indicates the first Probability distribution of each target region; Indicates the first The geometric center coordinates of the target region; Indicates the number of target regions.

7. The PCB board headphone electronic component surface identification method according to claim 1, characterized in that, The screening threshold is 0.

9.

8. The PCB board headphone electronic component surface identification method according to claim 1, characterized in that, In Step 1, the dataset includes images of at least 10 different models of PCB board headphones, with no less than 1,000 images for each model. The image acquisition conditions include natural light, fluorescent light, and LED light, and the acquisition angles include 0°, 45°, and 90°.

9. A PCB board headphone electronic component surface identification system, comprising the PCB board headphone electronic component surface identification method of claim 1, characterized in that, The surface recognition system includes: The data acquisition module (10) is used to acquire images of electronic components and build a dataset; The preprocessing module (20) is used to enhance, segment, scale and normalize the image; The model training module (30) is used to train the YOLO model and optimize its parameters; The defect detection module (40) is used to identify and locate defects in the input image; The output module (50) is used to output the location, type and confidence level of defects.