Defect detection method and device for equipment shell, electronic equipment and storage medium

Through the defect segmentation model of the DeepLab V3+ model, the area of ​​interest of the equipment casing is identified and defect detection is performed, which solves the instability and high cost problems of manual inspection and achieves accurate detection and quality assurance of equipment casing defects.

CN118552497APending Publication Date: 2024-08-27SHANGHAI WINGTECH ELECTRONICS TECH
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202410648727.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-23
Publication Date
2024-08-27

AI Technical Summary

Technical Problem

In the existing technology, equipment casing defect detection relies on manual inspection, which has instability, high cost, high missed detection rate and false detection rate, and cannot guarantee the quality of the equipment casing.

Method used

The defect segmentation model based on the DeepLab V3+ model is used to obtain multiple images of the equipment casing to be inspected, identify areas of interest, perform defect detection, count defect categories and area information, and determine the quality inspection results of the equipment casing.

Benefits of technology

It achieves accurate detection of defects in equipment casings, reduces detection costs, improves detection efficiency, and ensures the quality of equipment casings.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118552497A
    Figure CN118552497A
Patent Text Reader

Abstract

The embodiment of the invention relates to a defect detection method and device for an equipment shell, electronic equipment and a storage medium, and the method comprises the steps: obtaining a plurality of to-be-detected images corresponding to the equipment shell, the plurality of to-be-detected images respectively corresponding to different shell regions of the equipment shell; identifying a region of interest, corresponding to the equipment shell, of the first to-be-detected image; the first to-be-detected image is any to-be-detected image; performing defect detection on the region of interest through a defect segmentation model to obtain a defect detection result corresponding to the first to-be-detected image, the defect detection result comprising defect category and / or defect region information; and carrying out statistics on the defect detection results corresponding to the plurality of to-be-detected images, and determining a quality detection result corresponding to the equipment shell according to a statistical result. According to the defect detection method and device for the equipment shell, the electronic equipment and the storage medium, the defects on the equipment shell can be accurately detected, and the quality of the equipment shell is guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a method, device, electronic device and storage medium for detecting defects of a device casing. Background Art

[0002] As the automation level of current production lines increases, the assembly and production process of equipment becomes more mature, and the probability of defects in equipment casings is greatly reduced. However, customers are increasingly demanding equipment quality, and minor defects on equipment casings still have a significant impact on product quality and also affect customers' experience of the product. At present, manual inspection is usually used to detect defects on equipment casings. Manual inspection of defects has problems such as great instability and high labor costs, and the missed detection rate and false detection rate are too high, which cannot guarantee the quality of the equipment casing. Summary of the invention

[0003] The embodiments of the present application disclose a method, an apparatus, an electronic device and a storage medium for detecting defects of a device casing, which can accurately detect defects on the device casing and ensure the quality of the device casing.

[0004] In a first aspect, an embodiment of the present application discloses a method for detecting defects in a device housing, comprising:

[0005] Acquire a plurality of images to be detected corresponding to a device shell, wherein the plurality of images to be detected respectively correspond to different shell areas of the device shell;

[0006] Identify a first image to be detected and a region of interest corresponding to the device housing; the first image to be detected is any image to be detected;

[0007] Perform defect detection on the region of interest using a defect segmentation model to obtain a defect detection result corresponding to the first image to be detected, wherein the defect detection result includes defect category and / or defect region information;

[0008] The defect detection results corresponding to the multiple images to be detected are respectively counted, and the quality inspection result corresponding to the device shell is determined according to the statistical results.

[0009] As an optional implementation, in the first aspect of the embodiment of the present application, the identifying the region of interest corresponding to the first image to be detected and the device housing includes:

[0010] Determining a reference edge corresponding to the first image to be detected according to a mean value of the grayscale values ​​of each column of pixels in the first image to be detected;

[0011] According to the reference edge and the preset size, a region of interest corresponding to the first image to be detected and the device housing is determined.

[0012] As an optional implementation, in the first aspect of the embodiment of the present application, determining the reference edge corresponding to the first image to be detected according to the mean grayscale value of each column of pixels in the first image to be detected includes:

[0013] According to the preset image direction, the grayscale value mean of each column of pixels in the first image to be detected is calculated in sequence;

[0014] If it is detected that the mean grayscale value corresponding to the pixel points in the current column is greater than the grayscale threshold, the pixel points in the current column are used as the reference edge corresponding to the first image to be detected.

[0015] As an optional implementation manner, in the first aspect of the embodiment of the present application, before performing defect detection on the region of interest by using the defect segmentation model to obtain a defect detection result corresponding to the first image to be detected, the method further includes:

[0016] Performing image segmentation on the region of interest to obtain multiple detection sub-images;

[0017] The performing defect detection on the region of interest by using the defect segmentation model to obtain a defect detection result corresponding to the first image to be detected includes:

[0018] Defect detection is performed on each of the detection sub-images through a defect segmentation model to obtain a defect detection result corresponding to each of the detection sub-images, and the defect detection results corresponding to the multiple detection sub-images are used as defect detection results corresponding to the first image to be detected.

[0019] As an optional implementation manner, in the first aspect of the embodiment of the present application, the defect detection result corresponding to the detection sub-image includes the defect category, defect area information and defect confidence corresponding to each defect in the detection sub-image;

[0020] Before collecting statistics on the defect detection results respectively corresponding to the plurality of images to be detected, the method further includes:

[0021] According to the defect detection results respectively corresponding to the multiple detection sub-images, the defect categories and defect area information corresponding to the defects whose defect confidence is greater than the confidence threshold are added to the target set;

[0022] The step of collecting statistics on defect detection results corresponding to the plurality of images to be detected includes:

[0023] Statistics are collected on defect categories and defect area information corresponding to each defect included in the target set.

[0024] As an optional implementation manner, in the first aspect of the embodiment of the present application, the statistical results include one or more of the number of defects included in various defect categories, the total area of ​​defect regions included in various defect categories, the area of ​​defect regions corresponding to each defect, the total length of defect regions included in various defect categories, and the length of defect regions corresponding to each defect;

[0025] Determining the quality inspection result corresponding to the device housing according to the statistical result includes:

[0026] If it is detected that the number of defects included in the first defect category is greater than the quantity threshold corresponding to the first defect category, then the quality inspection result corresponding to the device housing is determined to be unqualified in the quality inspection; the first defect category is any defect category; and / or,

[0027] If it is detected that the total area of ​​the defect regions included in the first defect category is greater than the first area threshold, then determining that the quality inspection result corresponding to the device housing is unqualified in the quality inspection; and / or,

