Image detection method, device, readable medium, electronic device and program product

CN122798685APending Publication Date: 2026-09-22TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510338131.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-20
Publication Date
2026-09-22

AI Technical Summary

Technical Problem

传统的做法是提交与业务信息相关的图像,通过检测图像是否被伪造来确定业务信息的真实性,此过程的图像防伪检测通常为人工审核,这样往往需要耗费大量的人力成本

Benefits of technology

[0069]In the technical solution provided in this application embodiment, image information is extracted from the image to be detected, and an initial anti-counterfeiting detection is performed on the image to be detected based on its image features to obtain a first detection result. Simultaneously, a mask image corresponding to the image to be detected is obtained based on these image features. The mask image is used to indicate the counterfeited and non-counterfeited areas in the image to be detected. Finally, based on the overlap between the image information and the mask image, and the first detection result, a second detection result is obtained. Thus, obtaining the second detection result is equivalent to performing another anti-counterfeiting detection. Therefore, this technical solution can combine multiple anti-counterfeiting detections to obtain the final detection result, enabling a more accurate determination of whether the image to be detected has been counterfeited, thereby improving the accuracy of anti-counterfeiting detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122798685A_ABST
    Figure CN122798685A_ABST
Patent Text Reader

Abstract

The application discloses an image detection method and device, readable medium, electronic equipment and program product. The method comprises the following steps: extracting image information in a to-be-detected image; wherein the image information represents position data of image content in the to-be-detected image; performing primary anti-counterfeiting detection on the to-be-detected image according to image features of the to-be-detected image, to obtain a first detection result of the to-be-detected image; obtaining a mask image corresponding to the to-be-detected image according to the image features; and obtaining a second detection result of the to-be-detected image according to coincidence between the image information and the mask image and the first detection result. The technical scheme of the application combines multiple anti-counterfeiting detections to obtain a final detection result, which can more accurately determine whether the to-be-detected image is counterfeited, thereby improving the accuracy of anti-counterfeiting detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of image processing technology, specifically relating to an image detection method, apparatus, readable medium, electronic device, and program product. Background Technology

[0002] With the development of internet technology, more and more businesses need to be conducted online, making the verification of the authenticity of online business transactions a crucial issue. The traditional approach involves submitting images related to the business information and verifying their authenticity by checking for forgery. This image verification process typically involves manual review, which is often very labor-intensive. Currently, models are also used for image verification; however, in some cases, for data security reasons, image providers may preprocess the images, and model detection is susceptible to interference from this preprocessing, leading to a decrease in recognition accuracy.

[0003] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this application, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention

[0004] The purpose of this application is to provide an image detection method, apparatus, readable medium, electronic device, and program product to improve the accuracy of image anti-counterfeiting detection.

[0005] Other features and advantages of this application will become apparent from the following detailed description, or may be learned in part from practice of this application.

[0006] According to one aspect of the embodiments of this application, an image detection method is provided, comprising:

[0007] Extract image information from the image to be detected; wherein, the image information represents the location data of the image content in the image to be detected;

[0008] Based on the image features of the image to be detected, an initial anti-counterfeiting detection is performed on the image to be detected to obtain the first detection probability that the image to be detected belongs to a counterfeited image.

[0009] Obtain the mask image corresponding to the image to be detected based on the image features;

[0010] Based on the overlap between the image information and the mask image, and the first detection result, a second detection result for the image to be detected is obtained.

[0011] According to one aspect of the embodiments of this application, an authentication device is provided, comprising:

[0012] The data extraction module is used to extract image information from the image to be detected; wherein, the image information represents the location data of the image content in the image to be detected;

[0013] The initial detection module is used to perform an initial anti-counterfeiting detection on the image to be detected based on the image features of the image to be detected, and obtain a first detection result of the image to be detected; wherein, the first detection result indicates whether the image to be detected is a counterfeited image;

[0014] A mask image acquisition module is used to acquire a mask image corresponding to the image to be detected based on the image features; wherein, the mask image is used to indicate the forged and unforged areas in the image to be detected;

[0015] The detection result generation module is used to obtain a second detection result of the image to be detected based on the overlap between the image information and the mask image, and the first detection result, if it is determined from the first detection result that the image to be detected belongs to a forged image.

[0016] In one embodiment of this application, the initial detection module includes:

[0017] The feature extraction unit is used to extract image features from the image to be detected to obtain the first feature to be processed of the image to be detected.

[0018] The first probability calculation unit is used to calculate the first probability that the image to be detected belongs to a forged image based on the similarity between the first feature to be processed and the preset image features; wherein, the preset image features are features corresponding to an unforged image;

[0019] The second probability calculation unit is used to perform anti-counterfeiting classification processing on the first feature to be processed to obtain the second probability that the image to be detected belongs to the counterfeited image.

[0020] The first detection result generation unit is used to generate the first detection probability based on the first probability and the second probability, and to obtain the first detection result based on the first detection probability.

[0021] In one embodiment of this application, the feature extraction unit includes:

[0022] A multi-scale feature extraction subunit is used to perform multi-scale feature extraction on the image to be detected to obtain multiple first feature maps;

[0023] An attention feature extraction subunit is used to extract attention features from the plurality of first feature maps respectively, so as to obtain attention feature maps corresponding to the plurality of first feature maps respectively;

[0024] The first feature selection subunit is used to select at least one attention feature map as the first feature to be processed from the attention feature maps corresponding to the plurality of first feature maps respectively, according to the scale of the feature map.

[0025] In one embodiment of this application, the first feature selection subunit is specifically used for:

[0026] The attention feature map corresponding to the first feature map with a scale smaller than the threshold in the plurality of first feature maps is taken as the first feature to be processed.

[0027] In one embodiment of this application, the mask image acquisition module is specifically used for:

[0028] The attention feature map corresponding to the first feature map with a scale greater than a threshold in the plurality of first feature maps is taken as the second feature to be processed;

[0029] The second feature to be processed is subjected to image segmentation processing to obtain the mask image.

[0030] In one embodiment of this application, the first feature to be processed includes multiple attention feature maps; the mask image acquisition module is specifically used for:

[0031] The multiple attention feature maps included in the second feature to be processed are fused to obtain a fused feature map, which includes multiple channel feature maps;

[0032] The fused feature map is normalized to obtain a mask feature map that includes multi-channel feature maps, and one channel feature map in the mask feature map is used as the mask image.

[0033] In one embodiment of this application, the mask image acquisition module is specifically used for:

[0034] The multiple attention feature maps included in the second feature to be processed are sampled to obtain sampled feature maps corresponding to the multiple attention feature maps respectively; wherein the sampled feature maps corresponding to the multiple attention feature maps have the same scale;

[0035] The sampled feature maps corresponding to the multiple attention feature maps are concatenated to obtain a concatenated feature map;

[0036] The concatenated feature map is subjected to convolution processing to obtain the fused feature map; wherein the number of channels in the fused feature map is less than the number of channels in the concatenated feature map.

[0037] In one embodiment of this application, the attention feature extraction subunit is specifically used for:

[0038] Each of the plurality of first feature maps is pooled to obtain a pooled feature map corresponding to each first feature map.

[0039] Perform multilayer perceptron and activation processing on the pooled feature maps corresponding to each first feature map to obtain the attention vector corresponding to each first feature map;

[0040] The attention vectors corresponding to each of the first feature maps are fused with the corresponding first feature maps to obtain the attention feature maps corresponding to each of the first feature maps.

[0041] In one embodiment of this application, the multi-scale feature extraction subunit is specifically used for:

[0042] Multiple serial feature extractions are performed on the image to be detected to obtain multiple second feature maps; wherein, the multiple serial feature extractions mean that the second feature map output by the previous feature extraction is the input data for the next feature extraction, and the input data for the first feature extraction is the image to be detected; the scale of the multiple second feature maps decreases sequentially;

[0043] Multi-dimensional convolution and concatenation are performed on the smallest-scale second feature map among the plurality of second feature maps to obtain the smallest-scale first feature map;

[0044] For each of the multiple second feature maps except for the second feature map with the smallest scale, feature fusion is performed sequentially according to the feature map scale from smallest to largest to obtain the first feature map corresponding to each of the remaining second feature maps; wherein, the input data of the i-th feature fusion includes the i-th second feature map and the first feature map output by the (i-1)-th feature fusion, and the input data of the 1-th feature fusion includes the first feature map with the smallest scale and the first second feature map of each of the remaining second feature maps, 1 < i < the number of feature fusions;

[0045] The plurality of first feature maps are obtained based on the first feature map of the minimum scale and the first feature maps corresponding to the remaining second feature maps.

[0046] In one embodiment of this application, the multi-scale feature extraction subunit is specifically used for:

[0047] Multiple convolutional processes are performed on the smallest-scale second feature map among the multiple second feature maps to obtain multiple convolutional features, wherein the scales of the convolutional kernels corresponding to the multiple convolutional processes are different from each other;

[0048] The multiple convolutional features are concatenated to obtain concatenated convolutional features;

[0049] The concatenated convolutional features are subjected to dimension-restoring convolution processing to obtain the minimum-scale first feature map; wherein, the dimension-restoring convolution processing refers to adjusting the scale of the minimum first feature map to be consistent with the scale of the second feature map.

[0050] In one embodiment of this application, the initial detection module is specifically used for:

[0051] Extract the detection region image containing the image content from the image to be detected based on the image information;

[0052] An initial anti-counterfeiting detection is performed on the image of the detection area to obtain the first detection result of the image to be detected.

[0053] In one embodiment of this application, the detection result generation module is specifically used for:

[0054] If the image to be detected is determined to be a forged image based on the first detection result, the area of ​​the overlapping region between the image information and the mask image is calculated, and the ratio of the area of ​​the overlapping region to the area of ​​the mask image is used as the second detection probability.

