Image checking method and apparatus

By blocking and abnormal detection of target images, the problem of difficulty in capturing small abnormalities on the product surface is solved by traditional methods, and high-precision and high-efficiency abnormal detection is achieved, improving product quality.

WO2025030877A1PCT designated stage expired Publication Date: 2025-02-13CONTEMPORARY AMPEREX TECHNOLOGY CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/084398
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-08-04
Filing Date
2024-03-28
Publication Date
2025-02-13

AI Technical Summary

Technical Problem

Traditional image anomaly detection algorithms are difficult to capture small abnormalities on the product surface, resulting in detection failure and affecting product quality.

Method used

By tiling the target image, multiple target image blocks are obtained and abnormality detection is performed based on these image blocks. This method can focus on more details, improve detection accuracy, and quickly realize abnormal detection by reducing the amount of calculation.

Benefits of technology

It improves the accuracy and efficiency of abnormal detection, effectively improves product quality, and can achieve the purpose of abnormal detection more quickly.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024084398_13022025_PF_FP_ABST
    Figure CN2024084398_13022025_PF_FP_ABST
Patent Text Reader

Abstract

Provided in the embodiments of the present application are an image checking method and apparatus, capable of achieving the objective of anomaly detection with high detection precision. The method comprises: obtaining a target image; partitioning the target image to obtain a plurality of target image blocks; and on the basis of the plurality of target image blocks, performing anomaly detection on the target image.
Need to check novelty before this filing date? Find Prior Art

Description

Image detection method and device

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002] This application claims priority to Chinese patent application No. 202310977129.7, filed on August 4, 2023, entitled “Method and Apparatus for Image Detection,” the entire contents of which are incorporated by reference into this application. Technical Field

[0003] The present application relates to the field of image detection technology, and in particular to a method and device for image detection. Background Art

[0004] Industrial anomaly detection is crucial for controlling product quality. With the advancement of computer technology, images are widely used in various industries. Machine learning models can be trained to detect whether images have anomalies. In this case, image anomaly detection can be used to determine product anomalies.

[0005] However, sensors on the production line generally collect large-scale, high-resolution image data. Traditional image anomaly detection algorithms may not be able to capture smaller anomalies on the product surface, resulting in detection failure.

[0006] Summary of the Invention

[0007] The embodiments of the present application provide a method and apparatus for image detection, which can achieve the purpose of anomaly detection with high detection accuracy.

[0008] In a first aspect, a method for image detection is provided, the method comprising: acquiring a target image; dividing the target image into blocks to obtain a plurality of target image blocks; and performing anomaly detection on the target image based on the plurality of target image blocks.

[0009] In the embodiment of the present application, after acquiring a target image, the target image is segmented and, based on the multiple target image blocks obtained after segmentation, anomaly detection is performed on the target image. This allows for greater attention to detail during anomaly detection, thereby improving anomaly detection accuracy and effectively enhancing product quality. Furthermore, segmenting the target image into multiple target image blocks significantly reduces the computational effort for each target image block, enabling rapid anomaly detection and improving detection efficiency.

[0010] In some possible implementations, at least two target image blocks among the multiple target image blocks overlap.

[0011] In the above technical solution, at least two target image blocks among the multiple target image blocks overlap, so that abnormalities at the edges of the divided target image blocks can be detected, thereby further improving the detection accuracy.

[0012] In some possible implementations, performing anomaly detection on the target image based on the multiple target image blocks includes: determining an abnormal image block among the multiple target image blocks; and performing anomaly detection on the target image block based on the abnormal image block.

[0013] In the above technical solution, since abnormality detection is performed on the target image block, the abnormal image block is determined among multiple target image blocks, and the target image block is detected based on the abnormal image block, which makes abnormality detection easier and effectively improves the detection efficiency.

[0014] In some possible implementations, determining the abnormal image block among the multiple target image blocks includes: inputting each target image block among the multiple target image blocks into a first model to obtain abnormal information of each target image block, wherein the first model is trained by sample image blocks and abnormal information; and determining the abnormal image block based on the abnormal information of each target image block.

[0015] In the above technical solution, since the number of sample training is generally large, the first model obtained by training based on the sample image blocks and abnormal information generally conforms to the distribution of abnormal information, so the accuracy of determining abnormal image blocks based on the first model is high.

[0016] In some possible implementations, the abnormality information includes an abnormality score, and determining the abnormal image block based on the abnormality information of each target image block includes: determining an abnormality score threshold based on a first sample and / or a second sample, the first sample including a normal sample among image samples, and the second sample including an abnormal sample among the image samples; and determining the target image block having the abnormality score greater than or equal to the abnormality score threshold as the abnormal image block.

[0017] The above technical solution determines an anomaly score threshold based on the first sample and / or the second sample, and then determines the target image block with an anomaly score greater than or equal to the anomaly score threshold as an abnormal image block. This is not only simple to implement but also convenient to operate.

[0018] In some possible implementations, the first model is a memory-based model.