[0028] If it is detected that the defect area corresponding to the first defect is greater than the second area threshold, it is determined that the quality inspection result corresponding to the device housing is unqualified; the first defect is any defect; and / or,

[0029] If it is detected that the total length of the defective area included in the first defect category is greater than the first length threshold, then determining that the quality inspection result corresponding to the device housing is unqualified in the quality inspection; and / or,

[0030] If it is detected that the length of the defect area corresponding to the first defect is greater than the second length threshold, it is determined that the quality inspection result corresponding to the device shell is unqualified.

[0031] As an optional implementation, in the first aspect of the embodiments of the present application, the defect segmentation model is constructed based on the DeepLab V3+ model, and the defect segmentation model includes a backbone network module and a dilated space convolution pooling pyramid ASPP module; the backbone network module includes a lightweight convolutional neural network, and the ASPP module uses stripe pooling technology for pooling.

[0032] In a second aspect, an embodiment of the present application discloses a defect detection device for a device housing, comprising:

[0033] An image acquisition module, used to acquire a plurality of images to be detected corresponding to a device housing, wherein the plurality of images to be detected respectively correspond to different housing areas of the device housing;

[0034] An identification module, used for identifying a first image to be detected and an area of ​​interest corresponding to the device housing; the first image to be detected is any image to be detected;

[0035] A defect detection module, configured to perform defect detection on the region of interest by using a defect segmentation model to obtain a defect detection result corresponding to the first image to be detected, wherein the defect detection result includes defect category and / or defect region information;

[0036] The statistical module is used to collect statistics on the defect detection results corresponding to the multiple images to be detected, and determine the quality detection result corresponding to the device shell according to the statistical results.

[0037] In a third aspect, an embodiment of the present application discloses an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor implements the method described in any of the above embodiments.

[0038] In a fourth aspect, an embodiment of the present application discloses a storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the method described in any of the above embodiments is implemented.

[0039] The defect detection method, device, electronic device and storage medium of the device shell disclosed in the embodiment of the present application, obtain multiple images to be detected corresponding to the device shell, and the multiple images to be detected correspond to different shell areas of the device shell respectively; identify the first image to be detected and the area of ​​interest corresponding to the device shell; the first image to be detected is any image to be detected; the defect detection of the area of ​​interest is performed on the defect segmentation model to obtain the defect detection result corresponding to the first image to be detected, and the defect detection result includes defect category and / or defect area information; the defect detection results corresponding to the multiple images to be detected are statistically analyzed, and the quality detection result corresponding to the device shell is determined according to the statistical results. In the embodiment of the present application, multiple images to be detected corresponding to the device shell are obtained, and the defect detection results corresponding to each image to be detected are obtained by performing defect detection on the area of ​​interest corresponding to the device shell in the multiple images to be detected, so that the defects on the device shell can be accurately detected, and the defect categories and / or defect area information in the multiple images to be detected are statistically analyzed to determine whether the device shell meets the quality standards, accurately detect the defects on the device shell, ensure the quality of the device shell, and do not rely on manual detection, which can reduce the cost of defect detection and improve the detection efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0041] Figure 1a This is an application scenario diagram of a method for detecting defects in a device housing in one embodiment;

[0042] Figure 1b is a schematic diagram of multiple images to be detected corresponding to a device housing in one embodiment;

[0043] Figure 2 is a flow chart of a method for detecting defects in a device housing in one embodiment;

[0044] Figure 3 A flowchart of identifying a region of interest corresponding to a first image to be detected and a device housing in one embodiment;

[0045] Figure 4 A flowchart for identifying a region of interest corresponding to a first image to be detected and a device housing in another embodiment;

[0046] Figure 5 is a flow chart of a method for detecting defects in a device housing in another embodiment;

[0047] Figure 6 A flowchart of another embodiment of the electronic device determining a quality inspection result corresponding to the device housing after obtaining defect inspection results corresponding to each inspection sub-image;

[0048] Figure 7 is a block diagram of a defect detection device for a device housing in one embodiment;

[0049] Figure 8 FIG. 4 is a structural block diagram of an electronic device in an embodiment. DETAILED DESCRIPTION

[0050] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0051] It should be noted that the terms "including" and "having" and any variations thereof in the embodiments of the present application and the accompanying drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device including a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products or devices.

[0052] In the related technology, manual inspection and visual inspection based on traditional algorithms are usually used to detect defects in the equipment shell. Among them, in the process of manual inspection, the standard judgment of defect detection by manual inspection will change with the change of human attention, fatigue and other factors, making it difficult to ensure that the product inspection standards are within the technical range that meets the production process requirements in continuous quality inspection; in addition, in the process of visual inspection based on traditional algorithms, there are usually many background interferences and differences in product consistency in the products corresponding to the equipment shell, which leads to differences in optical imaging, resulting in problems such as too high missed detection rate and false detection rate, and it is difficult to meet the production requirements of the production line.

[0053] The embodiments of the present application disclose a method, an apparatus, an electronic device and a storage medium for detecting defects of a device casing, which can accurately detect defects on the device casing and ensure the quality of the device casing.

[0054] Figure 1a FIG. 1 is an application scenario diagram of a method for detecting defects in a device housing in an embodiment. Figure 1a As shown, the defect detection method for the device shell provided in the embodiment of the present application can be applied to the electronic device 110, and the electronic device 110 may also have a camera device 120 connected thereto; wherein the electronic device 110 may include but is not limited to mobile phones, smart wearable devices, tablet computers, PCs (Personal Computers), computers, etc., and the embodiment of the present application does not limit this.

[0055] Optionally, the camera device 120 may include but is not limited to infrared thermal imagers, digital cameras, digital imaging equipment, X-ray computer tomography equipment and other imaging devices. Due to the different types of camera devices, the images or videos captured are also different, which can be in the RGB (red, green and blue) color domain, CMY / CMYK (Cyan, Magenta, Yellow, Black) color domain, or grayscale imaging. After the color image is acquired, it can be grayscaled so that the color image is converted into a grayscale image for defect detection. The camera device 120 can be independent of the electronic device 110 and only connected through various connection methods, or it can be located inside the electronic device 110; the available connection methods include but are not limited to data cable connection, Bluetooth connection, NFC (Near Field Communication) connection and other wired or wireless connection methods.

[0056] Optionally, the camera device 120 may be independent of the electronic device 110, and the shooting direction of the camera device 120 may be toward the production line, so that the image of the equipment housing 130 on the production line can be captured, and the electronic device 110 may not be near the production line, that is, the electronic device 110 can remotely control the camera device 120 to capture the image of the equipment housing 130 on the production line to obtain multiple images to be detected.