[0055] Based on the relationship between the second detection probability and the second preset threshold, the anti-counterfeiting type corresponding to the image to be detected is determined; wherein, the anti-counterfeiting type of the image to be detected includes the image to be detected being a counterfeited image and the image to be detected being an uncounterfeited image;

[0056] A second detection result is generated for the image to be detected based on the anti-counterfeiting type and the second detection probability.

[0057] In one embodiment of this application, the apparatus further includes:

[0058] The content detection module is used to detect the matching degree between the position data of each image content in the image information and the position data of the corresponding image content in the reference image; if the position data of the image content in the image information does not match the position data of the image content in the reference image, the position data of the image content in the image information is adjusted according to the position data of the image content in the reference image so that the position data of each image content in the image information matches the position data of the corresponding image content in the reference image.

[0059] In one embodiment of this application, the image information further includes the size data of the object to be detected in the image to be detected; the content detection module is specifically used for:

[0060] Calculate a first ratio between the position data of the image content in the image information and the size data of the detected object, and a second ratio between the position data of the image content in the reference image and the size data of the detected object in the reference image;

[0061] If the first ratio is consistent with the second ratio, then it is determined that the position data of the image content in the image information matches the position data of the corresponding image content in the reference image;

[0062] If the first ratio is inconsistent with the second ratio, it is determined that the position data of the image content in the image information does not match the position data of the corresponding image content in the reference image.

[0063] In one embodiment of this application, the detection result generation module is specifically used for:

[0064] If the second detection probability is greater than the second preset threshold, then the anti-counterfeiting type of the image to be detected is determined to be that the image to be detected belongs to a counterfeited image;

[0065] If the second detection probability is less than the second preset threshold, then the anti-counterfeiting type of the image to be detected is determined to be that the image to be detected belongs to an uncounterfeited image.

[0066] According to one aspect of the embodiments of this application, a computer-readable medium is provided having a computer program stored thereon, which, when executed by a processor, implements the image detection method as described above.

[0067] According to one aspect of the embodiments of this application, an electronic device is provided, the electronic device comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor executes the executable instructions to cause the electronic device to perform the image detection method as described in the above technical solutions.

[0068] According to one aspect of the embodiments of this application, a computer program product or computer program is provided, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the image detection method as described above.

[0069] In the technical solution provided in this application embodiment, image information is extracted from the image to be detected, and an initial anti-counterfeiting detection is performed on the image to be detected based on its image features to obtain a first detection result. Simultaneously, a mask image corresponding to the image to be detected is obtained based on these image features. The mask image is used to indicate the counterfeited and non-counterfeited areas in the image to be detected. Finally, based on the overlap between the image information and the mask image, and the first detection result, a second detection result is obtained. Thus, obtaining the second detection result is equivalent to performing another anti-counterfeiting detection. Therefore, this technical solution can combine multiple anti-counterfeiting detections to obtain the final detection result, enabling a more accurate determination of whether the image to be detected has been counterfeited, thereby improving the accuracy of anti-counterfeiting detection.

[0070] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description

[0071] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. It is obvious that the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.

[0072] Figure 1A A schematic diagram illustrating one application scenario of the technical solution of this application is shown.

[0073] Figure 1B A schematic diagram illustrating one application scenario of the technical solution of this application is shown.

[0074] Figure 2 A flowchart illustrating an embodiment of the image detection method provided in this application is shown schematically.

[0075] Figure 3 A flowchart illustrating an embodiment of OCR recognition provided in this application is shown schematically.

[0076] Figure 4 A schematic diagram of an image to be detected provided in one embodiment of this application is shown.

[0077] Figure 5 A flowchart illustrating an embodiment of the image detection method provided in this application is shown schematically.

[0078] Figure 6 A schematic diagram of an image detection method provided in one embodiment of this application is shown.

[0079] Figure 7 A flowchart illustrating an embodiment of the image detection method provided in this application is shown schematically.

[0080] Figure 8 A flowchart illustrating a post-processing procedure provided in one embodiment of this application is shown schematically.

[0081] Figure 9 A schematic block diagram of an image detection apparatus provided in one embodiment of this application is shown.

[0082] Figure 10 A flowchart illustrating an embodiment of the image detection method provided in this application is shown schematically.

[0083] Figure 11 A schematic block diagram of the authentication device provided in the embodiments of this application is shown.

[0084] Figure 12 A schematic diagram of a computer system architecture suitable for implementing the embodiments of this application is shown. Detailed Implementation

[0085] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided to make this application more comprehensive and complete, and to fully convey the concept of the exemplary embodiments to those skilled in the art.

[0086] Furthermore, the described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. Numerous specific details are provided in the following description to give a thorough understanding of embodiments of this application. However, those skilled in the art will recognize that the technical solutions of this application can be practiced without one or more of the specific details, or other methods, components, apparatuses, steps, etc., can be employed. In other instances, well-known methods, apparatuses, implementations, or operations are not shown or described in detail to avoid obscuring various aspects of this application.

[0087] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.

[0088] The flowcharts shown in the accompanying drawings are merely illustrative and do not necessarily include all content and operations / steps, nor do they necessarily have to be performed in the described order. For example, some operations / steps can be broken down, while others can be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.

[0089] It is understood that in the specific implementation of this application, data related to user information (such as the image to be detected) is involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0090] Currently, image anti-counterfeiting detection is required in many scenarios, such as the anti-counterfeiting detection of personal ID photos and shop business licenses. In some cases, to prevent information leakage, image providers often process the images, such as adding watermarks or special descriptions like "image for a specific purpose only." This information can interfere with ordinary detection models, leading to low accuracy. For example, a standard model might identify a watermarked ID photo as a forged image, causing the image detection to fail, which can impact the user's subsequent business processes.

[0091] Based on the above problems, this application proposes an image detection method to improve the accuracy of image anti-counterfeiting detection. The implementation process of the technical solution of this application will be described below with reference to specific embodiments.

[0092] Figure 1A A schematic diagram illustrating one application scenario of the technical solution of this application is shown.

[0093] like Figure 1A As shown, in this application scenario, the user submits an image to be detected to the terminal device 110. The terminal device 110 performs image detection on the image to be detected according to the technical solution of this application and outputs the corresponding detection result. The detection result indicates whether the image to be detected is a forged image. The user can obtain the detection result through the display interface of the terminal device 110. The terminal device 110 may include smartphones, tablets, laptops, smart voice interaction devices, smart home appliances, in-vehicle terminals, etc.

[0094] In one embodiment of this application, after acquiring the image to be detected, the terminal device 110 can send the image to be detected to the server 120 via a network. The server 120 then performs image detection on the image according to the technical solution of this application and feeds back the corresponding detection results to the terminal device 110. The server 120 can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. The network between the terminal device 110 and the server 120 can be a communication medium of various connection types capable of providing a communication link between the terminal device 110 and the server 120, such as a wired communication link or a wireless communication link.

[0095] Figure 1B A schematic diagram illustrating one application scenario of the technical solution of this application is shown.

[0096] like Figure 1B As shown, in this application scenario, the user can use the terminal device 110 to take a picture of the target object to obtain the image to be detected. Then, the terminal device 110 performs image detection on the image to be detected according to the technical solution of this application to obtain the detection result, or the terminal device 110 sends the image to be detected to the server 120 so that the server 120 performs image detection on the image to be detected according to the technical solution of this application and feeds back the detection result to the terminal device 110.

[0097] Figure 2 A flowchart illustrating an embodiment of the image detection method provided in this application is shown schematically. This embodiment can be implemented by a terminal device, a server, or both a terminal device and a server. For ease of description, the implementation process of the technical solution of this application will be described below using a terminal device as the execution subject. Figure 2 As shown, the image detection method provided in this application embodiment includes steps 210 to 240, as detailed below:

[0098] Step 210: Extract image information from the image to be detected; wherein, image information represents the location data of the image content in the image to be detected.

[0099] Specifically, the image to be detected is an image containing a target object, which is the target of image detection. For example, the image to be detected might be a document image (such as an ID card image or business license image), where the document itself is the target object to be detected. The content contained in the image to be detected is called image content, which is usually associated with the target object. Examples include image content within the target object's area, image content partially within but partially outside the target object's area (such as watermark data in the image to be detected), and image content within a preset distance from the target object (such as text data added near the target object). Image content can be textual content in the image to be detected, such as names and addresses in ID photos, or graphic content, such as facial images or shop icons in ID photos. The location data of this image content is identified and used as image information in the image to be detected. Here, image information can be extracted using methods such as OCR (Optical Character Recognition) and trained models.

[0100] In one embodiment of this application, taking OCR recognition as an example, the extracted image information includes the specific content and location data of each image item in the image to be detected. An image item can be a specific field, an image region, or the entire image region containing the target object. For example, taking an ID card photo, the location data of the image content includes the location data of fields such as name and address, the location data of the portrait area, and the location data of the ID card as a whole within the ID card photo. The image content and its location data can be marked using a target detection box, which is typically a rectangle. Therefore, the location data of the image content can be represented by the coordinates of the four vertices of the target detection box. For example, as shown... Figure 3 As shown, when performing OCR recognition on the image to be detected, each field is treated as an image content item. For example, the name field contains the content "Name: xxx". The corresponding position data is the coordinates of the four vertices of the rectangle that selects the name field, which can be represented as (x1, y1, x2, y2, x3, y3, x4, y4). Here, (x1, y1) represents the coordinates of one vertex, and the other coordinates are deduced in the same way.

[0101] Step 220: Perform an initial anti-counterfeiting detection on the image to be detected based on its image features to obtain the first detection result of the image to be detected; wherein, the first detection result indicates whether the image to be detected is a counterfeited image.