[0019] The above technical solution sets the first model as a memory-based model, so that fewer training samples are required, which not only enhances the generalization ability of the first model but also improves the training efficiency.

[0020] In some possible implementations, performing abnormality detection on the target image block based on the abnormal image blocks includes: determining the abnormality type of each abnormal image block in the abnormal image blocks; and performing abnormality detection on the target image block based on the abnormality type of each abnormal image block.

[0021] The above technical solution classifies abnormal image blocks and performs abnormality detection on target image blocks based on the abnormality type of each abnormal image block, thereby further improving the accuracy of abnormality detection on target image blocks.

[0022] In some possible implementations, determining the abnormality type of each abnormal image block in the abnormal image blocks includes: determining the abnormality type of each abnormal image block based on each abnormal image block and a second model, where the second model is trained by abnormal image block samples and abnormal type samples.

[0023] In the above technical solution, since the number of sample training is generally large, the second model obtained by training the abnormal image block samples and abnormal type samples conforms to the distribution of abnormal types as a whole. In this way, the accuracy of the abnormal type of each abnormal image block determined based on the second model is high.

[0024] In some possible implementations, the method further includes: determining whether each abnormal image block is an abnormal block.

[0025] The above technical solution, after determining the abnormal image block among multiple target image blocks, again determines whether the previously determined abnormal image block is an abnormal block, thereby improving the reliability of abnormality detection and effectively reducing the probability of misjudging a normal block as an abnormal block.

[0026] In some possible implementations, the second model is trained by the abnormal image block samples, the abnormal type samples and the normal type samples, and determining whether each abnormal image block is an abnormal block includes: inputting each abnormal image block into the second model respectively to determine whether each abnormal image block is the abnormal block.

[0027] In the above technical solution, since the number of sample training is generally large, the second model obtained by training the abnormal image block samples, abnormal type samples and normal type samples conforms to the distribution of abnormal blocks as a whole. In this way, the accuracy of determining whether each abnormal image block is an abnormal block based on the second model is relatively high.

[0028] In some possible implementations, the performing abnormality detection on the target image block based on the abnormality type of each abnormal image block includes: integrating the abnormality type of each abnormal image block to obtain a target probability of the target image, wherein the target probability includes the probability of the target image under different abnormality types.

[0029] Because different image regions may show different anomaly detection results, for example, a sample may only have anomalies in some blocks, while other areas appear normal. Therefore, the above technical solution integrates the anomaly type of each abnormal image block, making the final anomaly detection result more accurate.

[0030] In some possible implementations, the abnormality type includes a first abnormality type, the target probability includes the probability of the target image under the first abnormality type, and integrating the abnormality type of each abnormal image block to obtain the target probability of the target image includes: determining, for the first abnormality type, a first probability that the abnormality type of each abnormal image block is the first abnormality type, the number of the first probabilities being at least one; and averaging the first probabilities to obtain the probability that the abnormality type of the target image block is the first abnormality type.

[0031] The above technical solution determines the probability that the abnormal type of each abnormal image block is the abnormal type for a certain abnormal type, and then takes the average of the obtained probabilities, so as to obtain the probability that the abnormal type of the target image block is the abnormal type. It is not only simple to implement but also easy to operate.

[0032] In some possible implementations, the method further includes: using the probability that each abnormal image block is a normal image block to weight the first probability to obtain the weighted first probability; averaging the first probabilities to obtain the probability that the abnormal type of the target image block is the first abnormal type, including: averaging the weighted first probabilities to obtain the probability that the abnormal type of the target image block is the first abnormal type.

[0033] The above technical solution performs weighting based on the probability that each abnormal image block is a normal image block. In this way, the influence of the probability of normal image blocks on the abnormality detection result of the target image can be reduced, thereby further improving the accuracy of abnormality detection of the target image.

[0034] In a second aspect, an image detection device is provided, comprising: an acquisition unit for acquiring a target image; a blocking unit for blocking the target image to obtain a plurality of target image blocks; and a detection unit for performing anomaly detection on the target image based on the plurality of target image blocks.

[0035] In some possible implementations, at least two target image blocks among the multiple target image blocks overlap.

[0036] In some possible implementations, the apparatus further includes: a determination unit configured to determine an abnormal image block among the multiple target image blocks; and the detection unit is specifically configured to perform abnormality detection on the target image block based on the abnormal image block.

[0037] In some possible implementations, the determination unit is specifically used to: input each target image block among the multiple target image blocks into a first model to obtain abnormality information of each target image block, where the first model is trained by sample image blocks and abnormality information; and determine the abnormal image block based on the abnormality information of each target image block.

[0038] In some possible implementations, the anomaly information includes an anomaly score, and the determining unit is specifically configured to:

[0039] An abnormality score threshold is determined based on the first sample and / or the second sample, where the first sample includes normal samples in the image samples and the second sample includes abnormal samples in the image samples; and the target image block having the abnormality score greater than or equal to the abnormality score threshold is determined as the abnormal image block.