[0057] Among them, the device housing 130 refers to the outer shell, middle shell, front shell and other shells of the product equipment, which can be used to protect or isolate the components and circuit boards of the product equipment; the product equipment may include but is not limited to mobile phones, wearable devices and other devices with shells; specifically, the device housing can be the front shell of a mobile phone including the front screen part and the front extension part of the mobile phone, and the front shell of the mobile phone may include a front camera, an earpiece, sensors and possible touch buttons or virtual button areas, etc.

[0058] In some embodiments, when the electronic device 110 controls the camera device 120 to capture images of the device housing 130, it may start from one side of the device housing 130 and continuously capture images around the device housing 130. Optionally, the camera device 120 may start to capture images from any side around the device housing 130, and the direction of the camera device 120 around the device housing 130 is not limited here, as long as the multiple images to be detected captured by the camera device 120 include all sides of the device housing 130. Specifically, Figure 1a As shown, the device housing 130 is placed horizontally, the camera device 120 is located on the left side of the device housing 130, and the shooting angle of view is toward the left side of the device housing 130, and the electronic device 110 controls the camera device 120 to move clockwise from the left side of the device housing 130 along the four sides of the device housing 130 and collect the image to be detected until it returns to the starting position, and the moving trajectory of the camera device 120 is always on the same horizontal plane as the device housing 130, and the shooting angle of view of the camera device 120 is always toward the device housing 130, and finally a plurality of images to be detected corresponding to the device housing 130 are obtained.

[0059] Different images to be detected include different housing areas of the device housing 130, and all images to be detected can include all housing areas of the device housing 130. In one embodiment, Figure 1b As shown, Figure 1b It includes multiple images 140 to be detected of three different device shells captured by the camera device 120 (each column is 6 images to be detected corresponding to one device shell). If the multiple images 140 to be detected corresponding to the same device shell 130 are spliced, a complete image of the device shell 130 can be obtained.

[0060] After the electronic device 110 controls the camera device 120 to collect multiple images 140 to be detected corresponding to the device housing 130, the region of interest corresponding to each image 140 to be detected and the device housing 130 is identified, that is, the housing region of the device housing 130 in the image 140 to be detected; the electronic device 110 performs defect detection on the region of interest through the defect segmentation model to obtain defect detection results corresponding to each image 140 to be detected; the electronic device 110 then counts the defect detection results corresponding to the multiple images 140 to be detected, and determines the quality detection result corresponding to the device housing 130 according to the statistical results. The electronic device 110 determines whether the device housing meets the quality standard by detecting the defects on the device housing, thereby realizing accurate judgment of the quality of the device housing.

[0061] like Figure 2 As shown, in one embodiment, a method for detecting defects in a device housing is provided, which can be applied to the above electronic device. The method may include the following steps:

[0062] Step 210 , obtaining a plurality of images to be detected corresponding to the device shell, wherein the plurality of images to be detected respectively correspond to different shell areas of the device shell.

[0063] In some embodiments, the electronic device can control the camera device to capture images of the device housing to obtain multiple images to be detected corresponding to the device housing. The method of capturing the images to be detected by the camera device can refer to the above Figure 1a The relevant description will not be repeated here.

[0064] The multiple images to be detected correspond to different shell areas of the device shell, respectively. Each image to be detected includes a partial shell area of ​​the device shell. The shell areas of the device shell included in different images to be detected are different. Furthermore, the multiple images to be detected can be spliced ​​to obtain a complete shell image of the device shell.

[0065] The defects of the equipment shell refer to various minor defects such as bumps, scratches, and bruises on the surface that appear during the production and processing of the equipment shell due to the equipment shell's own processing technology, collisions on the assembly line, and contact with other objects. The defects of the equipment shell may include but are not limited to defects caused by "bumps", "scratches", "abrasions", "dents", "bright spots", etc.

[0066] In some embodiments, after acquiring multiple images to be detected corresponding to the device housing, the electronic device may preprocess the multiple images to be detected to eliminate noise interference in the acquisition and transmission process of the images to be detected, so as to reduce the computational complexity when subsequently identifying the region of interest in the images to be detected, thereby improving the defect detection efficiency of the device housing. The preprocessing methods that the electronic device may use include, but are not limited to, graying the images to be detected, performing image enhancement on the images to be detected, performing geometric transformation on the images to be detected, etc.

[0067] Step 220: Identify the region of interest corresponding to the first image to be detected and the device housing.

[0068] The first image to be detected is any image to be detected. The region of interest refers to the housing region of the device housing in the image to be detected.

[0069] After the electronic device obtains multiple images to be inspected corresponding to the device shell, and / or pre-processes the images to be inspected, the electronic device can identify the region of interest corresponding to the device shell in each image to be inspected. By identifying the region of interest in each image to be inspected, it can facilitate subsequent accurate defect detection of the device shell and avoid interference from non-device shell areas contained in the images to be inspected.

[0070] In some embodiments, the electronic device can identify the shell area corresponding to the device shell in the first image to be detected based on the target detection algorithm to obtain the region of interest. The target detection algorithms that can be used include but are not limited to machine learning-based methods (artificial feature + classifier method) and deep learning-based methods (including Faster-RCNN (Faster Regions with CNN features, faster regional convolutional neural network) framework, FPN (Feature Pyramid Network, feature pyramid network) framework, YOLO (you only look once, single detection) framework, etc.).

[0071] In some embodiments, the electronic device may also use an edge detection algorithm to detect the edge of the device housing in the first image to be processed to determine the region of interest. The edge detection algorithms that may be used include Sobel operator, Prewitt operator, and Canny operator.

[0072] In some specific embodiments, the electronic device may calculate the pixel difference of each pair of adjacent pixels in the first image to be detected; and determine the region of interest based on each adjacent pixel whose pixel difference is greater than a pixel threshold. The greater the pixel difference of adjacent pixels, the greater the possibility that the two adjacent pixels are pixels of the background area and the shell area of ​​the device shell, respectively. Therefore, the contour of the device shell in the first image to be detected can be determined by the pixel difference of each adjacent pixel, thereby obtaining the region of interest.