[0102] Specifically, the initial anti-counterfeiting detection is based on the image features of the image to be detected, where image features refer to features extracted from the image to be detected through feature extraction. In this step, the initial anti-counterfeiting detection refers to using a pre-trained detection model to detect whether the image to be detected is a forged image. The detection model can directly output a first detection result, such as "Is the image to be detected a forged image?"; alternatively, the detection model can output the probability that the image to be detected is a forged image, denoted as the first detection probability. This first detection probability can be compared with a first preset threshold to determine whether the image to be detected is a forged image. For example, if the first detection probability is greater than the first preset threshold, the image to be detected is determined to be a forged image; if the first detection probability is less than the first preset threshold, the image to be detected is determined not to be a forged image. The case where the first detection probability equals the first preset threshold can be categorized into cases where the first detection probability is greater than the first preset threshold or cases where the first detection probability is less than the first preset threshold, depending on the actual needs.

[0103] In this embodiment, a forged image refers to the act of creating or modifying the content of an image without authorization through fraudulent means to make it appear real or legal, in order to achieve a deceptive purpose. Similar acts to "forgery" include alteration, fabrication, defacement, and embellishment; any act that illegally damages the authenticity or integrity of image content constitutes forgery. A forged image is an image obtained based on the aforementioned acts of forgery. Taking an ID card photo as an example, if any information in an ID card photo, such as the name field, gender field, address field, or facial image area, is modified, then that ID card photo is a forged image (or tampered with). For example, if an ID card photo with the original name field "Zhang**" is modified to create an ID card photo with the name field "Li**", then the ID card photo with the name field "Li**" is a forged image. Optionally, the modification of image content involved in the forged image may also include the modification of additional information of the object to be detected in the image. This additional information includes watermarks, text descriptions, etc. For example, if an accurate ID photo has a watermark "111" added to it, and "111" is changed to "222", then the ID photo containing the watermark "222" is a forged image. As another example, if an accurate ID photo has a text description "This photo is only for use in occasion A", and "Occasion A" is changed to "Occasion B", then the ID photo containing the text description "This photo is only for use in occasion B" is a forged image. It can be understood that the above examples illustrate the specific content of the text in an image being tampered with. In reality, tampering also includes illegal modifications to the expression of text or graphics (such as thickening, thinning, or curving lines), implied meanings, etc.

[0104] In one embodiment of this application, considering that the image to be detected may cover a large area, containing other content besides the target object (e.g., taking a picture of an ID card placed on a table, where the image includes part of the table background in addition to the ID card), to reduce the computational load and improve processing speed in subsequent processing, when performing anti-counterfeiting detection on the image to be detected, the detection region image containing the image content can be extracted first based on the image information; then, anti-counterfeiting detection is performed on the detection region image to obtain the first detection probability that the image to be detected belongs to a counterfeited image. That is, based on the image information in the image to be detected, the image to be detected is cropped to remove the edge regions that do not contain image content (also known as edge trimming) to obtain the detection region image, and then anti-counterfeiting detection is performed on the detection region image. For example, as shown... Figure 4 As shown, the image to be detected on the left is processed by edge trimming to obtain the detection area image on the right.

[0105] Step 230: Obtain the mask image corresponding to the image to be detected based on the image features; wherein, the mask image is used to indicate the forged and non-forged areas in the image to be detected.

[0106] Specifically, a mask image is a binary image generated based on the identification of forged information in the image to be detected. The forged region (i.e., the tampered region) in the image to be detected is set as the first pixel value, and other regions (i.e., the unforged or untampered regions) are set as the second pixel value, thus forming the mask image. The mask image is also obtained based on image features. Optionally, a pre-trained model can be used to process the image to be detected to obtain the mask image. For example, an image segmentation model can be used to process image features to obtain the mask image corresponding to the image to be detected.

[0107] Step 240: Based on the overlap between the image information and the mask image, and the first detection result, obtain the second detection result of the image to be detected.

[0108] Specifically, based on the first detection result, it can be preliminarily determined whether the image to be detected is a forged image. If it is preliminarily determined that the image to be detected is not forged, the first detection result is directly used as the final output second detection result. Optionally, the mask image can also be output as the second detection result. If it is preliminarily determined that the image to be detected is a forged image, in order to improve the accuracy of anti-counterfeiting detection, a second anti-counterfeiting detection is performed based on the overlap between the image information and the mask image to determine whether the image to be detected is a genuine forged image. As defined above, the image information represents the positional data of the image content in the image to be detected. The mask image separates the forged and unforged areas in the image to be detected. By matching the two, it can be determined how many forged areas are contained in the image information, and thus determine whether the image to be detected is a genuine forged image. Therefore, the lower the overlap between the image information and the mask image, the fewer forged areas are contained in the image content of the image to be detected. The lower the probability that the image to be detected is forged, the less likely it is to be considered that the image to be detected is not forged, or that it is not an image that has been maliciously tampered with. For example, an image with a watermark is not considered a forged image, or in other words, an image with a watermark is considered a non-maliciously altered image. If there is a high degree of overlap between the image information and the mask image, it indicates that the image to be detected is indeed a genuine forged image, and thus the image to be detected is identified as a forged image (i.e., a altered image).

[0109] In the technical solution provided in this application embodiment, image information is extracted from the image to be detected, and an initial anti-counterfeiting detection is performed on the image to be detected based on its image features to obtain a first detection result. Simultaneously, a mask image corresponding to the image to be detected is obtained based on these image features. The mask image is used to indicate the counterfeited and non-counterfeited areas in the image to be detected. Based on the overlap between the image information and the mask image, and the first detection result, a second detection result is obtained. Thus, obtaining the second detection result is equivalent to performing another anti-counterfeiting detection. Therefore, this technical solution can combine multiple anti-counterfeiting detections to obtain the final detection result, enabling a more accurate determination of whether the image to be detected has been counterfeited, thereby improving the accuracy of anti-counterfeiting detection.

[0110] Figure 5 A flowchart illustrating an embodiment of the image detection method provided in this application is shown schematically. This embodiment is a further refinement of the above embodiment. Figure 5 As shown, the image detection method provided in this application includes the following steps:

[0111] Step 510: Extract image information from the image to be detected; wherein, image information represents the location data of image content in the image to be detected.

[0112] Step 510 can refer to the relevant description in step 210 above, and will not be repeated here.

[0113] Step 520: Extract image features from the image to be detected to obtain the first feature to be processed in the image to be detected.

[0114] Specifically, image feature extraction aims to extract features that represent the content contained in an image, in order to determine whether the image is a forged image based on these features. In this embodiment, the features extracted from the image to be detected are denoted as the first feature to be processed, and image feature extraction can be performed through methods such as modeling, sampling, and convolution.

[0115] In one embodiment of this application, the image feature extraction process includes: performing multi-scale feature extraction on the image to be detected to obtain multiple first feature maps; performing attention feature extraction on the multiple first feature maps respectively to obtain attention feature maps corresponding to the multiple first feature maps respectively; and selecting at least one attention feature map as a first feature to be processed from the attention feature maps corresponding to the multiple first feature maps according to the scale of the feature maps.

[0116] Specifically, multi-scale feature extraction refers to obtaining first feature maps at multiple different scales through feature extraction. The feature map scale refers to the spatial size or resolution of the features output by the feature extraction operation, typically including parameters such as height (H), width (W), and number of channels (C). In some cases, it may also include batch (B) data. In this embodiment, multi-scale feature extraction is achieved through convolution operations with various convolution parameters, including kernel size (also called kernel scale) and stride. In this embodiment, multi-scale feature extraction can be achieved by performing convolution operations on the image to be detected using different convolution parameters to obtain multiple first feature maps; or by performing sequential convolution operations with different convolution parameters to obtain multiple first feature maps. For example, first, convolution kernel 1 is used to convolve the image to be detected to obtain the first first feature map, then convolution kernel 2 is used to convolve the first first feature map to obtain the second first feature map, and so on. After several convolution operations, multiple first feature maps can be obtained.

[0117] In one embodiment of this application, the multi-scale feature extraction process may include a bottom-up feature extraction process and a top-down feature fusion process. Specifically, the bottom-up feature extraction process refers to performing multiple serial feature extractions on the image to be detected to obtain multiple second feature maps; wherein, multiple serial feature extractions mean that the second feature map output by the previous feature extraction is the input data for the next feature extraction, and the input data for the first feature extraction is the image to be detected, and the scale of the multiple second feature maps decreases sequentially. This serial feature extraction process is the same as the aforementioned example of performing serial convolution operations with different convolution parameters, and will not be repeated here. However, in this process, the scale of the obtained second feature maps decreases sequentially, so each feature extraction can also be regarded as a downsampling operation on the input data.

[0118] After a bottom-up feature extraction process, multiple scales of second feature maps are obtained. Then, a top-down feature fusion process is performed on these second feature maps. The aforementioned bottom-up feature extraction operation arranges the multiple second feature maps in descending order of scale, with larger scale second feature maps at the bottom and smaller scale second feature maps at the top. Therefore, the top-down feature fusion process starts with the smallest scale second feature map and proceeds sequentially towards the larger scale second feature maps. During this process, the smallest scale second feature map is processed by multi-dimensional convolution and concatenation to obtain the corresponding first feature map. The multi-dimensional convolution and concatenation processing can be implemented using a PPM Head (Pyramid Pooling Module Head). The second feature map at other scales fuses itself with the first feature map output by the previous feature fusion to obtain the first feature map corresponding to the second feature map at that scale. That is, the input data of the i-th feature fusion includes the i-th second feature map and the first feature map output by the (i-1)-th feature fusion, and the input data of the first feature fusion includes the first feature map at the smallest scale and the first second feature map in each of the other second feature maps, where 1 < i < the number of feature fusions.

