A method and device for detecting defects of notebook computer casing

By acquiring multi-angle images and analyzing difference areas, the defect types of laptop casings are identified, which solves the problem of low accuracy of traditional ultrasonic detection and achieves higher detection accuracy and precision.

CN117635590BActive Publication Date: 2024-09-27SHENZHEN YINGWEISHENG TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311702863.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-12
Publication Date
2024-09-27
Estimated Expiration
2043-12-12

AI Technical Summary

Technical Problem

Traditional ultrasonic testing cannot distinguish the types of defects in laptop casings, and the detection accuracy is low.

Method used

By obtaining the images corresponding to the top and side light sources of the object to be detected, compare with the standard image, extract the target circumscribed rectangular frame of the difference area, intercept the sub-image, calculate the pixel difference, form a difference image, and input the defect detection model for feature extraction and Analysis to identify defects such as nicks, scrapes, bumps, deformations, foreign objects and discoloration.

Benefits of technology

It improves the accuracy and precision of shell defect detection, can identify different types of defects, reduces interference from irrelevant information, and enhances the robustness of detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117635590B
    Figure CN117635590B
Patent Text Reader

Abstract

The present invention is applicable to the technical field of image detection, and provides a defect detection method and device for a laptop computer shell. The defect detection method for the laptop computer shell includes: obtaining a first image to be detected and a second image to be detected at the same position of the object to be detected. By comparing with the standard image, the scheme can respectively extract the target circumscribed rectangular frame of the difference area in the first image to be detected and the second image to be detected. According to the position information of the target circumscribed rectangular frame, the first sub-image and the second sub-image are intercepted in the first image to be detected and the second image to be detected. By processing and analyzing these features through a defect detection model, detection results for defect types such as scratches, scrapes, bumps, deformations, foreign matter and discoloration can be obtained. In general, the technical solution can realize the identification of defect types of objects such as laptop computer shells, and improve the precision and accuracy of detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of image detection, and in particular relates to a method and a device for detecting defects of a notebook computer shell. Background Art

[0002] Shell defect detection refers to the use of various technologies and methods to detect whether there are defects or damages on the outer surface of objects (such as mechanical equipment, electronic products, automobiles, etc.). These shell defects may be cracks, scratches, wear, deformation, etc. Shell defects may weaken the structure of the product, affect its performance and life, and even bring safety hazards.

[0003] In traditional technology, ultrasonic testing technology is often used for shell defect detection. Ultrasonic testing technology detects defects by transmitting high-frequency sound waves into the shell and then analyzing the characteristics of the sound waves propagating inside the object. When the sound wave encounters a defect, it will be reflected or scattered, so that the location and nature of the defect can be determined.

[0004] However, traditional ultrasonic testing cannot distinguish the defect types of shell defects, and the detection accuracy is also low. This is a technical problem that needs to be solved urgently. Summary of the invention

[0005] In view of this, an embodiment of the present invention provides a defect detection method, a defect detection device and a storage medium for a laptop computer casing to solve the technical problem that traditional ultrasonic detection cannot distinguish the defect types of casing defects and has low detection accuracy.

[0006] A first aspect of an embodiment of the present invention provides a method for detecting defects in a laptop computer housing, the method comprising:

[0007] Acquire a first image to be detected corresponding to a top light source and a second image to be detected corresponding to a side light source at the same position of the object to be detected; the object to be detected includes the laptop computer housing;

[0008] Comparing the first image to be detected and the second image to be detected with a standard image respectively;

[0009] Extracting target circumscribed rectangular frames of different regions in the first image to be detected and the second image to be detected respectively; the different regions refer to regions where the first image to be detected or the second image to be detected differs from the standard image;

[0010] According to the position information corresponding to the target circumscribed rectangular frame, intercepting a first sub-image and a second sub-image in the first image to be detected and the second image to be detected respectively;

[0011] Extracting difference pixels in the first sub-image and the second sub-image, and calculating a pixel difference between two pixels corresponding to the difference pixels; the difference pixels refer to pixels whose pixel difference values ​​at the same pixel positions in the first sub-image, the second sub-image and the standard image are greater than a first threshold;

[0012] forming a difference image according to the positions of the difference pixels and the pixel difference values;

[0013] The first image to be detected is input into the first feature extraction layer of the defect detection model, the second image to be detected is input into the second feature extraction layer of the defect detection model, and the difference image is input into the third feature extraction layer of the defect detection model to obtain the defect detection results output by the defect detection model; the defect detection results include scratches, scrapes, bumps, deformation, foreign matter and discoloration.

[0014] Furthermore, the step of respectively extracting target circumscribed rectangular frames of different areas in the first image to be detected and the second image to be detected includes:

[0015] Traversing the difference area between the first to-be-detected image and the standard image;

[0016] Traversing the difference area between the second to-be-detected image and the standard image;

[0017] The minimum bounding rectangular frame corresponding to the difference area with the most pixels is selected as the target bounding rectangular frame.

[0018] Furthermore, the step of traversing the difference area between the first image to be detected and the standard image includes:

[0019] Gray-scale the first image to be detected and the standard image to obtain a first grayscale image and a second grayscale image;

[0020] Identifying a first contour region and a second contour region in the first grayscale image and the second grayscale image by a contour recognition algorithm;

[0021] Align the first contour area with the second contour area, and traverse the difference pixel points between the first contour area and the second contour area;

[0022] If the pixel difference value of the difference pixel point is greater than a second threshold value, and the number of adjacent difference pixel points exceeds a preset number, the corresponding area is taken as the difference area.

[0023] Furthermore, the step of forming a difference image according to the position of the difference pixel point and the pixel difference value comprises:

[0024] Generate a blank image according to the image size of the target circumscribed rectangular frame; the blank image refers to an image without pixel values;

[0025] In the blank image, according to a first pixel position of a difference pixel point corresponding to the first sub-image, a pixel point at the first pixel position is set to the pixel difference value to obtain a first image;