[0073] In some embodiments, after the electronic device identifies the region of interest corresponding to the first image to be detected and the device housing, it can perform foreground segmentation on the region of interest based on a foreground segmentation algorithm. The foreground segmentation methods that can be used include but are not limited to threshold-based segmentation methods (gray threshold method, region growing algorithm, etc.), edge detection-based segmentation methods (gradient algorithm processing, Roberts (cross differential) algorithm, Laplacian (Laplace) algorithm, etc.), segmentation algorithms based on active contour models (active contours), segmentation algorithms based on SAM segmentation large models, etc. The target image area is segmented out from the first image to be detected to facilitate the subsequent defect segmentation model to detect defects in the region of interest, and avoid erroneous extraction of defects in non-interested areas.

[0074] Step 230 , performing defect detection on the region of interest using a defect segmentation model to obtain a defect detection result corresponding to the first image to be detected.

[0075] The defect segmentation model refers to a model that can identify each defect in an image. The input of the defect segmentation model is an image, and the output is the defect detection result in the image; wherein the defect detection result may include defect category and / or defect area information. Defect category refers to the category of each defect, which may include but is not limited to one or more of the categories such as bumps, scratches, abrasions, depressions, bright spots, watermarks, etc. The electronic device can determine the defect category according to the cause of the defect. Defect area information refers to the area information of the defect on the first image to be detected, which may include but is not limited to the area information, size information (the size information may include length, width), etc. of the defect in the image to be detected or the area of ​​interest. Through the defect detection results, the electronic device can know all the defects contained in the first image to be detected and the corresponding defect categories and / or defect area information, and can judge whether the quality of the device shell meets the quality standards based on the defects contained in all the images to be detected.

[0076] In some embodiments, the defect segmentation model is constructed based on the DeepLab V3+ model, which includes a backbone network module and an ASPP (Atrous Spatial Pyramid Pooling) module; the backbone network module includes a lightweight convolutional neural network, and the ASPP module uses stripe pooling technology for pooling. Among them, the DeepLab V3+ model is a model for semantic segmentation, which can quickly and accurately identify the object pointed to in the image; the backbone network module uses a lightweight convolutional neural network to reduce the space occupied by the defect segmentation model and the resource consumption in the process of defect detection using the defect segmentation model; the stripe pooling technology is used instead of the global pooling in the ASPP module. Compared with global pooling, stripe pooling can deploy long strips of pooling kernels along a spatial dimension for pooling, effectively capture the long-distance relationship of isolated areas, and can more accurately understand the spatial connection between different areas in the region of interest, so as to better identify the defects of each area in the region of interest.

[0077] In some embodiments, training of a defect segmentation model may include: an electronic device acquiring a training sample image, wherein the training sample image includes a shell area of ​​a device shell; dividing the training sample image into a positive sample set and a negative sample set, wherein the positive sample set is used to characterize that there are no defects in the device shell in the training sample image, and the negative sample set is used to characterize that there are defects in the device shell in the training sample image; and training the defect segmentation model based on the training sample image.

[0078] Optionally, since the number of training sample images containing defects in the negative sample set is small, in order to improve the accuracy of the defect segmentation model and avoid overfitting of the defect segmentation model, the electronic device may amplify the negative sample set to generate more training sample images containing defects; image change methods that can be used to expand negative samples include but are not limited to expanding negative samples through adversarial networks, generating negative samples through data enhancement (including random cropping, rotation, flipping and scaling operations), etc.; the electronic device labels the defects contained in the amplified negative sample set and the positive sample set, and determines the sample defect category and sample defect area information corresponding to each defect in each training sample image.

[0079] Furthermore, a pre-trained defect segmentation model can be constructed based on the DeepLab V3+ model, and each labeled training sample image is divided into a training group, a verification group and a test group according to a preset ratio. Specifically, the preset ratio can be customized, such as 14:3:3; the training sample images contained in the training group are respectively subjected to defect detection through the pre-trained defect segmentation model to obtain the predicted defect detection results corresponding to each training sample image contained in the training group; according to the predicted defect detection results and the corresponding sample defect categories and sample defect area information, the parameters of the pre-trained defect segmentation model are adjusted, and then each training sample image contained in the verification group is subjected to defect detection through the defect segmentation model after parameter adjustment, and according to the defect detection results corresponding to the verification group and the corresponding sample defect categories and sample defect area information, it is determined whether the defect segmentation model after parameter adjustment needs to be re-adjusted; finally, the training sample images contained in the test group are subjected to defect detection through the trained defect segmentation model to determine the accuracy corresponding to the trained defect segmentation model, thereby ensuring the convergence of the trained defect segmentation model to make defect detection more accurate.

[0080] Step 240 , statistically analyzing the defect detection results corresponding to the plurality of images to be detected, and determining the quality detection result corresponding to the device housing according to the statistical results.

[0081] In some embodiments, the electronic device will count the settlement inspection results corresponding to the multiple images to be inspected, that is, all defects contained in the device shell and the corresponding defect categories and defect area information are counted; the statistical results may include one or more of the total number of all defects, the number of defects contained in various defect categories, the total area of ​​defect areas contained in various defect categories, the area of ​​defect areas corresponding to each defect, the total length of defect areas contained in various defect categories, and the length of defect areas corresponding to each defect; since the electronic device captures images of the side of the device shell, the length of the defect area can be used to judge whether the device shell meets the quality requirements.

[0082] In some embodiments, the electronic device may determine the quality inspection result corresponding to the device housing based on the comparison of each element included in the statistical result with the corresponding element process standard. The quality inspection result is used to characterize the quality of the device housing in various aspects. Specifically, the electronic device may determine the quality inspection result corresponding to the device housing based on the number of elements in the statistical result of the device housing that meet the corresponding element process standard; wherein, the more elements that meet the element process standard, the better the quality of the device housing; that is, if the electronic device detects that the number of elements that meet the corresponding element process standard is greater than or equal to the element threshold, the quality inspection result corresponding to the device housing is determined to be qualified for the quality inspection; if the electronic device detects that the number of parameters that meet the process standard is less than the element threshold, it means that there are many defects or the defects are more obvious on the device housing, and the quality inspection result corresponding to the device housing is determined to be unqualified for the quality inspection.

[0083] In some embodiments, the electronic device may determine the weight corresponding to each element according to the importance of each element in the statistical results; calculate the score corresponding to each element according to the weight; and determine the quality inspection result corresponding to the device housing according to the total score corresponding to multiple elements. Among them, the higher the score, the more unqualified the quality inspection. In addition, the electronic device can also determine the quality inspection result corresponding to the device housing by calculating the percentage between the total score and the standard score. The larger the percentage, the more unqualified the quality inspection. Measuring the quality inspection result corresponding to the device housing in digital form can more intuitively determine the quality of the device housing and reduce the impact of insignificant defects.