[0119] For example, suppose the bottom-up feature extraction process includes four feature extraction operations, and the resulting second feature maps are arranged from largest to smallest as P1, P2, P3, and P4. In the top-down feature fusion process, firstly, the second feature map P4 is subjected to multi-dimensional convolution and concatenation to obtain the smallest-scale first feature map F4, which is the first feature map corresponding to the second feature map P4. Then, the second feature map P3 is fused with the first feature map F4 to obtain the first feature map F3 corresponding to the second feature map P3. Next, the second feature map P2 is fused with the first feature map F3 to obtain the first feature map F2 corresponding to the second feature map P2. Finally, the second feature map P1 is fused with the first feature map F2 to obtain the first feature map F1 corresponding to the second feature map P1. Thus, four first feature maps F4, F3, F2, and F1 are obtained in ascending order.

[0120] In one embodiment of this application, it can be seen from the serial feature extraction process that the deeper the feature extraction layer (or the more times the feature extraction is performed), the smaller the scale of the corresponding first feature map. Therefore, the smallest scale second feature map is actually the deepest level feature in the serial feature extraction process. In the process of multi-dimensional convolution and concatenation of the smallest scale second feature map, multiple convolution processes are first performed on the smallest scale second feature map to obtain multiple convolutional features. The scales of the convolution kernels corresponding to these multiple convolution processes are different. For example, using convolution kernels of 3*3, 5*5, and 7*7 sizes to convolve the smallest scale second feature map P4 yields three convolutional features. Then, these multiple convolutional features are concatenated to obtain concatenated convolutional features. The concatenation is performed along the channel dimension, and the number of channels in the concatenated convolutional features is the sum of the number of channels in the multiple convolutional features. For example, if the number of channels corresponding to the aforementioned three convolutional features are C1, C2, and C3, the number of channels after concatenation is C1 + C2 + C3. Finally, the concatenated convolutional features are subjected to dimension-restoring convolution processing to obtain the minimum-scale first feature map. Here, dimension-restoring convolution processing means adjusting the scale of the minimum first feature map to be consistent with the scale of the second feature map. This can be achieved by performing dimension-restoring convolution processing on the concatenated convolutional features through a convolution operation, so that the scale of the concatenated convolutional features is restored to the scale of the second feature map, thus obtaining a first feature map with the same scale as the second feature map.

[0121] After obtaining multiple first feature maps, attention feature extraction is performed on each first feature map to obtain the attention feature map corresponding to that first feature map. In this embodiment, performing attention feature extraction on a first feature map means performing attention feature extraction on the data of each channel in the first feature map. This process can calculate the importance score of each channel in the first feature map and weight the channels according to these scores to obtain the attention feature map.

[0122] In one embodiment of this application, the attention feature extraction process specifically includes: firstly, pooling is performed on each of the multiple first feature maps to obtain pooled feature maps corresponding to each first feature map; here, the pooling process can be max pooling, average pooling, etc.; taking max pooling as an example, assuming the scale of the first feature map is H*W*C, where H represents the height of the first feature map, W represents the width of the first feature map, and C represents the number of channels of the first feature map, after max pooling, the scale of the pooled feature map obtained is 1*1*C. Then, multilayer perceptron and activation processing are performed on the pooled feature maps corresponding to each first feature map to obtain the attention vector corresponding to each first feature map; the multilayer perceptron (MLP) is a type of feedforward neural network, and the activation processing can be implemented by activation functions, such as ReLU, Softmax, etc. After multilayer perceptron and activation processing, the sum of all channels in the obtained attention vector is 1, where the attention vector is also equivalent to a feature map. Finally, the attention vectors corresponding to each first feature map are fused with the corresponding first feature map to obtain the attention feature map corresponding to each first feature map; here, the attention vectors corresponding to the first feature map can be multiplied with the first feature map to obtain the attention feature map corresponding to that first feature map.

[0123] After obtaining attention feature maps at various scales (the scale of each attention feature map is the same as the scale of its corresponding first feature map), at least one attention feature map is selected as the first feature to be processed. For example, the attention feature map corresponding to the first feature map with a scale smaller than a threshold can be selected as the first feature to be processed; or, for example, the attention feature map with the smallest scale can be selected as the first feature to be processed. In this embodiment, the size of the first feature map reflects the number of feature extractions or feature extraction levels that the first feature map undergoes during the multi-scale feature extraction process. Based on the bottom-up feature extraction operation, the deeper the feature extraction level (i.e., the more feature extractions), the smaller the scale of the resulting feature map. Thus, a small-scale feature map can also be called a deep feature map, which is farther away from the image to be detected; a large-scale feature map can also be called a shallow feature map, which is closer to the image to be detected.

[0124] Step 530: Calculate the first probability that the image to be detected belongs to the forged image based on the similarity between the first feature to be processed and the preset image features; wherein, the preset image features are the features corresponding to the unforged image.

[0125] Specifically, the features corresponding to the unspoofed image can be pre-stored as preset image features in the cache of the terminal device. During detection, the corresponding preset image features are retrieved from the cache. The similarity between the first feature to be processed and the preset image features can be represented by methods such as Euclidean distance or cosine similarity.

[0126] In one embodiment of this application, the cache of the terminal device can store preset image features of various types. Here, the type refers to the type of target object corresponding to the image feature, such as preset image features corresponding to ID card images, preset image features corresponding to business license images, etc. When obtaining preset image features, the corresponding preset image features can be obtained based on the type of target object in the image to be detected.

[0127] In one embodiment of this application, if the first feature to be processed includes multiple attention feature maps, the similarity between each attention feature map and a preset image feature is calculated respectively, and finally the similarity between these attention feature maps and the preset image feature is fused to calculate the first probability.

[0128] In one embodiment of this application, the attention feature map corresponding to the deepest feature, i.e., the first feature map with the smallest scale, is used as the first feature to be processed. Then, the calculation of the first probability may specifically include the following process:

[0129] First, feature extraction is performed on the attention feature map to obtain the anti-counterfeiting feature. Here, the attention feature map can be processed by continuous downsampling and convolutional layers to obtain the anti-counterfeiting feature, which is actually also a feature map. To facilitate calculation, the height and width dimensions of the anti-counterfeiting feature can be reduced as much as possible. For example, through processing, the final anti-counterfeiting feature with a scale of 1*1*C is obtained.

[0130] Then, based on the similarity between the anti-counterfeiting features and the preset image features, the first probability that the image to be detected belongs to the counterfeited image is calculated; where the preset image features are the features corresponding to the uncounterfeited image. In this embodiment, real uncounterfeited sample images can be obtained in advance, and the features of the sample images can be extracted and stored in a database or cache (hereinafter, the database will be used as an example). It can be understood that the database can store preset image features corresponding to various types of sample images. Here, the type refers to the type of target object in the image, such as ID card, business license, degree certificate, etc. Optionally, the preset image features can also be obtained during the model training process and then stored in the memory cache. Using a randomly initialized vector as the preset image features, during the model training process, contrastive learning is used to make the randomly initialized vector continuously approach the classification features of positive samples (i.e., uncounterfeited sample images) while distancing it from the separation features of negative samples (i.e., counterfeited sample images). After training, the resulting vector can be used as a general representation of the positive sample classification features, that is, it can be used as the preset image features.

[0131] When calculating similarity, corresponding preset image features can be retrieved from the database based on the target object type in the image to be detected. These features are then compared with anti-counterfeiting features to calculate the similarity between them. Cosine similarity, Euclidean distance, etc., can be used to represent the similarity. The higher the similarity between two features, the more likely the image to be detected is a genuine, unforged image. Therefore, the similarity can be normalized to between 0 and 1. Then, subtracting the similarity between the two features from 1 yields the first probability that the image to be detected is a forged image.

[0132] Step 540: Perform anti-counterfeiting classification processing on the first feature to be processed to obtain the second probability that the image to be detected belongs to the counterfeited image.

[0133] Specifically, the calculation of the first probability and the second probability can be performed simultaneously. Both the first probability and the second probability represent the probability that the detected image belongs to a forged image. In this embodiment, the anti-counterfeiting classification process can be a binary classification process, that is, classifying the image to be detected into two categories: forged images and non-forged images. The anti-counterfeiting classification process can be performed by the network module in the trained detection model.

[0134] In one embodiment of this application, anti-counterfeiting classification processing can be implemented using a trained binary classification head. Anti-counterfeiting classification processing typically performs binary classification based on the probability that the image to be detected belongs to a counterfeited image; this probability is denoted as the second probability. For example, the anti-counterfeiting features are input into the classification head to obtain two-dimensional output data. This two-dimensional output data is then normalized (e.g., using softmax). In this two-dimensional output data, one dimension represents the probability that the image to be detected belongs to a counterfeited image, and the other dimension represents the probability that the image to be detected belongs to an authentic image. Here, the probability representing the image to be detected as a counterfeited image is denoted as the second probability.

[0135] In one embodiment of this application, after obtaining the first feature to be processed, image classification processing can be performed based on the first feature to obtain the image type corresponding to the image to be detected. Here, image classification processing refers to the type of the target object in the image, such as the front and back of a document, or types like ID card and business license. This classification processing can be implemented using a dedicated classification head.

[0136] In one embodiment of this application, the above-mentioned image classification processing can be added to the training process of the detection model and removed during the application process of the detection model. This allows the training process of the detection model to learn the type of the target object, which is beneficial to improving the accuracy of probability calculation. At the same time, the application process of the detection model does not need to output too much data, which can improve the model processing speed.

[0137] Step 550: Generate a first detection probability based on the first probability and the second probability, and obtain a first detection result based on the first detection probability.

[0138] Specifically, the first detection probability can be selected from either a first probability or a second probability. For example, the maximum or minimum value can be chosen as the first detection probability. Alternatively, the first and second probabilities can be weighted to obtain the first detection probability, with their respective weights preset, such as both set to 0.5. The first detection probability represents the probability that the image to be detected is a forged image. Comparing it with a first preset threshold yields the first detection result. For example, if the first detection probability is greater than the first preset threshold, the image to be detected is determined to be a forged image; if the first detection probability is less than the first preset threshold, the image to be detected is determined not to be a forged image.