[0026] In the blank image, according to a second pixel position of a difference pixel corresponding to the second sub-image, a pixel point at the second pixel position is set to the pixel difference value to obtain a second image;

[0027] The first image and the second image are combined to obtain the difference image.

[0028] Further, the defect detection model includes a first feature extraction layer, a second feature extraction layer, a third feature extraction layer, a fourth feature extraction layer, a downsampling layer and a classifier;

[0029] The first image to be detected is processed by a first feature extraction layer to obtain a first feature image;

[0030] The second image to be detected is processed by a second feature extraction layer to obtain a second feature image;

[0031] The difference image is processed by a third feature extraction layer to obtain a third feature image;

[0032] Calculating a first similarity between the third feature image and the first feature image;

[0033] calculating a second similarity between the third feature image and the second feature image;

[0034] If the first similarity is greater than the second similarity, fusing the third feature image with the first feature image to obtain a fused image;

[0035] If the first similarity is less than the second similarity, fusing the third feature image with the second feature image to obtain a fused image;

[0036] The fused image is processed by the fourth feature extraction layer to obtain a fourth feature image;

[0037] The fourth feature image is processed by the downsampling layer and the classifier to obtain the defect detection result.

[0038] Furthermore, before the step of acquiring a first image to be detected corresponding to a top light source and a second image to be detected corresponding to a side light source at the same position of the object to be detected, the method further includes:

[0039] Acquire an initial model and a plurality of training samples, each of the training samples comprising a first sample image, a second sample image, a sample difference image and a label;

[0040] Randomly selecting a preset number of training samples from the plurality of training samples, and performing interference processing on the preset number of training samples to obtain a plurality of interference samples;

[0041] The initial model is trained by using a plurality of the training samples and a plurality of the interference samples to obtain the defect detection model.

[0042] Furthermore, the step of randomly selecting a preset number of training samples from the plurality of training samples, performing interference processing on the preset number of training samples, and obtaining a plurality of interference samples comprises:

[0043] Randomly selecting a preset number of training samples from the plurality of training samples;

[0044] Substitute the training sample input into the following formula, and after K iterations, obtain the target iterative interference sample;

[0045] The formula is:

[0046] in, represents the current iteration interference sample, wherein the current iteration interference sample of the Kth iteration is the target iteration interference sample, represents the interference sample of the previous iteration, represents the hyperparameter controlling the iteration step size, Indicates the gradient of the training sample, L represents the loss function, y represents the label corresponding to the original sample, Represents a projection operation, Represents the sign function.

[0047] A second aspect of an embodiment of the present invention provides a defect detection device for a notebook computer casing, comprising:

[0048] An acquisition unit, used for acquiring a first image to be detected corresponding to a top light source and a second image to be detected corresponding to a side light source at the same position of the object to be detected; the object to be detected includes the laptop computer housing;

[0049] A comparison unit, used for comparing the first to-be-detected image and the second to-be-detected image with a standard image respectively;

[0050] An extraction unit, used to extract target circumscribed rectangular frames of different areas in the first image to be detected and the second image to be detected, respectively; the different area refers to an area where the first image to be detected or the second image to be detected is different from the standard image;

[0051] A capture unit, configured to capture a first sub-image and a second sub-image in the first image to be detected and the second image to be detected respectively according to position information corresponding to the target circumscribed rectangular frame;

[0052] a first calculation unit, configured to extract difference pixels in the first sub-image and the second sub-image, and calculate a pixel difference between two pixels corresponding to the difference pixels; the difference pixels refer to pixels whose pixel difference values ​​at the same pixel positions in the first sub-image, the second sub-image and the standard image are greater than a first threshold;

[0053] A processing unit, configured to form a difference image according to the positions of the difference pixels and the pixel difference values;

[0054] The second computing unit is used to input the first image to be detected into the first feature extraction layer of the defect detection model, input the second image to be detected into the second feature extraction layer of the defect detection model, and input the difference image into the third feature extraction layer of the defect detection model to obtain the defect detection results output by the defect detection model; the defect detection results include scratches, scrapes, bumps, deformation, foreign matter and discoloration.

[0055] A third aspect of an embodiment of the present invention provides a terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method described in the first aspect when executing the computer program.

[0056] A fourth aspect of an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method described in the first aspect are implemented.

[0057] The beneficial effects of the embodiments of the present invention compared with the prior art are as follows: the present invention obtains a first image to be detected corresponding to a top light source and a second image to be detected corresponding to a side light source at the same position of the object to be detected; compares the first image to be detected and the second image to be detected with a standard image respectively; extracts target circumscribed rectangular frames of the difference areas in the first image to be detected and the second image to be detected respectively; the difference area refers to the area where the first image to be detected or the second image to be detected is different from the standard image; according to the position information corresponding to the target circumscribed rectangular frames, captures a first sub-image and a second sub-image in the first image to be detected and the second image to be detected respectively; extracts the first sub-image The difference pixel points in the first sub-image and the second sub-image are obtained, and the pixel difference between the two pixel points corresponding to the difference pixel point is calculated; the difference pixel point refers to the pixel point whose pixel difference value of the same pixel position in the first sub-image, the second sub-image and the standard image is greater than the first threshold; according to the position of the difference pixel point and the pixel difference value, a difference image is formed; the first image to be detected is input into the first feature extraction layer of the defect detection model, the second image to be detected is input into the second feature extraction layer of the defect detection model, and the difference image is input into the third feature extraction layer of the defect detection model to obtain the defect detection result output by the defect detection model; the defect detection result includes scratches, scrapes, bumps, deformation, foreign matter and discoloration. The above scheme, by obtaining the first image to be detected corresponding to the top light source and the second image to be detected corresponding to the side light source at the same position of the object to be detected, the scheme can comprehensively utilize the image information of multiple angles for comparison and analysis, thereby increasing the accuracy of shell defect detection. By comparing with the standard image, the scheme can respectively extract the target circumscribed rectangular frame of the difference area in the first image to be detected and the second image to be detected. The difference area refers to the area that is different from the standard image, so that the potential shell defect area can be quickly located. According to the position information of the target circumscribed rectangular frame, the first sub-image and the second sub-image are intercepted in the first image to be detected and the second image to be detected. This can focus on the difference area, reduce the interference of irrelevant information, and improve the accuracy of detection. Extract the difference pixels in the difference sub-image, and calculate the pixel difference between these pixels. The difference pixel point refers to the pixel point whose pixel difference value at the same pixel position is greater than the set threshold. By calculating the pixel difference amount, the degree of difference can be quantified, and different types of defects can be further identified and classified. The features of the first image to be detected are input into the first feature extraction layer of the defect detection model, the features of the second image to be detected are input into the second feature extraction layer of the defect detection model, and the difference image is input into the third feature extraction layer of the defect detection model. By processing and analyzing these features through the defect detection model, the detection results for defect types such as scratches, scrapes, bumps, deformation, foreign matter and discoloration can be obtained.In general, this technical solution can identify the defect types of objects such as laptop computer cases and improve the precision and accuracy of detection by integrating multi-angle information, difference area extraction, sub-image extraction, pixel difference calculation and defect detection model analysis. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments or related technical descriptions. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0059] Figure 1 A schematic flow chart of a method for detecting defects of a notebook computer casing provided by the present invention is shown;

