Image detection method, computer device and storage medium

CN115861153BActive Publication Date: 2026-08-21HON HAI PRECISION INDUSTRY CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111121998.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-24
Publication Date
2026-08-21
Estimated Expiration
2041-09-24

AI Technical Summary

Technical Problem

即使用高分辨率的相机对产品进行拍摄,不同光源拍摄环境下仍会出现某些瑕疵拍摄出来的效果不明显的状况,导致产品瑕疵检测时的检测准确度降低

Benefits of technology

[0014]Compared with existing technologies, the image detection method, computer device and storage medium described above can enhance the representation of defects in images without affecting normal samples, thereby improving the accuracy of defect detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115861153B_ABST
    Figure CN115861153B_ABST
Patent Text Reader

Abstract

The application provides an image detection method, a computer device and a storage medium, wherein the method comprises: acquiring a plurality of first flawed images; performing image correction on the first flawed images; acquiring first sub-region images of the first flawed images; performing image flaw processing on each first sub-region image; obtaining a target model based on the image flaw processed first sub-region images; acquiring a second flawed image; performing image correction on the second flawed image; acquiring second sub-region images of the corrected second flawed image; performing image flaw processing on each second sub-region image; and detecting the image flaw processed second sub-region images by using the target model to obtain a detection result. The application can assist in detecting whether an image is abnormal, and improve the accuracy of image detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of product testing, and in particular to an image testing method, computer device, and storage medium. Background Technology

[0002] In actual industrial production, some products inevitably have scratches or dust-related defects on their surfaces. Even when photographing the products with a high-resolution camera, certain flaws may not be clearly visible under different lighting conditions, leading to a decrease in the accuracy of product defect detection. Summary of the Invention

[0003] In view of the above, it is necessary to provide an image detection method, a computer device, and a storage medium that can assist in detecting product anomalies to solve the above problems.

[0004] The image detection method, computer device, and storage medium include: acquiring a test set, the test set including multiple first flawed images; performing image correction on each of the first flawed images; segmenting each corrected first flawed image into a preset number of first sub-region images; performing image flaw processing on each first sub-region image; training a neural network using the image flaw-processed first sub-region images to obtain a target model; acquiring a validation set, the validation set including second flawed images; performing the image correction on the second flawed images; segmenting the corrected second flawed images into the preset number of second sub-region images; performing image flaw processing on each second sub-region image; and detecting the image flaw-processed second sub-region images using the target model to obtain a detection result.

[0005] Optionally, the image defect processing for each of the first sub-region images includes: adjusting the image contrast for each of the first sub-region images.

[0006] Optionally, adjusting the image contrast of any first sub-region image includes: obtaining a first grayscale histogram of the arbitrary first sub-region image; adjusting the first grayscale histogram according to a preset truncation threshold H; and adjusting the contrast of the arbitrary first sub-region image using a histogram equalization method based on the adjusted first grayscale histogram.

[0007] Optionally, the horizontal axis of the first grayscale histogram of any first sub-region image represents the pixel value x of the first sub-region image, and the vertical axis of the first grayscale histogram represents the number b of pixels with pixel value x in the first sub-region image. x .

[0008] Optionally, adjusting the first grayscale histogram according to a preset truncation threshold H includes: determining the number b pixels in the first grayscale histogram that are greater than the truncation threshold H. x Using the formula Obtain an adjusted first grayscale histogram, wherein the horizontal axis of the adjusted first grayscale histogram is the pixel value x, and the vertical axis of the adjusted first grayscale histogram is the number of pixels with pixel value x, b′. x .

[0009] Optionally, adjusting the contrast of the first sub-region image using a histogram equalization method based on the adjusted first gray-level histogram includes: calculating the cumulative distribution function cdf(x), using the following formula: The pixel value x is updated using the cumulative distribution function cdf(x) to obtain the updated pixel value h(x). The formula used is as follows: Where, round represents the rounding function, W represents the number of pixels in the width of the first sub-region image, and H represents the number of pixels in the height of the first sub-region image.

[0010] Optionally, the step of training a neural network using the first sub-region image after image defect processing to obtain a target model includes: training a neural network using the first sub-region image after image defect processing to obtain a detection model; determining whether the detection model meets preset requirements, and using the detection model that meets the preset requirements as the target model.