[0139] Step 560: Obtain the mask image corresponding to the image to be detected based on the image features; wherein, the mask image is used to indicate the forged and non-forged areas in the image to be detected.

[0140] Specifically, when extracting image features from the image to be detected, in addition to obtaining the first feature to be processed of the image to be detected, a second feature to be processed of the image to be detected can also be obtained. This second feature to be processed can be used for image segmentation processing to obtain the mask image corresponding to the image to be detected.

[0141] In one embodiment of this application, based on the foregoing example, after obtaining multiple attention feature maps, the attention feature map corresponding to the first feature map with a scale greater than a threshold can be selected as the second feature to be processed.

[0142] In one embodiment of this application, after obtaining the attention feature map, the multiple attention feature maps are divided into two parts based on the feature map scale: a first feature to be processed and a second feature to be processed. The first feature to be processed is used to calculate a first detection probability, and the second feature to be processed is used to perform image segmentation processing to obtain a mask image.

[0143] After attention feature extraction, the scale of the attention feature maps does not change significantly; that is, the scales of multiple attention feature maps correspond to the scales of multiple first feature maps. In the sequential feature extraction process, shallower features are closer to the image to be processed and often contain more local information, making them suitable for fine-grained image segmentation. Deeper features, on the other hand, are farther from the image and tend to be more abstract global features, making them more suitable for probability calculations. Therefore, when dividing multiple attention feature maps, based on the feature map scale, at least one attention feature map corresponding to a first feature map with a scale smaller than a threshold can be used as the first feature to be processed; a scale smaller than the threshold indicates that the corresponding feature is a deep feature. The remaining attention feature maps are then used as the second feature to be processed.

[0144] In one embodiment of this application, image segmentation processing can be performed using a trained segmentation head. The segmentation head performs a series of processing steps to divide the content in the image to be processed into two types of pixel values. The regions that belong to the image content are set to the first pixel value (e.g., set to 1, which is represented as white), and the regions that do not belong to the image content are set to the second pixel value (e.g., set to 0, which is represented as black) to obtain a mask image.

[0145] In one embodiment of this application, attention feature maps other than the deepest attention feature map can be used as second features to be processed to obtain a mask image. During the mask image acquisition process, multiple attention feature maps in the second features to be processed are first fused to obtain a fused feature map. The fused feature map includes multiple channel feature maps. For example, assuming the scale of the fused feature map is H*W*C, each channel of the fused feature map can be equivalent to a feature map with a scale of H*W. Then, by normalizing the fused feature map, a mask feature map including multi-channel feature maps is obtained, and one of the channel feature maps in the mask feature map is used as the mask image.

[0146] In one embodiment of this application, considering the different scales of different attention feature maps, to facilitate fusion, multiple attention feature maps corresponding to the second feature to be processed can be sampled separately to obtain multiple sampled feature maps with the same scale. For example, the scale of the largest attention feature map among the multiple attention feature maps can be used as a benchmark, and the other attention feature maps can be upsampled to change their scale to the largest scale. Alternatively, other sampling scales can be selected to sample multiple attention feature maps separately to ensure consistent feature map scales. Then, the sampled feature maps corresponding to the multiple attention feature maps are concatenated to obtain a concatenated feature map; here, concatenation is still performed at the channel dimension, i.e., the number of channels in the concatenated feature map is the sum of the number of channels in all sampled feature maps. Finally, the concatenated feature map is convolved to obtain a fused feature map; wherein, the number of channels in the fused feature map is less than the number of channels in the concatenated feature map. The convolutional processing performed on the stitched feature map is used to reduce the number of channels in the feature map. In the binary classification case, a pixel has only two categories: fake and not fake. Therefore, the number of channels can be reduced to 2, and the scale of the fused feature map can be represented as H*W*2. Finally, the fused feature map is normalized using a normalization function (e.g., softmax) to obtain a mask feature map that includes multiple channel feature maps. One of the channel feature maps is then output as the mask image. For example, if the first channel feature map is selected as the mask image output, the scale of the mask image can be represented as H*W*1.

[0147] Step 570: Based on the overlap between the image information and the mask image, and the first detection result, obtain the second detection result of the image to be detected.

[0148] Step 570 can be referred to the relevant description in step 240 above, and will not be repeated here.

[0149] In the technical solution provided in this application embodiment, image features are extracted from the image to be detected to obtain a first feature to be processed. Then, a first probability is calculated based on the similarity between the first feature to be processed and a preset image feature. The first feature to be processed is then subjected to anti-counterfeiting classification processing to obtain a second probability. Finally, a first detection probability is generated based on the first probability and the second probability. This effectively avoids the problem of inaccurate detection probability calculation caused by calculating the detection probability in a single way, improves the accuracy of the first detection probability calculation, and thus helps to improve the accuracy of the final anti-counterfeiting detection result.

[0150] For example, in one specific embodiment, Figure 6 A schematic diagram illustrating an image detection method provided in one embodiment of this application is shown. Figure 6 As shown, the method includes the following procedures:

[0151] S1. Image cropping based on OCR detection. OCR detection is used to extract image information from the image to be detected. This image information is represented by the specific content in the image and its position coordinates. This process extracts the region where the target object is located in the image to be detected based on the OCR detection information, and obtains the detection region image.

[0152] S2. Multi-scale feature extraction. This process includes multiple sequential feature extractions, multi-dimensional convolution and concatenation of the smallest-scale second feature map, and feature fusion processing of other second feature maps in order of increasing feature map scale. For details, please refer to the relevant description in step 520 above, which will not be repeated here.

[0153] S3. Channel Attention Feature Extraction. This process involves extracting attention features from multiple first feature maps separately. During this process, the extracted attention vectors need to be fused with the corresponding first feature maps. For details, please refer to the relevant description in step 530 above, which will not be repeated here.

[0154] S4. Image segmentation processing. This process inputs attention feature maps other than the deepest attention feature map into the segmentation head to obtain the corresponding mask image. For details, please refer to the relevant description in step 550 above, which will not be repeated here.

[0155] S5. Initial Anti-counterfeiting Detection. This process extracts anti-counterfeiting features from the deepest attention feature map, and simultaneously inputs them into the feature library matching and classification head. The first probability is obtained by calculating the similarity between the first feature to be processed and the preset image features through feature library matching. The second probability is obtained by binary classification in the classification head. Finally, the first probability and the second probability are combined to obtain the first detection probability. For details, please refer to the relevant descriptions in steps 530-550 above. S5 will not be repeated here.

[0156] Optionally, in S6, the first feature to be processed can also be simultaneously input into an auxiliary classification head, which can be used to identify the image type.

[0157] Figure 7 A flowchart illustrating an embodiment of the image detection method provided in this application is shown schematically. This embodiment is a further refinement of the above embodiment. Figure 7 As shown, the image detection method provided in this application includes the following steps:

[0158] Step 710: Extract image information from the image to be detected; wherein, image information represents the location data of the image content in the image to be detected.

[0159] Step 720: Perform an initial anti-counterfeiting detection on the image to be detected based on its image features to obtain the first detection result of the image to be detected; wherein, the first detection result indicates whether the image to be detected is a counterfeited image.

[0160] Step 730: Obtain the mask image corresponding to the image to be detected based on the image features; wherein, the mask image is used to indicate the forged and non-forged areas in the image to be detected.

[0161] Steps 710-730 can refer to the relevant descriptions in the aforementioned steps 210-230 or steps 510-560, and will not be repeated here.

[0162] Step 740: If the image to be detected is determined to be a forged image based on the first detection result, calculate the area of ​​the overlapping region between the image information and the mask image, and use the ratio of the overlapping region area to the area of ​​the mask image as the second detection probability.

[0163] Specifically, the overlapping area between the image information and the mask image refers to the sum of the overlapping areas of data at the same position in the image information and the mask image. Here, the image to be detected, marked with image information, can be superimposed on the mask image, and then the overlapping area of ​​the two for the image content can be calculated. For example, the image content in the image to be detected is marked with a rectangular box, the forged area in the mask image is set to a pixel value of 1, and other areas (unforged areas) are set to a pixel value of 0. Then, after superimposing the image to be detected and the mask image, the sum of the number of pixels with a pixel value of 1 within the rectangular box can be used as the overlapping area between the image content and the mask image. Finally, the overlapping areas between all image content and the mask image are summed to obtain the overlapping area between the image information and the mask image. If multiple image contents and the mask image have the same overlapping area, the area is calculated only once for that area; that is, the same area is not calculated repeatedly. After obtaining the area of ​​the overlapping region, the area of ​​the overlapping region is compared with the area of ​​the mask image to obtain the ratio between the two. This ratio is used as the second detection probability, which represents the probability that the image to be detected belongs to the forged image.

[0164] In one embodiment of this application, considering that image information may not be extracted accurately enough, such as the position of the rectangle obtained by OCR recognition being offset compared to the image content field, in order to improve the accuracy of the overlapping area calculation, the image information is adjusted before calculating the overlapping area to make it as accurate as possible. The specific adjustment process includes: detecting the matching degree between the positional data of each image content in the image information and the positional data of the corresponding image content in the reference image; if the positional data of the image content in the image information does not match the positional data of the image content in the reference image, then adjusting the positional data of the image content in the image information according to the positional data of the image content in the reference image to match the positional data of the corresponding image content in the reference image.