[0040] In some possible implementations, the first model is a memory-based model.

[0041] In some possible implementations, the determination unit is further configured to determine an abnormality type of each abnormal image block in the abnormal image blocks; and the detection unit is specifically configured to perform abnormality detection on the target image block based on the abnormality type of each abnormal image block.

[0042] In some possible implementations, the determining unit is specifically configured to determine the abnormality type of each abnormal image block according to each abnormal image block and a second model, where the second model is trained by abnormal image block samples and abnormal type samples.

[0043] In some possible implementations, the determining unit is further configured to determine whether each abnormal image block is an abnormal block.

[0044] In some possible implementations, the second model is trained by the abnormal image block samples, the abnormal type samples and the normal type samples, and the determination unit is specifically used to: input each abnormal image block into the second model respectively to determine whether each abnormal image block is the abnormal block.

[0045] In some possible implementations, the device further includes: an integration unit, configured to integrate the abnormality type of each abnormal image block to obtain a target probability of the target image, where the target probability includes probabilities of the target image under different abnormality types.

[0046] In some possible implementations, the abnormality type includes a first abnormality type, the target probability includes the probability of the target image under the first abnormality type, and the determination unit is specifically used to: determine, for the first abnormality type, a first probability that the abnormality type of each abnormal image block is the first abnormality type, and the number of the first probabilities is at least one; the device also includes an averaging unit for averaging the first probabilities to obtain the probability that the abnormality type of the target image block is the first abnormality type.

[0047] In some possible implementations, the device further includes: a weighting unit, configured to weight the first probability using the probability that each abnormal image block is a normal image block to obtain the weighted first probability; and the averaging unit is specifically configured to average the weighted first probabilities to obtain the probability that the abnormal type of the target image block is the first abnormal type.

[0048] In some possible implementations, the first model is a memory-based model.

[0049] In a third aspect, an image detection device is provided, comprising a processor and a memory, wherein the memory is used to store a computer program, and the processor is used to call the computer program to execute the method in the above-mentioned first aspect or its various implementations.

[0050] In a fourth aspect, a computer-readable storage medium is provided for storing a computer program, which enables a computer to execute the method in the above-mentioned first aspect or its various implementations. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the drawings without creative work.

[0052] In the drawings, the drawings are not drawn to scale.

[0053] FIG1 is a schematic flowchart of an image detection method according to an embodiment of the present application.

[0054] FIG2 is a schematic block diagram of an image detection apparatus according to an embodiment of the present application.

[0055] FIG3 is a schematic block diagram of an image detection apparatus according to an embodiment of the present application. DETAILED DESCRIPTION

[0056] The following detailed description of the embodiments of the present application is provided in conjunction with the accompanying drawings and examples. The following detailed description of the embodiments and the accompanying drawings are used to illustrate the principles of the present application, but are not intended to limit the scope of the present application, that is, the present application is not limited to the described embodiments.

[0057] In the description of this application, it should be noted that, unless otherwise specified, "plurality" means more than two; terms such as "upper," "lower," "left," "right," "inner," and "outer" indicating directions or positional relationships are merely for the purpose of facilitating the description of this application and simplifying the description, and do not indicate or imply that the devices or components referred to must have a specific orientation, be constructed, or operate in a specific orientation. Therefore, they should not be construed as limiting this application. Furthermore, terms such as "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.

[0058] Unless otherwise defined, all technical and scientific terms used in this application have the same meanings as commonly understood by those skilled in the art to which this application belongs. The terms used in the specification of this application are for the purpose of describing specific embodiments only and are not intended to limit this application. The terms "including" and "having" and any variations thereof in the specification and claims of this application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first" and "second" in the specification and claims of this application or the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order or a primary-secondary relationship.

[0059] References to "embodiments" in this application mean that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute an independent or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described in this application may be combined with other embodiments.

[0060] In the industrial sector, anomaly detection, particularly for product quality inspection, covers nearly all industrial manufacturing fields, such as semiconductors, automotive, and packaging and printing. Industrial anomaly detection is crucial for controlling product quality. Traditional anomaly detection relies on a large number of manual inspections, significantly increasing production costs. Furthermore, the accuracy of manual inspections depends on the technical level of the inspectors, which undoubtedly increases the uncertainty in anomaly detection.

[0061] With advances in computer technology, images are widely used across industries. Machine learning models can be trained to detect anomalies in images. In this context, image anomaly detection can be used to pinpoint product anomalies. However, sensors on production lines typically capture large-scale, high-resolution image data. Traditional image anomaly detection algorithms may not capture minor anomalies on the product surface, leading to detection failures and compromising product quality.