[0084] In an embodiment of the present application, multiple images to be inspected corresponding to a device shell are obtained, and defect detection is performed on an area of ​​interest corresponding to the device shell in the multiple images to be inspected to obtain defect detection results corresponding to each image to be inspected. This allows for accurate detection of defects on the device shell, and a comprehensive statistical analysis of defect categories and / or defect area information in the multiple images to be inspected is performed to determine whether the device shell meets quality standards. This allows for accurate detection of defects on the device shell, ensuring the quality of the device shell without relying on manual inspection, thereby reducing defect detection costs and improving inspection efficiency.

[0085] In one embodiment, Figure 3 As shown, the step of identifying the region of interest corresponding to the first image to be detected and the device housing may include the following steps 302 to 304:

[0086] Step 302: Determine a reference edge corresponding to the first image to be detected according to the mean grayscale value of each column of pixels in the first image to be detected.

[0087] The reference edge refers to a reference edge or boundary used to locate and align the region of interest in the first image to be detected; using the reference edge to identify the region of interest corresponding to the first image to be detected and the device housing can improve the accuracy and efficiency of recognition.

[0088] In some embodiments, the electronic device may calculate the grayscale value mean of each column of pixels in the first image to be detected in sequence according to the preset image direction; if it is detected that the grayscale value mean corresponding to the current column of pixels is greater than the grayscale threshold, the current column of pixels is used as the reference edge corresponding to the first image to be detected. The preset image direction may be from left to right or from right to left, etc., which is not limited here.

[0089] As an implementation method, the electronic device may calculate the mean grayscale value of the pixels in the i-th column in the first image to be detected in order from right to left. Specifically, the mean grayscale value V_mean_i of the pixels in the i-th column may be calculated by formula (1):

[0090]

[0091] Among them, V 0i Represents the grayscale value corresponding to the pixel in the 1st row of the ith column, V (h-1)i represents the grayscale value corresponding to the pixel in the i-th column and the h-th row, h represents the number of pixels in each column of the first image to be detected, and i represents the i-th column from left to right of the first image to be detected.

[0092] Specifically, assuming that the grayscale threshold is 150, and the first image to be detected has a total of w columns, the electronic device starts from i=w and calculates the mean grayscale value of the pixels in the i-th column. If it is detected that V_mean_i≤150 corresponding to the pixels in the i-th column, the electronic device calculates the mean grayscale value of the pixels in the i-1th column, and determines whether the V_mean_i corresponding to the pixels in the i-1th column is greater than 150. If not, continue to calculate the mean grayscale value of the next column of pixels. If greater, use the column of pixels as the reference edge corresponding to the first image to be detected.

[0093] Step 304: Determine the region of interest corresponding to the first image to be detected and the device housing according to the reference edge and the preset size.

[0094] The preset size is set based on the actual process experience and process requirements of the device shell. The preset size has a proportional correspondence with the size of the device shell. Under normal circumstances, the size of the device shell is a fixed size, so the size of the device shell in the first image to be detected is also a fixed size, so based on the preset size and the reference edge, the electronic device can determine the shell area of ​​the device shell in the first image to be detected.

[0095] In some specific embodiments, the preset size can be an area with a width of 100px (pixel) and an unlimited height. Assuming that the obtained reference edge is the i-th column of pixels, the coordinates of the upper left corner of the area of ​​interest can be obtained as (i-100, 1) based on the reference edge, so that the rectangular area where the area of ​​interest is located can be determined.

[0096] In a specific embodiment, Figure 4 As shown, the electronic device identifying the first image to be detected and the area of ​​interest corresponding to the device housing may include:

[0097] The electronic device may first perform image graying processing on the first image to be detected, and convert the first image to be processed from a color image to a grayscale image; in order to reduce the calculation of determining the reference edge, the electronic device compresses the first image to be processed to obtain a first compressed image, so that the image size is reduced from (W, H) to (0.25*W, 0.25*H); then filter the first compressed image to reduce noise interference; binarize the first compressed image to obtain a binary image; and perform binarization processing on the binary image from right to left. Traverse and calculate the mean value V_mean_i of the pixels in the current i-th column, determine whether V_mean_i is greater than the grayscale threshold of 150. If V_mean_i≤150, take the i-1th column as the current column, calculate the mean grayscale value corresponding to the pixels in the current column, and re-determine whether V_mean_i is greater than the grayscale threshold of 150, until V_mean_i>150, then determine the pixels in the current column as the reference edge; according to the reference edge and the preset size, determine the area of ​​interest corresponding to the first image to be detected and the device shell.

[0098] In an embodiment of the present application, by using a reference edge to identify the region of interest corresponding to the device shell in the first image to be inspected, the accuracy and efficiency of the electronic device in identifying the region of interest can be improved. By accurately identifying the region of interest in each image to be inspected, it is possible to facilitate subsequent accurate defect detection in the device shell area and avoid interference from non-regions of interest contained in the image to be inspected.

[0099] like Figure 5 As shown, in another embodiment, a method for detecting defects in a device housing is provided, which can be applied to the above electronic device. The method may include the following steps:

[0100] Step 502 : acquiring a plurality of images to be detected corresponding to the device housing, wherein the plurality of images to be detected respectively correspond to different housing areas of the device housing.

[0101] Step 504: Identify the region of interest corresponding to the first image to be detected and the device housing.

[0102] The first image to be detected is any image to be detected.

[0103] The description of steps 502 to 504 may refer to the relevant description of steps 210 to 220 in the above embodiment, and will not be repeated here.

[0104] Step 506: perform image segmentation on the region of interest to obtain multiple detection sub-images.

[0105] Because the electronic device controls the camera device to capture images of the device shell, it shoots along the four sides of the device shell. Even if the shell area of ​​the device shell has been divided into multiple images to be detected, the row-column ratio of each image to be detected is also large. If the images to be detected with relatively large rows and columns are sent to the defect segmentation model for defect detection, it is easy to cause inaccurate defect detection results due to the large gap between the rows and columns of the images to be detected, and some defects may be missed and not detected. Therefore, before performing defect detection on the area of ​​interest through the defect segmentation model, the electronic device needs to perform image segmentation on the area of ​​interest in the first image to be detected, so that the row-column ratio of the segmented detection sub-image is reduced, so as to avoid poor defect detection results of the defect segmentation model.

[0106] In some embodiments, if the electronic device detects that the number of rows of the region of interest in the first image to be detected is significantly greater than the number of columns, the electronic device may equally divide the region of interest by rows while keeping the number of columns unchanged, thereby obtaining multiple detection sub-images, and ensuring that the number of rows and columns of the detection sub-images are close. Specifically, the electronic device may determine the number of equally divided rows or columns according to the ratio of the number of rows to the number of columns of the region of interest, thereby segmenting the region of interest.