[0011] Optionally, the step of using the target model to detect the second sub-region image after image defect processing and obtaining the detection result includes: inputting the second sub-region image after image defect processing into the target model to obtain the defect value of the second sub-region image after image defect processing; comparing the defect value with a preset defect threshold; when it is determined that the defect value is greater than or equal to the defect threshold, determining that the second sub-region image after image defect processing is a defective image; and when it is determined that the defect value is less than the defect threshold, determining that the second sub-region image after image defect processing is a defect-free image.

[0012] The computer-readable storage medium stores at least one instruction, which, when executed by a processor, implements the image detection method.

[0013] The computer device includes a memory and at least one processor, the memory storing at least one instruction which, when executed by the at least one processor, implements the image detection and inspection method.

[0014] Compared with existing technologies, the image detection method, computer device and storage medium described above can enhance the representation of defects in images without affecting normal samples, thereby improving the accuracy of defect detection. Attached Figure Description

[0015] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0016] Figure 1 This is a flowchart of the image detection method provided in the embodiments of this application.

[0017] Figure 2 This is an architectural diagram of the computer device provided in the embodiments of this application.

[0018] Figure 3 This is an example diagram of the corrected first flawed image and the first sub-region image provided in the embodiments of this application.

[0019] Figure 4 These are example diagrams of the first grayscale histogram and the adjusted first grayscale histogram provided in the embodiments of this application.

[0020] Figure 5 This is a flowchart of step S7 provided in the embodiments of this application.

[0021] Explanation of main component symbols

[0022] processor 32 memory 31 Image detection system 30

[0023] The following detailed description, in conjunction with the accompanying drawings, will further illustrate this application. Detailed Implementation

[0024] To better understand the above-mentioned objectives, features, and advantages of this application, the application will be described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that, unless otherwise specified, the embodiments and features described herein can be combined with each other.

[0025] Numerous specific details are set forth in the following description to provide a thorough understanding of this application. The described embodiments are merely some, not all, of the embodiments described herein. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.

[0026] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application.

[0027] See Figure 1 The diagram shown is a flowchart of the image detection method provided in an embodiment of this application.

[0028] In this embodiment, the image detection method can be applied to a computer device. For a computer device that needs to perform image detection, the image detection function provided by the method of this application can be directly integrated into the computer device, or it can be run on the computer device in the form of a software development kit (SDK).

[0029] like Figure 1 As shown, the image detection method specifically includes the following steps. Depending on different needs, the order of the steps in this flowchart can be changed, and some steps can be omitted.

[0030] Step S1: The computer device acquires a test set, which includes multiple flawed images (for clarity of this application, each flawed image included in the test set is referred to as the "first flawed image").

[0031] In one embodiment, the computer device may acquire the test set in response to user input. The computer device may also pre-store the test set in its memory or in another device communicatively connected to the computer device. Each of the first defective images may be an image taken from a printed material (e.g., a cosmetic instruction manual) that needs to be inspected.

[0032] Step S2: The computer device performs image correction on each of the first flawed images.

[0033] In one embodiment, the computer device may acquire a flawless image in response to user input, and use the flawless image as a reference image when performing image correction on the first flawed image. The computer device may also pre-store the flawless image in its memory or in another device communicatively connected to the computer device. In this embodiment, the flawless image may be a standard sample image of the printed matter, that is, an image taken of the flawless printed matter.

[0034] In one embodiment, image correction of the first defective image includes geometric correction of the position of the first defective image using the scale-invariant feature transform (SIFT) technique.

[0035] The geometric correction of the position of the first flawed image using SIFT technology includes: acquiring multiple first feature points in the first flawed image (e.g., points with drastic texture changes, corner points, intersections of lines, and isolated points in simple regions, etc.) and multiple second feature points in the flawless image (e.g., points with drastic texture changes, corner points, intersections of lines, and isolated points in simple regions, etc.); establishing a matching relationship between each first feature point and each second feature point using a matching matrix calculation method to obtain multiple mutually matching first feature point pairs; removing incorrectly matched first feature point pairs from the multiple first feature point pairs using the Random Sample Consensus (RANSAC) algorithm to obtain correctly matched first feature point pairs; calculating a first correction matrix for the first flawed image based on the correctly matched first feature point pairs; and correcting the first flawed image based on the first correction matrix. It should be noted that in this embodiment, each first feature point pair is also a combination of mutually matching first and second feature points.

[0036] It should be noted that the corrected first flawed image and the flawless image are the same size.