[0062] Based on this, an embodiment of the present application proposes an image detection method that obtains a target image, then divides the target image into multiple target image blocks, and then performs anomaly detection on the target image based on the multiple target image blocks. In this way, more details can be paid attention to during the anomaly detection process, thereby improving the accuracy of anomaly detection and effectively improving product quality. Furthermore, dividing the target image into multiple target image blocks greatly reduces the amount of computation required for each target image block, thereby quickly achieving the purpose of anomaly detection and improving detection efficiency.

[0063] The technical solutions described in the embodiments of the present application can be applied to but not limited to battery abnormality detection. It should be understood that the battery mentioned in the embodiments of the present application refers to a single physical module including one or more battery cells to provide higher voltage and capacity. Optionally, the battery can be a power battery. In terms of the type of battery, the battery can be a lithium-ion battery, a lithium metal battery, a lead-acid battery, a nickel-cathode battery, a nickel-hydrogen battery, a lithium-sulfur battery, a lithium-air battery or a sodium-ion battery, etc., which is not specifically limited in the embodiments of the present application. In terms of battery scale, the battery in the embodiments of the present application can be a battery cell / battery cell, or a battery module or a battery pack, which is not specifically limited in the embodiments of the present application.

[0064] Fig. 1 shows a schematic flow chart of an image detection method 100 according to an embodiment of the present application. As shown in Fig. 1 , the method 100 may include at least part of the following contents.

[0065] S110: Acquire a target image.

[0066] S120: Divide the target image into blocks to obtain multiple target image blocks.

[0067] S130: Perform anomaly detection on the target image based on the multiple target image blocks.

[0068] In the embodiment of the present application, after acquiring a target image, the target image is segmented and, based on the multiple target image blocks obtained after segmentation, anomaly detection is performed on the target image. This allows for greater attention to detail during anomaly detection, thereby improving anomaly detection accuracy and effectively enhancing product quality. Furthermore, segmenting the target image into multiple target image blocks significantly reduces the computational effort for each target image block, enabling rapid anomaly detection and improving detection efficiency.

[0069] Alternatively, the target image may be randomly divided into blocks. In this way, at least two of the obtained multiple target image blocks may have different sizes. Alternatively, the target image may be divided into multiple target image blocks of the same size.

[0070] In some embodiments, the target image may be divided into blocks by slicing. For example, for samples with relatively fixed sensor sampling angles and light sources, slicing may be used for block division.

[0071] In order to detect anomalies at the edge of a slice, the target image block may be divided into blocks in an overlapping slicing manner, that is, at least two target image blocks among the multiple target image blocks overlap.

[0072] In this technical solution, at least two target image blocks among the multiple target image blocks overlap, so that abnormalities at the edges of the divided target image blocks can be detected, thereby further improving the detection accuracy.

[0073] Considering that the embodiment of the present application is to perform anomaly detection, in some embodiments, S130 may specifically include: determining an abnormal image block among multiple target image blocks, and performing anomaly detection on the target image block based on the abnormal image block.

[0074] Since the target image block is subjected to abnormality detection, an abnormal image block is determined among multiple target image blocks, and the target image block is detected based on the abnormal image block, so that the abnormality detection can be performed more easily, thereby effectively improving the detection efficiency.

[0075] Specifically, each target image block among the plurality of target image blocks can be input into a first model to obtain abnormality information of each target image block, and then abnormal image blocks can be determined based on the abnormality information of each target image block. The first model is trained using sample image blocks and abnormality information.

[0076] Since the number of sample training is generally large, the first model obtained by training based on the sample image blocks and abnormal information generally conforms to the abnormal information distribution, so the accuracy of determining abnormal image blocks based on the first model is high.

[0077] Optionally, the first model may be a memory-based model, which requires fewer training samples, thereby enhancing the generalization ability of the first model and improving the efficiency of training.

[0078] In addition to the memory library, the first model may also be a reconstruction-based model or a comparison-based model.

[0079] Optionally, the anomaly information may include but is not limited to an anomaly score, an anomaly probability, etc. Exemplarily, the anomaly score may be a score ranging from several tens to one hundred.

[0080] In a case where the abnormality information includes an abnormality score, determining the abnormal image block according to the abnormality information of each target image block may include: determining an abnormality score threshold according to the first sample and / or the second sample, and then determining the target image block having an abnormality score greater than or equal to the abnormality score threshold as an abnormal image block.

[0081] This technical solution determines an anomaly score threshold based on the first sample and / or the second sample, and then determines a target image block with an anomaly score greater than or equal to the anomaly score threshold as an abnormal image block. This is not only simple to implement but also convenient to operate.

[0082] The first sample may include a normal sample in the image sample, and the second sample may include an abnormal sample in the image sample.

[0083] For example, assuming that the first sample includes 3 samples, and the scores of the 3 samples are a1, b1, and c1; the second sample also includes 3 samples, and the scores of the 3 samples are a2, b2, and c2, then the scores of the 3 samples in the first sample can be averaged to obtain d1=(a1+b1+c1) / 3, and the scores of the 3 samples in the second sample can be averaged to obtain d2=(a2+b2+c2) / 3, then the anomaly score threshold can be the average of d1 and d2.