[0107] Step 508 , performing defect detection on each detection sub-image respectively through the defect segmentation model to obtain the defect detection result corresponding to each detection sub-image, and taking the defect detection results corresponding to the multiple detection sub-images respectively as the defect detection result corresponding to the first image to be detected.

[0108] Among them, the defect detection result corresponding to the detection sub-image includes the defect category, defect area information and defect confidence corresponding to each defect in the detection sub-image. The defect detection result corresponding to the first image to be detected includes all defects in all detection sub-images obtained by segmenting the first image to be detected and the corresponding defect category, defect area information and defect confidence. The defect confidence can be used to characterize the degree of certainty of the defect obtained by the defect detection model for the detection sub-image; the smaller the defect confidence, the greater the possibility that the corresponding defect is a false detection and / or the greater the impact on the device shell.

[0109] The description of performing defect detection on the detection sub-image by using the defect segmentation model in step 508 can refer to the related description of performing defect detection on the region of interest by using the defect segmentation model in step 230 of the above embodiment, which will not be repeated here.

[0110] Step 510 , according to the defect detection results corresponding to the plurality of detection sub-images, defect categories and defect area information corresponding to defects with defect confidence greater than a confidence threshold are added to the target set.

[0111] In order to determine whether the defects in the defect detection results corresponding to the detection sub-image are effective defects, the electronic device can determine the defects with defect confidence greater than the confidence threshold as effective defects according to the confidence threshold, and add the defect category and defect area information corresponding to the effective defect to the target set; effective defects refer to defects that have an impact or a large impact on the quality of the device shell; the target set is used to store the defect category and defect area information corresponding to the effective defect. The electronic device removes defects with defect confidence less than or equal to the defect threshold, that is, removes defects that have no impact or a small impact on the device shell or are detected incorrectly, which can facilitate the subsequent accurate detection of the quality of the device shell.

[0112] Step 512, statistics are collected on the defect categories and defect area information corresponding to the defects included in the target set, and the quality inspection results corresponding to the equipment shell are determined according to the statistical results.

[0113] In some embodiments, the statistical results may include one or more of the number of defects included in various defect categories, the total area of ​​defect regions included in various defect categories, the area of ​​defect regions corresponding to each defect, the total length of defect regions included in various defect categories, and the length of defect regions corresponding to each defect.

[0114] Optionally, the step of determining the quality inspection result corresponding to the device housing according to the statistical result may include one or more of the following steps:

[0115] Step one, detect the number of defects included in the first defect category in the statistical results; if it is detected that the number of defects included in the first defect category is greater than the quantity threshold corresponding to the first defect category, determine that the quality inspection result corresponding to the equipment shell is unqualified in the quality inspection; the first defect category is any defect category.

[0116] Step 2: Detect the total area of ​​defective regions included in the first defect category in the statistical results; if it is detected that the total area of ​​defective regions included in the first defect category is greater than the first area threshold, determine that the quality inspection result corresponding to the device housing is unqualified. The first area threshold has a corresponding relationship with the defect category, each defect category corresponds to a first area threshold, and the first area thresholds corresponding to different defect categories can be the same or different.

[0117] Step three, detect the defect area corresponding to the first defect in the statistical results; if the defect area corresponding to the first defect is detected to be greater than the second area threshold, determine that the quality inspection result corresponding to the device housing is unqualified; the first defect is any defect. Among them, the second area thresholds corresponding to the first defects belonging to the same defect category are the same, and the second area thresholds corresponding to the first defects belonging to different defect categories can be the same or different; the second area threshold is less than the first area threshold. Optionally, the electronic device can determine the corresponding second area threshold according to the defect category corresponding to the first defect.

[0118] Step 4: Detect the total length of the defective area included in the first defect category in the statistical results; if it is detected that the total length of the defective area included in the first defect category is greater than the first length threshold, then determine that the quality inspection result corresponding to the device shell is unqualified. Among them, the first length threshold has a corresponding relationship with the defect category, each defect category corresponds to a first length threshold, and the first length thresholds corresponding to different defect categories can be the same or different.

[0119] Step 5: Detect the length of the defect area corresponding to the first defect in the statistical result; if the length of the defect area corresponding to the first defect is detected to be greater than the second length threshold, determine that the quality inspection result corresponding to the device housing is unqualified. The second length thresholds corresponding to the first defects of the same defect category are the same, and the second length thresholds corresponding to the first defects of different defect categories can be the same or different; the second length threshold is less than the first length threshold. Optionally, the electronic device can determine the corresponding second length threshold according to the defect category corresponding to the first defect.

[0120] Optionally, the step of determining the quality inspection result corresponding to the equipment shell according to the statistical results may also include steps other than the above five steps, and there is no order restriction and quantity restriction between the above five steps. The order of the steps can be set according to actual needs and is not limited here.

[0121] In some specific embodiments, Figure 6The electronic device obtains the defect detection results corresponding to each detection sub-image; determines the defect detection results corresponding to each detection word that is too small in multiple images to be processed, and obtains all defects contained in the device shell and the corresponding defect confidence, defect category, and defect area information; compares the defect confidence corresponding to each defect with the confidence threshold, discards the defects whose defect confidence is not greater than the confidence threshold, and adds the defects whose defect confidence is greater than the confidence threshold to the target set; counts all defects in the target set to obtain the number of defects contained in various defect categories, the total area of ​​defect areas contained in various defect categories, the area of ​​defect areas corresponding to each defect, and various The total length of defect areas included in the defect categories and the length of defect areas corresponding to each defect; if the electronic device detects that the number of all defects included in various defect categories is not greater than the quantity threshold corresponding to the various defect categories, and the total area of ​​all defect areas included in various defect categories is not greater than the first area threshold, and the area of ​​the defect areas corresponding to each defect is not greater than the second area threshold, and the total length of all defect areas included in various defect categories is not greater than the first length threshold, and the length of the defect areas corresponding to each defect is not greater than the second length threshold, then the quality inspection result of the device shell is qualified; other situations indicate that the quality inspection result of the device shell is unqualified.

[0122] In an embodiment of the present application, by performing image segmentation on the region of interest in the first image to be detected, the row-column ratio of the segmented detection sub-image is reduced, thereby avoiding poor defect detection results of the defect segmentation model and improving the accuracy of the defect segmentation model in detecting defects on the device casing; by performing threshold judgment on the statistical results of defect confidence, defect category and defect area information, it is determined whether the quality of the device casing meets the production process standards, and the defects on the device casing are accurately detected, thereby ensuring the quality of the device casing, and not relying on manual inspection, which can reduce defect detection costs and improve detection efficiency.