[0037] Step S3: The computer device divides each corrected first flawed image into a preset number of images (for clarity, each image in the preset number of images into which the first flawed image is divided is referred to as a first sub-region image).

[0038] In one embodiment, the computer device can divide the corrected first flawed image into M×N equal parts to obtain M×N first sub-region images; and establish a one-to-one correspondence between any corrected first flawed image and each first sub-region image obtained by segmentation based on any corrected first flawed image. For example, ... Figure 3 The corrected first flawed image 3A is divided into 5×2 parts on average to obtain 10 first sub-region images; for ease of illustration, one of the first sub-region images is magnified as shown in image 3B.

[0039] Step S4: The computer device performs image defect processing on each first sub-region image.

[0040] In one embodiment, the image defect processing for each first sub-region image includes: adjusting the image contrast for each first sub-region image.

[0041] In one embodiment, adjusting the image contrast of any first sub-region image includes: obtaining a first grayscale histogram of the arbitrary first sub-region image; adjusting the first grayscale histogram according to a preset truncation threshold H; and adjusting the contrast of the arbitrary first sub-region image using a histogram equalization method based on the adjusted first grayscale histogram.

[0042] In one embodiment, the horizontal axis of the first grayscale histogram of any first sub-region image represents the pixel value x of the first sub-region image, and the vertical axis of the first grayscale histogram represents the number b of pixels with pixel value x in the first sub-region image. x The pixel value x is an integer greater than or equal to 0 and less than or equal to 255. For example, Figure 4 The first grayscale histogram of image 3B shown in image 4A.

[0043] In one embodiment, adjusting the first grayscale histogram according to a preset truncation threshold H includes: determining the number b of pixels in the first grayscale histogram that are greater than the truncation threshold H. x Using the formula Obtain an adjusted first grayscale histogram, wherein the horizontal axis of the adjusted first grayscale histogram is the pixel value x, and the vertical axis of the adjusted first grayscale histogram is the number of pixels with pixel value x, b′. x The truncation threshold H is proportional to the total number of pixels in the first sub-region image. For example, when the width of the first sub-region image has 640 pixels and the height has 480 pixels, the total number of pixels in the first sub-region image is 640 × 480 = 307200, and the truncation threshold H can be 2000. For instance, for... Figure 4 The first grayscale histogram in Figure 4 After adjusting A, the resulting adjusted first grayscale histogram is as follows: Figure 4 Image 4B is shown in the figure.

[0044] In one embodiment, adjusting the contrast of the first sub-region image using a histogram equalization method based on the adjusted first gray-level histogram includes: calculating the cumulative distribution function cdf(x), using the following formula: The pixel value x is updated using the cumulative distribution function cdf(x) to obtain the updated pixel value h(x). The formula used is as follows: Wherein, round represents the rounding function, W represents the number of pixels in the width of the first sub-region image (e.g., 640), and H represents the number of pixels in the height of the first sub-region image (e.g., 480).

[0045] In one embodiment, a computer device updates pixel x in the first sub-region image using the updated pixel value h(x) to obtain a first sub-region image after image defect processing. The image defect processing includes: enhancing defects in the first sub-region image; and establishing a one-to-one correspondence between any corrected first defective image and each image defect-processed first sub-region image of the corrected first defective image. For example... Figure 3 As shown, the enhanced image 3C is obtained after image defect processing of the first sub-region image 3B.

[0046] Step S5: The computer device trains a neural network using the first sub-region image after image defect processing to obtain the target model.

[0047] In one embodiment, training a neural network using the first sub-region image after image defect processing to obtain a target model includes: training a neural network (e.g., a convolutional neural network) using the first sub-region image after image defect processing to obtain a detection model; determining whether the detection model meets a preset requirement (e.g., the training process of the detection model reaches 1000 epochs), and using the detection model that meets the preset requirement as the target model.

[0048] Step S6: The computer device acquires a verification set, which includes a second defective image; performs image correction on the second defective image; divides the corrected second defective image into a preset number of second sub-region images; and performs image defect processing on each second sub-region image.

[0049] In one embodiment, the computer device may acquire the verification set in response to user input, the test set including one or more second defective images. The computer device may also pre-store the verification set in its memory or in another device communicatively connected to the computer device. The second defective image may be an image captured from a printed material to be inspected. The test set may also include multiple flawless images, which do not require image correction. The flawless images are directly divided into a predetermined number of third sub-region images, establishing a one-to-one correspondence between any flawless image and each of the third sub-region images. The third sub-region images do not require image defect processing, and the size of the third sub-region images is the same as that of the first sub-region images.