[0084] For another example, if the anomaly score threshold is determined based on the second sample, and the scores of the samples in the second sample are f1, f2, f3, and f4, the minimum value of f1, f2, f3, and f4 can be determined as the anomaly score threshold.

[0085] After the abnormal image block is determined, abnormality detection may be performed on the target image block based on the abnormal image block.

[0086] In some embodiments, the abnormality type of each abnormal image block in the abnormal image blocks may be determined, and based on the abnormality type of each abnormal image block, abnormality detection may be performed on the target image block.

[0087] The above technical solution classifies abnormal image blocks and performs abnormality detection on target image blocks based on the abnormality type of each abnormal image block, thereby further improving the accuracy of abnormality detection on target image blocks.

[0088] For example, if the object of abnormality detection is a battery, the abnormality type may include whether the battery has scratches, whether there is dirt on the battery, whether the battery has a missing corner, whether the battery has extra parts, whether the battery has cracks, etc.

[0089] In the process of determining the abnormality type of each abnormal image block in the abnormal image blocks, as an example, the abnormality type of each abnormal image block can be determined based on each abnormal image block and a second model, wherein the second model is trained by abnormal image block samples and abnormality type samples.

[0090] That is to say, each abnormal image block may also be input into the second model, and the output of the second model is the abnormality type of the abnormal image block.

[0091] In this technical solution, since the number of sample training is generally large, the second model obtained by training the abnormal image block samples and the abnormal type samples conforms to the distribution of abnormal types as a whole. In this way, the accuracy of the abnormal type of each abnormal image block determined based on the second model is high.

[0092] Considering that misjudgments may occur when determining abnormal image blocks, i.e., a normal image block may be misjudged as an abnormal image block, or an abnormal image block may be misjudged as a normal image block, method 100 may further include determining whether each abnormal image block is an abnormal block. In other words, re-determining whether a previously determined abnormal image block is indeed an abnormal image block.

[0093] After determining the abnormal image block among multiple target image blocks, it is determined again whether the previously determined abnormal image block is an abnormal block, which improves the reliability of abnormality detection and effectively reduces the probability of misjudging a normal block as an abnormal block.

[0094] As an example, each target image block may be input into the first model again.

[0095] As another example, each target image block can be input again into another model other than the first model, where the other model is trained by sample image blocks and abnormal information different from those used to train the first model.

[0096] As another example, a normal class can be added to the second model. That is, the second model can be trained using abnormal image block samples, abnormal type samples, and normal type samples. Each abnormal image block is then input into the second model to determine whether it is truly an abnormal block.

[0097] Then for each abnormal image block, the output of the second model can be:

[0098] (α,β1,β2,…,β n )

[0099] Among them, α is the probability that the abnormal classification block is a normal block, n is the number of abnormal types, β1,β2,…,β n The probability of different abnormal types for the abnormal classification block.

[0100] In the above technical solution, since the number of sample training is generally large, the second model obtained by training the abnormal image block samples, abnormal type samples and normal type samples conforms to the distribution of abnormal blocks as a whole. In this way, the accuracy of determining whether each abnormal image block is an abnormal block based on the second model is relatively high.

[0101] After determining the anomaly type for each abnormal image block, the results for multiple target image blocks can be integrated to obtain an anomaly detection result for the target image. In other words, the anomaly type for each abnormal image block can be integrated to obtain a target probability for the target image, which includes the probability of the target image under different anomaly types.

[0102] Because different image regions may show different anomaly detection results, for example, a sample may only have anomalies in some blocks, while other areas appear normal. Therefore, the above technical solution integrates the anomaly type of each abnormal image block, making the final anomaly detection result more accurate.

[0103] In one implementation, the anomaly type may include a first anomaly type, and the target probability may include a probability of the target image being of the first anomaly type. In this case, for the first anomaly type, a first probability that the anomaly type of each abnormal image block is the first anomaly type may be determined, and then the first probabilities may be averaged to obtain a probability that the anomaly type of the target image block is the first anomaly type. The number of first probabilities is at least one.

[0104] For a certain abnormality type, the probability that the abnormality type of each abnormal image block is the abnormality type is determined, and then the obtained probabilities are averaged to obtain the probability that the abnormality type of the target image block is the abnormality type. This method is not only simple to implement but also easy to operate.

[0105] Furthermore, the output of the second model may be weighted, and then the target probability of the target image may be obtained based on the weighted abnormality type of each abnormal image block.

[0106] Considering that the probability of image blocks being classified as normal has a greater impact on the abnormality detection results of the target image, that is, the higher the probability of a normal image block, the less accurate the judgment of the abnormal image block may be, the weight of the normal image block can be reduced.

[0107] Specifically, the first probability may be weighted using the probability that each abnormal image block is a normal image block to obtain a weighted first probability. In this case, averaging the first probabilities to obtain the probability that the abnormality type of the target image block is the first abnormality type may include averaging the weighted first probabilities to obtain the probability that the abnormality type of the target image block is the first abnormality type.