[0060] Figure 2 A schematic diagram of a defect detection device for a notebook computer casing provided by an embodiment of the present invention is shown;

[0061] Figure 3 A schematic diagram of a terminal device provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0062] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present invention. However, it should be clear to those skilled in the art that the present invention may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present invention.

[0063] The embodiments of the present invention provide a notebook computer shell defect detection method, a defect detection device and a storage medium to solve the technical problem that the conventional ultrasonic detection cannot distinguish the defect types of shell defects and the detection accuracy is also low.

[0064] First, the present invention provides a method for detecting defects in a laptop computer housing. Figure 1 , Figure 1 FIG. 1 is a schematic flow chart of a method for detecting defects in a notebook computer housing provided by the present invention. Figure 1 As shown, the defect detection method of the notebook computer casing may include the following steps:

[0065] Step 101: Acquire a first image to be detected corresponding to a top light source and a second image to be detected corresponding to a side light source at the same position of an object to be detected; the object to be detected includes a housing of the laptop computer;

[0066] In order to obtain defect information of the laptop computer shell more accurately, the present application obtains a first image to be detected corresponding to a top light source and a second image to be detected corresponding to a side light source at the same position of the object to be detected.

[0067] The laptop computer shell is transmitted by the transmission module to the image acquisition area, where a top light source and a side light source are arranged. When the top light source is turned on and the side light source is turned off, the camera device takes a first image to be detected. When the top light source is turned off and the side light source is turned on, the camera device takes a second image to be detected.

[0068] It is worth noting that due to shell defects such as bumps, deformations or foreign matter, different bright areas and shadow areas will appear on the defect surface through the top light source and the side light source. Therefore, this application obtains the first image to be detected corresponding to the top light source and the second image to be detected corresponding to the side light source to comprehensively detect the defect type and improve the defect detection accuracy.

[0069] Step 102: comparing the first image to be detected and the second image to be detected with a standard image respectively;

[0070] The standard image refers to an image corresponding to a non-defective shell. The first image to be detected and the second image to be detected are respectively compared with the standard image to determine whether there are suspected defects in the shells in the first image to be detected and the second image to be detected.

[0071] Step 103: extracting target circumscribed rectangular frames of different regions in the first image to be detected and the second image to be detected respectively; the different regions refer to regions where the first image to be detected or the second image to be detected differs from the standard image;

[0072] Specifically, step 103 specifically includes steps 1031 to 1033:

[0073] Step 1031: traverse the difference area between the first to-be-detected image and the standard image;

[0074] Specifically, step 1031 includes steps A to D:

[0075] Step A: grayscale the first image to be detected and the standard image to obtain a first grayscale image and a second grayscale image;

[0076] If there is a defect in the shell, after being illuminated by the top light source or the side light source, a bright area and a shadow area will appear in the defective area. If there is no defect in the shell, after being illuminated by the top light source or the side light source, the brightness of the shell surface is relatively flat. Therefore, only a grayscale image is needed to compare and obtain the difference area. Therefore, the present application grayscales the first image to be detected and the standard image to obtain a first grayscale image and a second grayscale image to reduce unnecessary calculations.

[0077] Step B: identifying a first contour region and a second contour region in the first grayscale image and the second grayscale image by using a contour recognition algorithm;

[0078] Since there is no need to analyze the area outside the shell, the present application uses a contour recognition algorithm to identify the first contour area and the second contour area in the first grayscale image and the second grayscale image, and then intercepts the first contour area and the second contour area to reduce unnecessary calculations.

[0079] Step C: aligning the first contour area with the second contour area, and traversing the difference pixel points between the first contour area and the second contour area;

[0080] Since the first image to be detected and the standard image are both taken at the same height and the same position, the sizes of the shell image areas of the two are consistent. In order to better compare the difference between the first image to be detected and the standard image, it is necessary to align the first contour area and the second contour area, and traverse the difference pixels between the first contour area and the second contour area. The difference pixel point refers to the pixel point whose pixel difference value at the same pixel position in the first contour area and the second contour area is greater than the second threshold.

[0081] Step D: If the pixel difference of the difference pixel point is greater than a second threshold, and the number of adjacent difference pixel points exceeds a preset number, the corresponding area is used as the difference area.

[0082] In this embodiment, the first image to be detected and the standard image are grayed to obtain a first gray image and a second gray image. The first contour area and the second contour area in the first gray image and the second gray image are identified by a contour recognition algorithm. The first contour area and the second contour area are aligned, and the difference pixels therebetween are traversed. If the pixel difference of the difference pixel is greater than the second threshold value, and the number of adjacent difference pixels exceeds a preset number, the corresponding area is taken as the difference area. This technical solution can extract the difference area from the first image to be detected and the standard image. These difference areas represent the differences between the two images and have a high extraction accuracy.