[0050] In one embodiment, image correction of the second defective image includes geometric correction of the position of the second defective image using SIFT technology.

[0051] The geometric correction of the position of the second flawed image using SIFT technology includes: acquiring multiple third feature points (e.g., points with drastic texture changes, corner points, intersections of straight lines, and isolated points in simple regions) in the second flawed image and multiple fourth feature points (e.g., points with drastic texture changes, corner points, intersections of straight lines, and isolated points in simple regions) in the flawless image; establishing a matching relationship between each third feature point and each fourth feature point using a matching matrix calculation method to obtain multiple pairs of mutually matching second feature points; removing incorrectly matched second feature point pairs from the multiple pairs of second feature points using the RANSAC algorithm to obtain correctly matched second feature point pairs; calculating a second correction matrix for the second flawed image based on the correctly matched second feature point pairs; and correcting the second flawed image based on the second correction matrix. It should be noted that in this embodiment, each pair of second feature points is also a combination of mutually matching third and fourth feature points.

[0052] It should be noted that the corrected second flawed image is the same size as the flawless image, that is, the corrected second flawed image is the same size as the corrected first flawed image.

[0053] In one embodiment, segmenting the corrected second flawed image into the predetermined number of second sub-region images includes: a computer device equally dividing the corrected second flawed image into M×N parts to obtain the M×N second sub-region images; and establishing a one-to-one correspondence between any corrected second flawed image and each second sub-region image segmented based on the corrected second flawed image. In one embodiment, the second sub-region image has the same size as the first sub-region image.

[0054] In one embodiment, the image defect processing for each second sub-region image includes: adjusting the image contrast for each second sub-region image.

[0055] In one embodiment, adjusting the image contrast of any second sub-region image includes: obtaining a second grayscale histogram of the arbitrary second sub-region image; adjusting the second grayscale histogram according to the truncation threshold H; and adjusting the contrast of the arbitrary second sub-region image using a histogram equalization method based on the adjusted second grayscale histogram.

[0056] In one embodiment, the horizontal axis of the second grayscale histogram of any second sub-region image represents the pixel value x of the first sub-region image, and the vertical axis of the second grayscale histogram represents the number d of pixels with pixel value x in the second sub-region image. x .

[0057] In one embodiment, adjusting the second grayscale histogram based on the truncation threshold H includes: determining the number d of pixels d in the second grayscale histogram that are greater than the truncation threshold H. x Using the formula Obtain an adjusted second grayscale histogram, wherein the horizontal axis of the adjusted second grayscale histogram is the pixel value x, and the vertical axis of the adjusted second grayscale histogram is the number of pixels with pixel value x, d′. x .

[0058] In one embodiment, adjusting the contrast of the second sub-region image using a histogram equalization method based on the adjusted second gray-level histogram includes: calculating the cumulative distribution function cdf2(x), using the following formula: The pixel value x is updated using the cumulative distribution function cdf2(x) to obtain the updated pixel value g(x). The formula used is: Wherein, round represents the rounding function, W represents the number of pixels in the width of the second sub-region image (e.g., 640), and H represents the number of pixels in the height of the second sub-region image (e.g., 480).

[0059] In one embodiment, the computer device updates pixel x in the second sub-region image using the updated pixel value g(x) to obtain a second sub-region image after image defect processing, wherein the image defect processing includes enhancing defects in the second sub-region image; and establishing a one-to-one correspondence between any corrected second defective image and each second sub-region image after image defect processing of the any corrected second defective image.

[0060] Step S7: The computer device uses the target model to detect the second sub-region image after image defect processing and obtains the detection result.

[0061] In one embodiment, the step of using the target model to detect the second sub-region image after image defect processing to obtain the detection result includes: Figure 5 The process is shown below.

[0062] In step S70, the computer device inputs the image of the second sub-region after image defect processing into the target model to obtain the defect value of the image of the second sub-region after image defect processing.

[0063] In one embodiment, the computer device may also input the third sub-region image into the target model for detection. The defect value may range from [0, 1].

[0064] Step S71: The computer device compares the defect value with a preset defect threshold; when it is determined that the defect value is greater than or equal to the defect threshold, step S72 is executed; and when it is determined that the defect value is less than the defect threshold, step S73 is executed.