[0108] Therefore, the final function can satisfy:

[0109] Among them, m is the number of abnormal image blocks, n is the number of abnormal types, j is the number of each abnormal image block, i is the number of each abnormal type, p is the number of each abnormal image block, i is the probability that the abnormal type of the target image block is the i-th abnormal type, β i is the probability that the abnormal type of the abnormal image block is the i-th abnormal type.

[0110] The above technical solution performs weighting based on the probability that each abnormal image block is a normal image block. In this way, the influence of the probability of normal image blocks on the abnormality detection result of the target image can be reduced, thereby further improving the accuracy of abnormality detection of the target image.

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

[0112] Moreover, under the premise of no conflict, the various embodiments and / or technical features in the various embodiments described in this application can be arbitrarily combined with each other, and the technical solutions obtained after the combination should also fall within the protection scope of this application.

[0113] The above describes in detail the image detection method of the embodiment of the present application, and the following describes the image detection device of the embodiment of the present application. It should be understood that the image detection device of the embodiment of the present application can execute the image detection method of the embodiment of the present application.

[0114] Figure 2 shows a schematic block diagram of an image detection apparatus 200 according to an embodiment of the present application. As shown in Figure 2, the image detection apparatus 200 may include:

[0115] The acquisition unit 210 is configured to acquire a target image.

[0116] The blocking unit 220 is configured to block the target image to obtain a plurality of target image blocks.

[0117] The detection unit 230 is configured to perform anomaly detection on the target image based on the multiple target image blocks.

[0118] Optionally, in this embodiment of the present application, at least two target image blocks among the multiple target image blocks overlap.

[0119] Optionally, in an embodiment of the present application, the image detection apparatus 200 further includes: a determination unit for determining abnormal image blocks among multiple target image blocks; and the detection unit 230 is specifically configured to perform abnormality detection on the target image blocks based on the abnormal image blocks.

[0120] Optionally, in an embodiment of the present application, the determination unit is specifically used to: input each target image block among multiple target image blocks into a first model to obtain abnormal information of each target image block, where the first model is trained by sample image blocks and abnormal information; and determine the abnormal image block based on the abnormal information of each target image block.

[0121] Optionally, in an embodiment of the present application, the abnormality information includes an abnormality score, and the determination unit is specifically used to: determine an abnormality score threshold based on the first sample and / or the second sample, the first sample includes a normal sample in the image sample, and the second sample includes an abnormal sample in the image sample; and determine a target image block whose abnormality score is greater than or equal to the abnormality score threshold as an abnormal image block.

[0122] Optionally, in an embodiment of the present application, the first model is a memory-based model.

[0123] Optionally, in an embodiment of the present application, the determination unit is further used to: determine the abnormality type of each abnormal image block in the abnormal image blocks; the detection unit 230 is specifically used to: perform abnormality detection on the target image block based on the abnormality type of each abnormal image block.

[0124] Optionally, in an embodiment of the present application, the determining unit is specifically configured to determine the abnormal type of each abnormal image block according to each abnormal image block and a second model, wherein the second model is trained by abnormal image block samples and abnormal type samples.

[0125] Optionally, in the embodiment of the present application, the determining unit is further configured to: determine whether each abnormal image block is an abnormal block.

[0126] Optionally, in an embodiment of the present application, the second model is trained by abnormal image block samples, abnormal type samples and normal type samples, and the determination unit is specifically used to: input each abnormal image block into the second model respectively to determine whether each abnormal image block is an abnormal block.

[0127] Optionally, in an embodiment of the present application, the image detection device 200 further includes: an integration unit for integrating the abnormality type of each abnormal image block to obtain a target probability of the target image, where the target probability includes the probability of the target image under different abnormality types.

[0128] Optionally, in an embodiment of the present application, the abnormality type includes a first abnormality type, the target probability includes the probability of the target image under the first abnormality type, and the determination unit is specifically used to: for the first abnormality type, determine the first probability that the abnormality type of each abnormal image block is the first abnormality type, and the number of first probabilities is at least one; the image detection device 200 also includes an averaging unit for averaging the first probabilities to obtain the probability that the abnormality type of the target image block is the first abnormality type.

[0129] Optionally, in an embodiment of the present application, the image detection device 200 further includes: a weighting unit for weighting the first probability using the probability that each abnormal image block is a normal image block to obtain a weighted first probability; and an averaging unit for averaging the weighted first probability to obtain the probability that the abnormal type of the target image block is the first abnormal type.

[0130] It should be understood that the image detection device 200 can implement the corresponding operations in the method 100, which will not be described here for the sake of brevity.

[0131] Figure 3 is a schematic diagram of the hardware structure of an image detection device 300 according to an embodiment of the present application. The image detection device 300 includes a memory 301, a processor 302, a communication interface 303, and a bus 304. The memory 301, the processor 302, and the communication interface 303 are connected to each other via the bus 304.

