Circuit board component polarity detection method, device, medium and electronic equipment
By preprocessing and clustering circuit board images, combined with the VGG16 backbone classification model, the problems of low efficiency and poor accuracy in component polarity detection are solved, thereby improving the detection accuracy and production pass rate.
Patent Information
- Application Number
- CN202210926874.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-03
- Publication Date
- 2026-01-16
- Estimated Expiration
- 2042-08-03
AI Technical Summary
In existing technologies, component polarity detection is inefficient, costly, and has a high rate of missed detections and false detections. Methods based on image processing and deep learning have poor detection performance when the image quality is poor, making it difficult to accurately segment polarity markers.
Clustering algorithms are used to preprocess circuit board images, Gaussian filtering is used to eliminate noise, k-means algorithm is used to segment component silkscreen and polarity markings, and polarity detection is performed using the VGG16 backbone classification model to identify the polarity of components.
It improved the accuracy of polarity detection, increased the pass rate of PCBA circuit board production, and reduced detection errors of polarity reversal defects.
Smart Images

Figure CN115439411B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of circuit board, and in particular to a circuit board component polarity detection method, device, medium and electronic equipment. BACKGROUND
[0002] As the main component of electronic products, the quality of printed circuit board (PCB) determines the quality of electronic products. The production process standard of PCBA (Printed Circuit Board Assembly) after component installation on the PCB is also improved. The polarity component needs special attention in the whole PCBA processing process. The error of component direction can cause batch accidents and whole PCBA board failure. Therefore, component polarity detection has become an important part of PCBA defect detection. The same polarity means that the positive and negative poles or the first pin of the component and the positive and negative poles or the first pin on the printed circuit board are in the same direction. If the component and the PCB are not matched in direction, it is considered that the component has a polarity defect. In related technologies, the component polarity detection scheme mainly includes manual identification, automatic identification based on image processing technology, and using deep learning method to identify whether the component polarity matches the positive and negative poles on the printed circuit.
[0003] In the above component polarity detection scheme, manual detection has the disadvantages of low efficiency, high cost, high missed detection and misidentification rate. The image processing technology scheme identifies and determines the polarity mark of the component and the PCB, which has the following disadvantages: ① The image processing method uses threshold segmentation method to convert the image to a binary image and extract the polarity mark in the image. This method loses the color information of the original image and classifies the pixels into foreground and background. It is very sensitive to noise and target size. When the image quality is poor, it is difficult to segment the polarity mark. ② When there are many polarity components on the PCB, the polarity marks of different components are different, and the polarity matching between the component and the PCB has various situations, which increases the difficulty of the algorithm. ③ The polarity mark is very small, and the detection performance depends on the image quality. When the image quality is poor and the polarity mark is not clear, the detection result will be wrong or the detection will fail. The deep learning method also has the same defects as the above ② and ③. SUMMARY
[0004] The present application aims to at least solve one of the technical problems in the related art. To this end, one object of the present application is to provide a circuit board component polarity detection method that can improve the high dependence on component polarity marks in detection, improve the accuracy of polarity defect detection, and improve the pass rate of PCBA circuit board production.
[0005] A second object of the present application is to provide a circuit board component polarity detection device.
[0006] A third object of the present application is to provide a computer readable storage medium.
[0007] A fourth object of the present application is to provide an electronic device.
[0008] To achieve the above objects, the first aspect of the present application provides a circuit board component polarity detection method, comprising: acquiring a to-be-detected circuit board image; clustering pixel points of the to-be-detected circuit board image, and segmenting the to-be-detected circuit board image according to a clustering result to obtain a target image containing component silk screen and polarity mark; and obtaining polarity of the component by using a preset polarity detection model according to the target image.
[0009] The circuit board component polarity detection method of the present application can improve the problem of high dependence on component polarity marks in detection, improve the accuracy of polarity defect detection, and improve the pass rate of PCBA circuit board production.
[0010] In addition, the circuit board component polarity detection method according to the above embodiments of the present application can have the following additional technical features:
[0011] According to one embodiment of the present application, before clustering the pixel points of the to-be-detected circuit board image, the method further comprises: preprocessing the to-be-detected circuit board image by using a Gaussian filtering algorithm.
[0012] According to one embodiment of the present application, the clustering of the pixel points of the to-be-detected circuit board image comprises: determining a target class; determining a target clustering center corresponding to each target class according to pixel information of each pixel point in the to-be-detected circuit board image; and clustering the pixel points of the to-be-detected circuit board image according to the target clustering center by using a k-means algorithm.
[0013] According to one embodiment of the present application, the target class includes a pin, a silk screen, a polarity mark and a background of the component.
[0014] According to one of the embodiments of the present application, the clustering result comprises a plurality of clusters, and the splitting of the image of the circuit board to be detected according to the clustering result comprises: splitting the image of the circuit board to be detected according to the target categories and the relative position relationships corresponding to the clusters.
[0015] According to one of the embodiments of the present application, the image of the circuit board to be detected is a color image, and the pixel information comprises color information.
[0016] According to one of the embodiments of the present application, the preset polarity detection model adopts a classification model based on a VGG16 backbone, and the obtaining of the polarity of the component by the preset polarity detection model according to the target image comprises: angle recognition of the target image by the classification model based on the VGG16 backbone; if the angle recognition result is a first preset angle, it is determined that the polarity of the component is normal; if the angle recognition result is a second preset angle, it is determined that the component has a polarity reverse defect, wherein the difference between the first preset angle and the second preset angle is 180 degrees.
[0017] To achieve the above-mentioned purpose, the second aspect of the embodiments of the present application provides a device for detecting the polarity of a component of a circuit board, which comprises: an acquisition module configured to acquire an image of a circuit board to be detected; a splitting module configured to cluster pixel points of the image of the circuit board to be detected and split the image of the circuit board to be detected according to a clustering result to obtain a target image containing component silk screen and polarity marks; and a detection module configured to obtain the polarity of the component according to the target image by using a preset polarity detection model.
[0018] In addition, the device for detecting the polarity of a component of a circuit board according to the above-mentioned embodiments of the present application can have the following additional technical features:
[0019] According to one of the embodiments of the present application, the device further comprises a preprocessing module configured to perform preprocessing on the image of the circuit board to be detected by using a Gaussian filtering algorithm before the splitting module clusters the pixel points of the image of the circuit board to be detected.
[0020] According to one of the embodiments of the present application, the splitting module is specifically configured to determine target categories, determine target clustering centers corresponding to each of the target categories according to pixel information of each pixel point in the image of the circuit board to be detected, and cluster the pixel points of the image of the circuit board to be detected according to the target clustering centers by using a k-means algorithm.
[0021] According to one of the embodiments of the present application, the target categories comprise pins, silk screens, polarity marks and backgrounds of the component.
[0022] According to one embodiment of the present application, the clustering result comprises a plurality of clusters, and the segmentation module is further configured to segment the image of the circuit board to be detected according to the target category and the relative position relationship of each cluster.
[0023] According to one embodiment of the present application, the preset polarity detection model adopts a classification model based on a VGG16 backbone, and the detection module is configured to perform angle recognition on the target image by using the classification model based on the VGG16 backbone; if the angle recognition result is a first preset angle, it is determined that the polarity of the component is normal; if the angle recognition result is a second preset angle, it is determined that the component has a polarity reverse defect, wherein the difference between the first preset angle and the second preset angle is 180 degrees.
[0024] To achieve the above-mentioned purpose, the third aspect of the present application provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to realize the detection method of the polarity of the circuit board component as described above.
[0025] To achieve the above-mentioned purpose, the fourth aspect of the present application provides an electronic device, which comprises a memory and a processor, and the memory stores a computer program, and the computer program is executed by the processor to realize the detection method of the polarity of the circuit board component as described above.
[0026] Additional aspects and advantages of the present application will be in part apparent and in part pointed out hereinafter. BRIEF DESCRIPTION OF DRAWINGS
[0027] Figure 1 is a flowchart of the detection method of the polarity of the circuit board component according to one embodiment of the present application;
[0028] Figure 2 is a flowchart of clustering the pixel points of the image of the circuit board to be detected according to one embodiment of the present application;
[0029] Figure 3 is a flowchart of obtaining the polarity of the component according to the target image according to one embodiment of the present application;
[0030] Figure 4 is a schematic diagram of the polarity detection module of the circuit board component according to one embodiment of the present application;
[0031] Figure 5 is a schematic diagram of the target category of the circuit board component according to one embodiment of the present application;
[0032] Figure 6 is a structural schematic diagram of the detection device of the polarity of the circuit board component according to one embodiment of the present application;
[0033] Figure 7 FIG. 1 is a structural schematic diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0034] Embodiments of the present application will be described in detail below, examples of which are shown in the drawings, wherein the same or similar notations represent the same or similar elements or elements having the same or similar functions throughout. The embodiments described below by referring to the drawings are exemplary and are intended to explain the present application, and cannot be understood as a limitation of the present application.
[0035] The circuit board component polarity detection method, device, medium and electronic device according to the embodiments of the present application will be described in detail below in combination with the drawings in the specification and the specific embodiments. Figures 1-7
[0036] Figure 1 FIG. 2 is a flowchart of a circuit board component polarity detection method according to an embodiment of the present application.
[0037] In this embodiment, as shown in FIG. 2, the circuit board component polarity detection method comprises: Figure 1
[0038] S1, acquiring an image of a circuit board to be detected.
[0039] Specifically, the image of the circuit board to be detected can be acquired by using a camera, and the image of the circuit board to be detected can be an image of a PCBA circuit board on which components have been installed, and the image of the circuit board to be detected acquired by the camera can be a color image.
[0040] Since the quality of the image of the circuit board to be detected acquired by the camera directly affects the quality of the segmentation result of the image of the circuit board to be detected, the image of the circuit board to be detected can be preprocessed before further processing of the image of the circuit board to be detected. In an embodiment of the present application, before clustering the pixel points of the image of the circuit board to be detected, the circuit board component polarity detection method can further comprise: preprocessing the image of the circuit board to be detected by using a Gaussian filtering algorithm.
[0041] Specifically, the color image of the circuit board to be detected acquired by the camera usually contains noise, and if the noise in the image of the circuit board to be detected is not eliminated, it will directly affect the design and accuracy of the polarity detection algorithm. The present application uses a Gaussian filtering algorithm to preprocess the image of the circuit board to be detected, performs weighted average processing on the value of each pixel point in the image of the circuit board to be detected, eliminates Gaussian noise in the image of the circuit board to be detected, reduces noise in the circuit board image, and improves the accuracy of the polarity detection algorithm.
[0042] It should be noted that the color image of the circuit board to be detected obtained after the pre-processing of the image of the circuit board to be detected does not include noise. Figure 4 As shown in the figure, the component image after the image pre-processing in module two is clearer than the image to be detected in module one.
[0043] After the weighted average processing of the pixel points of the image of the circuit board to be detected (i.e., after the pre-processing described above), the pixel points of the processed image are clustered.
[0044] S2, the pixel points of the image of the circuit board to be detected are clustered, and the image of the circuit board to be detected is segmented according to the clustering result to obtain a target image containing component silk screen and polarity mark.
[0045] Specifically, the pixel points in the image of the circuit board to be detected can be divided into multiple categories, the pixel points of the image of the circuit board to be detected are clustered and divided into multiple categories, which facilitates the segmentation of the image of the circuit board to be detected in the next step.
[0046] In an embodiment of the present application, as shown in the figure, Figure 2 the clustering of the pixel points of the image of the circuit board to be detected comprises:
[0047] S21, determining a target category.
[0048] The target category can include the pins, silk screen, polarity mark and background of the component.
[0049] S22, determining the target clustering center corresponding to each target category according to the pixel information of each pixel point in the image of the circuit board to be detected.
[0050] The image of the circuit board to be detected is a color image, and the pixel information can include color information of the pixel points, such as R, G and B three color components.
[0051] S23, using the k-means algorithm to cluster the pixel points of the image of the circuit board to be detected according to the target clustering center.
[0052] Specifically, as shown in the figure, Figure 5As shown, the polarity mark of the component, such as o or + symbol, the character, such as Acv23 represents the silk screen of the component, and the image background in the image library of the to-be-detected circuit board represents the background of the component. Since the components in the PCBA board are simple in composition form, most of the components are composed of pins, silk screens, polarity marks and backgrounds, and the target categories can be determined as the pins, silk screens, polarity marks and backgrounds. The colors of the four categories of pins, silk screens, polarity marks and backgrounds are single and do not repeat, and the category of each pixel point in the to-be-detected circuit board image can be determined according to the pixel information (such as R, G and B color components) of each pixel point in the to-be-detected circuit board image, that is, the target clustering center is obtained, which can be represented by the pixel information of the four target pixel points.
[0053] Further specifically, the clustering algorithm determines the target clustering center of each target category according to the number of determined target categories, and uses the k-means algorithm to cluster the pixel points of the to-be-detected circuit board image according to the target clustering center. The principle of the k-means clustering algorithm is to make the pixel points in each category as close as possible, and to make the distance between categories as large as possible. Other pixel points are assigned to the category corresponding to the target clustering center, until all pixel points in the to-be-detected image are assigned, and the k-means algorithm converges, and the clustering processing of the to-be-detected circuit board image is completed. Compared with the threshold segmentation algorithm which can only classify the pixels according to the pixel gray value, the k-means clustering algorithm can not only classify the image pixels, but also accept color images as input, and can effectively utilize the image color information, so the segmentation result is more accurate.
[0054] After the clustering processing is completed, the to-be-detected circuit board image is segmented according to the clustering result to obtain a target image containing component silk screens and polarity marks.
[0055] In an embodiment of the present application, the clustering result includes a plurality of clusters, and the to-be-detected circuit board image is segmented according to the clustering result, including: segmenting the to-be-detected circuit board image according to the target category and the relative position relationship corresponding to each cluster.
[0056] Specifically, the present application determines that the target categories are four kinds of pins, silk screens, polarity marks and backgrounds, and after clustering the to-be-detected circuit board image, the clustering result includes the corresponding four clusters. The present application uses the characteristic that the relative position relationship between the component silk screen and the polarity mark is unchanged, and regards the component silk screen and the polarity mark as a whole to increase the image features, and sets the silk screen and the polarity mark in the target category corresponding to each cluster as the region of interest, and the rest as the non-region of interest, that is, the to-be-detected circuit board image is segmented according to the target category and the relative position relationship corresponding to each cluster to obtain a target image containing component silk screens and polarity marks.
[0057] S3, obtaining the polarity of the component according to the target image by using a preset polarity detection model.
[0058] Specifically, the obtained target image containing the component device silk screen and the polarity mark is input into a preset polarity detection model, the polarity detection model performs polarity detection on the target image, and the polarity of the component device is obtained.
[0059] In an embodiment of the present application, the preset polarity detection model adopts a classification model based on a VGG16 backbone, such as Figure 3 As shown, obtaining the polarity of the component device from the target image by using the preset polarity detection model can include:
[0060] S31, performing angle recognition on the target image by using a classification model based on a VGG16 backbone.
[0061] S32, if the angle recognition result is a first preset angle, it is determined that the polarity of the component device is normal.
[0062] S33, if the angle recognition result is a second preset angle, it is determined that the component device has a polarity reverse defect, wherein the difference between the first preset angle and the second preset angle is 180 degrees.
[0063] Specifically, the preset polarity detection model can adopt a classification model based on a VGG16 backbone, the classification model based on a VGG16 backbone is composed of a plurality of convolution layers and pooling layers in a stacking manner, forming a deep network structure, performing angle recognition on the target image, and identifying the first preset angle or the second preset angle, the first preset angle can be 0°, and the second preset angle can be 180°, as shown in module four in Figure 4 if the angle recognition result is 0°, it is determined that the polarity of the component device is normal, and if the angle recognition result is 180°, it is determined that the component device has a polarity reverse defect. It should be noted that the preset polarity detection model can be obtained by training in advance using training images containing component device silk screen and polarity marks.
[0064] The method for detecting polarity of a circuit board component provided in the embodiments of the present application first acquires an image of a circuit board to be detected and pre-processes the circuit board image, clusters the pixel points of the pre-processed circuit board image to be detected, and segments the circuit board image to be detected according to the clustering result to obtain a target image containing component silk screen and polarity mark. The clustering algorithm is used to segment the region of interest (the region of interest is the silk screen and the polarity mark) of the component color image. Compared with the threshold segmentation method for segmenting a gray image, the segmentation precision of the region of interest is more accurate, and the foreground contour is more complete. Moreover, instead of simply focusing on the polarity mark of the component, the relative position relationship between the polarity mark and the silk screen is considered, the polarity mark and the silk screen are regarded as a whole, the detection features are increased, and when the polarity mark is not clear, the silk screen features can be relied on for detection and analysis. Then, a preset polarity detection model is used to obtain the polarity of the component according to the target image, the correct rate of polarity defect detection is improved, and the qualified rate of PCBA circuit board production is improved.
[0065] Based on the above-mentioned method for detecting polarity of a circuit board component, the present application further provides a device for detecting polarity of a circuit board component.
[0066] In one embodiment of the present application, as shown in Figure 6 The device 100 for detecting polarity of a circuit board component comprises an acquisition module 10 configured to acquire an image of a circuit board to be detected, a segmentation module 30 configured to cluster pixel points of the circuit board image to be detected and segment the circuit board image to be detected according to the clustering result to obtain a target image containing component silk screen and polarity mark, and a detection module 40 configured to obtain the polarity of the component according to the target image by using a preset polarity detection model.
[0067] It should be noted that other specific embodiments of the device for detecting polarity of a circuit board component according to the embodiments of the present application can refer to the specific embodiments of the method for detecting polarity of a circuit board component described above.
[0068] In one embodiment of the present application, as shown in Figure 6 The device 100 for detecting polarity of a circuit board component further comprises a pre-processing module 20 configured to pre-process the circuit board image to be detected by using a Gaussian filtering algorithm before the segmentation module clusters the pixel points of the circuit board image to be detected.
[0069] In one embodiment of the present application, the segmentation module 30 is specifically configured to determine target categories, determine target clustering centers corresponding to each target category according to pixel information of each pixel point in the circuit board image to be detected, and cluster the pixel points of the circuit board image to be detected according to the target clustering centers by using a k-means algorithm.
[0070] In an embodiment of the present application, the target categories include pins, silk screen, polarity mark and background of the component.
[0071] In an embodiment of the present application, the preset polarity detection model adopts a classification model based on VGG16 backbone, and the detection module 40 is specifically configured to: perform angle recognition on the target image by using the classification model based on the VGG16 backbone; if the angle recognition result is a first preset angle, it is determined that the polarity of the component is normal; and if the angle recognition result is a second preset angle, it is determined that the component has a polarity reverse defect, wherein the difference between the first preset angle and the second preset angle is 180 degrees.
[0072] Based on the above circuit board component polarity detection method, the present application further provides a computer readable storage medium.
[0073] In an embodiment of the present application, the computer readable storage medium stores a computer program, and the computer program is executed by the processor to implement the above circuit board component polarity detection method.
[0074] Based on the above circuit board component polarity detection method, the present application further provides an electronic device.
[0075] In an embodiment of the present application, as shown in Figure 7 the electronic device 200 includes a memory 50 and a processor 60, the memory 50 stores a computer program, and the computer program is executed by the processor 60 to implement the above circuit board component polarity detection method.
[0076] The circuit board component polarity detection method, device, medium and electronic device of the embodiments of the present application first acquire an image of a circuit board to be detected and pre-process the circuit board image, cluster the pixel points of the pre-processed circuit board image to be detected, and segment the circuit board image to be detected according to the clustering result to obtain a target image containing component silk screen and polarity mark, and use a clustering algorithm to segment the region of interest (the region of interest is the silk screen and the polarity mark) of the component color image. Compared with the threshold segmentation method for gray image segmentation, the segmentation accuracy of the region of interest is more accurate, and the foreground contour is more complete. Moreover, instead of simply focusing on the component polarity mark, the relative position relationship between the component polarity mark and the silk screen is considered, the polarity mark and the silk screen are regarded as a whole, the detection features are increased, and when the polarity mark is not clear, the silk screen features can be relied on for detection and analysis. Then, a preset polarity detection model is used to obtain the polarity of the component according to the target image, improve the correctness of the polarity reverse defect detection, and improve the pass rate of the PCBA circuit board production.
[0077] It is to be appreciated that the above description and the examples that follow are intended to be illustrative only and that changes can be made to the description and examples without departing from the scope of the application. Note also that the use of particular brand names in the description is solely for illustration and should not be construed as an endorsement of such brands.
[0078] It should be understood that aspects of the application can be implemented in hardware, software, firmware or combinations thereof. In the embodiments described above, various steps or methods can be implemented, for example, in software or firmware that is stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, and in another embodiment, any of the following techniques, which are well known in the art, can be used to implement the functions of the application: a discrete logic circuit having logic gates for implementing logic functions upon data signals, an application specific integrated circuit having appropriate combinational logic gates, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0079] In the description of the present application, reference has been made to the use of terms such as "one embodiment", "some embodiments", "an example", "a specific example" or "some examples" means that a particular feature, structure, material or characteristic is included in at least one embodiment or example of the present application. The illustrative examples given are not necessarily to be construed as preferred or advantageous or with the exclusion of other equally valid examples that can be particularly adapted to a given application. Moreover, such illustrative examples are not necessarily mutually exclusive as the various aspects of the application can be combined in any suitable manner.
[0080] In the description of the application, it should be understood that the orientation or positional relationship indicated by the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "upper", "lower", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", "clockwise", "counterclockwise", "axial", "radial", "circumferential" and the like is based on the orientation or positional relationship shown in the drawings, and is only for the convenience of describing the application and simplifying the description, and does not indicate or imply that the device or element referred to must have a particular orientation, be constructed and operated in a particular orientation, and therefore cannot be understood as a limitation on the application.
[0081] In addition, the terms "first", "second" are only for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the technical features indicated. Therefore, the features defined with "first", "second" can explicitly or implicitly include at least one of the features. In the description of the application, the meaning of "a plurality of" is at least two, such as two, three, etc., unless otherwise explicitly specified and limited.
[0082] In the present application, unless otherwise explicitly specified and limited, the terms "mounting", "connecting", "connecting", "fixing" and the like should be understood broadly, for example, it can be fixedly connected, or it can be detachably connected, or it can be integrated; it can be mechanically connected, or it can be electrically connected; it can be directly connected, or it can be indirectly connected through an intermediate medium; it can be the internal communication of two elements or the interaction relationship between two elements, unless otherwise explicitly limited. For those skilled in the art, the specific meaning of the above terms in the present application can be understood according to the specific circumstances.
[0083] In the present application, unless otherwise explicitly specified and limited, the first feature is "on" or "under" the second feature, which can be direct contact between the first and second features, or indirect contact between the first and second features through an intermediate medium. Moreover, the first feature "above", "above" and "above" the second feature can be directly above or obliquely above the first feature, or only indicate that the horizontal height of the first feature is higher than that of the second feature. The first feature "below", "below" and "below" the second feature can be directly below or obliquely below the first feature, or only indicate that the horizontal height of the first feature is less than that of the second feature.
[0084] Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as a limitation on the present application, and those skilled in the art can make changes, modifications, replacements and variations to the above embodiments within the scope of the present application.
Claims
1. A method of detecting polarity of a circuit board component, characterized by, The method comprises: acquiring an image of a circuit board to be detected; performing clustering on pixel points of the image of the circuit board to be detected, and segmenting the image of the circuit board to be detected according to a clustering result to obtain a target image containing component silk screen and polarity mark; obtaining polarity of the component by using a preset polarity detection model according to the target image; the clustering result comprises a component silk screen area and a polarity mark area, and the method further comprises: segmenting the component silk screen area and the polarity mark area as a whole; in the case that the polarity mark in the target image is not clear, obtaining the polarity of the component according to the component silk screen in the target image.
2. The method of claim 1, wherein the polarity of the circuit board component is determined by: Before the clustering on the pixel points of the image of the circuit board to be detected, the method further comprises: performing preprocessing on the image of the circuit board to be detected by using a Gaussian filtering algorithm.
3. The method of claim 1 or 2, wherein The clustering on the pixel points of the image of the circuit board to be detected comprises: determining a target category; determining a target clustering center corresponding to each target category according to pixel information of each pixel point in the image of the circuit board to be detected; performing clustering on the pixel points of the image of the circuit board to be detected according to the target clustering center by using a k-means algorithm.
4. The method of claim 3, wherein the polarity of the circuit board component is determined by: The target category comprises a pin, a silk screen, a polarity mark and a background of the component.
5. The method of claim 4, wherein the step of detecting the polarity of the circuit board component is characterized by: The clustering result comprises a plurality of clusters, and the segmentation of the image of the circuit board to be detected according to the clustering result comprises: segmenting the image of the circuit board to be detected according to a target category and a relative position relationship corresponding to each cluster.
6. The method of claim 3, wherein the polarity of the circuit board component is determined by: The image of the circuit board to be detected is a color image, and the pixel information comprises color information.
7. The method of claim 1 or 2, wherein The preset polarity detection model adopts a classification model based on a VGG16 backbone, and the obtaining of the polarity of the component by using the preset polarity detection model according to the target image comprises: performing angle recognition on the target image by using the classification model based on the VGG16 backbone; if the angle recognition result is a first preset angle, it is determined that the polarity of the component is normal; if the angle recognition result is a second preset angle, it is determined that the component has a polarity reverse defect, wherein a difference between the first preset angle and the second preset angle is 180 degrees.
8. An apparatus for detecting polarity of a circuit board component, characterized by The device comprises: an acquisition module configured to acquire an image of a circuit board to be detected; a segmentation module configured to perform clustering on pixel points of the image of the circuit board to be detected, and segment the image of the circuit board to be detected according to a clustering result to obtain a target image containing component silk screen and polarity mark; a detection module configured to obtain polarity of the component by using a preset polarity detection model according to the target image; the clustering result comprises a component silk screen area and a polarity mark area, and the segmentation module is further configured to segment the component silk screen area and the polarity mark area as a whole; the detection module is further configured to obtain the polarity of the component according to the component silk screen in the target image in the case that the polarity mark in the target image is not clear.
9. The apparatus according to claim 8, wherein The device further comprises: a preprocessing module configured to perform preprocessing on the image of the circuit board to be detected by using a Gaussian filtering algorithm before the segmentation module performs clustering on the pixel points of the image of the circuit board to be detected.
10. The apparatus according to claim 8 or 9, characterized in that The segmentation module is specifically used for: determining target categories, and determining target cluster centers corresponding to each target category according to pixel information of each pixel point in the to-be-detected circuit board image; and performing clustering on pixel points of the to-be-detected circuit board image according to the target cluster centers by using a k-means algorithm.
11. The apparatus for detecting polarity of a circuit board component according to claim 10, wherein, The target categories include pins, silk screen printing, polarity marks, and backgrounds of components.
12. The apparatus for detecting polarity of a circuit board component of claim 10, wherein, The clustering result includes multiple clusters, and the segmentation module is specifically further used for: segmenting the to-be-detected circuit board image according to target categories and relative position relationships of each cluster.
13. The apparatus according to claim 8 or 9, wherein The preset polarity detection model adopts a classification model based on a VGG16 backbone, and the detection module is specifically used for: performing angle recognition on the target image by using the classification model based on the VGG16 backbone; if an angle recognition result is a first preset angle, determining that polarity of the component is normal; if the angle recognition result is a second preset angle, determining that the component has a polarity reverse defect, wherein a difference between the first preset angle and the second preset angle is 180 degrees.
14. A computer readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the detection method for the polarity of the component of the circuit board according to any one of claims 1-7.
15. An electronic device comprising a memory and a processor, said memory having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the detection method for the polarity of the component of the circuit board according to any one of claims 1-7.
Citation Information
Patent Citations
PCB component detection method based on deep learning
CN110070536A
Defect detection method and device, electronic equipment and storage medium
CN112288724A