[0123] like Figure 7 As shown, in one embodiment, a device housing defect detection device 700 is provided, which can be applied to the above electronic device. The device housing defect detection device 700 may include an image acquisition module 710, a recognition module 720, a defect detection module 730 and a statistics module 740.

[0124] The image acquisition module 710 is used to acquire a plurality of images to be detected corresponding to the device shell, and the plurality of images to be detected respectively correspond to different shell areas of the device shell.

[0125] The identification module 720 is used to identify the first image to be detected and the region of interest corresponding to the device shell; the first image to be detected is any image to be detected.

[0126] The defect detection module 730 is used to perform defect detection on the region of interest through a defect segmentation model to obtain a defect detection result corresponding to the first image to be detected, where the defect detection result includes defect category and / or defect region information.

[0127] The statistical module 740 is used to collect statistics on the defect detection results corresponding to the multiple images to be detected, and determine the quality detection result corresponding to the device shell according to the statistical results.

[0128] In some embodiments, the identification module 720 is also used to determine the reference edge corresponding to the first image to be detected based on the average grayscale value of each column of pixels in the first image to be detected; and determine the area of ​​interest corresponding to the first image to be detected and the device shell based on the reference edge and the preset size.

[0129] Optionally, the recognition module 720 is also used to calculate the grayscale value mean of each column of pixels in the first image to be detected in sequence according to a preset image direction; if it is detected that the grayscale value mean corresponding to the current column of pixels is greater than the grayscale threshold, the current column of pixels is used as the reference edge corresponding to the first image to be detected.

[0130] In some embodiments, the device housing defect detection apparatus 700 further includes an image segmentation module and a confidence module.

[0131] The image segmentation module is used to segment the image of the region of interest to obtain multiple detection sub-images.

[0132] Optionally, the defect detection module 730 is also used to perform defect detection on each detection sub-image through a defect segmentation model to obtain a defect detection result corresponding to each detection sub-image, and use the defect detection results corresponding to multiple detection sub-images as the defect detection results corresponding to the first image to be detected.

[0133] In some embodiments, the defect detection result corresponding to the detection sub-image includes the defect category, defect area information and defect confidence corresponding to each defect in the detection sub-image.

[0134] Optionally, the confidence module is used to add defect categories and defect area information corresponding to defects with defect confidence greater than a confidence threshold to the target set according to defect detection results corresponding to multiple detection sub-images respectively.

[0135] In some embodiments, the statistics module 740 is further used to collect statistics on defect categories and defect area information corresponding to each defect included in the target set.

[0136] Optionally, the statistical results include one or more of the number of defects included in various defect categories, the total area of ​​defect regions included in various defect categories, the area of ​​defect regions corresponding to each defect, the total length of defect regions included in various defect categories, and the length of defect regions corresponding to each defect.

[0137] In some embodiments, the statistical module 740 is also used to determine that the quality inspection result corresponding to the device shell is unqualified in the quality inspection if it is detected that the number of defects contained in the first defect category is greater than the quantity threshold corresponding to the first defect category; the first defect category is any defect category; and / or, if it is detected that the total area of ​​the defect region contained in the first defect category is greater than the first area threshold, the quality inspection result corresponding to the device shell is determined to be unqualified in the quality inspection; and / or, if it is detected that the area of ​​the defect region corresponding to the first defect is greater than the second area threshold, the quality inspection result corresponding to the device shell is determined to be unqualified in the quality inspection; the first defect is any defect; and / or, if it is detected that the total length of the defect region contained in the first defect category is greater than the first length threshold, the quality inspection result corresponding to the device shell is determined to be unqualified in the quality inspection; and / or, if it is detected that the length of the defect region corresponding to the first defect is greater than the second length threshold, the quality inspection result corresponding to the device shell is determined to be unqualified in the quality inspection.

[0138] Optionally, the defect segmentation model is built based on the DeepLab V3+ model, and the defect segmentation model includes a backbone network module and a dilated space convolution pooling pyramid ASPP module; the backbone network module includes a lightweight convolutional neural network, and the ASPP module uses stripe pooling technology for pooling.

[0139] In an embodiment of the present application, by performing image segmentation on the region of interest in the first image to be detected, the row-column ratio of the segmented detection sub-image is reduced, thereby avoiding poor defect detection results of the defect segmentation model and improving the accuracy of the defect segmentation model in detecting defects on the device casing; by performing threshold judgment on the statistical results of defect confidence, defect category and defect area information, it is determined whether the quality of the device casing meets the production process standards, and the defects on the device casing are accurately detected, thereby ensuring the quality of the device casing, and not relying on manual inspection, which can reduce defect detection costs and improve detection efficiency.

[0140] Figure 8 FIG. 1 is a block diagram of an electronic device in an embodiment. The electronic device may be a mobile phone, a tablet computer, a smart wearable device, etc. Figure 8As shown, the electronic device 800 may include one or more of the following components: a processor 810, and a memory 820 coupled to the processor 810, wherein the memory 820 may store one or more computer programs, and the one or more computer programs may be configured to implement the methods described in the above embodiments when executed by one or more processors 810.

[0141] The processor 810 may include one or more processing cores. The processor 810 uses various interfaces and lines to connect various parts of the entire electronic device 800, and executes various functions and processes data of the electronic device 800 by running or executing instructions, programs, code sets or instruction sets stored in the memory 820, and calling data stored in the memory 820. Optionally, the processor 810 can be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), and programmable logic array (PLA). The processor 810 can integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. Among them, the CPU mainly processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 810, but may be implemented separately through a communication chip.

[0142] The memory 820 may include a random access memory (RAM) or a read-only memory (ROM). The memory 820 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 820 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc. The data storage area may also store data created by the electronic device 800 during use, etc.

[0143] It can be understood that the electronic device 800 may include more or fewer structural elements than those in the above structural block diagram, for example, including a power supply, input buttons, cameras, speakers, screens, RF (Radio Frequency) circuits, Wi-Fi (Wireless Fidelity) modules, Bluetooth modules, sensors, etc., and no limitation is made here.

[0144] An embodiment of the present application discloses a storage medium storing a computer program, wherein the computer program implements the methods described in the above embodiments when executed by a processor.

[0145] The embodiments of the present application disclose a computer program product, including a computer program, and the computer program can be executed by a processor to implement the methods described in the above embodiments.