[0165] Specifically, the accuracy of the positional data of the image content in the image to be detected can be determined by using the positional data of the image content in a reference image. Here, a first ratio between the positional data of the image content in the image information and the size data of the detected object can be calculated, along with a second ratio between the corresponding positional data of the image content in the reference image and the size data of the detected object in the reference image. If the first ratio matches the second ratio, it is determined that the positional data of the image content in the image information matches the corresponding positional data of the image content in the reference image; if the first ratio does not match the second ratio, it is determined that the positional data of the image content in the image information does not match the corresponding positional data of the image content in the reference image.

[0166] Taking an ID card image as an example, let's assume the image content is the name field on the ID card, i.e., the field "Name xxx". When extracting location information, a rectangle is used to frame the "Name xxx" field, and the coordinates of the four corners of the rectangle represent the location data of that field. During location data extraction, the dimensions of the ID card in the image can also be identified, i.e., its length and width. The reference image is a standard ID card image, whose dimensions and the location data of each field have been pre-recorded.

[0167] Taking the field "Name xxx" as an example, on one hand, the ratio of the length of the rectangle corresponding to this field to the length of the ID card in the image to be detected is calculated, and the ratio of the length of the rectangle corresponding to the field "Name xxx" in the reference image to the length of the ID card in the reference image is also calculated. If the difference between these two ratios is within a preset range, they can be considered to match in the length direction. On the other hand, the ratio of the width of the rectangle corresponding to this field to the width of the ID card in the image to be detected is calculated, and the ratio of the width of the rectangle corresponding to the field "Name xxx" in the reference image to the width of the ID card in the reference image is also calculated. If the difference between these two ratios is within a preset range, they can be considered to match in the width direction. If they match in both length and width directions, the position data of this field in the image to be detected is accurate and does not require adjustment; otherwise, the mismatched side needs to be adjusted. The adjustment here is based on the position data in the reference image to adjust the position data in the image to be detected. For example, if the length in the image to be detected is 2.5cm, while the length in the reference image is 3cm, then the length in the image to be detected needs to be adjusted to 3cm.

[0168] It is understandable that the positional data of each image content in the image to be detected needs to be detected, and only the positional data needs to be adjusted during the adjustment process, without adjusting the image content in the image.

[0169] Step 750: Determine the anti-counterfeiting type of the image to be detected based on the relationship between the second detection probability and the second preset threshold; wherein, the anti-counterfeiting type of the image to be detected includes the image to be detected being a counterfeited image and the image to be detected being an uncounterfeited image.

[0170] Specifically, a higher second detection probability indicates a larger area of ​​forged region in the image information, meaning more image content has been modified, thus indicating a higher probability that the image to be detected has been forged. Therefore, based on the relationship between the second detection probability and the second preset threshold, the anti-counterfeiting type of the image to be detected can be determined. Here, the anti-counterfeiting type of the image to be detected includes whether the image to be detected is a forged image or an unforged image.

[0171] In one embodiment of this application, if the second detection probability is greater than the second preset threshold, the anti-counterfeiting type of the image to be detected is determined to be that the image to be detected belongs to a counterfeited image; if the second detection probability is less than the second preset threshold, the anti-counterfeiting type of the image to be detected is determined to be that the image to be detected belongs to an uncounterfeited image.

[0172] In this embodiment, when the image to be detected is determined to be a forged image, i.e., a tampered image, based on the first detection result, the secondary anti-counterfeiting detection based on the overlap between the image information and the mask image is actually to further confirm whether the image has been maliciously tampered with. Here, malicious tampering refers to genuine tampering behavior, similar to the aforementioned meaning of "forged image," which refers to achieving a deceptive purpose through illegal means; while non-malicious tampering refers to an image being modified, but the modification is not for a deceptive purpose, such as adding specified watermark information or specific text description information. In this embodiment, the act of non-maliciously tampering with an image is considered as not forging an image. Therefore, when the first detection probability is greater than the first preset threshold and the second detection probability is less than the second preset threshold, it is considered that although the image to be detected has been modified, the modification behavior is not malicious, and thus the image to be detected is considered a non-maliciously tampered image, belonging to an unforged image; when the first detection probability is greater than the first preset threshold and the second detection probability is greater than the second preset threshold, it is considered that the image to be detected has not only been modified, but the modification behavior is malicious, and thus the image to be detected is considered a genuinely tampered image, belonging to a forged image.

[0173] Step 760: Generate the second detection result of the image to be detected based on the anti-counterfeiting type and the second detection probability.

[0174] Specifically, the final detection result is obtained based on the anti-counterfeiting type and the second detection probability. The terminal device can directly output the anti-counterfeiting type and the second detection probability, and can also output the first detection probability and the mask image.

[0175] The technical solution of this application calculates the area of ​​the overlapping region between the image information and the mask image, and the ratio of the overlapping region area to the area of ​​the mask image. Then, it uses the ratio to determine whether the image to be detected is a forged image, thereby improving the accuracy of anti-counterfeiting image detection.

[0176] For example, in one specific embodiment, the process of generating a second detection result of the image to be detected based on the overlap between the image information and the mask image is referred to as the post-processing process. Figure 8 A flowchart illustrating a post-processing procedure provided in one embodiment of this application is shown, such as... Figure 8 As shown, the post-processing procedure includes:

[0177] S1. Obtain the segmentation mask. Here, the segmentation mask is the mask image.

[0178] S2. Obtain OCR information. Here, OCR information refers to the image information obtained through OCR recognition.

[0179] S3. Check if the current information bit OCR size is normal. Here, an information bit refers to the image content. Taking an ID card photo as an example, one information bit is equivalent to a text field (such as the "name" field) or an image field (or image region, such as the portrait region) in the ID card photo. The current information bit OCR size refers to whether the detection box size corresponding to the current field (including text and image fields) matches the detection box size of the reference image. For details, please refer to the relevant description in step 740 above, which will not be repeated here.

[0180] S4. OCR box completion. In the case of size matching, the image information in the image to be detected is adjusted according to the size in the reference image. For details, please refer to the relevant description in step 740 above, which will not be repeated here.

[0181] S5. Calculate the overlap between the mask and the current information bits. That is, calculate the area of ​​the overlapping region between the image information and the mask image. For details, please refer to the relevant description in step 740 above, which will not be repeated here.

[0182] S6. Calculate the ratio of the union of all overlapping regions to the mask area. That is, calculate the ratio of the area of ​​the overlapping region to the area of ​​the mask image. For details, please refer to the relevant description in step 740 above, which will not be repeated here.

[0183] S7. Compare the ratio with the threshold. The threshold here is the second preset threshold.

[0184] S8. If the ratio is greater than the threshold, the anti-counterfeiting type is determined to be image tampering. Here, an image tampering can be considered a forged image.

[0185] S9. If the ratio is less than the threshold, the anti-counterfeiting type is determined to be a non-malicious tampered image. A non-malicious tampered image can be considered as an unforged image.

[0186] Among them, the ratio equal to the threshold can be classified into either the ratio greater than the threshold or the ratio less than the threshold according to actual needs.

[0187] Figure 9 The diagram schematically illustrates a structural block diagram of an image detection apparatus provided in one embodiment of this application. Figure 10 The flowchart of an image detection method provided in one embodiment of this application is illustrated schematically. The following is in conjunction with... Figure 9-10 This document describes the implementation process of the technical solution of this application.

[0188] like Figure 9 As shown, the image detection device provided in this application embodiment includes an OCR detection module 910, a tamper detection module 920, and a post-processing module 930. For example... Figure 10 As shown, the image detection method includes the following steps:

[0189] S1, the OCR detection module 910 performs information recognition on the image to be detected, obtaining the image information in the image to be detected (i.e., Figure 9 The field position in the image; where image information represents the position data of the image content in the image to be detected.

[0190] S2. The tamper detection module 920 performs edge trimming on the image to be detected based on the image information to obtain the detection area image.

[0191] S3. The tamper detection module 920 performs an initial anti-counterfeiting detection on the detection area image based on the image features of the detection area image, and obtains the first detection probability that the image to be detected belongs to the counterfeited image.

[0192] S4. If the first detection probability is less than the first preset threshold, it means that the image to be detected has not been forged. At this time, the first detection probability is directly output as the second detection result, and the process ends.

[0193] S5. If the first detection probability is greater than the first preset threshold, the tamper detection module 920 outputs the mask image corresponding to the detection region image based on the image features of the detection region image (i.e., ...). Figure 9 (PS position in the text).

[0194] S6. The post-processing module 930 calculates the area of ​​the overlapping region between the image information and the mask image, and the ratio of the overlapping region area to the area of ​​the mask image.

[0195] S7. If the ratio is greater than the second preset threshold, the post-processing module 930 outputs the result that the image to be detected has been forged.

[0196] S8. If the ratio is less than the second preset threshold, the post-processing module 930 outputs the result that the image to be detected has not been forged.

[0197] The specific processing procedure of the post-processing module 930 can be referred to the above. Figure 8 The flowchart shown is not repeated here.

[0198] The technical solution provided in this application significantly improves the accuracy and interpretability of image anti-counterfeiting detection. It can quickly and accurately determine the probability that the image to be detected is a counterfeited image. By introducing OCR information in the post-processing, the noise interference of non-information bits can be ignored, thereby improving the accuracy of detection. At the same time, the output mask image provides an explanation of whether the image is counterfeited, which can effectively ensure the accuracy of the results.

[0199] It should be noted that although the steps of the method in this application are described in a specific order in the accompanying drawings, this does not require or imply that the steps must be performed in that specific order, or that all the steps shown must be performed to achieve the desired result. Additional or alternative steps may be omitted, multiple steps may be combined into one step, and / or one step may be broken down into multiple steps.

[0200] The following describes an apparatus embodiment of this application, which can be used to perform the image detection method described in the above embodiments of this application. Figure 11 A schematic block diagram of the authentication device provided in an embodiment of this application is shown. Figure 11 As shown, the authentication device provided in this application embodiment includes:

[0201] The data extraction module 1110 is used to extract image information from the image to be detected; wherein, the image information represents the location data of the image content in the image to be detected;

[0202] The initial detection module 1120 is used to perform an initial anti-counterfeiting detection on the image to be detected based on the image features of the image to be detected, and obtain a first detection result of the image to be detected; wherein, the first detection result indicates whether the image to be detected is a counterfeited image;

[0203] The mask image acquisition module 1130 is used to acquire a mask image corresponding to the image to be detected based on the image features; wherein, the mask image is used to indicate the forged area and the non-forged area in the image to be detected;

[0204] The detection result generation module 1140 is used to obtain a second detection result of the image to be detected based on the overlap between the image information and the mask image, and the first detection result.

[0205] In one embodiment of this application, the initial detection module 1120 includes:

[0206] The feature extraction unit is used to extract image features from the image to be detected to obtain the first feature to be processed of the image to be detected.

[0207] The first probability calculation unit is used to calculate the first probability that the image to be detected belongs to a forged image based on the similarity between the first feature to be processed and the preset image features; wherein, the preset image features are features corresponding to an unforged image;

[0208] The second probability calculation unit is used to perform anti-counterfeiting classification processing on the first feature to be processed to obtain the second probability that the image to be detected belongs to the counterfeited image.

[0209] The first detection result generation unit is used to generate the first detection probability based on the first probability and the second probability, and to obtain the first detection result based on the first detection probability.

[0210] In one embodiment of this application, the feature extraction unit includes:

[0211] A multi-scale feature extraction subunit is used to perform multi-scale feature extraction on the image to be detected to obtain multiple first feature maps;

[0212] An attention feature extraction subunit is used to extract attention features from the plurality of first feature maps respectively, so as to obtain attention feature maps corresponding to the plurality of first feature maps respectively;

[0213] The first feature selection subunit is used to select at least one attention feature map as the first feature to be processed from the attention feature maps corresponding to the plurality of first feature maps respectively, according to the scale of the feature map.

[0214] In one embodiment of this application, the first feature selection subunit is specifically used for:

[0215] The attention feature map corresponding to the first feature map with a scale smaller than the threshold in the plurality of first feature maps is taken as the first feature to be processed.

[0216] In one embodiment of this application, the mask image acquisition module 1130 is specifically used for:

[0217] The attention feature map corresponding to the first feature map with a scale greater than a threshold in the plurality of first feature maps is taken as the second feature to be processed;

[0218] The second feature to be processed is subjected to image segmentation processing to obtain the mask image.

[0219] In one embodiment of this application, the first feature to be processed includes multiple attention feature maps; the mask image acquisition module 1130 is specifically used for:

[0220] The multiple attention feature maps included in the second feature to be processed are fused to obtain a fused feature map, which includes multiple channel feature maps;

[0221] The fused feature map is normalized to obtain a mask feature map that includes multi-channel feature maps, and one channel feature map in the mask feature map is used as the mask image.

[0222] In one embodiment of this application, the mask image acquisition module 1130 is specifically used for:

[0223] The multiple attention feature maps included in the second feature to be processed are sampled to obtain sampled feature maps corresponding to the multiple attention feature maps respectively; wherein the sampled feature maps corresponding to the multiple attention feature maps have the same scale;

[0224] The sampled feature maps corresponding to the multiple attention feature maps are concatenated to obtain a concatenated feature map;

[0225] The concatenated feature map is subjected to convolution processing to obtain the fused feature map; wherein the number of channels in the fused feature map is less than the number of channels in the concatenated feature map.

[0226] In one embodiment of this application, the attention feature extraction subunit is specifically used for:

[0227] Each of the plurality of first feature maps is pooled to obtain a pooled feature map corresponding to each first feature map.

[0228] Perform multilayer perceptron and activation processing on the pooled feature maps corresponding to each first feature map to obtain the attention vector corresponding to each first feature map;

[0229] The attention vectors corresponding to each of the first feature maps are fused with the corresponding first feature maps to obtain the attention feature maps corresponding to each of the first feature maps.

[0230] In one embodiment of this application, the multi-scale feature extraction subunit is specifically used for:

[0231] Multiple serial feature extractions are performed on the image to be detected to obtain multiple second feature maps; wherein, the multiple serial feature extractions mean that the second feature map output by the previous feature extraction is the input data for the next feature extraction, and the input data for the first feature extraction is the image to be detected; the scale of the multiple second feature maps decreases sequentially;

[0232] Multi-dimensional convolution and concatenation are performed on the smallest-scale second feature map among the plurality of second feature maps to obtain the smallest-scale first feature map;

[0233] For each of the multiple second feature maps except for the second feature map with the smallest scale, feature fusion is performed sequentially according to the feature map scale from smallest to largest to obtain the first feature map corresponding to each of the remaining second feature maps; wherein, the input data of the i-th feature fusion includes the i-th second feature map and the first feature map output by the (i-1)-th feature fusion, and the input data of the 1-th feature fusion includes the first feature map with the smallest scale and the first second feature map of each of the remaining second feature maps, 1 < i < the number of feature fusions;

[0234] The plurality of first feature maps are obtained based on the first feature map of the minimum scale and the first feature maps corresponding to the remaining second feature maps.

[0235] In one embodiment of this application, the multi-scale feature extraction subunit is specifically used for:

[0236] Multiple convolutional processes are performed on the smallest-scale second feature map among the multiple second feature maps to obtain multiple convolutional features, wherein the scales of the convolutional kernels corresponding to the multiple convolutional processes are different from each other;

[0237] The multiple convolutional features are concatenated to obtain concatenated convolutional features;

[0238] The concatenated convolutional features are subjected to dimension-restoring convolution processing to obtain the minimum-scale first feature map; wherein, the dimension-restoring convolution processing refers to adjusting the scale of the minimum first feature map to be consistent with the scale of the second feature map.

[0239] In one embodiment of this application, the initial detection module 1120 is specifically used for:

[0240] Extract the detection region image containing the image content from the image to be detected based on the image information;

[0241] An initial anti-counterfeiting detection is performed on the image of the detection area to obtain the first detection result of the image to be detected.

[0242] In one embodiment of this application, the detection result generation module 1140 is specifically used for:

[0243] If the image to be detected is determined to be a forged image based on the first detection result, the area of ​​the overlapping region between the image information and the mask image is calculated, and the ratio of the area of ​​the overlapping region to the area of ​​the mask image is used as the second detection probability.

[0244] Based on the relationship between the second detection probability and the second preset threshold, the anti-counterfeiting type corresponding to the image to be detected is determined; wherein, the anti-counterfeiting type of the image to be detected includes the image to be detected being a counterfeited image and the image to be detected being an uncounterfeited image;

[0245] A second detection result is generated for the image to be detected based on the anti-counterfeiting type and the second detection probability.

[0246] In one embodiment of this application, the apparatus further includes:

[0247] The content detection module is used to detect the matching degree between the position data of each image content in the image information and the position data of the corresponding image content in the reference image; if the position data of the image content in the image information does not match the position data of the image content in the reference image, the position data of the image content in the image information is adjusted according to the position data of the image content in the reference image so that the position data of each image content in the image information matches the position data of the corresponding image content in the reference image.

[0248] In one embodiment of this application, the image information further includes the size data of the object to be detected in the image to be detected; the content detection module is specifically used for:

[0249] Calculate a first ratio between the position data of the image content in the image information and the size data of the detected object, and a second ratio between the position data of the image content in the reference image and the size data of the detected object in the reference image;

[0250] If the first ratio is consistent with the second ratio, then it is determined that the position data of the image content in the image information matches the position data of the corresponding image content in the reference image;

[0251] If the first ratio is inconsistent with the second ratio, it is determined that the position data of the image content in the image information does not match the position data of the corresponding image content in the reference image.

[0252] In one embodiment of this application, the detection result generation module 1140 is specifically used for:

[0253] If the second detection probability is greater than the second preset threshold, the anti-counterfeiting type of the image to be detected is determined to be a counterfeited image; if the second detection probability is less than the second preset threshold, the anti-counterfeiting type of the image to be detected is determined to be an uncounterfeited image.

[0254] The specific details of the image detection apparatus provided in the various embodiments of this application have been described in detail in the corresponding method embodiments, and will not be repeated here.

[0255] Figure 12 A schematic block diagram of a computer system architecture for implementing an electronic device according to embodiments of the present application is shown.

[0256] It should be noted that, Figure 12 The computer system 1200 of the electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.

[0257] like Figure 12 As shown, the computer system 1200 includes a central processing unit (CPU) 1201, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 1202 or programs loaded from storage section 1208 into random access memory (RAM). The RAM 1203 also stores various programs and data required for system operation. The CPU 1201, ROM 1202, and RAM 1203 are interconnected via a bus 1204. An input / output interface 1205 (I / O interface) is also connected to the bus 1204.

[0258] The following components are connected to the input / output interface 1205: an input section 1206 including a keyboard, mouse, etc.; an output section 1207 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 1208 including a hard disk, etc.; and a communication section 1209 including a network interface card such as a local area network card, modem, etc. The communication section 1209 performs communication processing via a network such as the Internet. A drive 1210 is also connected to the input / output interface 1205 as needed. A removable medium 1211, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 1210 as needed so that computer programs read from it can be installed into the storage section 1208 as needed.

[0259] Specifically, according to embodiments of this application, the processes described in the various method flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 1209, and / or installed from removable medium 1211. When the computer program is executed by central processing unit 1201, it performs various functions defined in the system of this application.

[0260] It should be noted that the computer-readable medium shown in the embodiments of this application can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such transmitted data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to wireless, wired, etc., or any suitable combination thereof.

[0261] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0262] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to the embodiments of this application, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.

[0263] Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, touch terminal, or network device, etc.) to execute the method according to the embodiments of this application.