[0083] Step 1032: traverse the difference area between the second to-be-detected image and the standard image;

[0084] The calculation logic of step 1032 is consistent with that of step 1031. Please refer to the calculation logic of step 1031 and will not be repeated here.

[0085] Step 1033: Select the minimum bounding rectangular frame corresponding to the difference area with the most pixels as the target bounding rectangular frame.

[0086] In order to ensure that effective pixel information is retained as much as possible, the present application selects the smallest bounding rectangular frame corresponding to the difference area with the most pixels as the target bounding rectangular frame.

[0087] In this embodiment, two input images are required, namely, the first image to be detected and the standard image. The two images should have the same size and ratio. First, the difference area between the first image to be detected and the standard image is traversed. By comparing the difference in pixels, the difference between the two images is determined. In the difference area between the first image to be detected and the standard image, the difference area with the most pixels is selected. This can be achieved by calculating the number of pixels in the difference area. After selecting the difference area with the most pixels, the minimum bounding rectangular frame corresponding to the area is extracted. The bounding rectangular frame is the minimum rectangle surrounding the difference area. Finally, the extracted bounding rectangular frame is used as the target bounding rectangular frame. This bounding rectangular frame can accurately surround the area with the maximum difference from the standard image. The technical solution realizes the extraction of the target bounding rectangular frame by comparing the difference area between the two images and extracting the minimum bounding rectangular frame with the most difference pixels. This method can quickly and accurately find the target area.

[0088] Step 104: capturing a first sub-image and a second sub-image in the first image to be detected and the second image to be detected respectively according to the position information corresponding to the target circumscribed rectangular frame;

[0089] The first sub-image is captured based on the position information corresponding to the target circumscribed rectangular frame in the first image to be detected. The second sub-image is captured based on the position information corresponding to the target circumscribed rectangular frame in the second image to be detected.

[0090] Step 105: extracting difference pixels in the first sub-image and the second sub-image, and calculating the pixel difference between two pixels corresponding to the difference pixels; the difference pixels refer to pixels whose pixel difference values ​​at the same pixel positions in the first sub-image, the second sub-image and the standard image are greater than a first threshold;

[0091] The first sub-image is aligned with the shell image in the standard image, and the pixel difference at the same pixel position between the two images is compared. If the pixel difference at the same pixel position is greater than a first threshold, the pixel point is taken as a difference pixel point.

[0092] The second sub-image is aligned with the shell image in the standard image, and the pixel difference at the same pixel position between the two images is compared. If the pixel difference at the same pixel position is greater than a first threshold, the pixel point is taken as a difference pixel point.

[0093] Step 106: forming a difference image according to the positions of the difference pixels and the pixel differences;

[0094] In order to better extract the shell defect features, this application forms a difference image based on the position and pixel difference of the difference pixel points. The specific logic is as follows:

[0095] Specifically, step 106 specifically includes steps 1061 to 1064:

[0096] Step 1061: Generate a blank image according to the image size of the target circumscribed rectangular frame; the blank image refers to an image without pixel values;

[0097] Step 1062: in the blank image, according to a first pixel position of a difference pixel corresponding to the first sub-image, setting the pixel point at the first pixel position as the pixel difference value to obtain a first image;

[0098] Step 1063: in the blank image, according to the second pixel position of the difference pixel corresponding to the second sub-image, setting the pixel point at the second pixel position to the pixel difference value to obtain a second image;

[0099] Step 1064: Merge the first image and the second image to obtain the difference image.

[0100] In order to further highlight the difference area, the present application superimposes the two images, that is, merges the first image and the second image to obtain a difference image.

[0101] In this embodiment, a blank image is generated according to the image size of the target circumscribed rectangular frame. This blank image refers to an image without any pixel value. In the blank image, according to the first pixel position of the difference pixel corresponding to the first sub-image, the pixel at the position is set to the pixel difference value. This means that the first sub-image is used as a reference to determine which pixels in the blank image need to be filled in order to reflect the difference between the first sub-image and the target. Similarly, in the blank image, according to the second pixel position of the difference pixel corresponding to the second sub-image, the pixel at the position is set to the pixel difference value. This means that the second sub-image is used as a reference to add its difference pixel to the blank image to reflect the difference between the second sub-image and the target. Finally, the first image and the second image are merged to obtain the final difference image. This difference image will contain the result of superimposing the difference pixels of the two sub-images. The effect of this technical solution is to generate a difference image, which can intuitively show the difference between the two sub-images relative to the target. The pixel value in the difference image represents the difference size of the pixels of the two sub-images at the corresponding positions. Through the above scheme, sufficient data preparation can be provided for subsequent feature extraction.

[0102] Step 107: Input the first image to be detected into the first feature extraction layer of the defect detection model, input the second image to be detected into the second feature extraction layer of the defect detection model, and input the difference image into the third feature extraction layer of the defect detection model to obtain the defect detection results output by the defect detection model; the defect detection results include scratches, scrapes, bumps, deformation, foreign matter and discoloration.

[0103] The network structure in the defect detection model includes but is not limited to a first feature extraction layer, a second feature extraction layer, a third feature extraction layer, a fourth feature extraction layer, a downsampling layer, and a classifier.

[0104] The specific execution logic of the defect detection model is as follows: the first image to be detected is processed by the first feature extraction layer to obtain a first feature image; the second image to be detected is processed by the second feature extraction layer to obtain a second feature image; the difference image is processed by the third feature extraction layer to obtain a third feature image; the first similarity between the third feature image and the first feature image is calculated; the second similarity between the third feature image and the second feature image is calculated; if the first similarity is greater than the second similarity, the third feature image and the first feature image are fused to obtain a fused image; if the first similarity is less than the second similarity, the third feature image and the second feature image are fused to obtain a fused image; the fused image is processed by the fourth feature extraction layer to obtain a fourth feature image; the fourth feature image is processed by the downsampling layer and the classifier to obtain the defect detection result.