[0065] In one embodiment, the defect threshold can be preset to 0.05.

[0066] In step S72, the computer device determines that the second sub-region image after image defect processing is a defective image.

[0067] In one embodiment, when it is determined that any second sub-region image after image defect processing is a defective image, the corrected second defective image corresponding to the second sub-region image after image defect processing is determined to be a defective image, thereby determining the corresponding second defective image as a defective image.

[0068] In step S73, the computer device determines that the second sub-region image after image defect processing is a defect-free image.

[0069] In one embodiment, when any second sub-region image after image defect processing is determined to be a defect-free image, the corrected second defective image corresponding to the second sub-region image after image defect processing is determined to be a defect-free image, thereby determining the corresponding second defective image as a defect-free image.

[0070] The above Figure 1 The image detection method of this application is described in detail below. Figure 2 The hardware architecture for implementing the image detection method is described below.

[0071] It should be understood that the embodiments described are for illustrative purposes only and are not limited to this structure in the scope of the patent application.

[0072] See Figure 2 The diagram shown is a structural schematic of a computer device provided in a preferred embodiment of this application. In this preferred embodiment, the computer device 3 includes a memory 31 and at least one processor 32. Those skilled in the art should understand that... Figure 2 The structure of the computer device shown does not constitute a limitation of the embodiments of this application. It can be a bus-type structure or a star-type structure. The computer device 3 may also include more or fewer other hardware or software than shown, or different component arrangements.

[0073] In some embodiments, the computer device 3 includes a terminal capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions, the hardware of which includes, but is not limited to, microprocessors, application-specific integrated circuits, programmable gate arrays, digital processors, and embedded devices.

[0074] It should be noted that the computer device 3 described herein is merely an example. Other existing or future electronic products that are suitable for this application should also be included within the scope of protection of this application and are incorporated herein by reference.

[0075] In some embodiments, the memory 31 is used to store program code and various data, such as the image detection system 30 installed in the computer device 3, and to achieve high-speed and automatic access to programs or data during the operation of the computer device 3. The memory 31 includes read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), one-time programmable read-only memory (OTPROM), electrically-erasable programmable read-only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, disk storage, magnetic tape storage, or any other computer-readable storage medium capable of carrying or storing data.

[0076] In some embodiments, the at least one processor 32 may be composed of integrated circuits, such as a single-packaged integrated circuit or multiple integrated circuits packaged with the same or different functions, including combinations of one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and various control chips. The at least one processor 32 is the control unit of the computer device 3, connecting various components of the computer device 3 via various interfaces and lines. It executes programs or modules stored in the memory 31 and calls data stored in the memory 31 to perform various functions of the computer device 3 and process data, such as executing... Figure 1 The image detection function shown.

[0077] In some embodiments, the image detection system 30 operates in a computer device 3. The image detection system 30 may include multiple functional modules composed of program code segments. The program code of each program segment in the image detection system 30 may be stored in the memory 31 of the computer device 3 and executed by at least one processor 32 to achieve... Figure 1 The image detection function shown.

[0078] Although not shown, the computer device 3 may also include a power supply (such as a battery) to power the various components. Preferably, the power supply can be logically connected to the at least one processor 32 via a power management device, thereby enabling functions such as charging, discharging, and power consumption management. The power supply may also include one or more DC or AC power supplies, recharging devices, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components. The computer device 3 may also include various sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be described in detail here.

[0079] It should be understood that the embodiments described are for illustrative purposes only and are not limited to this structure in the scope of the patent application.

[0080] The integrated unit implemented as a software functional module described above can be stored in a computer-readable storage medium. This software functional module, stored in a storage medium, includes several instructions to cause a computer device (which may be a server, personal computer, etc.) or processor to execute portions of the methods described in the various embodiments of this application.

[0081] In a further embodiment, combined with Figure 2 The at least one processor 32 can execute the operating device of the computer device 3 and various installed applications (such as the image detection system 30), program code, etc., for example, the various modules mentioned above.

[0082] The memory 31 stores program code, and the at least one processor 32 can call the program code stored in the memory 31 to execute related functions. For example, Figure 2 The modules described herein are program codes stored in the memory 31 and executed by the at least one processor 32, thereby implementing the functions of the modules to achieve the desired results. Figure 1 The purpose of the image detection shown.

