Defect detection method and device, computer device and storage medium
By rotating the object to be inspected on a rotating platform and combining the object images acquired from multiple angles for defect identification, the problem of inaccurate defect detection caused by lighting and shooting angle in traditional methods is solved, achieving higher detection accuracy and stability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA TELECOM CORP LTD GUANGDONG RESEARCH INSTITUTE
- Filing Date
- 2023-05-19
- Publication Date
- 2026-05-19
AI Technical Summary
In traditional defect detection methods, due to issues such as lighting conditions or shooting angle, the defective area of the object to be detected has an unstable shape in the image, making it difficult to accurately identify defects.
By placing the object to be inspected on a rotating platform, an initial object image is obtained and suspected defect areas are identified. The rotating platform is then controlled to rotate, and the object image is re-acquired. The mapping position of the suspected defect areas is determined based on the rotation angle, and defect identification is performed in the re-acquired object image. By combining the defect identification results from multiple angles, the detection accuracy is improved.
By rotating the platform and acquiring data from multiple angles, the problems of lighting and shooting angles were solved, improving the accuracy and stability of defect detection, avoiding unstable morphology of defect areas, and enhancing the reliability of defect detection.
Smart Images

Figure CN116698849B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the fields of computer vision and image processing technology, and in particular to a defect detection method, apparatus, computer equipment, and storage medium. Background Technology
[0002] With the development of computer vision and image processing technology, automatic defect detection of products or workpieces on the production line is becoming increasingly common. For example, automatic detection of surface defects of hardware parts is used to detect impurities, dents or scratches on the surface of the hardware parts.
[0003] Traditional methods typically involve directly detecting defects in a single image of the object to be inspected. However, due to factors such as lighting conditions and shooting conditions, it is difficult to stably and accurately represent the shape of the defective area of the object in the image, which can easily lead to inaccurate defect detection. Summary of the Invention
[0004] Therefore, it is necessary to provide a defect detection method, apparatus, computer equipment, computer-readable storage medium, and computer program product that can improve the accuracy of defect detection in response to the above-mentioned technical problems.
[0005] Firstly, this application provides a defect detection method. The method includes:
[0006] Obtain an object image of the object to be detected; the object to be detected is placed on a rotating platform;
[0007] Defect identification is performed on the contour region of the object image;
[0008] If a contour area suspected of having a defect is identified, the rotating platform is controlled to rotate, and an object image re-acquired for the object to be detected at the angle after rotation is obtained;
[0009] Based on the rotation angle of the rotating platform, the location of the contour area suspected of having a defect is determined to be the corresponding mapped position in the re-acquired object image;
[0010] Defect identification is performed on the contour region located at the mapped position in the re-acquired object image.
[0011] Secondly, this application also provides a defect detection device. The device includes:
[0012] The image acquisition module is used to acquire an object image of the object to be detected; the object to be detected is placed on a rotating platform;
[0013] A defect identification module is used to identify defects in the contour region of the object image.
[0014] The control module is used to control the rotation platform to rotate if a contour area suspected of having a defect is identified, and to acquire an object image re-acquired for the object to be detected at the angle after rotation.
[0015] The mapping module is used to determine the location of the contour area suspected of having a defect in the re-acquired object image based on the rotation angle of the rotating platform.
[0016] The defect identification module is also used to identify defects in the contour region located at the mapped position in the re-acquired object image.
[0017] In one embodiment, the defect identification module is further configured to, if the defect identification result of the contour area at the mapped position is suspected to be a defect, notify the control module to return to execute the step of controlling the rotating platform to rotate, and obtain the object image re-acquired for the object to be detected at the angle after rotation, and subsequent steps.
[0018] The defect identification module is further configured to determine the defect identification result of the contour region at the mapping position as the final defect identification result corresponding to the contour region if the defect identification result of the contour region at the mapping position is either a defect or no defect.
[0019] In one embodiment, the defect identification module is further configured to determine multi-dimensional features of the contour region in the object graph; for each dimension, determine the defect probability of the contour region based on the membership function corresponding to the dimension and the features of the dimension; and obtain the defect identification result of the contour region based on the defect probabilities of the contour region determined in each dimension.
[0020] In one embodiment, the multi-dimensional features include at least one of image content difference feature information, region size feature information, location feature information, and shape feature information; the defect identification module is also configured to perform at least one of the following:
[0021] The defect probability of the contour region is determined based on the first membership function corresponding to the image content difference dimension and the image content difference feature information;
[0022] The defect probability of the contour region is determined based on the second membership function corresponding to the region size dimension and the region size feature information;
[0023] The defect probability of the contour region is determined based on the third membership function corresponding to the position dimension and the position feature information.
[0024] The defect probability of the contour region is determined based on the fourth membership function corresponding to the shape dimension and the shape feature information.
[0025] In one embodiment, when the multi-dimensional features include the image content difference feature information, the image content difference feature information includes gradient difference; the gradient difference refers to the difference between the maximum gradient value and the minimum gradient value of the pixel values in the contour region.
[0026] The defect identification module is further configured to determine the defect probability of the contour region as 0 if the gradient difference is less than a first preset threshold; determine the defect probability of the contour region as 1 if the gradient difference is greater than a second preset threshold; and determine the defect probability of the contour region according to the gradient difference and a preset linear transformation formula if the gradient difference is greater than or equal to the first preset threshold and less than or equal to the second preset threshold.
[0027] In one embodiment, when the multi-dimensional features include the region size feature information, the region size feature information includes the number of pixels within the contour region;
[0028] The defect identification module is further configured to determine the defect probability of the contour region as 0 if the number of pixels is less than a third preset threshold; determine the defect probability of the contour region as 1 if the number of pixels is greater than a fourth preset threshold; and determine the defect probability of the contour region according to the number of pixels and a preset exponential transformation formula if the number of pixels is greater than or equal to the third preset threshold and less than or equal to the fourth preset threshold.
[0029] In one embodiment, the shape of the object to be detected includes a circle; where the multi-dimensional features include the positional feature information, the positional feature information includes the distance from the center point of the contour region to the center of the circle of the object to be detected;
[0030] The defect identification module is further configured to determine the defect probability of the contour region as 0 if the difference between the distance and the radius of the object to be detected is less than a fifth preset threshold; and to determine the defect probability of the contour region as 1 if the difference between the distance and the radius of the object to be detected is greater than or equal to the fifth preset threshold.
[0031] In one embodiment, when the multi-dimensional features include the shape feature information, the shape feature information includes the aspect ratio of the bounding rectangle of the contour region;
[0032] The defect identification module is further configured to determine the defect probability of the contour region as 0 if the aspect ratio is greater than a sixth preset threshold, and to determine the defect probability of the contour region as 1 if the aspect ratio is less than or equal to the sixth preset threshold.
[0033] In one embodiment, the defect identification module is further configured to determine the final probability of a defect in the contour region based on the defect probabilities of the contour region determined in each dimension; if the final probability is greater than a first probability threshold, the defect identification result of the contour region is determined to be defective; if the final probability is less than a second probability threshold, the defect identification result of the contour region is determined to be defect-free; if the final probability is greater than or equal to the second probability threshold and less than or equal to the first probability threshold, the defect identification result of the contour region is determined to be suspected defective.
[0034] In one embodiment, an image acquisition device is disposed above the rotating platform; the image acquisition device is used to acquire images of the object to be detected on the rotating platform; the rotation of the rotating platform is a rotation of its central axis.
[0035] In one embodiment, an arc-shaped light source is provided above the rotating platform; the arc-shaped light source is used to illuminate the object to be inspected on the rotating platform; the image acquisition device is used to acquire an image of the object to be inspected through the central opening of the arc-shaped light source.
[0036] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, which, when executed by the processor, causes the processor to perform the steps in the defect detection methods described in the embodiments of this application.
[0037] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, causes the processor to perform the steps in the defect detection methods described in the embodiments of this application.
[0038] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, causes the processor to perform the steps of the defect detection methods described in the embodiments of this application.
[0039] The aforementioned defect detection method, apparatus, computer equipment, storage medium, and computer program product acquire an object image of the object to be inspected placed on a rotating platform. Defect identification is performed on the contour regions within the object image. If a contour region suspected of having a defect is identified, the rotating platform is controlled to rotate, and a new object image is acquired at the rotated angle. Based on the rotation angle of the rotating platform, the corresponding mapping position of the suspected defective contour region in the newly acquired object image is determined. Defect identification is then performed on the contour region located at the mapping position in the newly acquired object image. This allows for defect identification of the suspected defective contour region within the newly acquired object image after rotating the object to be inspected using the rotating platform, and by combining defect identification results from multiple angles, the instability and inaccuracy of the defective region's appearance in the image at different angles due to lighting conditions or shooting angles are avoided, thus improving the accuracy of defect detection. Attached Figure Description
[0040] Figure 1 This is a diagram illustrating the application environment of a defect detection method in one embodiment;
[0041] Figure 2 This is a flowchart illustrating a defect detection method in one embodiment;
[0042] Figure 3 This is a schematic diagram of the object graph of the object to be detected in one embodiment;
[0043] Figure 4 This is a schematic diagram of the outline in an object diagram in one embodiment;
[0044] Figure 5 This is a schematic diagram of rotation and mapping in one embodiment;
[0045] Figure 6 This is a schematic diagram of the overall process of a defect detection method in one embodiment;
[0046] Figure 7 This is a structural block diagram of a defect detection device in one embodiment;
[0047] Figure 8 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0048] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0049] The defect detection method provided in this application embodiment can be applied to, for example, Figure 1 In the application environment shown, the object to be inspected 102 is placed on a rotating platform 104, which rotates to cause the object to be inspected 102 to rotate as well. The image acquisition device 106 can communicate with the computer device 108. The image acquisition device 106 can acquire images of the object to be inspected 102, and the computer device 108 can obtain the acquired object image from the image acquisition device 106. The computer device 108 can control the rotating platform 104 to rotate. The computer device 108 can execute the defect detection methods in the embodiments of this application to perform defect detection on the object to be inspected 102. The object to be inspected 102 can be any object requiring defect detection. For example, the object to be inspected 102 can be hardware parts or printed circuit boards produced on a production line. The image acquisition device 106 can be a camera or webcam with image acquisition capabilities. The computer device 108 can be a terminal or a server. The terminal can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, smart in-vehicle systems, etc. Portable wearable devices can include smartwatches, smart bracelets, head-mounted devices, etc. The server can be implemented using a standalone server or a server cluster consisting of multiple servers.
[0050] In some embodiments, such as Figure 2 As shown, a defect detection method is provided, which can be applied to... Figure 1 Taking computer device 108 as an example, the following steps are included:
[0051] Step 202: Obtain the object image collected for the object to be detected; the object to be detected is placed on a rotating platform.
[0052] The object to be inspected is the target of defect detection. The object image is the image obtained by image acquisition of the object to be inspected. The rotating platform is a platform used to place the object to be inspected and is capable of rotation. It can be understood that when the rotating platform rotates, the object to be inspected placed on the rotating platform can rotate along with the platform.
[0053] In some embodiments, the object to be inspected can be any object that needs to be defect-detected. For example, the object to be inspected can be hardware parts or printed circuit boards produced on a production line.
[0054] In some embodiments, the image acquisition device can acquire an image of the object to be detected to obtain an object image, and the computer device can obtain the object image of the object to be detected from the image acquisition device.
[0055] In some embodiments, the image acquisition device may be positioned above the rotating platform.
[0056] Step 204: Defect identification is performed on the contour region in the object image.
[0057] In this context, the contour region in the object graph refers to the area enclosed by the contour in the object graph. Defect identification is the process of identifying whether a defect exists within the defect region.
[0058] Figure 3 This is a schematic diagram of an object diagram. Figure 4 It shows Figure 3 The outlines in the object diagram shown are the contours, and the area enclosed by these outlines is the contour region.
[0059] In some embodiments, the defect identification result may include the presence of a defect, the absence of a defect, and the suspected presence of a defect. Here, the defect identification result refers to the outcome of the defect identification process.
[0060] In some embodiments, the computer device can determine the final probability of a defect existing in a contour region through defect identification. If the final probability is greater than a first probability threshold, the defect identification result of the contour region is determined to be defective; if the final probability is less than a second probability threshold, the defect identification result of the contour region is determined to be non-defective; if the final probability is greater than or equal to the second probability threshold and less than or equal to the first probability threshold, the defect identification result of the contour region is determined to be suspected of having a defect. The first probability threshold is greater than the second probability threshold. The first probability threshold and the second probability threshold are preset thresholds.
[0061] In some embodiments, the computer device may perform edge detection on the object image to obtain the contour in the object image, determine the contour region enclosed by the contour, and then perform defect identification on the contour region in the object image.
[0062] In some embodiments, when the contours in the object diagram include non-closed contours, the computer device may first close the non-closed contours to obtain closed contours, and then determine the contour region enclosed by each closed contour.
[0063] In some embodiments, the number of contour regions in the object graph can be one or more.
[0064] In some embodiments, the computer device may first convert the object image into a grayscale image, perform noise reduction processing on the grayscale image, and then perform edge detection on the noise-reduced image to obtain the contours in the object image and determine the contour region enclosed by the contours. The noise reduction processing may be Gaussian filtering.
[0065] In some embodiments, the computer device may first extract the region of interest (ROI) from the object image to obtain an ROI image, and then perform edge detection on the ROI image to obtain contours in the object image, determining the contour region enclosed by the contours. The ROI image contains the object to be detected but does not contain any other objects besides the object to be detected.
[0066] In some embodiments, during region of interest (ROI) extraction, the computer device can first locate the region where the object to be detected is located in the object image, and then perform bitwise operations on the region where the object to be detected is located using a preset mask to extract the ROI image. The bitwise operation refers to multiplying the preset mask by the pixel values of each pixel in the region where the object to be detected is located, bitwise.
[0067] In some embodiments, the computer device can locate the region where the object to be detected is located from the object map by Hough detection based on the shape of the object to be detected.
[0068] Step 206: If a contour area suspected of having a defect is identified, the rotating platform is controlled to rotate, and an object image re-acquired for the object to be inspected at the angle after rotation is obtained.
[0069] In this context, identifying a contour region suspected of having a defect means that at least one contour region in the object image is identified as having a suspected defect. The number of contour regions suspected of having a defect can be one or more.
[0070] In some embodiments, if a contour region suspected of having a defect is identified, the computer device performs step 206 and subsequent steps to further identify defects in the contour region suspected of having a defect at the rotated angle. The computer device can determine the defect identification result (i.e., whether a defect exists or not) of contour regions other than the contour region suspected of having a defect as the final defect identification result corresponding to that contour region.
[0071] In some embodiments, the computer device can control the rotating platform to rotate by a preset angle. When the object to be detected is at the rotated angle, the image acquisition device can re-acquire an image of the rotated object, and the computer device can obtain the re-acquired object image from the image acquisition device.
[0072] In some embodiments, the rotation of the rotating platform can be a rotation around its central axis, that is, the rotating platform rotates around its own central axis.
[0073] In some embodiments, if the defect identification results of each contour region in the object diagram are either "existence of contour" or "absence of contour", the computer device can directly determine the defect identification results of each contour region as the final defect identification results corresponding to each contour region.
[0074] Step 208: Based on the rotation angle of the rotating platform, determine the corresponding mapping position of the suspected defective contour area in the re-acquired object image.
[0075] In some embodiments, the computer device can map the position of the suspected defective contour area to the re-acquired object image based on the rotation angle of the rotating platform, thereby obtaining the corresponding mapped position in the re-acquired object image.
[0076] Step 210: Defect identification is performed on the contour region located at the mapped position in the re-acquired object image.
[0077] In some embodiments, the computer device can perform edge detection on the re-acquired object image to obtain the contour in the re-acquired object image, determine the contour region enclosed by the contour in the re-acquired object image, and then perform defect identification on the contour region at the mapping position in the re-acquired object image.
[0078] In some embodiments, the computer device can determine the location of the outline region suspected of having a defect in the object map, and then map the outline region suspected of having a defect in the object map to the re-acquired object map to obtain the mapped area of the outline region suspected of having a defect in the object map in the re-acquired object map. Then, the outline region located within the mapped area in the re-acquired object map is used for defect identification.
[0079] like Figure 5 As shown, the probabilities of identifying defects 1 and 2 in the contour regions of the first object image are P1 and P2, respectively. Assuming that the defect identification results of the contour regions corresponding to defects 1 and 2 are determined to be suspected defects based on P1 and P2, the second object image is acquired after rotation. The positions of the contour regions corresponding to defects 1 and 2 in the first object image are mapped to the second object image to obtain the mapped area, which is the rectangle outlined by the dashed line in the second object image. Then, the contour region within the mapped area in the second object image is determined, which is the region outlined by the dashed line within the rectangle outlined by the dashed line in the second object image.
[0080] In some embodiments, the location of a suspected defective contour region within an object diagram can be represented by the region's width, height, and center point coordinates. For example, the location of a suspected defective contour region within an object diagram can be represented as (x... i y i w i h i ), where x i and y i w represents the x-coordinate and y-coordinate of the center point of the region, respectively. i h represents the width of the region. i The height of the region is represented by , and 'i' represents the index of the contour region. The computer device can determine the width, height, and center point coordinates of the region in the object map where the suspected defective contour region is located. Then, based on the rotation angle, the width, height, and center point coordinates of the circumscribed rectangle, the region is mapped onto the re-acquired object map, resulting in the mapped region in the re-acquired object map.
[0081] In some embodiments, the computer device can directly determine the defect identification result of the contour region located at the mapped position in the re-acquired object image as the final defect identification result for that contour region. That is, regardless of the defect identification result of the contour region located at the mapped position in the re-acquired object image, that result can be determined as the final defect identification result. For example, if the defect identification result of the contour region located at the mapped position in the re-acquired object image is a suspected defect, then the suspected defect is determined as the final defect identification result for that contour region; if the defect identification result of the contour region located at the mapped position in the re-acquired object image is either a defect or no defect, then the presence or absence of a defect is determined as the final defect identification result, and the contour region suspected of having a defect can then be manually inspected.
[0082] In other embodiments, if the defect identification result of the contour region at the mapped location is a suspected defect, the computer device can return to the step of controlling the rotating platform to rotate and acquiring a re-acquired object image of the object to be inspected at the rotated angle, and subsequent steps, to further perform defect identification at other angles. If the defect identification result of the contour region at the mapped location is either a defect or no defect, the computer device can determine the defect identification result of the contour region at the mapped location as the final defect identification result corresponding to the contour region.
[0083] The aforementioned defect detection method acquires an object image of the object to be inspected placed on a rotating platform. Defect identification is performed on the contour regions within this object image. If a contour region suspected of having a defect is identified, the rotating platform is controlled to rotate, and a new object image is acquired at the rotated angle. Based on the rotation angle of the platform, the location of the suspected defective contour region is determined to its corresponding mapping position in the newly acquired object image. Defect identification is then performed on the contour region located at the mapping position in the newly acquired object image. This method allows for defect identification of the suspected defective contour region at multiple angles after rotating the object to be inspected using the rotating platform, avoiding inaccuracies in the image's appearance due to lighting conditions or shooting angles, thus improving the accuracy of defect detection. Furthermore, rotating the object to be inspected on the rotating platform solves the problem of object placement stability, thereby improving the stability of the acquired object image and ultimately enhancing the accuracy of defect detection.
[0084] The table below shows a comparison between the defect detection results achieved using multiple object images from multiple angles in the above embodiments and the defect detection results achieved using only a single object image:
[0085]
[0086] As can be seen from the table above, the method of defect detection using multiple object images from multiple angles as described in the above embodiments is significantly more accurate than the method of defect detection using only a single object image. Moreover, the detection time is only slightly longer than that of the method of defect detection using only a single object image. Therefore, the method of defect detection using multiple object images from multiple angles as described in the above embodiments improves the accuracy of defect detection.
[0087] In some embodiments, after performing defect identification on the contour region located at the mapping position in the re-acquired object image, the method further includes: if the defect identification result of the contour region at the mapping position is suspected to be defective, then return to the step of controlling the rotation platform to rotate and obtaining the object image re-acquired for the object to be detected at the angle after rotation, and subsequent steps; if the defect identification result of the contour region at the mapping position is defective or not defective, then determine the defect identification result of the contour region at the mapping position as the final defect identification result corresponding to the contour region.
[0088] In some embodiments, if the defect identification result of the contour region at the mapped position is suspected to be a defect, the process returns to the step of controlling the rotation platform to rotate and obtaining the object image re-acquired for the object to be detected at the angle after rotation, and subsequent steps. If the defect identification result of the contour region at the mapped position is either a defect or no defect, the defect identification result of the contour region at the mapped position is determined as the final defect identification result corresponding to the contour region, until the stopping condition is met.
[0089] In some embodiments, the stopping condition may be that there are no contour regions suspected of having defects, that is, there are no suspected defect identification results in the defect identification results of each contour region.
[0090] In other embodiments, the stopping condition can be that the number of rotations is greater than or equal to a preset rotation threshold. For example, if the preset rotation threshold is 2, after the computer device controls the rotating platform to perform the first rotation, if a contour region suspected of having a defect is still identified, the computer device can control the rotating platform to perform a second rotation. Regardless of the defect identification result of the second rotation, the iteration stops, and no further rotation is performed. The defect identification result obtained after the second rotation for the contour region suspected of having a defect is determined as the final defect identification result for the contour region suspected of having a defect. Subsequently, the contour region still suspected of having a defect can be manually inspected.
[0091] like Figure 5 The diagram illustrates the mapping of the contour region after each rotation in the above embodiment. The image acquisition device can acquire images of the object to be inspected placed on a rotating platform. The computer device can extract the Region of Interest (ROI) from the first acquired object image, then extract the contour from the ROI and calculate the probability of defects in the contour region, i.e., P1 and P2. If the probability of defects indicates a suspected defect in the contour region, the rotating platform can be controlled to rotate, and a second object image acquired at the rotated angle can be obtained. The contour region within the mapped area in the second object image is then determined. Similarly, if the contour region within the mapped area in the second object image indicates a suspected defect, the rotating platform is controlled to rotate again, and a third object image acquired at the rotated angle is obtained. The contour region within the mapped area in the third object image is then determined. The defect identification result is determined based on the contour region within the mapped area in the third object image.
[0092] In the above embodiments, if the defect identification result of the contour region at the mapping position is suspected to be defective, the process iteratively returns to the step of controlling the rotation platform to rotate and obtaining the object image re-acquired for the object to be detected at the rotated angle, and subsequent steps. If the defect identification result of the contour region at the mapping position is either defective or not defective, the defect identification result of the contour region at the mapping position is determined as the final defect identification result corresponding to the contour region. This allows for the combination of defect identification results for contour regions suspected to be defective from multiple angles. This avoids the situation where the shape of the defect region of the object to be detected is unstable and inaccurate in the image at different angles due to lighting conditions or shooting angles, thereby improving the accuracy of defect detection.
[0093] In some embodiments, defect identification of contour regions in an object graph includes: determining multi-dimensional features of contour regions in the object graph; for each dimension, determining the defect probability of the contour region based on the membership function corresponding to the dimension and the features of the dimension; and obtaining the defect identification result of the contour region based on the defect probabilities of the contour region determined in each dimension.
[0094] The membership function is a predefined function used to calculate the probability of a defect existing in the contour region. Each dimension has a corresponding membership function. The defect probability is the probability that a defect exists in the contour region.
[0095] In some embodiments, the multidimensional features include at least one of image content difference feature information, region size feature information, location feature information, and shape feature information.
[0096] In some embodiments, for each dimension, the computer device can substitute the features of that dimension into the membership function corresponding to that dimension to determine the defect probability of the contour region.
[0097] In some embodiments, the computer device may determine the final probability of a defect in the contour region based on the defect probability of the contour region determined in each dimension, and then determine the defect identification result of the contour region based on the final probability of a defect in the contour region.
[0098] In some embodiments, the computer device may determine the final probability of a defect in a contour region based on the product of the defect probabilities of the contour regions determined separately in each dimension. In other embodiments, the computer device may determine the final probability of a defect in a contour region based on the weighted sum of the defect probabilities of the contour regions determined separately in each dimension.
[0099] It is understood that the method for defect identification of the contour region in the object image after rotation and re-acquisition can refer to the method for defect identification of the contour region in the object image in the various embodiments of this application, and will not be elaborated further.
[0100] In the above embodiments, compared to computationally complex methods such as deep learning, the fuzzy logic method, which calculates probabilities using membership functions, can achieve accurate defect identification, thereby reducing computational load and system resource consumption. Furthermore, it eliminates the need for extensive model training with a large number of samples, avoiding the problem of a very small sample size containing defects. Moreover, because defects vary greatly in size and shape, and may exhibit white spots or stripes with varying degrees of intensity during imaging, traditional template matching methods suffer from inconsistent template standards and inaccurate detection results. The fuzzy logic method, which calculates probabilities using membership functions, is significantly more accurate than traditional template matching.
[0101] In some embodiments, the multi-dimensional features include at least one of image content difference feature information, region size feature information, position feature information, and shape feature information; for each dimension, determining the defect probability of the contour region based on the membership function corresponding to the dimension and the feature of the dimension includes at least one of the following: determining the defect probability of the contour region based on the first membership function corresponding to the image content difference dimension and the image content difference feature information; determining the defect probability of the contour region based on the second membership function corresponding to the region size dimension and the region size feature information; determining the defect probability of the contour region based on the third membership function corresponding to the position dimension and the position feature information; and determining the defect probability of the contour region based on the fourth membership function corresponding to the shape dimension and the shape feature information.
[0102] Among them, image content difference feature information is used to characterize the differences between image content within the contour region. Region size feature information is used to characterize the size of the contour region. Location feature information is used to characterize the location of the contour region. Shape feature information is used to characterize the shape features of the contour region.
[0103] In some embodiments, the computer device may substitute image content difference feature information into the first membership function corresponding to the image content difference dimension to determine the defect probability of the contour region.
[0104] In some embodiments, the computer device can substitute the region size feature information into the second membership function corresponding to the region size dimension to determine the defect probability of the contour region.
[0105] In some embodiments, the computer device can substitute location feature information into the third membership function corresponding to the location dimension to determine the defect probability of the contour region.
[0106] In some embodiments, the computer device may substitute shape feature information into the fourth membership function corresponding to the shape dimension to determine the defect probability of the contour region.
[0107] In the above embodiments, the probability of defects in the contour region is determined by the corresponding membership function under at least one of the dimensions of image content difference, region size, position and shape. This can measure the probability of defects in the contour region from multiple perspectives and improve the accuracy of defect detection.
[0108] In some embodiments, when the multi-dimensional features include image content difference feature information, the image content difference feature information includes gradient difference; gradient difference refers to the difference between the maximum gradient value and the minimum gradient value of the pixel values in the contour region; determining the defect probability of the contour region based on the first membership function corresponding to the image content difference dimension and the image content difference feature information includes: if the gradient difference is less than a first preset threshold, then the defect probability of the contour region is determined to be 0; if the gradient difference is greater than a second preset threshold, then the defect probability of the contour region is determined to be 1; if the gradient difference is greater than or equal to the first preset threshold and less than or equal to the second preset threshold, then the defect probability of the contour region is determined according to the gradient difference and a preset linear transformation formula.
[0109] The first preset threshold is less than the second preset threshold.
[0110] In some embodiments, if the gradient difference is greater than or equal to a first preset threshold and less than or equal to a second preset threshold, the computer device can substitute the gradient difference into a preset linear transformation formula to determine the defect probability of the contour region. The defect probability of the contour region is positively linearly correlated with the gradient difference.
[0111] In some embodiments, if the gradient difference is greater than or equal to a first preset threshold and less than or equal to a second preset threshold, the computer device can determine the defect probability of the contour region based on the ratio between the first difference and the second difference. The first difference is determined based on the difference between the gradient difference and the first preset threshold. The second difference is determined based on the difference between the second preset threshold and the first preset threshold.
[0112] In some embodiments, the first membership function corresponding to the image content difference dimension can be expressed by the following formula:
[0113]
[0114] Where p_ΔG represents the defect probability of the contour region determined by the first membership function corresponding to the image content difference dimension, ΔG represents the gradient difference of the contour region, G1 represents the first preset threshold, and G2 represents the second preset threshold.
[0115] In the above embodiments, the defect probability of the contour region is determined based on the first membership function corresponding to the image content difference dimension and the gradient difference of the contour region. This can accurately determine the defect probability under the image content difference dimension. Moreover, the use of fuzzy logic to calculate the probability through the membership function reduces the amount of computation and the consumption of system resources.
[0116] In some embodiments, when the multi-dimensional features include region size feature information, the region size feature information includes the number of pixels within the contour region; determining the defect probability of the contour region based on the second membership function corresponding to the region size dimension and the region size feature information includes: if the number of pixels is less than a third preset threshold, then the defect probability of the contour region is determined to be 0; if the number of pixels is greater than a fourth preset threshold, then the defect probability of the contour region is determined to be 1; if the number of pixels is greater than or equal to the third preset threshold and less than or equal to the fourth preset threshold, then the defect probability of the contour region is determined based on the number of pixels and a preset exponential transformation formula.
[0117] The third preset threshold is less than the fourth preset threshold. The number of pixels within the contour area refers to the number of pixels within the contour area.
[0118] In some embodiments, if the number of pixels is greater than or equal to a third preset threshold and less than or equal to a fourth preset threshold, the computer device can substitute the number of pixels into a preset exponential transformation formula to determine the defect probability of the contour region. The defect probability is positively correlated with the number of pixels.
[0119] In some embodiments, if the number of pixels is greater than or equal to a third preset threshold and less than or equal to a fourth preset threshold, the computer device can determine the defect probability of the contour region based on the difference between the natural exponent and 1. The natural exponent is obtained by exponentiation with base e and the target difference as the exponent. The target difference is determined based on the difference between the number of pixels within the contour region and the third preset threshold.
[0120] In some embodiments, the second membership function corresponding to the region size dimension can be expressed by the following formula:
[0121]
[0122] Where p_S represents the defect probability of the contour region determined by the second membership function corresponding to the region size dimension and the number of pixels. S represents the number of pixels within the contour region. S0 represents the third preset threshold, Nln2+S0 represents the fourth preset threshold, and N is a preset constant.
[0123] In the above embodiments, the defect probability of the contour region is determined based on the second membership function corresponding to the region size dimension and the number of pixels within the contour region. This can accurately determine the defect probability in the region size dimension. Furthermore, the use of fuzzy logic to calculate the probability through the membership function reduces the amount of computation and the consumption of system resources.
[0124] In some embodiments, the shape of the object to be detected includes a circle; when the multi-dimensional features include positional feature information, the positional feature information includes the distance from the center point of the contour region to the center of the circle of the object to be detected; determining the defect probability of the contour region based on the third membership function corresponding to the positional dimension and the positional feature information includes: if the difference between the distance and the radius of the object to be detected is less than a fifth preset threshold, then the defect probability of the contour region is determined to be 0; if the difference between the distance and the radius of the object to be detected is greater than or equal to the fifth preset threshold, then the defect probability of the contour region is determined to be 1.
[0125] In some embodiments, the third membership function corresponding to the location dimension can be expressed by the following formula:
[0126]
[0127] Where p_loc represents the defect probability of the contour region determined based on the third membership function corresponding to the position dimension and the distance from the center point of the contour region to the center of the object to be detected. dst represents the distance from the center point of the contour region to the center of the object to be detected. R represents the radius of the object to be detected. ε represents the fifth preset threshold.
[0128] In the above embodiments, since the smaller the difference between the distance from the center point of the contour region to the center of the object to be detected and the radius of the object to be detected, the closer the contour region is to the edge of the object to be detected, the defect probability of the contour region near the edge is identified as 0, and the defect probability of the contour region far from the edge is identified as 1. This can accurately avoid misidentifying the contour region at the edge of the object to be detected as a defect in the position dimension, thus improving the accuracy of defect detection. In addition, using fuzzy logic to calculate the probability through the membership function reduces the amount of computation and the consumption of system resources.
[0129] In some embodiments, when the multi-dimensional features include shape feature information, the shape feature information includes the aspect ratio of the bounding rectangle of the contour region; determining the defect probability of the contour region based on the fourth membership function corresponding to the shape dimension and the shape feature information includes: if the aspect ratio is greater than a sixth preset threshold, then the defect probability of the contour region is determined to be 0; if the aspect ratio is less than or equal to the sixth preset threshold, then the defect probability of the contour region is determined to be 1.
[0130] The aspect ratio of the bounding rectangle of the outline region refers to the ratio between the length and width of the bounding rectangle of the outline region.
[0131] In some embodiments, the fourth membership function corresponding to the shape dimension can be expressed by the following formula:
[0132]
[0133] Where p_shape represents the defect probability of the contour region determined by the fourth membership function corresponding to the shape dimension and the aspect ratio. l represents the length of the bounding rectangle of the contour region, and w represents the width of the bounding rectangle of the contour region. The aspect ratio of the bounding rectangle of the outline region is represented. δ represents the sixth preset threshold.
[0134] In the above embodiments, since there may be some long strip-shaped patterns on the surface of the hardware parts, these are not considered defects. The larger the aspect ratio of the bounding rectangle of the contour area, the longer the shape of the contour area. The defect probability of contour areas with an aspect ratio greater than a sixth preset threshold is identified as 0, and the defect probability of contour areas with an aspect ratio less than or equal to the sixth preset threshold is identified as 1. This can accurately avoid misidentifying long contour areas as defects in the shape dimension, thus improving the accuracy of defect detection. In addition, using fuzzy logic to calculate probabilities through membership functions reduces the amount of computation and system resources consumed.
[0135] In some embodiments, obtaining the defect identification result of the contour region based on the defect probability of the contour region determined in each dimension includes: determining the final probability that the contour region has a defect based on the defect probability of the contour region determined in each dimension; if the final probability is greater than a first probability threshold, then the defect identification result of the contour region is determined to have a defect; if the final probability is less than a second probability threshold, then the defect identification result of the contour region is determined to have no defect; if the final probability is greater than or equal to the second probability threshold and less than or equal to the first probability threshold, then the defect identification result of the contour region is determined to have a suspected defect.
[0136] In some embodiments, the computer device may determine the final probability of a defect in a contour region based on the product of the defect probabilities of the contour regions determined in each dimension.
[0137] In some embodiments, the final probability of a defect in the contour region can be calculated using the following formula:
[0138] p=p_ΔG×p_S×p_loc×p_shape
[0139] Where p represents the final probability of a defect in the contour region, p_ΔG represents the probability of a defect in the contour region determined in the dimension of image content difference, p_S represents the probability of a defect in the contour region determined in the dimension of region size, p_loc represents the probability of a defect in the contour region determined in the dimension of position, and p_shape represents the probability of a defect in the contour region determined in the dimension of shape.
[0140] In the above embodiments, the final probability of a defect in the contour region is determined based on the defect probability of the contour region determined in each dimension. Then, the defect identification result of the contour region is determined based on the relationship between the final probability and the first probability threshold and the second probability threshold. The use of fuzzy logic reduces the amount of computation and the consumption of system resources.
[0141] like Figure 6 The diagram shown is a schematic representation of the overall process of the defect detection method in various embodiments of this application. First, the material handling platform moves and rotates, carrying the object to be detected into the image acquisition point, acquiring the first object image. Image preprocessing and ROI region extraction are performed on the first object image. Then, contour extraction (i.e., edge detection) is performed on the ROI region to obtain the contour region. Multi-dimensional features of the contour region are determined, and the defect probability of the contour region is calculated based on the membership function corresponding to each dimension. Based on the defect probabilities determined for each dimension, the final probability of a defect in the contour region is determined. If the final probability is less than the first probability threshold (P_MIN), the defect identification result of the contour region is determined to be that there is no defect. If the final probability is greater than the second probability threshold (P_MAX), the defect identification result of the contour region is determined to be that there is a defect. If the final probability is greater than or equal to the second probability threshold and less than or equal to the first probability threshold (i.e., the final probability is within the range [P_MIN, P_MAX]), the defect identification result of the contour region is determined to be that there is a suspected defect. If the defect identification result of the contour area is suspected to be defective, the rotation platform is controlled to rotate and acquire a second object image. The position of the contour area in the first object image is mapped to the second object image according to the rotation angle, so as to locate the contour area suspected to be defective in the second object image. The final probability of the contour area located in the second object image having a defect is calculated in the same way, and the existence of a defect is determined according to the final probability. If it is still suspected to be defective, the rotation platform is controlled to rotate and acquire a third object image, and so on.
[0142] In some embodiments, an image acquisition device is provided above the rotating platform; the image acquisition device is used to acquire images of the object to be detected on the rotating platform; the rotation of the rotating platform is a rotation of the central axis.
[0143] The number of image acquisition devices is one. Central axis rotation refers to rotation around the central axis of the rotating platform itself.
[0144] In the above embodiments, the rotating platform rotates the central axis, causing the object to be inspected placed on the platform to rotate as well. This allows for image acquisition of the object from multiple angles using only a single image acquisition device, eliminating the need for multiple image acquisition devices or high-precision 3D imaging equipment. This reduces the cost of image acquisition equipment. Furthermore, it combines defect identification data from multiple angles for suspected defective contour areas. This avoids inaccurate or unstable morphology of defective areas in the image due to lighting conditions or shooting angles, thus improving the accuracy of defect detection. In addition, rotating the object on the platform solves the problem of object placement stability, improving the stability of the acquired object image and further enhancing the accuracy of defect detection.
[0145] In some embodiments, an arc-shaped light source is provided above the rotating platform; the arc-shaped light source is used to illuminate the object to be inspected on the rotating platform; and the image acquisition device is used to acquire an image of the object to be inspected through the central opening of the arc-shaped light source.
[0146] Among them, an arc-top light source refers to a light source with an arc-shaped surface. For example... Figure 5 As shown, the arc-shaped light source is positioned above the rotating platform to illuminate the object to be inspected on the rotating platform. The image acquisition device acquires images of the object to be inspected through the central opening of the arc-shaped light source.
[0147] In some embodiments, the dome light source can be a dome light source with a diffused surface, thereby avoiding the problem of inaccurate defect detection caused by reflection from the surface of the object to be inspected.
[0148] In the above embodiments, illuminating the object to be tested with an arc-shaped light source can reduce the reflection on the surface of the object to be tested, and the lighting effect is better than using multiple light sources to illuminate from multiple angles.
[0149] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0150] Based on the same inventive concept, this application also provides a defect detection device for implementing the defect detection method described above. The solution provided by this device is similar to the solution described in the above method; therefore, the specific limitations in one or more defect detection device embodiments provided below can be found in the limitations of the defect detection method described above, and will not be repeated here.
[0151] In some embodiments, such as Figure 7 As shown, a defect detection device 700 is provided, including: an image acquisition module 702, a defect recognition module 704, a control module 706, and a mapping module 708, wherein:
[0152] Image acquisition module 702 is used to acquire an object image of the object to be detected; the object to be detected is placed on a rotating platform.
[0153] The defect identification module 704 is used to identify defects in the contour area of the object drawing.
[0154] The control module 706 is used to control the rotation platform to rotate if a contour area suspected of having a defect is identified, and to acquire a new object image of the object to be inspected at the angle after rotation.
[0155] The mapping module 708 is used to determine the corresponding mapping position of the contour area suspected of having defects in the re-acquired object map based on the rotation angle of the rotating platform.
[0156] The defect identification module 704 is also used to identify defects in the contour region located at the mapped position in the re-acquired object image.
[0157] In some embodiments, the defect identification module 704 is further configured to, if the defect identification result of the contour region at the mapped position is suspected to be a defect, notify the control module 706 to return to the step of controlling the rotation platform to rotate, and to obtain the object image re-acquired for the object to be inspected at the angle after rotation, and subsequent steps; the defect identification module 704 is further configured to, if the defect identification result of the contour region at the mapped position is either a defect or no defect, determine the defect identification result of the contour region at the mapped position as the final defect identification result corresponding to the contour region.
[0158] In some embodiments, the defect identification module 704 is further configured to determine the multi-dimensional features of the contour region in the object graph; for each dimension, determine the defect probability of the contour region based on the membership function corresponding to the dimension and the features of the dimension; and obtain the defect identification result of the contour region based on the defect probability of the contour region determined in each dimension.
[0159] In some embodiments, the multi-dimensional features include at least one of image content difference feature information, region size feature information, position feature information, and shape feature information; the defect recognition module 704 is further configured to perform at least one of the following: determining the defect probability of the contour region based on the first membership function corresponding to the image content difference dimension and the image content difference feature information; determining the defect probability of the contour region based on the second membership function corresponding to the region size dimension and the region size feature information; determining the defect probability of the contour region based on the third membership function corresponding to the position dimension and the position feature information; and determining the defect probability of the contour region based on the fourth membership function corresponding to the shape dimension and the shape feature information.
[0160] In some embodiments, when the multi-dimensional features include image content difference feature information, the image content difference feature information includes gradient difference; gradient difference refers to the difference between the maximum gradient value and the minimum gradient value of the pixel values in the contour region; the defect recognition module 704 is further configured to determine the defect probability of the contour region as 0 if the gradient difference is less than a first preset threshold; determine the defect probability of the contour region as 1 if the gradient difference is greater than a second preset threshold; and determine the defect probability of the contour region according to the gradient difference and a preset linear transformation formula if the gradient difference is greater than or equal to the first preset threshold and less than or equal to the second preset threshold.
[0161] In some embodiments, when the multi-dimensional features include region size feature information, the region size feature information includes the number of pixels within the contour region; the defect identification module 704 is further configured to determine the defect probability of the contour region as 0 if the number of pixels is less than a third preset threshold; determine the defect probability of the contour region as 1 if the number of pixels is greater than a fourth preset threshold; and determine the defect probability of the contour region according to the number of pixels and a preset exponential transformation formula if the number of pixels is greater than or equal to the third preset threshold and less than or equal to the fourth preset threshold.
[0162] In some embodiments, the shape of the object to be detected includes a circle; when the multi-dimensional features include positional feature information, the positional feature information includes the distance from the center point of the contour region to the center of the circle of the object to be detected; the defect identification module 704 is further configured to determine the defect probability of the contour region as 0 if the difference between the distance and the radius of the object to be detected is less than a fifth preset threshold; and to determine the defect probability of the contour region as 1 if the difference between the distance and the radius of the object to be detected is greater than or equal to the fifth preset threshold.
[0163] In some embodiments, when the multi-dimensional features include shape feature information, the shape feature information includes the aspect ratio of the bounding rectangle of the contour region; the defect identification module 704 is further configured to determine the defect probability of the contour region as 0 if the aspect ratio is greater than a sixth preset threshold, and to determine the defect probability of the contour region as 1 if the aspect ratio is less than or equal to the sixth preset threshold.
[0164] In some embodiments, the defect identification module 704 is further configured to determine the final probability of a defect in the contour region based on the defect probabilities of the contour region determined in each dimension; if the final probability is greater than a first probability threshold, the defect identification result of the contour region is determined to be a defect; if the final probability is less than a second probability threshold, the defect identification result of the contour region is determined to be a defect-free region; if the final probability is greater than or equal to the second probability threshold and less than or equal to the first probability threshold, the defect identification result of the contour region is determined to be a suspected defect.
[0165] In some embodiments, an image acquisition device is provided above the rotating platform; the image acquisition device is used to acquire images of the object to be detected on the rotating platform; the rotation of the rotating platform is a rotation of the central axis.
[0166] In some embodiments, an arc-shaped light source is provided above the rotating platform; the arc-shaped light source is used to illuminate the object to be inspected on the rotating platform; and the image acquisition device is used to acquire an image of the object to be inspected through the central opening of the arc-shaped light source.
[0167] The aforementioned defect detection device acquires an object image of the object to be inspected placed on a rotating platform. It then identifies defects in the contour regions of the object image. If a contour region suspected of having a defect is identified, the rotating platform is controlled to rotate, and a new object image is acquired at the rotated angle. Based on the rotation angle of the rotating platform, the location of the suspected defective contour region is determined to be mapped to the corresponding position in the newly acquired object image. Defect identification is then performed on the contour region located at the mapped position in the newly acquired object image. This allows for defect identification of the suspected defective contour region within the newly acquired object image after rotating the object to be inspected via the rotating platform. By combining defect identification results from multiple angles, the device avoids inaccurate or unstable morphology of the defective region in the image due to lighting conditions or shooting angle, thus improving the accuracy of defect detection.
[0168] Each module in the aforementioned defect detection device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the corresponding operations of each module.
[0169] In one embodiment, a computer device is provided, the internal structure of which can be shown as follows: Figure 8 As shown, the computer device includes a processor, memory, communication interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements a defect detection method. The display screen can be an LCD screen or an e-ink screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the computer device casing, or an external keyboard, touchpad, or mouse.
[0170] Those skilled in the art will understand that Figure 8The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0171] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.
[0172] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.
[0173] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0174] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0175] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0176] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0177] The above embodiments are merely illustrative of several implementation methods of this application, and are described in a relatively specific and detailed manner. However, they should not be construed as limiting the scope of this application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A defect detection method, characterized in that, The method includes: Obtain an object image of the object to be detected; the object to be detected is placed on a rotating platform; Defect identification of the contour region in the object graph includes: determining multi-dimensional features of the contour region in the object graph; for each dimension, determining the defect probability of the contour region based on the membership function corresponding to the dimension and the features of the dimension; and obtaining the defect identification result of the contour region based on the defect probabilities of the contour region determined in each dimension. If a contour area suspected of having a defect is identified, the rotating platform is controlled to rotate, and an object image re-acquired for the object to be detected at the angle after rotation is obtained; Based on the rotation angle of the rotating platform, the location of the contour area suspected of having a defect is determined to be the corresponding mapped position in the re-acquired object image; Defect identification is performed on the contour region located at the mapped position in the re-acquired object image.
2. The method according to claim 1, characterized in that, After performing defect identification on the contour region located at the mapped position in the re-acquired object image, the method further includes: If the defect identification result of the contour area at the mapped position is suspected to be a defect, then return to the steps of controlling the rotation platform to rotate and obtaining the object image re-acquired for the object to be detected at the angle after rotation, and subsequent steps. If the defect identification result of the contour region at the mapped position is either that a defect exists or that no defect exists, then the defect identification result of the contour region at the mapped position is determined as the final defect identification result corresponding to the contour region.
3. The method according to claim 1, characterized in that, The method further includes: The region of interest (ROI) is extracted from the object image to obtain the ROI image; Edge detection is performed on the region of interest image to obtain the contour in the object image; Define the contour region enclosed by the contour.
4. The method according to claim 1, characterized in that, The multi-dimensional features include at least one of image content difference features, region size features, location features, and shape features; for each dimension, determining the defect probability of the contour region based on the membership function corresponding to the dimension and the features of the dimension includes at least one of the following: The defect probability of the contour region is determined based on the first membership function corresponding to the image content difference dimension and the image content difference feature information; The defect probability of the contour region is determined based on the second membership function corresponding to the region size dimension and the region size feature information; The defect probability of the contour region is determined based on the third membership function corresponding to the position dimension and the position feature information. The defect probability of the contour region is determined based on the fourth membership function corresponding to the shape dimension and the shape feature information.
5. The method according to claim 4, characterized in that, When the multi-dimensional features include the image content difference feature information, the image content difference feature information includes gradient difference; the gradient difference refers to the difference between the maximum gradient value and the minimum gradient value of the pixel values in the contour region. The step of determining the defect probability of the contour region based on the first membership function corresponding to the image content difference dimension and the image content difference feature information includes: If the gradient difference is less than the first preset threshold, then the defect probability of the contour region is determined to be 0. If the gradient difference is greater than the second preset threshold, then the defect probability of the contour region is determined to be 1. If the gradient difference is greater than or equal to the first preset threshold and less than or equal to the second preset threshold, then the defect probability of the contour region is determined according to the gradient difference and the preset linear transformation formula.
6. The method according to claim 4, characterized in that, When the multi-dimensional features include the region size feature information, the region size feature information includes the number of pixels within the contour region; determining the defect probability of the contour region based on the second membership function corresponding to the region size dimension and the region size feature information includes: If the number of pixels is less than a third preset threshold, then the probability of a defect in the contour region is determined to be 0. If the number of pixels is greater than the fourth preset threshold, then the defect probability of the contour region is determined to be 1. If the number of pixels is greater than or equal to the third preset threshold and less than or equal to the fourth preset threshold, then the defect probability of the contour region is determined according to the number of pixels and the preset exponential transformation formula.
7. The method according to claim 4, characterized in that, The shape of the object to be detected includes a circle; when the multi-dimensional features include the positional feature information, the positional feature information includes the distance from the center point of the contour region to the center of the circle of the object to be detected; determining the defect probability of the contour region based on the third membership function corresponding to the positional dimension and the positional feature information includes: If the difference between the distance and the radius of the object to be detected is less than a fifth preset threshold, then the probability of a defect in the contour region is determined to be 0. If the difference between the distance and the radius of the object to be detected is greater than or equal to a fifth preset threshold, then the probability of a defect in the contour region is determined to be 1.
8. The method according to claim 4, characterized in that, When the multi-dimensional features include the shape feature information, the shape feature information includes the aspect ratio of the bounding rectangle of the contour region; determining the defect probability of the contour region based on the fourth membership function corresponding to the shape dimension and the shape feature information includes: If the aspect ratio is greater than the sixth preset threshold, then the probability of a defect in the contour region is determined to be 0. If the aspect ratio is less than or equal to the sixth preset threshold, then the defect probability of the contour region is determined to be 1.
9. The method according to claim 3, characterized in that, The step of obtaining the defect identification result of the contour region based on the defect probability of the contour region determined in each dimension includes: Based on the defect probability of the contour region determined in each dimension, the final probability of the presence of a defect in the contour region is determined. If the final probability is greater than the first probability threshold, then the defect identification result of the contour region is determined to be that a defect exists; If the final probability is less than the second probability threshold, then the defect identification result of the contour region is determined to be that there is no defect. If the final probability is greater than or equal to the second probability threshold and less than or equal to the first probability threshold, then the defect identification result of the contour region is determined to be a suspected defect.
10. The method according to any one of claims 1 to 9, characterized in that, An image acquisition device is installed above the rotating platform; the image acquisition device is used to acquire images of the object to be detected on the rotating platform; the rotation of the rotating platform is a rotation of the central axis.
11. The method according to claim 10, characterized in that, An arc-shaped light source is provided above the rotating platform; the arc-shaped light source is used to illuminate the object to be inspected on the rotating platform; the image acquisition device is used to acquire an image of the object to be inspected through the central opening of the arc-shaped light source.
12. A defect detection device, characterized in that, The device includes: The image acquisition module is used to acquire an object image of the object to be detected; the object to be detected is placed on a rotating platform; The defect identification module is used to identify defects in the contour region of the object image, including: determining multi-dimensional features of the contour region in the object image; for each dimension, determining the defect probability of the contour region according to the membership function corresponding to the dimension and the features of the dimension; and obtaining the defect identification result of the contour region according to the defect probability of the contour region determined in each dimension. The control module is used to control the rotation platform to rotate if a contour area suspected of having a defect is identified, and to acquire an object image re-acquired for the object to be detected at the angle after rotation. The mapping module is used to determine the location of the contour area suspected of having a defect in the re-acquired object image based on the rotation angle of the rotating platform. The defect identification module is also used to identify defects in the contour region located at the mapped position in the re-acquired object image.
13. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 11.
14. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 11.
15. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 11.