[0105] The defect detection model realizes defect detection by using multiple feature extraction layers and similarity calculation. First, the first image to be detected is processed by the first feature extraction layer to obtain the first feature image; at the same time, the second image to be detected is processed by the second feature extraction layer to obtain the second feature image. Then, the difference image is processed by the third feature extraction layer to obtain the third feature image. Next, the first similarity between the third feature image and the first feature image is calculated, and the second similarity between the third feature image and the second feature image is calculated. If the first similarity is greater than the second similarity, the third feature image and the first feature image are fused to obtain a fused image; if the first similarity is less than the second similarity, the third feature image and the second feature image are fused to obtain a fused image. Secondly, the fused image is processed by the fourth feature extraction layer to obtain a fourth feature image. Finally, the fourth feature image is processed by the downsampling layer and the classifier to obtain the defect detection result. The inventive point of the above technical solution is to use similarity to fuse feature images. By comparing the similarity between the third feature image and the first and second feature images, a more similar feature image is selected for fusion to improve the detection precision and accuracy. In addition, using multiple feature extraction layers and classifiers can capture richer feature information, and output the final defect detection results through downsampling and classifier combination. The advantage of this technical solution is that it can comprehensively utilize the information of multiple feature extraction layers and similarity calculations for image fusion, thereby improving the accuracy and robustness of defect detection. By gradually processing different feature images and fusing them, the key features in the image can be effectively extracted and the situation of misjudgment or missed detection can be reduced.

[0106] In this embodiment, a first image to be detected corresponding to a top light source and a second image to be detected corresponding to a side light source are obtained at the same position of the object to be detected; the first image to be detected and the second image to be detected are compared with a standard image respectively; target circumscribed rectangular frames of the difference areas in the first image to be detected and the second image to be detected are extracted respectively; the difference area refers to the area where the first image to be detected or the second image to be detected is different from the standard image; according to the position information corresponding to the target circumscribed rectangular frame, a first sub-image and a second sub-image are captured in the first image to be detected and the second image to be detected respectively; the first sub-image and the second sub-image are extracted; , and calculate the pixel difference between the two pixels corresponding to the difference pixel; the difference pixel refers to the pixel whose pixel difference value of the same pixel position in the first sub-image, the second sub-image and the standard image is greater than the first threshold; according to the position of the difference pixel and the pixel difference value, a difference image is formed; the first image to be detected is input into the first feature extraction layer of the defect detection model, the second image to be detected is input into the second feature extraction layer of the defect detection model, and the difference image is input into the third feature extraction layer of the defect detection model to obtain the defect detection result output by the defect detection model; the defect detection result includes scratches, scratches, bumps, deformation, foreign matter and discoloration. The above scheme, by obtaining the first image to be detected corresponding to the top light source and the second image to be detected corresponding to the side light source at the same position of the object to be detected, the scheme can comprehensively utilize the image information of multiple angles for comparison and analysis, thereby increasing the accuracy of shell defect detection. Difference area extraction: by comparing with the standard image, the scheme can respectively extract the target circumscribed rectangular frame of the difference area in the first image to be detected and the second image to be detected. The difference area refers to the area that is different from the standard image, so that the potential shell defect area can be quickly located. According to the position information of the target circumscribed rectangular frame, the first sub-image and the second sub-image are intercepted in the first image to be detected and the second image to be detected. This can focus on the difference area, reduce the interference of irrelevant information, and improve the accuracy of detection. Extract the difference pixels in the difference sub-image, and calculate the pixel difference between these pixels. The difference pixel point refers to the pixel point whose pixel difference value at the same pixel position is greater than the set threshold. By calculating the pixel difference amount, the degree of difference can be quantified, and different types of defects can be further identified and classified. The features of the first image to be detected are input into the first feature extraction layer of the defect detection model, the features of the second image to be detected are input into the second feature extraction layer of the defect detection model, and the difference image is input into the third feature extraction layer of the defect detection model. By processing and analyzing these features through the defect detection model, the detection results for defect types such as scratches, scrapes, bumps, deformation, foreign matter and discoloration can be obtained.In general, this technical solution can identify the defect types of objects such as laptop computer cases and improve the precision and accuracy of detection by integrating multi-angle information, difference area extraction, sub-image extraction, pixel difference calculation and defect detection model analysis.

[0107] Optionally, before step 101, steps 11 to 13 are also included:

[0108] Step 11: Obtain an initial model and a plurality of training samples, each of the training samples comprising a first sample image, a second sample image, a sample difference image and a label;

[0109] Step 12: randomly selecting a preset number of training samples from the plurality of training samples, and performing interference processing on the preset number of training samples to obtain a plurality of interference samples;

[0110] Specifically, step 12 includes:

[0111] Randomly selecting a preset number of training samples from the plurality of training samples;

[0112] Substitute the training sample input into the following formula, and after K iterations, obtain the target iterative interference sample;

[0113] The formula is:

[0114] in, represents the current iteration interference sample, wherein the current iteration interference sample of the Kth iteration is the target iteration interference sample, represents the interference sample of the previous iteration, represents the hyperparameter controlling the iteration step size, Indicates the gradient of the training sample, L represents the loss function, y represents the label corresponding to the original sample, Represents a projection operation, Represents the sign function.

[0115] Step 13: Train the initial model using a plurality of the training samples and a plurality of the interference samples to obtain the defect detection model.