[0264] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein.

[0265] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.

Claims

1. An image detection method, characterized in that, include: Extract image information from the image to be detected; wherein, the image information represents the location data of the image content in the image to be detected; The image to be detected is subjected to an initial anti-counterfeiting detection based on its image features, and a first detection result is obtained for the image to be detected; wherein, the first detection result indicates whether the image to be detected is a counterfeited image; The mask image corresponding to the image to be detected is obtained based on the image features; wherein, the mask image is used to indicate the forged and non-forged areas in the image to be detected; Based on the overlap between the image information and the mask image, and the first detection result, a second detection result for the image to be detected is obtained.

2. The image detection method according to claim 1, characterized in that, The step of performing an initial anti-counterfeiting detection on the image to be detected based on its image features to obtain a first detection result for the image to be detected includes: Image feature extraction is performed on the image to be detected to obtain the first feature to be processed of the image to be detected; Based on the similarity between the first feature to be processed and the preset image features, the first probability that the image to be detected belongs to a forged image is calculated; wherein, the preset image features are the features corresponding to an unforged image; The first feature to be processed is subjected to anti-counterfeiting classification processing to obtain the second probability that the image to be detected belongs to the counterfeited image; The first detection probability is generated based on the first probability and the second probability, and the first detection result is obtained based on the first detection probability.

3. The image detection method according to claim 2, characterized in that, The step of extracting image features from the image to be detected to obtain the first feature to be processed of the image to be detected includes: Multi-scale feature extraction is performed on the image to be detected to obtain multiple first feature maps; Attention features are extracted from the plurality of first feature maps respectively to obtain attention feature maps corresponding to the plurality of first feature maps; Based on the scale of the feature map, at least one attention feature map is selected as the first feature to be processed from the attention feature maps corresponding to the plurality of first feature maps respectively.

4. The image detection method according to claim 3, characterized in that, The step of selecting at least one attention feature map as the first feature to be processed from the attention feature maps corresponding to the plurality of first feature maps according to the scale of the feature map includes: The attention feature map corresponding to the first feature map with a scale smaller than the threshold in the plurality of first feature maps is taken as the first feature to be processed.

5. The image detection method according to claim 3, characterized in that, The step of obtaining the mask image corresponding to the image to be detected based on the image features includes: The attention feature map corresponding to the first feature map with a scale greater than a threshold in the plurality of first feature maps is taken as the second feature to be processed; The second feature to be processed is subjected to image segmentation processing to obtain the mask image.

6. The image detection method according to claim 5, characterized in that, The second feature to be processed includes multiple attention feature maps; the image segmentation process performed on the second feature to be processed to obtain the mask image includes: The multiple attention feature maps included in the second feature to be processed are fused to obtain a fused feature map, which includes multiple channel feature maps; The fused feature map is normalized to obtain a mask feature map that includes multi-channel feature maps, and one channel feature map in the mask feature map is used as the mask image.

7. The image detection method according to claim 6, characterized in that, The process of fusing multiple attention feature maps included in the second feature to be processed to obtain a fused feature map includes: The multiple attention feature maps included in the second feature to be processed are sampled to obtain sampled feature maps corresponding to the multiple attention feature maps respectively; wherein the sampled feature maps corresponding to the multiple attention feature maps have the same scale; The sampled feature maps corresponding to the multiple attention feature maps are concatenated to obtain a concatenated feature map; The concatenated feature map is subjected to convolution processing to obtain the fused feature map; wherein the number of channels in the fused feature map is less than the number of channels in the concatenated feature map.

8. The image detection method according to claim 3, characterized in that, The step of extracting attention features from the plurality of first feature maps to obtain attention feature maps corresponding to the plurality of first feature maps includes: Each of the plurality of first feature maps is pooled to obtain a pooled feature map corresponding to each first feature map. Perform multilayer perceptron and activation processing on the pooled feature maps corresponding to each first feature map to obtain the attention vector corresponding to each first feature map; The attention vectors corresponding to each of the first feature maps are fused with the corresponding first feature maps to obtain the attention feature maps corresponding to each of the first feature maps.

9. The image detection method according to claim 3, characterized in that, The step of performing multi-scale feature extraction on the image to be detected yields multiple first feature maps, including: Multiple serial feature extractions are performed on the image to be detected to obtain multiple second feature maps; wherein, the multiple serial feature extractions mean that the second feature map output by the previous feature extraction is the input data for the next feature extraction, and the input data for the first feature extraction is the image to be detected; the scale of the multiple second feature maps decreases sequentially; Multi-dimensional convolution and concatenation are performed on the smallest-scale second feature map among the plurality of second feature maps to obtain the smallest-scale first feature map; For each of the multiple second feature maps except for the second feature map with the smallest scale, feature fusion is performed sequentially according to the feature map scale from smallest to largest to obtain the first feature map corresponding to each of the remaining second feature maps; wherein, the input data of the i-th feature fusion includes the i-th second feature map and the first feature map output by the (i-1)-th feature fusion, and the input data of the 1-th feature fusion includes the first feature map with the smallest scale and the first second feature map of each of the remaining second feature maps, 1 < i < the number of feature fusions; The plurality of first feature maps are obtained based on the first feature map of the minimum scale and the first feature maps corresponding to the remaining second feature maps.

10. The image detection method according to claim 9, characterized in that, The step of performing multi-dimensional convolution and concatenation on the smallest-scale second feature map among the plurality of second feature maps to obtain the smallest-scale first feature map includes: Multiple convolutional processes are performed on the smallest-scale second feature map among the multiple second feature maps to obtain multiple convolutional features, wherein the scales of the convolutional kernels corresponding to the multiple convolutional processes are different from each other; The multiple convolutional features are concatenated to obtain concatenated convolutional features; The concatenated convolutional features are subjected to dimension-restoring convolution processing to obtain the minimum-scale first feature map; wherein, the dimension-restoring convolution processing refers to adjusting the scale of the minimum first feature map to be consistent with the scale of the second feature map.

11. The image detection method according to claim 1, characterized in that, The step of performing an initial anti-counterfeiting detection on the image to be detected based on its image features to obtain a first detection result for the image to be detected includes: Extract the detection region image containing the image content from the image to be detected based on the image information; An initial anti-counterfeiting detection is performed on the image of the detection area to obtain the first detection result of the image to be detected.

12. The image detection method according to claim 1, characterized in that, Based on the overlap between the image information and the mask image, and the first detection result, a second detection result for the image to be detected is obtained, including: If the image to be detected is determined to be a forged image based on the first detection result, the area of ​​the overlapping region between the image information and the mask image is calculated, and the ratio of the area of ​​the overlapping region to the area of ​​the mask image is used as the second detection probability. Based on the relationship between the second detection probability and the second preset threshold, the anti-counterfeiting type corresponding to the image to be detected is determined; wherein, the anti-counterfeiting type of the image to be detected includes the image to be detected being a counterfeited image and the image to be detected being an uncounterfeited image; A second detection result is generated for the image to be detected based on the anti-counterfeiting type and the second detection probability.

13. The image detection method according to claim 12, characterized in that, Before calculating the area of ​​the overlapping region between the image information and the mask image, the method further includes: The matching degree between the positional data of each image content in the image information and the positional data of the corresponding image content in the reference image is detected; If the position data of the image content in the image information does not match the position data of the image content in the reference image, the position data of the image content in the image information is adjusted according to the position data of the image content in the reference image so that the position data of each image content in the image information matches the position data of the corresponding image content in the reference image.

14. The image detection method according to claim 13, characterized in that, The image information also includes the size data of the object to be detected in the image to be detected; the matching degree between the positional data of each image content in the image information and the positional data of the corresponding image content in the reference image includes: Calculate a first ratio between the position data of the image content in the image information and the size data of the detected object, and a second ratio between the position data of the image content in the reference image and the size data of the detected object in the reference image; If the first ratio is consistent with the second ratio, then it is determined that the position data of the image content in the image information matches the position data of the corresponding image content in the reference image; If the first ratio is inconsistent with the second ratio, it is determined that the position data of the image content in the image information does not match the position data of the corresponding image content in the reference image.

15. The image detection method according to claim 12, characterized in that, The step of determining the anti-counterfeiting type corresponding to the image to be detected based on the relationship between the second detection probability and the second preset threshold includes: If the second detection probability is greater than the second preset threshold, then the anti-counterfeiting type of the image to be detected is determined to be that the image to be detected belongs to a counterfeited image; If the second detection probability is less than the second preset threshold, then the anti-counterfeiting type of the image to be detected is determined to be that the image to be detected belongs to an uncounterfeited image.

16. An image detection device, characterized in that, include: The data extraction module is used to extract image information from the image to be detected; wherein, the image information represents the location data of the image content in the image to be detected; The initial detection module is used to perform an initial anti-counterfeiting detection on the image to be detected based on the image features of the image to be detected, and obtain a first detection result of the image to be detected; wherein, the first detection result indicates whether the image to be detected is a counterfeited image; A mask image acquisition module is used to acquire a mask image corresponding to the image to be detected based on the image features; wherein, the mask image is used to indicate the forged and unforged areas in the image to be detected; The detection result generation module is used to obtain a second detection result of the image to be detected based on the overlap between the image information and the mask image, and the first detection result.

17. A computer-readable medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the image detection method according to any one of claims 1 to 15.

18. An electronic device, characterized in that, include: processor; as well as Memory for storing the executable instructions of the processor; The processor executes the executable instructions to cause the electronic device to perform the image detection method according to any one of claims 1 to 15.

19. A computer program product, characterized in that, The computer program product includes computer instructions, which are stored in a computer-readable storage medium. The processor of the computer device reads and executes the computer instructions from the computer-readable storage medium, causing the computer device to perform the image detection method according to any one of claims 1 to 15.