[0132] The memory 301 may be a read-only memory (ROM), a static storage device, or a random access memory (RAM). The memory 301 may store programs. When the programs stored in the memory 301 are executed by the processor 302, the processor 302 and the communication interface 303 are used to perform the various steps of the image detection method of the embodiment of the present application.

[0133] The processor 302 can be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), a graphics processing unit (GPU) or one or more integrated circuits to execute relevant programs to implement the functions required to be performed by the units in the device of the embodiment of the present application, or to execute the image detection method of the embodiment of the present application.

[0134] The processor 302 may also be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the image detection method of the embodiment of the present application may be completed by hardware integrated logic circuits in the processor 302 or software instructions.

[0135] The processor 302 may also be a general-purpose processor, a digital signal processor (DSP), an ASIC, a field programmable gate array (FPGA), or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component. It may implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of the present application may be directly implemented as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, or the like. The storage medium is located in the memory 301, and the processor 302 reads the information in the memory 301 and, in combination with its hardware, completes the functions required to be executed by the units included in the image detection apparatus 300 of the embodiments of the present application, or executes the image detection method of the embodiments of the present application.

[0136] The communication interface 303 uses a transceiver device such as, but not limited to, a transceiver to implement communication between the image detection apparatus 300 and other devices or a communication network.

[0137] The bus 304 may include a path for transmitting information between various components of the apparatus 300 for image detection (eg, the memory 301 , the processor 302 , and the communication interface 303 ).

[0138] It should be noted that although the above-mentioned image detection device 300 only shows a memory, a processor, and a communication interface, in the specific implementation process, those skilled in the art should understand that the image detection device 300 may also include other devices necessary for normal operation. At the same time, according to specific needs, those skilled in the art should understand that the image detection device 300 may also include hardware devices that implement other additional functions. In addition, those skilled in the art should understand that the image detection device 300 may also include only the devices necessary to implement the embodiments of the present application, and does not necessarily include all the devices shown in Figure 3.

[0139] An embodiment of the present application further provides a computer-readable storage medium for storing a computer program, which is used to execute the methods of the various embodiments of the present application described above.

[0140] The aforementioned computer-readable storage medium may be a transient computer-readable storage medium or a non-transitory computer-readable storage medium.

[0141] An embodiment of the present application also provides a computer program product, which includes a computer program stored on a computer-readable storage medium. The computer program includes program instructions. When the program instructions are executed by a computer, the computer executes the above-mentioned image detection method.

[0142] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these 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 application.

Claims

1. A method for image detection, characterized in that: The method comprises: Get the target image; Dividing the target image into blocks to obtain a plurality of target image blocks; Based on the multiple target image blocks, abnormality detection is performed on the target image.

2. The method according to claim 1, characterized in that At least two target image blocks among the multiple target image blocks overlap.

3. The method according to claim 1 or 2, characterized in that: The performing abnormality detection on the target image based on the multiple target image blocks includes: Determining abnormal image blocks among the multiple target image blocks; According to the abnormal image block, abnormality detection is performed on the target image block.

4. The method according to claim 3, characterized in that The determining of abnormal image blocks among the plurality of target image blocks comprises: Inputting each target image block of the plurality of target image blocks into a first model to obtain abnormal information of each target image block, wherein the first model is trained by the sample image blocks and the abnormal information; The abnormal image block is determined according to the abnormal information of each target image block.

5. The method according to claim 4, characterized in that The abnormal information includes an abnormality score, and determining the abnormal image block according to the abnormal information of each target image block includes: Determine an abnormality score threshold according to a first sample and / or a second sample, wherein the first sample includes a normal sample in the image sample, and the second sample includes an abnormal sample in the image sample; The target image block whose anomaly score is greater than or equal to the anomaly score threshold is determined as the abnormal image block.

6. The method according to claim 4 or 5, characterized in that: The first model is a memory-based model.

7. The method according to any one of claims 3 to 6, characterized in that The performing abnormality detection on the target image block according to the abnormal image block comprises: Determining the abnormal type of each abnormal image block in the abnormal image blocks; Based on the abnormality type of each abnormal image block, abnormality detection is performed on the target image block.

8. The method according to claim 7, characterized in that The determining the abnormality type of each abnormal image block in the abnormal image blocks comprises: The abnormal type of each abnormal image block is determined according to each abnormal image block and a second model, wherein the second model is obtained by training the abnormal image block samples and the abnormal type samples.

9. The method according to claim 8, characterized in that The method further comprises: Determine whether each abnormal image block is an abnormal block.

10. The method according to claim 9, characterized in that The second model is obtained by training the abnormal image block samples, the abnormal type samples and the normal type samples, and the determining whether each abnormal image block is an abnormal block includes: Each abnormal image block is input into the second model respectively to determine whether each abnormal image block is the abnormal block.