[0116] In this embodiment, data is obtained from an initial model and a plurality of training samples. Each training sample includes a first sample image, a second sample image, a sample difference image, and a corresponding label. A certain number of samples are randomly selected from the plurality of training samples to form a preset number of training sample sets. This can ensure the diversity and representativeness of the training set. The selected training samples are subjected to interference processing to generate a plurality of interference samples. The interference processing may include performing transformation operations such as rotation, scaling, and translation on the image to increase the diversity of the training samples. The feature images in the plurality of training samples and the interference samples are fused using a similarity calculation method. By fusing feature images with high similarity, the model's ability to detect target defects can be enhanced. The fused feature images are used as input data, and the initial model is iteratively optimized through a training process. The training process may use a traditional supervised learning algorithm, such as a convolutional neural network (CNN), etc. After multiple rounds of training, an optimized defect detection model is obtained. The model can provide more accurate and robust results based on the fused feature images when detecting defects. Through the above steps, this technical solution makes full use of multiple training samples and interference samples, and combines similarity calculation to perform feature image fusion, thereby improving the accuracy and stability of the defect detection model. Compared with traditional methods, this solution helps to improve the generalization ability of the model and is suitable for a variety of defect detection scenarios.

[0117] like Figure 2 The present invention provides a defect detection device 2 for a notebook computer casing, see Figure 2 , Figure 2 A schematic diagram of a defect detection device for a notebook computer casing provided by the present invention is shown. Figure 2 A defect detection device for a laptop computer casing includes:

[0118] An acquisition unit 21 is used to acquire a first image to be detected corresponding to a top light source and a second image to be detected corresponding to a side light source at the same position of the object to be detected; the object to be detected includes the laptop computer housing;

[0119] A comparison unit 22, used for comparing the first to-be-detected image and the second to-be-detected image with a standard image respectively;

[0120] An extraction unit 23 is used to extract target circumscribed rectangular frames of different regions in the first image to be detected and the second image to be detected, respectively; the different regions refer to regions where the first image to be detected or the second image to be detected is different from the standard image;

[0121] A capture unit 24, configured to capture a first sub-image and a second sub-image in the first image to be detected and the second image to be detected, respectively, according to position information corresponding to the target circumscribed rectangular frame;

[0122] A first calculation unit 25 is used to extract difference pixels in the first sub-image and the second sub-image, and calculate a pixel difference between two pixels corresponding to the difference pixels; the difference pixels refer to pixels whose pixel difference values ​​at the same pixel positions in the first sub-image, the second sub-image and the standard image are greater than a first threshold;

[0123] A processing unit 26, configured to form a difference image according to the positions of the difference pixels and the pixel differences;

[0124] The second computing unit 27 is used to input the first image to be detected into the first feature extraction layer of the defect detection model, input the second image to be detected into the second feature extraction layer of the defect detection model, and input the difference image into the third feature extraction layer of the defect detection model to obtain the defect detection results output by the defect detection model; the defect detection results include scratches, scrapes, bumps, deformation, foreign matter and discoloration.

[0125] The present invention provides a defect detection device for a laptop computer shell, which obtains a first image to be detected corresponding to a top light source and a second image to be detected corresponding to a side light source at the same position of an object to be detected; compares the first image to be detected and the second image to be detected with a standard image respectively; extracts target circumscribed rectangular frames of the difference areas in the first image to be detected and the second image to be detected respectively; the difference area refers to the area where the first image to be detected or the second image to be detected is different from the standard image; according to the position information corresponding to the target circumscribed rectangular frames, intercepts a first sub-image and a second sub-image in the first image to be detected and the second image to be detected respectively; extracts the first sub-image and the difference pixel points in the second sub-image, and calculate the pixel difference between the two pixel points corresponding to the difference pixel point; the difference pixel point refers to the pixel point whose pixel difference value of the same pixel position in the first sub-image, the second sub-image and the standard image is greater than the first threshold; according to the position of the difference pixel point and the pixel difference value, a difference image is formed; the first image to be detected is input into the first feature extraction layer of the defect detection model, the second image to be detected is input into the second feature extraction layer of the defect detection model, and the difference image is input into the third feature extraction layer of the defect detection model to obtain the defect detection result output by the defect detection model; the defect detection result includes scratches, scratches, bumps, deformation, foreign matter and discoloration. The above scheme, by obtaining the first image to be detected corresponding to the top light source and the second image to be detected corresponding to the side light source at the same position of the object to be detected, the scheme can comprehensively utilize the image information of multiple angles for comparison and analysis, thereby increasing the accuracy of shell defect detection. Difference area extraction: by comparing with the standard image, the scheme can respectively extract the target circumscribed rectangular frame of the difference area in the first image to be detected and the second image to be detected. The difference area refers to the area that is different from the standard image, so that the potential shell defect area can be quickly located. According to the position information of the target circumscribed rectangular frame, the first sub-image and the second sub-image are intercepted in the first image to be detected and the second image to be detected. This can focus on the difference area, reduce the interference of irrelevant information, and improve the accuracy of detection. Extract the difference pixels in the difference sub-image, and calculate the pixel difference between these pixels. The difference pixel point refers to the pixel point whose pixel difference value at the same pixel position is greater than the set threshold. By calculating the pixel difference amount, the degree of difference can be quantified, and different types of defects can be further identified and classified. The features of the first image to be detected are input into the first feature extraction layer of the defect detection model, the features of the second image to be detected are input into the second feature extraction layer of the defect detection model, and the difference image is input into the third feature extraction layer of the defect detection model. By processing and analyzing these features through the defect detection model, the detection results for defect types such as scratches, scrapes, bumps, deformation, foreign matter and discoloration can be obtained.In general, this technical solution can identify the defect types of objects such as laptop computer cases and improve the precision and accuracy of detection by integrating multi-angle information, difference area extraction, sub-image extraction, pixel difference calculation and defect detection model analysis.

[0126] Figure 3 Schematic diagram of a terminal device provided by an embodiment of the present invention. Figure 3 As shown, a terminal device 3 of this embodiment includes: a processor 30, a memory 31, and a computer program 32 stored in the memory 31 and executable on the processor 30, such as a program for detecting defects in a laptop computer shell. When the processor 30 executes the computer program 32, the steps in the above-mentioned method for detecting defects in a laptop computer shell are implemented, such as Figure 1 Alternatively, when the processor 30 executes the computer program 32, the functions of each unit in the above-mentioned device embodiments are realized, for example, Figure 2 The functions of units 21 to 27 are shown.