[0083] In one embodiment of this application, the memory 31 stores one or more instructions (i.e., at least one instruction), which are executed by the at least one processor 32 to implement... Figure 1 The purpose of the image detection shown.

[0084] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and other division methods may be used in actual implementation.

[0085] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0086] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional modules.

[0087] It will be apparent to those skilled in the art that this application is not limited to the details of the exemplary embodiments described above, and that this application can be implemented in other specific forms without departing from the spirit or essential characteristics of this application. Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of this application is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be embraced within this application. No reference numerals in the claims should be construed as limiting the scope of the claims. Furthermore, it is clear that the word "comprising" does not exclude other elements or, and the singular does not exclude the plural. Multiple elements or devices recited in the apparatus claims may also be implemented by a single element or device in software or hardware. The terms "first," "second," etc., are used to indicate names and do not indicate any particular order.

[0088] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application and are not intended to limit it. Although this application has been described in detail with reference to the above preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of this application without departing from the spirit and scope of the technical solutions of this application.

Claims

1. An image detection method, characterized in that, The method includes: Obtain a test set, which includes multiple first flawed images; Perform image correction on each of the first flawed images; Each corrected first flawed image is divided into a preset number of first sub-region images; Image imperfection processing is performed on each first sub-region image to enhance the imperfections in each first sub-region image, including: image contrast adjustment for each first sub-region image, wherein image contrast adjustment for any first sub-region image includes: Obtain the first grayscale histogram of any of the first sub-region images; Based on the preset cutoff threshold The first grayscale histogram is adjusted, wherein the truncation threshold is proportional to the total number of pixels in any first sub-region image, and the adjustment is based on a preset truncation threshold. Adjusting the first grayscale histogram includes: determining that the first grayscale histogram is greater than the cutoff threshold. Number of pixels Using the formula Obtain an adjusted first grayscale histogram, wherein the horizontal axis of the adjusted first grayscale histogram represents pixel values. The vertical axis of the adjusted first grayscale histogram represents the pixel value. Number of pixels ;and Based on the adjusted first grayscale histogram, the contrast of any one of the first sub-region images is adjusted using the histogram equalization method. The target model is obtained by training a neural network using the first sub-region image after image defect removal. Obtain a verification set, which includes a second defective image; The image correction is performed on the second defective image; The corrected second flawed image is divided into the preset number of second sub-region images; The image defect processing is performed on each second sub-region image, and the image defect processing uses the same image contrast adjustment method as the first sub-region image; and The target model is used to detect the second sub-region image after image defect processing to obtain the detection result.

2. The image detection method according to claim 1, characterized in that, The horizontal axis of the first grayscale histogram of any first sub-region image represents the pixel value of any first sub-region image. The vertical axis of the first grayscale histogram represents the pixel value in any of the first sub-region images. Number of pixels .

3. The image detection method according to claim 1, characterized in that, The step of adjusting the contrast of the first sub-region image using a histogram equalization method based on the adjusted first grayscale histogram includes: Calculate the cumulative distribution function The formula used is: , Using the cumulative distribution function For pixel values Perform an update to obtain the updated pixel values. The formula used is: ), in, This represents the floor function. The number of pixels representing the width of the first sub-region image. This represents the number of high-resolution pixels in the first sub-region image.

4. The image detection method according to claim 1, characterized in that, The process of training a neural network using the first sub-region image after image defect processing to obtain the target model includes: A neural network is trained using the first sub-region image after image defect processing to obtain a detection model; Determine whether the detection model meets the preset requirements, and use the detection model that meets the preset requirements as the target model.

5. The image detection method according to claim 1, characterized in that, The detection results obtained by using the target model to detect image defects in the second sub-region image include: The image of the second sub-region after image defect processing is input into the target model to obtain the defect value of the image of the second sub-region after image defect processing; Compare the defect value with a preset defect threshold. When the defect value is determined to be greater than or equal to the defect threshold, the second sub-region image after defect processing is determined to be a defective image; and When the defect value is determined to be less than the defect threshold, the second sub-region image after image defect processing is determined to be a defect-free image.

6. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores at least one instruction, which, when executed by a processor, implements the image detection method as described in any one of claims 1 to 5.

7. A computer device, characterized in that, The computer device includes a memory and at least one processor, the memory storing at least one instruction which, when executed by the at least one processor, implements the image detection method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Lithium battery defect detection method based on integrated deep learning

    CN112258459A