11. The method according to any one of claims 7 to 10, characterized in that The performing abnormality detection on the target image block based on the abnormality type of each abnormal image block includes: The abnormal type of each abnormal image block is integrated to obtain a target probability of the target image, where the target probability includes the probability of the target image under different abnormal types.

12. The method according to claim 11, characterized in that The abnormality type includes a first abnormality type, the target probability includes a probability of the target image under the first abnormality type, and integrating the abnormality type of each abnormal image block to obtain the target probability of the target image includes: For the first abnormality type, determining a first probability that the abnormality type of each abnormal image block is the first abnormality type, the number of the first probability is at least one; The first probabilities are averaged to obtain a probability that the abnormality type of the target image block is the first abnormality type.

13. The method according to claim 12, characterized in that The method further comprises: Using the probability that each abnormal image block is a normal image block, weighting the first probability to obtain the weighted first probability; The averaging the first probabilities to obtain the probability that the abnormality type of the target image block is the first abnormality type includes: The weighted first probabilities are averaged to obtain the probability that the abnormality type of the target image block is the first abnormality type.

14. An image detection device, characterized in that: include: An acquisition unit, used for acquiring a target image; A block division unit, used for dividing the target image into blocks to obtain a plurality of target image blocks; A detection unit is used to perform anomaly detection on the target image based on the multiple target image blocks.

15. The device according to claim 14, characterized in that At least two target image blocks among the multiple target image blocks overlap.

16. The device according to claim 14 or 15, characterized in that The device also includes: A determination unit, configured to determine an abnormal image block among the plurality of target image blocks; The detection unit is specifically used for: According to the abnormal image block, abnormality detection is performed on the target image block.

17. The device according to claim 16, characterized in that The determining unit is specifically used for: Inputting each target image block of the plurality of target image blocks into a first model to obtain abnormal information of each target image block, wherein the first model is trained by the sample image blocks and the abnormal information; The abnormal image block is determined according to the abnormal information of each target image block.

18. The device according to claim 17, characterized in that The abnormal information includes an abnormal score, and the determining unit is specifically used for: Determine an abnormality score threshold according to a first sample and / or a second sample, wherein the first sample includes a normal sample in the image sample, and the second sample includes an abnormal sample in the image sample; The target image block whose anomaly score is greater than or equal to the anomaly score threshold is determined as the abnormal image block.

19. The device according to claim 17 or 18, characterized in that The first model is a memory-based model.

20. The device according to any one of claims 16 to 19, characterized in that The determining unit is further configured to: Determining the abnormal type of each abnormal image block in the abnormal image blocks; The detection unit is specifically used for: Based on the abnormality type of each abnormal image block, abnormality detection is performed on the target image block.

21. The device according to claim 20, characterized in that The determining unit is specifically used for: The abnormal type of each abnormal image block is determined according to each abnormal image block and a second model, wherein the second model is obtained by training the abnormal image block samples and the abnormal type samples.

22. The device according to claim 21, characterized in that The determining unit is further configured to: Determine whether each abnormal image block is an abnormal block.

23. The device according to claim 22, characterized in that The second model is obtained by training the abnormal image block samples, the abnormal type samples and the normal type samples, and the determination unit is specifically used for: Each abnormal image block is input into the second model respectively to determine whether each abnormal image block is the abnormal block.

24. The device according to any one of claims 20 to 23, characterized in that The device also includes: The integration unit is used to integrate the abnormal type of each abnormal image block to obtain the target probability of the target image, where the target probability includes the probability of the target image under different abnormal types.

25. The device according to claim 24, characterized in that The abnormality type includes a first abnormality type, the target probability includes a probability of the target image under the first abnormality type, and the determining unit is specifically configured to: For the first abnormality type, determining a first probability that the abnormality type of each abnormal image block is the first abnormality type, the number of the first probability is at least one; The device further includes an averaging unit, configured to average the first probabilities to obtain a probability that the abnormality type of the target image block is the first abnormality type.

26. The device according to claim 25, characterized in that The device also includes: a weighting unit, configured to weight the first probability using the probability that each abnormal image block is a normal image block, to obtain the weighted first probability; The averaging unit is specifically used for: The weighted first probabilities are averaged to obtain the probability that the abnormality type of the target image block is the first abnormality type.

27. An image detection device, characterized in that: include: Memory, used to store programs; A processor, configured to execute a program stored in the memory; when the program stored in the memory is executed, the processor is configured to execute the image detection method according to any one of claims 1 to 13.

28. A computer-readable storage medium, characterized in that: Used to store a computer program, wherein the computer program causes a computer to execute the image detection method according to any one of claims 1 to 13.

Citation Information

Patent Citations

  • Abnormal behavior detection method and equipment and method and equipment for generating abnormal behavior detection equipment

    CN102831442A

  • Product defect detection method, device and system

    CN111161246A

  • Image defect detection method and related equipment

    CN113781391A

  • Image classification method and device, computer equipment and storage medium

    CN113989566A

  • A method for manufacturing metal composite slub yarn

    KR1020240142098A