[0127] Exemplarily, the computer program 32 may be divided into one or more units, which are stored in the memory 31 and executed by the processor 30 to complete the present invention. The one or more units may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program 32 in the terminal device 3. For example, the computer program 32 may be divided into the following specific functions of each unit:

[0128] An acquisition unit, used for acquiring a first image to be detected corresponding to a top light source and a second image to be detected corresponding to a side light source at the same position of the object to be detected; the object to be detected includes the laptop computer housing;

[0129] A comparison unit, used for comparing the first to-be-detected image and the second to-be-detected image with a standard image respectively;

[0130] An extraction unit, used to extract target circumscribed rectangular frames of different areas in the first image to be detected and the second image to be detected, respectively; the different area refers to an area where the first image to be detected or the second image to be detected is different from the standard image;

[0131] A capture unit, configured to capture a first sub-image and a second sub-image in the first image to be detected and the second image to be detected respectively according to position information corresponding to the target circumscribed rectangular frame;

[0132] a first calculation unit, configured to extract difference pixels in the first sub-image and the second sub-image, and calculate a pixel difference between two pixels corresponding to the difference pixels; the difference pixels refer to pixels whose pixel difference values ​​at the same pixel positions in the first sub-image, the second sub-image and the standard image are greater than a first threshold;

[0133] A processing unit, configured to form a difference image according to the positions of the difference pixels and the pixel difference values;

[0134] The second computing unit is used to input the first image to be detected into the first feature extraction layer of the defect detection model, input the second image to be detected into the second feature extraction layer of the defect detection model, and input the difference image into the third feature extraction layer of the defect detection model to obtain the defect detection results output by the defect detection model; the defect detection results include scratches, scrapes, bumps, deformation, foreign matter and discoloration.

[0135] The terminal device includes but is not limited to a processor 30 and a memory 31. Those skilled in the art will appreciate that Figure 3 It is only an example of a terminal device 3 and does not constitute a limitation on the terminal device 3. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the terminal device may also include input and output devices, network access devices, buses, etc.

[0136] The processor 30 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0137] The memory 31 may be an internal storage unit of the terminal device 3, such as a hard disk or memory of the terminal device 3. The memory 31 may also be an external storage device of the terminal device 3, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the terminal device 3. Further, the memory 31 may also include both an internal storage unit and an external storage device of the terminal device 3. The memory 31 is used to store the computer program and other programs and data required by the roaming control device. The memory 31 may also be used to temporarily store data that has been output or is to be output.

[0138] It should be understood that the order of execution of the steps in the above embodiment 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 embodiment of the present invention.

[0139] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present invention. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.

[0140] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In actual applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0141] An embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.

[0142] An embodiment of the present invention provides a computer program product. When the computer program product runs on a mobile terminal, the mobile terminal can implement the steps in the above-mentioned method embodiments when executing the computer program product.

[0143] If the 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-readable storage medium. Based on this understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above-mentioned method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device that can carry the computer program code to the camera / terminal device, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.

[0144] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0145] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0146] In the embodiments provided by the present invention, it should be understood that the disclosed devices / network equipment and methods can be implemented in other ways. For example, the device / network equipment embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0147] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, and may be located in one place or distributed over multiple network units.

[0148] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.

[0149] It should also be understood that the term "and / or" used in the present description and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.

[0150] As used in the present specification and the appended claims, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to monitoring, depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is monitored" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is monitored" or "in response to monitoring [described condition or event]", depending on the context.

[0151] In addition, in the description of the present specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.

[0152] References to "one embodiment" or "some embodiments" etc. described in the present specification mean that one or more embodiments of the present invention include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0153] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.

Claims

1. A method for detecting defects in a notebook computer casing, characterized in that: The defect detection method of the notebook computer shell comprises: Acquire a first image to be detected corresponding to a top light source and a second image to be detected corresponding to a side light source at the same position of the object to be detected; the object to be detected includes the laptop computer housing; Comparing the first image to be detected and the second image to be detected with a standard image respectively; Extracting target circumscribed rectangular frames of different regions in the first image to be detected and the second image to be detected respectively; the different regions refer to regions where the first image to be detected or the second image to be detected is different from the standard image; According to the position information corresponding to the target circumscribed rectangular frame, intercepting a first sub-image and a second sub-image in the first image to be detected and the second image to be detected respectively; Extracting difference pixels between the first sub-image and the second sub-image; Calculating a pixel difference between two pixels corresponding to the difference pixel; the difference pixel refers to a pixel whose pixel difference value at the same pixel position in the first sub-image, the second sub-image and the standard image is greater than a first threshold; forming a difference image according to the positions of the difference pixels and the pixel difference values; The first image to be detected is processed by the first feature extraction layer to obtain a first feature image; the defect detection model includes a first feature extraction layer, a second feature extraction layer, a third feature extraction layer, a fourth feature extraction layer, a downsampling layer and a classifier; The second image to be detected is processed by a second feature extraction layer to obtain a second feature image; The difference image is processed by a third feature extraction layer to obtain a third feature image; Calculating a first similarity between the third feature image and the first feature image; calculating a second similarity between the third feature image and the second feature image; If the first similarity is greater than the second similarity, fusing the third feature image with the first feature image to obtain a fused image; If the first similarity is less than the second similarity, fusing the third feature image with the second feature image to obtain a fused image; The fused image is processed by the fourth feature extraction layer to obtain a fourth feature image; The fourth feature image is processed by the downsampling layer and the classifier to obtain the defect detection result; the defect detection result includes scratches, scrapes, bumps, deformation, foreign matter and discoloration; Among them, the step of extracting the difference pixel points in the first sub-image and the second sub-image includes: aligning the first sub-image with the shell image in the standard image, comparing the pixel difference at the same pixel position between the two images, and if the pixel difference value at the same pixel position is greater than a first threshold, then taking the pixel point as the difference pixel point; aligning the second sub-image with the shell image in the standard image, comparing the pixel difference at the same pixel position between the two images, and if the pixel difference value at the same pixel position is greater than the first threshold, then taking the pixel point as the difference pixel point.