[0146] A person skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a non-volatile computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a read-only memory (ROM), etc.

[0147] As used herein, any reference to memory, storage, database, or other medium may include nonvolatile and / or volatile memory. Suitable nonvolatile memory may include ROM, Programmable ROM (PROM), Erasable PROM (EPROM), Electrically Erasable PROM (EEPROM), or Flash memory. Volatile memory may include random access memory (RAM), which is used as an external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), memory bus direct RAM (RDRAM), and direct memory bus dynamic RAM (DRDRAM).

[0148] It should be understood that the "one embodiment" or "an embodiment" mentioned throughout the specification means that the specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. Those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required for the present application.

[0149] In the various embodiments of the present application, it should be understood that the size of the serial numbers of the above-mentioned processes does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0150] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, 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.

[0151] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0152] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0153] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-accessible memory. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product, which is stored in a memory and includes several requests for a computer device (which can be a personal computer, a server or a network device, etc., specifically a processor in a computer device) to perform some or all of the steps of the above-mentioned methods of various embodiments of the present application.

[0154] The above is a detailed introduction to a defect detection method, device, electronic device and storage medium for a device housing disclosed in an embodiment of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of ​​the present application. At the same time, for those of ordinary skill in the art, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A method for detecting defects in a device housing, characterized in that: The method comprises: Acquire a plurality of images to be detected corresponding to a device shell, wherein the plurality of images to be detected respectively correspond to different shell areas of the device shell; Identify a first image to be detected and a region of interest corresponding to the device housing; the first image to be detected is any image to be detected; Perform defect detection on the region of interest using a defect segmentation model to obtain a defect detection result corresponding to the first image to be detected, wherein the defect detection result includes defect category and / or defect region information; The defect detection results corresponding to the multiple images to be detected are respectively counted, and the quality inspection result corresponding to the device shell is determined according to the statistical results.

2. The method according to claim 1, characterized in that: The identifying the region of interest corresponding to the first image to be detected and the device housing includes: Determine a reference edge corresponding to the first image to be detected according to the mean grayscale value of each column of pixels in the first image to be detected; According to the reference edge and the preset size, a region of interest corresponding to the first image to be detected and the device housing is determined.

3. The method according to claim 2, characterized in that The step of determining the reference edge corresponding to the first image to be detected according to the mean grayscale value of each column of pixels in the first image to be detected comprises: According to the preset image direction, the grayscale value mean of each column of pixels in the first image to be detected is calculated in sequence; If it is detected that the mean grayscale value corresponding to the pixel points in the current column is greater than the grayscale threshold, the pixel points in the current column are used as the reference edge corresponding to the first image to be detected.

4. The method according to claim 1, characterized in that: Before performing defect detection on the region of interest by using the defect segmentation model to obtain a defect detection result corresponding to the first image to be detected, the method further includes: Performing image segmentation on the region of interest to obtain multiple detection sub-images; The performing defect detection on the region of interest by using the defect segmentation model to obtain a defect detection result corresponding to the first image to be detected includes: Defect detection is performed on each of the detection sub-images through a defect segmentation model to obtain a defect detection result corresponding to each of the detection sub-images, and the defect detection results corresponding to the multiple detection sub-images are used as defect detection results corresponding to the first image to be detected.

5. The method according to claim 4, characterized in that The defect detection result corresponding to the detection sub-image includes the defect category, defect area information and defect confidence corresponding to each defect in the detection sub-image; Before collecting statistics on the defect detection results respectively corresponding to the plurality of images to be detected, the method further includes: According to the defect detection results respectively corresponding to the multiple detection sub-images, the defect categories and defect area information corresponding to the defects whose defect confidence is greater than the confidence threshold are added to the target set; The step of collecting statistics on defect detection results corresponding to the plurality of images to be detected includes: Statistics are collected on defect categories and defect area information corresponding to each defect included in the target set.

6. The method according to claim 1, characterized in that The statistical results include one or more of the number of defects included in various defect categories, the total area of ​​defect regions included in various defect categories, the area of ​​defect regions corresponding to each defect, the total length of defect regions included in various defect categories, and the length of defect regions corresponding to each defect; Determining the quality inspection result corresponding to the device housing according to the statistical result includes: If it is detected that the number of defects included in the first defect category is greater than the quantity threshold corresponding to the first defect category, then the quality inspection result corresponding to the device housing is determined to be unqualified in the quality inspection; the first defect category is any defect category; and / or, If it is detected that the total area of ​​the defect regions included in the first defect category is greater than the first area threshold, then determining that the quality inspection result corresponding to the device housing is unqualified in the quality inspection; and / or, If it is detected that the defect area corresponding to the first defect is greater than the second area threshold, it is determined that the quality inspection result corresponding to the device housing is unqualified; the first defect is any defect; and / or, If it is detected that the total length of the defective area included in the first defect category is greater than the first length threshold, then determining that the quality inspection result corresponding to the device housing is unqualified in the quality inspection; and / or, If it is detected that the length of the defect area corresponding to the first defect is greater than the second length threshold, it is determined that the quality inspection result corresponding to the device shell is unqualified.

7. The method according to any one of claims 1 to 6, characterized in that: The defect segmentation model is constructed based on the DeepLab V3+ model, and the defect segmentation model includes a backbone network module and a dilated space convolutional pooling pyramid ASPP module; the backbone network module includes a lightweight convolutional neural network, and the ASPP module uses stripe pooling technology for pooling.

8. A defect detection device for an equipment housing, characterized in that: The device comprises: An image acquisition module, used to acquire a plurality of images to be detected corresponding to a device housing, wherein the plurality of images to be detected respectively correspond to different housing areas of the device housing; An identification module, used for identifying a first image to be detected and an area of ​​interest corresponding to the device housing; the first image to be detected is any image to be detected; A defect detection module, configured to perform defect detection on the region of interest by using a defect segmentation model to obtain a defect detection result corresponding to the first image to be detected, wherein the defect detection result includes defect category and / or defect region information; The statistical module is used to collect statistics on the defect detection results corresponding to the multiple images to be detected, and determine the quality detection result corresponding to the device shell according to the statistical results.

9. An electronic device, characterized in that: The method comprises a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor implements the method according to any one of claims 1 to 7.

10. A storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • Quantitative evaluation method, device and equipment for appearance quality of shaving board, medium and product

    CN119540227A

  • Quantitative evaluation method, device, equipment, medium and product for particleboard appearance quality

    CN119540227B

  • Method and system for realizing tunnel crack detection based on Deeplab

    CN119887764A