2. The defect detection method for a notebook computer casing according to claim 1, characterized in that: The step of respectively extracting target circumscribed rectangular frames of different areas in the first image to be detected and the second image to be detected comprises: Traversing the difference area between the first to-be-detected image and the standard image; Traversing the difference area between the second to-be-detected image and the standard image; The minimum bounding rectangular frame corresponding to the difference area with the most pixels is selected as the target bounding rectangular frame.

3. The method for detecting defects of a notebook computer casing according to claim 2, wherein: The step of traversing the difference area between the first image to be detected and the standard image comprises: Gray-scale the first image to be detected and the standard image to obtain a first grayscale image and a second grayscale image; Identifying a first contour region and a second contour region in the first grayscale image and the second grayscale image by a contour recognition algorithm; Align the first contour area with the second contour area, and traverse the difference pixel points between the first contour area and the second contour area; If the pixel difference value of the difference pixel point is greater than a second threshold value, and the number of adjacent difference pixel points exceeds a preset number, the corresponding area is taken as the difference area.

4. The method for detecting defects of a notebook computer casing according to claim 1, wherein: The step of forming a difference image according to the position of the difference pixel point and the pixel difference value comprises: Generate a blank image according to the image size of the target circumscribed rectangular frame; the blank image refers to an image without pixel values; In the blank image, according to a first pixel position of a difference pixel point corresponding to the first sub-image, a pixel point at the first pixel position is set to the pixel difference value to obtain a first image; In the blank image, according to a second pixel position of a difference pixel corresponding to the second sub-image, a pixel point at the second pixel position is set to the pixel difference value to obtain a second image; The first image and the second image are combined to obtain the difference image.

5. The method for detecting defects of a notebook computer casing according to claim 1, wherein: Before the step of acquiring the first image to be detected corresponding to the top light source and the second image to be detected corresponding to the side light source at the same position of the object to be detected, the method further includes: Acquire an initial model and a plurality of training samples, each of the training samples comprising a first sample image, a second sample image, a sample difference image and a label; Randomly selecting a preset number of training samples from the plurality of training samples, and performing interference processing on the preset number of training samples to obtain a plurality of interference samples; The initial model is trained by using a plurality of the training samples and a plurality of the interference samples to obtain the defect detection model.

6. The method for detecting defects of a notebook computer casing according to claim 5, characterized in that: The step of randomly selecting a preset number of training samples from the plurality of training samples, performing interference processing on the preset number of training samples, and obtaining a plurality of interference samples comprises: Randomly selecting a preset number of training samples from the plurality of training samples; Substitute the training sample input into the following formula, and after K iterations, obtain the target iterative interference sample; The formula is: in, represents the current iteration interference sample, wherein the current iteration interference sample of the Kth iteration is the target iteration interference sample, represents the interference sample of the previous iteration, represents the hyperparameter controlling the iteration step size, Indicates the gradient of the training sample, L represents the loss function, y represents the label corresponding to the original sample, Represents a projection operation, Represents the sign function.

7. A defect detection device for a notebook computer casing, characterized in that: The defect detection device for the notebook computer shell comprises: An acquisition unit, used for acquiring a first image to be detected corresponding to a top light source and a second image to be detected corresponding to a side light source at the same position of the object to be detected; the object to be detected includes the laptop computer housing; A comparison unit, used for comparing the first to-be-detected image and the second to-be-detected image with a standard image respectively; An extraction unit, used to extract target circumscribed rectangular frames of different areas in the first image to be detected and the second image to be detected, respectively; the different area refers to an area where the first image to be detected or the second image to be detected is different from the standard image; A capture unit, configured to capture a first sub-image and a second sub-image in the first image to be detected and the second image to be detected respectively according to position information corresponding to the target circumscribed rectangular frame; A first calculation unit is used to extract difference pixels in the first sub-image and the second sub-image; and calculate the pixel difference between two pixels corresponding to the difference pixels; the difference pixels refer to pixels whose pixel difference values ​​at the same pixel position in the first sub-image, the second sub-image and the standard image are greater than a first threshold; A processing unit, configured to form a difference image according to the positions of the difference pixels and the pixel difference values; A second computing unit is used for processing the first image to be detected through the first feature extraction layer to obtain a first feature image; the defect detection model includes a first feature extraction layer, a second feature extraction layer, a third feature extraction layer, a fourth feature extraction layer, a downsampling layer and a classifier; The second image to be detected is processed by a second feature extraction layer to obtain a second feature image; The difference image is processed by a third feature extraction layer to obtain a third feature image; Calculating a first similarity between the third feature image and the first feature image; calculating a second similarity between the third feature image and the second feature image; If the first similarity is greater than the second similarity, fusing the third feature image with the first feature image to obtain a fused image; If the first similarity is less than the second similarity, fusing the third feature image with the second feature image to obtain a fused image; The fused image is processed by the fourth feature extraction layer to obtain a fourth feature image; The fourth feature image is processed by the downsampling layer and the classifier to obtain the defect detection result; the defect detection result includes scratches, scrapes, bumps, deformation, foreign matter and discoloration; Among them, the step of extracting the difference pixel points in the first sub-image and the second sub-image includes: aligning the first sub-image with the shell image in the standard image, comparing the pixel difference at the same pixel position between the two images, and if the pixel difference value at the same pixel position is greater than a first threshold, then taking the pixel point as the difference pixel point; aligning the second sub-image with the shell image in the standard image, comparing the pixel difference at the same pixel position between the two images, and if the pixel difference value at the same pixel position is greater than the first threshold, then taking the pixel point as the difference pixel point.

8. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.