Certificate defect detection method and device and computer equipment

By dividing the detection areas in the certificate and performing feature extraction and feature comparison of different sizes, the accuracy of document defect detection is solved, and the accurate identification and detection of defect types in different areas is achieved.

CN120451133APending Publication Date: 2025-08-08BEIJING MUNICIPAL PUBLIC SECURITY BUREAU +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510645913.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-19
Publication Date
2025-08-08

AI Technical Summary

Technical Problem

In the case where there are fewer defect sample images, it is difficult to accurately identify the location, type and degree of defects in the certificate, which affects the normal use of the certificate.

Method used

By determining multiple detection areas in the printed documents, feature extraction of different sizes is performed, and reference feature sets are generated using hash encoding and principal component analysis to reduce the dimensions, and comparing them with floating-point features to determine the defect detection results.

Benefits of technology

Accurate detection of different defect types in different regions is achieved, the accuracy and efficiency of document defect detection is improved, and the normal use of document.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120451133A_ABST
    Figure CN120451133A_ABST
Patent Text Reader

Abstract

The invention provides a certificate defect detection method and device and computer equipment. The method comprises the following steps: determining a plurality of detection areas in a printed certificate; performing feature extraction of different sizes on the detection areas to obtain feature information of each detection area; comparing the feature information with the reference feature set of each region to obtain a detection result of each detection region; and determining a defect detection result of the printed certificate according to the detection result of each detection area. According to the method, feature extraction of different sizes is carried out on the detection area to obtain feature information under different scales, and detection of defect degrees of different defect types in different areas is effectively realized, so that the accuracy of certificate detection is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a document defect detection method, apparatus and computer equipment. Background Art

[0002] Printing, a common technology in modern industry, is widely used in packaging, publishing, and electronics. Due to factors such as printing processes and production environments, various defects and flaws are inevitable during the printing process. Common defects include over 20 types, including page impurities, text ghosting, printhead scraping, and page damage. These defects are particularly common in printed documents such as passports and ID cards, where they often render important information unavailable, impacting the user experience.

[0003] Currently, due to the limited availability of defect sample images, document defect detection is typically accomplished through machine vision model training. This typically involves using the trained model to identify the presence of defects in an image. However, in practice, the location, type, and severity of defects within a document can have varying impacts on the user experience. Specifically, different locations, types, and severity of defects can affect the document's ability to function properly. Currently, with limited sources of defect sample images, accurate defect detection results for these situations are often difficult to achieve. Summary of the Invention

[0004] Based on this, it is necessary to provide a document defect detection method, device and computer equipment to address the above technical problems, so as to improve the detection effect of document defect detection results.

[0005] In a first aspect, the present application provides a document defect detection method, comprising:

[0006] Determining a plurality of detection areas in a printed document to be detected; the plurality of detection areas are used to respectively indicate areas of the printed document containing different document information;

[0007] Performing feature extraction of different sizes on the multiple detection areas respectively to obtain feature information of each detection area;

[0008] Comparing the feature information with a reference feature set of each region to obtain a detection result for each detection region;

[0009] The defect detection result of the printed document is determined according to the detection result of each detection area.

[0010] As a further feasible implementation of the present application, the reference feature set is obtained by processing a plurality of sample ID images; the sample ID images include positive sample ID images without defects; wherein the step of determining the reference feature set using the sample ID images includes:

[0011] Inputting the positive sample ID image into a preset feature extraction model to obtain a feature map of the positive sample ID image; wherein the feature map includes a deep feature map and a shallow feature map; the deep feature map and the shallow feature map are used to respectively indicate the receptive fields of different regions in the sample ID image; wherein the receptive fields of different regions have different sizes;

[0012] Performing feature fusion on the divided feature maps to obtain fusion features; the fusion features include deep fusion features and shallow fusion features;

[0013] Performing hash coding on the fused features to obtain reference hash features, and performing principal component analysis and dimensionality reduction on the fused features to obtain reference floating-point features;

[0014] A reference feature set for each region is generated based on the reference hash features and reference floating-point features of the corresponding region in each of the positive sample document images.

[0015] As a further feasible implementation of the present application, generating a reference feature set for each region based on the reference hash features and reference floating-point features of the corresponding region in each positive sample document image includes:

[0016] Deduplicating the reference hash features according to the Hamming distance between the reference hash features of the corresponding regions in each of the positive sample document images to obtain deduplicated reference hash features;

[0017] Deduplicating the reference floating-point features based on the cosine similarity between the reference floating-point features of the corresponding regions in each of the positive sample ID images to obtain deduplicated reference floating-point features;

[0018] The deduplicated reference hash features and the deduplicated reference floating-point features are determined as a reference feature set for a corresponding area.

[0019] As a further feasible implementation of the present application, the sample ID image includes a negative sample ID image having defects; and the method further includes:

[0020] Inputting the negative sample ID image into a preset feature extraction model to obtain a defect feature map in the negative sample ID image; the defect feature map is used to indicate the receptive field of the defect area where defects exist in the sample ID image;

[0021] Clustering the defect feature graph to obtain a plurality of cluster feature sets corresponding to different defect types;

[0022] Performing hash coding and principal component analysis dimensionality reduction on the defect feature graph in each of the cluster feature sets to obtain defect hash features and defect floating-point features for each defect type;

[0023] The defect hash feature and the defect floating point feature are added to a reference feature set.

[0024] As a further feasible implementation of the present application, the feature information of the detection area includes hash detection features and floating point detection features;

[0025] The comparing the feature information with the reference feature set of each area to obtain a detection result for each detection area includes:

[0026] Calculating the Hamming distance between the hash detection feature of the detection area and the reference hash feature in the corresponding reference feature set;

[0027] Determining a first candidate area in the detection area based on a magnitude relationship between the Hamming distance and a preset distance threshold;

[0028] The cosine similarity between the floating-point detection features of the first candidate area and the reference floating-point features in the corresponding reference feature set is calculated to determine a detection result for each detection area.

[0029] As a further feasible implementation of the present application, determining the defect detection result of the printed document according to the detection result of each detection area includes:

[0030] Weighting the detection results of each detection area according to the weight coefficient corresponding to each detection area to obtain a weighted defect detection score;

[0031] The defect detection result of the printed document is determined based on the size relationship between the defect detection score and a preset score threshold.

[0032] As a further feasible implementation of the present application, the method further includes:

[0033] Calculating the Hamming distance between the hash detection feature of the first candidate area and the defect hash feature in the corresponding reference feature set;

[0034] Determine a second candidate area in the first candidate area based on a magnitude relationship between the Hamming distance and a preset distance threshold;

[0035] Calculating the cosine similarity between the floating-point detection features of the second candidate area and the defect floating-point features in the corresponding reference feature set to determine the defect type of the second candidate area;

[0036] The weight coefficient corresponding to the defect type of the second candidate area is set as the weight coefficient of the corresponding detection area, and the weight coefficients of other detection areas are determined as preset weight coefficients.

[0037] As a further feasible implementation scheme of the present application, the multiple areas include a first area and a second area; the first area includes at least one of the portrait area, text area and latent image area in the printed certificate; the second area includes the area outside the first area in the printed certificate.

[0038] In a second aspect, the present application further provides a document defect detection device, comprising:

[0039] A determination module, configured to determine a plurality of detection areas in a printed document to be detected; the plurality of detection areas are configured to respectively indicate areas in the printed document containing different document information;

[0040] An extraction module, configured to extract features of different sizes from the plurality of detection areas respectively, to obtain feature information of each of the detection areas;

[0041] A comparison module, configured to compare the feature information with a reference feature set of each region to obtain a detection result for each detection region;

[0042] The detection module is used to determine the defect detection result of the printed document according to the detection result of each detection area.

[0043] In a third aspect, the present application further provides a computer device, comprising:

[0044] one or more processors;

[0045] Memory; and

[0046] One or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the processor to implement the method provided above.

[0047] In a fourth aspect, the present application also provides a computer-readable storage medium on which a computer program is stored, and the computer program is loaded by a processor to execute the method provided above.

[0048] In a fifth aspect, embodiments of the present application provide a computer program product or computer program, 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 generation method provided above.

[0049] The document defect detection method provided in the embodiments of the present application identifies regions within a printed document that indicate different document information, extracts features of different sizes for each detection region, and obtains feature information at different scales. This feature information at different scales focuses on detecting defects of different sizes from different information dimensions. Subsequently, this feature information is compared with a reference feature set for the corresponding region, allowing the detection result for each detection region to be determined independently. This approach effectively detects the degree of defects of different defect types within different regions without relying on a large number of negative sample document images, thereby ensuring the accuracy of document detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0051] Figure 1a A schematic diagram of the steps of a document defect detection method provided in an embodiment of the present application;

[0052] Figure 1b A schematic diagram showing the effect of dividing a virtual passport into multiple detection areas provided in this embodiment;

[0053] Figure 1c A schematic diagram showing the effect of processing a document image to obtain a deep feature map and a shallow feature map provided in this embodiment;

[0054] Figure 2 A schematic diagram of the steps for determining a reference feature set using a sample ID image provided in this embodiment;

[0055] Figure 3 A schematic diagram of a flow chart of steps for deduplicating a feature set provided in an embodiment of the present application;

[0056] Figure 4 A schematic diagram of another step flow for generating a reference feature set provided in an embodiment of the present application;

[0057] Figure 5A schematic diagram of the steps for determining the test results provided in the embodiment of the present application;

[0058] Figure 6 A schematic diagram of a process flow for setting a weight coefficient based on defect type provided in an embodiment of the present application;

[0059] Figure 7 A schematic diagram of the structure of a document defect detection device provided in an embodiment of the present application;

[0060] Figure 8 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0061] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without making creative efforts are within the scope of protection of this application.

[0062] In the description of this application, the terms "first" and "second" are used for descriptive purposes only and should not be understood to indicate or imply relative importance or implicitly specify the number of the technical features indicated. Therefore, a feature specified as "first" or "second" may explicitly or implicitly include one or more of the described features. In the description of this application, "plurality" means two or more, unless otherwise specifically specified.

[0063] In the description of this application, the word "for example" is used to mean "used as an example, illustration or illustration". Any embodiment described in this application as "for example" is not necessarily to be construed as being more preferred or advantageous than other embodiments. The following description is given to enable any person skilled in the art to implement and use the present invention. In the following description, details are listed for the purpose of explanation. It should be understood that a person of ordinary skill in the art can recognize that the present invention can be implemented without using these specific details. In other examples, well-known structures and processes are not elaborated in detail to avoid obscuring the description of the present invention with unnecessary details. Therefore, the present invention is not intended to be limited to the embodiments shown, but is consistent with the widest scope consistent with the principles and features disclosed in this application.

[0064] To clearly understand the methods provided in the embodiments of this application, the following describes the background of the document defect detection methods provided herein. Specifically, the document defect detection methods provided herein generally refer to various flaws or defects that may appear during the printing process of documents such as identity cards, passports, or other documents due to factors such as the printing process and production environment. These defects may include page impurities, text ghosting, printhead scraping, page damage, and so on. These defects may more or less affect the reading of important information in the document, such as portraits, text numbers, or latent image areas, resulting in unusability in certain scenarios and a negative impact on the user experience.

[0065] To detect defects in documents, related technologies have proposed using machine vision to train models. While this method can detect defects in documents, in actual use, the location, type, and severity of defects in documents can affect whether the documents can be used normally. Accurately identifying documents with defects that prevent normal use often requires training using a large number of defective sample images. However, due to the limited availability of defective sample images, the trained model often struggles to accurately determine whether a document contains defects that will affect its normal use, i.e., to identify defects that do not affect normal use.

[0066] Precisely to solve the above-mentioned technical problems, the present application provides a method for detecting document defects. By determining the areas indicating different document information in the printed document, features of different sizes are extracted for the detection areas respectively to obtain feature information at different scales. These feature information at different scales will focus on detecting defects at different sizes from different information dimensions, so that the feature information will be subsequently compared with the reference feature set of the corresponding area. The detection result of each detection area can be determined separately, and the defect degree of different defect types in different areas can be effectively detected, thereby ensuring that defective documents that affect the normal use of the document can be accurately identified.

[0067] For details, please refer to Figure 1a , Figure 1a A schematic flow chart of a method for detecting document defects provided in an embodiment of the present application includes steps S110 to S140:

[0068] S110, determining a plurality of detection areas in the printed document to be detected.

[0069] In this embodiment, multiple detection areas are used to indicate areas within a printed document containing different types of document information. Different types of documents, such as identity cards and passports, require different detection areas. For simplicity, this embodiment uses a passport as an example. For other types of documents, the same instructions can be used to determine multiple detection areas.

[0070] For details, please refer to Figure 1b , Figure 1b This is a schematic diagram of the effect of dividing a passport into multiple detection areas provided in this embodiment, wherein it should be noted that: Figure 1b The passport shown is a virtual passport sample, not a real passport information, and does not involve personal privacy. Specifically, it can be seen that the multiple areas determined generally include a first area involving important information in the document, namely the personalized information area, and a second area of the document other than the first area, that is, not involving important information, namely the non-personalized information area. Specifically, the first area generally includes at least one of the portrait area, text area, and latent image area in the printed document, for example, Figure 1b As shown, the first area generally includes a first portrait area Z1, a second portrait area Z2, and an ID number area Z3. Of course, in addition to the above, the first area may further include other text areas not shown (such as the issuing unit and date in the figure), or other latent image areas where specific information can be read in a special way, etc., that is, the personalized information area can be a set (Z1, Z2, ..., Z k ), and correspondingly, the second area is the area excluding the personalized information area, which can be described as Z0. Of course, the above solution is only a feasible way to detect areas using a passport as an example, and should not be considered a limitation of this embodiment. In fact, for any other type of area, multiple areas divided by detecting the presence of personalized information should also be within the scope of protection claimed in this application.

[0071] S120 , performing feature extraction of different sizes on the multiple detection areas respectively to obtain feature information of each detection area.

[0072] On top of the above, combined with the aforementioned related explanations, considering that the type and degree of defects in different locations will affect whether the certificate can be used normally, for example, under normal circumstances, small defects in some personalized information areas will often affect the reading of the certificate information, while defects in non-personalized information areas will often have a smaller impact on the reading of the certificate information. In addition, when the information density of different personalized information areas is also different, the type and degree of defects detected in these different personalized areas will actually affect the use effect of the certificate. Therefore, in this embodiment, feature extraction of different sizes is performed on multiple detection areas respectively to obtain feature information for each detection area. Specifically, the feature information extracted at different sizes can be understood as describing the defects in the corresponding size dimension, thereby making it possible to focus on defects in specific dimensions in different detection areas.

[0073] Specifically, to facilitate understanding of the above content, feature extraction of different sizes for multiple detection areas can be achieved through a trained feature extraction model. The feature extraction model here can usually use convolutional neural networks (such as Resnet50), self-attention mechanism neural networks (such as Vision-Transformer) and other feature extraction networks. The embodiment of this application does not limit the specific model results of the feature extraction model.

[0074] For example, as a common feasible implementation solution, the image of the printed document can be scaled to the input size H*W*C (for example, 256*256*3) required by the feature extraction network algorithm, and then sent to the feature extraction model for training to obtain multi-scale feature maps. For example, a shallow feature map (H / 8*W / 8*C1, such as 32*32*256) and a deep feature map (H / 16*W / 16*C2, such as 16*16*512) can be obtained. Then, for different detection areas, for example, for the first area containing personalized information, since the shallow feature map has a small receptive field and focuses on small-sized defects, the first area containing personalized information can be divided into blocks, pooled, fused, etc. with multi-sized windows (such as 1*1 window and 3*3 window) on the shallow feature map to obtain feature information for focusing on small-sized defects in the first area. For the second area that does not contain personalized information, since the deep feature map has a large receptive field, that is, it focuses on large-sized defects, the second area can be divided into blocks, pooled, fused, etc. with multi-sized windows (such as 1*1 window and 3*3 window) on the deep feature map to obtain feature information for focusing on large-sized or obvious-sized defects in the second area. For example, please refer to Figure 1c , Figure 1cThe figure shows the effects of processing a document image to obtain a deep feature map and a shallow feature map. It can be seen that the pixels in the deep and shallow feature maps correspond to different receptive fields in the document image, so they can be used for detection and recognition of images of different dimensions.

[0075] Of course, the above is only an example of the detection area including a first area involving important information and a second area not involving important information. The feature information obtained also only includes feature information at two scales. In fact, based on the different types of the first area, the information density involved is also different. Therefore, there can be more feature information of different scales actually obtained. For example, as a feasible implementation scheme, for the portrait area, a feature map of H / 4*W / 4 can also be used to achieve attention to the features of smaller defects in the area. Of course, the solution provided in this application is only a feasible implementation scheme. In fact, the size of the specific feature map used is not limited in this application. It is only necessary to ensure that feature maps of different scales are used for different areas to achieve feature extraction while meeting the needs.

[0076] In addition, it should be noted that since the feature information of each detection area extracted here will affect the subsequent identification results of the defect detection results, as a feasible implementation scheme, this application also provides a hash feature and floating-point feature as the feature information of the detection area to more accurately realize the subsequent defect detection results of the detection area. The specific implementation scheme will be described in detail in conjunction with the scheme provided subsequently.

[0077] S130: Compare the feature information with a reference feature set of each area to obtain a detection result for each detection area.

[0078] In the embodiments of the present application, after extracting feature information at different scales from different inspection areas in a printed document as described above, the obtained feature information can be compared with a reference feature set for each area, wherein the reference feature set is typically obtained by processing multiple sample document images. For example, it can refer to a feature information set for a corresponding area in a positive sample document image that does not contain defects, or it can refer to a feature information set for a corresponding area in a negative sample document image that does contain defects. It is understood that by comparing the feature information with the reference feature set, it can be determined whether the features of the area are more inclined to the absence or presence of defects of the corresponding scale, thereby determining the detection result for the corresponding inspection area.

[0079] Of course, it is understandable that the extracted reference feature set will affect the subsequent judgment of the defect detection results of the detection area. Therefore, in order to further improve the accuracy of the defect detection method provided by this application, as a feasible embodiment of this application, a sample document image mainly includes a positive sample document image without defects, and provides an implementation scheme that combines hash features and floating-point features as feature information. For details, please refer to Figure 2 , Figure 2 The following is a flow chart showing the steps of determining a reference feature set using a sample document image, specifically including steps S210 to S240:

[0080] S210: Input the positive sample ID image into a preset feature extraction model to obtain a feature map of the positive sample ID image.

[0081] In the embodiment of the present application, similar to the aforementioned processing flow for printed documents, a feature map of the positive sample document image can also be obtained by inputting the positive sample document image into a preset feature extraction model. Specifically, the feature map includes the deep feature map and shallow feature map mentioned above, wherein the deep feature map and the shallow feature map are used to respectively indicate the receptive fields of different areas in the sample document image, wherein the sizes of the receptive fields of different areas are different. The specific types can be found in the explanation of the aforementioned step S120, and the embodiment of the present application will not be repeated here.

[0082] S220, performing feature fusion on the divided feature maps to obtain fused features.

[0083] In an embodiment of the present application, based on the deep feature map and shallow feature layer of the sample ID image obtained above, after the feature map is divided into blocks for different regions using multi-size windows (e.g., 1*1 window and 3*3 window), multiple features can be obtained, such as the local block low-dimensional floating-point feature set (m*H / 8*W / 8*1*1*C1 and m*H / 8*W / 8*3*3*C1) in the shallow feature map, and the local block high-dimensional floating-point feature set (m*H / 16*W / 16*1*1*C2 and m*H / 16*W / 16*3*3*C2) in the deep feature map. Then, through feature fusion, the fused local block low-dimensional floating-point feature set (m*H / 8*W / 8*C1) and the fused local block high-dimensional floating-point feature set (e.g., m*H / 16*W / 16*C2) can be obtained respectively. That is, the fused features include deep fused features and shallow fused features.

[0084] Of course, in the above process, the obtained local block low-dimensional floating-point feature set and the local block high-dimensional floating-point feature set can also be pooled based on the adaptive pooling method to process the local block low-dimensional floating-point features (local block high-dimensional floating-point feature sets) of different sizes into the same dimension to further improve the fusion effect between the features. That is to say, as another implementation scheme of the present application, the local block low-dimensional floating-point feature set (m*H / 8*W / 8*1*1*C1 and m*H / 8*W / 8*3*3*C1) and the local block high-dimensional floating-point feature set ( Adaptive pooling is performed on the local block low-dimensional floating-point feature set (m*H / 16*W / 16*1*1*C2 and m*H / 16*W / 16*3*3*C2) to obtain a pooled local block low-dimensional floating-point feature set (m*H / 8*W / 8*C1) and a pooled local block high-dimensional floating-point feature set (m*H / 16*W / 16*C2), and feature fusion is performed on the features in the local block low-dimensional floating-point feature set and the pooled local block high-dimensional floating-point feature set, respectively, to obtain the aforementioned fused local block low-dimensional floating-point feature set and fused local block high-dimensional floating-point feature set. Different feature sets are used to indicate the set of feature information of the corresponding area in the sample image.

[0085] S230 , performing hash coding on the fused features to obtain reference hash features, and performing principal component analysis and dimensionality reduction on the fused features to obtain reference floating-point features.

[0086] In an embodiment of the present application, by hash encoding the fused features of different regions obtained above, the fused features can be processed into a feature vector consisting of a group of 0 or 1, that is, a reference hash feature of each region is obtained. For example, the feature of one of the 1*1*256 feature blocks can be expressed as [0,1,1,1,0,...,1]256.

[0087] In addition to hashing the fusion features of different regions separately, in an embodiment of the present application, principal component analysis is performed on the fusion features to reduce the dimension to obtain a local block dimensionality reduction floating-point feature set (m*H / 8*W / 8*C3) after dimensionality reduction, wherein the features in the local block dimensionality reduction floating-point feature set after dimensionality reduction are reference floating-point features, that is, feature vectors composed of floating-point numbers. It should be noted that before principal component analysis is performed on the fusion features to reduce the dimension, it is often necessary to normalize the fusion features to eliminate the influence of features of different scales. For example, as a common feasible implementation scheme, the L2 normalization method can be used to normalize the fusion features before principal component analysis and dimensionality reduction are performed.

[0088] S240 , generating a reference feature set for each region based on the reference hash features and reference floating-point features of the corresponding region in each of the positive sample ID images.

[0089] After the reference hash features and reference floating-point features are generated for each region's fusion features, they can be indexed by the region's location. This allows the reference hash features and reference floating-point features of the corresponding region in each positive ID image to be integrated to obtain a reference feature set for each region. In other words, each region's reference feature set is indexed by the region's location and contains the reference hash features and reference floating-point features of the corresponding region in multiple positive ID images.

[0090] The method provided in the embodiment of the present application constructs a reference feature set for each area from hash features and floating-point features, thereby facilitating the subsequent rapid detection of areas where defects may exist through hash features, and then further accurately determining the detection results of the areas based on the floating-point features of the initially screened areas. By combining the aforementioned scheme of using the hash features of the entire area for coarse screening and then using the floating-point features with specific coordinate indexes for detailed identification, the efficiency of detecting printing defects on the passport data page can be improved while effectively ensuring detection accuracy, thereby improving the defect detection effect.

[0091] Of course, in order to further improve the feature significance of the generated reference feature set, as a further feasible implementation scheme of this application, it is also possible to perform clustering and deduplication by respectively performing similarity removal on the reference hash features and the reference floating point features, and to significantly reduce memory overhead by removing homogeneous features, so that the reference feature set obtained from the massive positive sample feature set can be stored as the feature boundary of the defect-free image, thereby improving the detection rate and robustness of the passport data page printing defect detection. Specifically, for the convenience of understanding the above content, please refer to Figure 3 , Figure 3 A flowchart of a step of deduplicating a feature set provided in an embodiment of the present application, specifically including steps S310 to S330:

[0092] S310, deduplicating the reference hash features according to the Hamming distance between the reference hash features of the corresponding regions in each of the positive sample document images to obtain deduplicated reference hash features.

[0093] Considering that a hash feature is a feature vector of a specific length composed of groups of 0 or 1, such as 256 dimensions or 512 dimensions, in an embodiment of the present application, the Hamming distance between the reference hash features of the corresponding areas in each positive sample document image can be utilized, that is, the number of different feature values existing in the corresponding positions between the reference hash features can be calculated. For example, the Hamming distance between the character strings "1011101" and "1001001" is 2, so as to deduplicate the reference hash features of the area and filter out homogeneous features. For example, hash features whose Hamming distance is less than a preset distance threshold, that is, hash features whose number of different feature values existing in the corresponding positions is less than a certain value, can be deduplicated.

[0094] S320 , deduplicating the reference floating-point features according to the cosine similarity between the reference floating-point features of the corresponding regions in each of the positive sample ID images to obtain deduplicated reference floating-point features.

[0095] Correspondingly, since floating-point features can more accurately describe the feature information in the area, the similarity calculation between reference floating-point features needs to rely on the calculation formula of cosine similarity, that is, calculating the cosine similarity between reference floating-point features, and then deduplicating multiple reference floating-point features with cosine similarity close to 1, so as to obtain the deduplicated reference floating-point features.

[0096] S330: Determine the reference hash features after deduplication and the reference floating-point features after deduplication as a reference feature set for a corresponding area.

[0097] In an embodiment of the present application, after deduplication of the reference hash features and the reference floating-point features, by determining the deduplicated reference hash features and the deduplicated reference floating-point features as the reference feature set of the corresponding area, the reference feature set obtained from the massive positive sample feature set can be stored as the feature boundary of the defect-free image, thereby further improving the detection rate and robustness of the passport data page printing defect detection.

[0098] Of course, it should be noted that the above-mentioned solution only refers to the use of positive sample ID images without defects to construct reference feature sets of different scales in different areas, so as to detect and identify defects of a specific degree of defect in a specific area. In fact, on the basis that the sample ID images can also include negative sample ID images with defects, this application also provides another method of constructing feature sets corresponding to different defect types based on a small number of negative sample ID images to further improve the recognition accuracy of subsequent defect detection results. For details, please refer to Figure 4 , Figure 4 Another flowchart of steps for generating a reference feature set provided in an embodiment of the present application includes steps S410 to S430:

[0099] S410: Input the negative sample ID image into a preset feature extraction model to obtain a defect feature map in the negative sample ID image.

[0100] In the embodiment of the present application, similar to the aforementioned positive sample document image, by inputting the manually annotated defect feature map into the feature extraction model, a defect feature map of the corresponding defect area in a given size dimension can also be obtained.

[0101] S420: Clustering the defect feature graph to obtain a plurality of cluster feature sets corresponding to different defect types.

[0102] It is understandable that since the defect types in different negative sample document images are different, the defect feature maps corresponding to different defect types will obviously be different. Therefore, it is possible to consider clustering the feature maps to obtain multiple cluster feature sets corresponding to different defect types, for example, a cluster feature set including page impurities or a cluster feature set including text ghosting.

[0103] The clustering process usually involves segmentation, pooling, and fusion of defect feature maps, which are not described here in this embodiment. Clustering of defect feature maps can be achieved through spectral clustering, thereby obtaining multiple cluster feature sets corresponding to different defect types.

[0104] S430 , performing hash coding and principal component analysis dimensionality reduction on the defect features in each of the cluster feature sets to obtain defect hash features and defect floating-point features for each defect type.

[0105] In an embodiment of the present application, based on the aforementioned cluster feature sets corresponding to different defect types, based on a method similar to the aforementioned method, through hash coding and principal component analysis dimensionality reduction, the defect hash features and defect floating-point features corresponding to each defect type can be obtained respectively.

[0106] Of course, in the above process, considering that the number of negative sample ID images used to obtain defect hash features and defect floating-point features is small, in order to ensure the richness of the data as much as possible, it is not necessary to deduplicate the defect hash features and defect floating-point features. Alternatively, in specific scenarios, such as when the number of negative sample ID images exceeds a certain number, you can consider using more stringent deduplication parameters (compared to the deduplication parameters set for positive sample ID images), for example, setting a stricter similarity threshold, such as a lower Hamming distance threshold, or a cosine similarity threshold closer to 1 to deduplicate the defect hash features and defect floating-point features.

[0107] S440: Add the defect hash feature and the defect floating point feature to a reference feature set.

[0108] In an embodiment of the present application, by adding the defect hash features and defect floating-point features obtained above to the reference feature set, it can further assist in the detection and identification of corresponding defect types in the printed documents being inspected, thereby further accurately identifying defect detection results that will interfere with the normal use of the documents.

[0109] Based on the reference feature set obtained by any of the aforementioned embodiments, the following will describe a specific implementation scheme for obtaining the detection results of each detection area. Specifically, similar to constructing the reference feature set, based on similar processing steps of the feature information of the detection area, such as hash coding or dimensionality reduction processing, the hash detection features and floating-point detection features of the detection area can also be obtained. In this case, please refer to Figure 5 , Figure 5 The following is a flow chart of steps for determining the test results provided in the embodiment of the present application, specifically including steps S510 to S530:

[0110] S510: Calculate the Hamming distance between the hash detection feature of the detection area and the reference hash feature in the corresponding reference feature set.

[0111] Under the premise of ensuring detection accuracy, in order to improve the efficiency of detecting printing defects on the passport data page, in an embodiment of the present application, the Hamming distance between the hash detection feature of the detection area and the reference hash feature in the corresponding reference feature set will be considered first. It can be understood that since these reference hash features are obtained based on the feature map of the corresponding area of the positive sample document image, it is possible to determine whether the hash detection feature is within the feature boundary of the defect-free image based on the Hamming distance between the hash detection feature of the detection area and the reference hash feature in the corresponding reference feature set, thereby determining whether the detection area is potentially defective or not.

[0112] Of course, it should be noted that, since the reference feature set usually includes multiple reference hash features, it is usually necessary to calculate the Hamming distance between the hash detection feature and each reference hash feature.

[0113] S520: Determine a first candidate area in the detection area based on a magnitude relationship between the Hamming distance and a preset distance threshold.

[0114] In an embodiment of the present application, by comparing the Hamming distance with a preset distance threshold, it is possible to determine whether the hash detection feature is within the feature boundary of a defect-free image, thereby determining whether the detection area is potentially defective or not. For example, in the case where there are usually multiple reference hash features, as long as the Hamming distance between a hash detection feature and a reference hash feature is less than a preset distance threshold, it can be considered whether the hash detection feature is within the feature boundary of the defect-free image. Therefore, the minimum Hamming distance among the multiple Hamming distances can be compared with the preset distance threshold. When the minimum Hamming distance exceeds the preset distance threshold, it can be considered that the hash detection feature of the detection area has a low similarity with the reference hash feature of the corresponding detection area in the positive sample document image, and thus the detection area can be considered as the first candidate area where defects may exist. Of course, conversely, if the minimum Hamming distance is less than the preset distance threshold, it can be considered that the hash detection feature of the detection area has a high similarity with the reference hash feature of the corresponding detection area in a positive sample document image. Therefore, it can be confirmed that the detection area has a feature of no defects, that is, usually no defects. Through the above scheme, especially by using the feature set composed of a large number of positive sample document images, the initial screening of the detection area can be accurately completed, and the first candidate area where defects may exist can be screened out.

[0115] S530 , calculating the cosine similarity between the floating-point detection features of the first candidate area and the reference floating-point features in the corresponding reference feature set to determine a detection result for each detection area.

[0116] In an embodiment of the present application, after the candidate regions that may have defects are screened out by the Hamming distance of the hash feature, by further detecting the cosine similarity between the floating-point detection feature of the first candidate region and the reference floating-point feature in the corresponding reference feature set, it can be further used to specifically determine the possibility of the existence of defects in the candidate region. For example, when the similarity between the floating-point detection feature of the candidate region and a reference floating-point feature in the reference feature set is high, such as when the cosine similarity is relatively close to 1, it can be considered that in this size dimension, the candidate region has similar features to the corresponding region of the corresponding positive sample detection image, that is, there is no defect in the size dimension. If the floating-point detection feature of a candidate region has at least a certain difference from all the reference floating-point features in the reference feature set, for example, when the cosine similarity with all the reference floating-point features is lower than a certain threshold, it can be considered that feature information that does not correspond to the positive sample detection image can be detected from the candidate region in this size dimension, and this feature information can often be used to indicate a certain defect that can be identified in the candidate region in this size dimension.

[0117] On the basis of the above-mentioned solution, the detection result of each detection area can be determined based on the Hamming distance between the hash detection feature and each reference hash feature, and the cosine similarity between the floating-point detection feature and the reference floating-point feature. For example, when the Hamming distance is lower than the preset distance threshold, or when the Hamming distance exceeds the preset distance threshold but the cosine similarity exceeds the preset similarity threshold, it can be considered that the detection area tends to have no defects, that is, the detection result of the detection area can be described by a score or probability of "0". When the Hamming distance exceeds the preset distance threshold and the cosine similarity is lower than the preset similarity threshold, a score or probability describing the possibility of a defect that can be identified in the detection area in the corresponding size dimension can be obtained by setting a weighting coefficient based on the value of the Hamming distance exceeding the preset distance threshold and / or the cosine similarity being lower than the preset similarity threshold. For example, the higher the value of the Hamming distance exceeding the preset distance threshold, or the lower the value of the cosine similarity being lower than the preset similarity threshold, the closer the score or probability of the possibility of a defect in the detection area being present is to "1".

[0118] Of course, the implementation scheme provided above is only an example of constructing a reference feature set using positive sample ID images to illustrate the implementation scheme for determining the detection results of each detection area. In fact, in the implementation scheme of constructing a reference feature set using some negative sample ID images, it is also possible to consider using the defect hash features and defect floating-point features in the reference feature set to detect the defect type. Of course, it should be noted that the detection results of the defect type are only used to assist in further improving the defect detection effect of printed documents, and are not considered to be able to accurately determine the defect detection type of printed documents.

[0119] S140: Determine a defect detection result of the printed document according to the detection result of each detection area.

[0120] Based on the aforementioned test results for each detection area, the defect detection results for the printed document can be determined by combining the test results for each detection area. In particular, considering that users have different tolerances for different areas, such as the personalized information area and the non-personalized information area, as a feasible implementation of this application, different weights can be set for each area to weight the test results for each detection area, thereby determining the defect detection results for the printed document. In other words, determining the defect detection results for the printed document based on the test results for each detection area includes:

[0121] Weighting the detection results of each detection area according to the weight coefficient corresponding to each detection area to obtain a weighted defect detection score;

[0122] The defect detection result of the printed document is determined based on the size relationship between the defect detection score and a preset score threshold.

[0123] In the embodiment of the present application, it can be understood that by setting a corresponding weight coefficient for each detection area to weight the detection results of each detection area, the defect detection score of the weighted area can be determined. When the defect detection score is less than the preset score threshold, it can be considered that the defects in the area are within the user's tolerance range. Otherwise, it can be considered that the defects in the area have exceeded the user's tolerance range.

[0124] In the embodiment of the present application, it should be noted that the defect detection result of the printed certificate is not strictly speaking referring to the presence of defects in the printed certificate, but is used to indicate whether there are defects in the printed certificate that affect the normal use of the printed certificate. For example, small-sized defects in some non-important information areas will not affect the normal use of the printed certificate, and these parts of the printed certificates will not be detected as having defects. Only when there are defects with a dimension larger than a certain size in a specific area will the printed certificate be considered to have defects. Through the above scheme, defect detection of printed certificates can be completed more accurately based on actual needs.

[0125] Of course, it should be noted that in the implementation scheme of constructing a reference feature set using some negative sample document images, the weight coefficient corresponding to each detection area can also be set based on the type of defects that may exist in the area. For example, see Figure 6 , Figure 6 A flowchart of a step for setting a weight coefficient based on defect type is provided in an embodiment of the present application, specifically including steps S610 to S640:

[0126] S610: Calculate the Hamming distance between the hash detection feature of the first candidate area and the defect hash feature in the corresponding reference feature set.

[0127] In an embodiment of the present application, after the first candidate area that may have defects is identified through the Hamming distance between the hash detection feature and the reference hash feature of the positive sample document image, by further calculating the Hamming distance between the hash detection feature of the first candidate area and the defect hash feature in the corresponding reference feature set, it is possible to determine whether the hash detection feature of the first candidate area is relatively similar to the defect hash feature of a certain defect type, thereby identifying whether the first candidate area may have the corresponding defect type.

[0128] S620: Determine a second candidate region in the first candidate region based on a magnitude relationship between the Hamming distance and a preset distance threshold.

[0129] In an embodiment of the present application, similar to the aforementioned step S520, by comparing the hash detection feature of each first candidate area with the defect hash feature of each defect type, and when the Hamming distance between the hash detection feature of a first candidate area and the defect hash feature of one or several defect types is small, for example, less than a certain distance threshold, it can be considered that the first candidate area may have the corresponding defect type. Therefore, the first candidate area can be regarded as the second candidate area for further comparison through subsequent floating-point features.

[0130] S630 , calculating the cosine similarity between the floating-point detection features of the second candidate area and the defect floating-point features in the corresponding reference feature set to determine the defect type of the second candidate area.

[0131] In an embodiment of the present application, after determining that a second candidate area may contain a certain defect type, the defect type of the second candidate area can be determined based on the cosine similarity by calculating the similarity between the floating-point detection features of the second candidate area and the defect floating-point features in the corresponding reference feature set. For example, if the cosine similarity between the floating-point detection features of the second candidate area and the defect floating-point features of the corresponding defect type is higher than a preset threshold, it can be considered that the corresponding defect type exists in the second candidate area. Alternatively, when the Hamming distance between the second candidate area and the defect hash features of multiple defect types is small, the defect type with the highest cosine similarity can also be considered as the defect type of the second candidate area.

[0132] S640: Set the weight coefficient corresponding to the defect type of the second candidate area as the weight coefficient of the corresponding detection area, and determine the weight coefficients of other detection areas as preset weight coefficients.

[0133] After the defect type of the second candidate area is predicted through the solution provided above, the defect type is not directly used to judge the defect detection result of the printed certificate. Instead, the weight coefficient of the corresponding detection area will be considered based on the weight coefficient corresponding to the defect type. For example, a higher weight coefficient can be set for a defect type that has a greater impact on the certificate, and a relatively lower weight coefficient can be set for a defect type that has a relatively smaller impact on the certificate. For other detection areas where no defect type is detected (including non-first candidate areas and non-second candidate areas in the first candidate area), their weight coefficients can be determined as preset default weight coefficients.

[0134] By introducing the detection of defect types as described above, the impact of different defect types on documents can be fully considered in subsequent defect detection results, thereby more accurately identifying defective printed documents that will affect subsequent use.

[0135] The document defect detection method provided in the embodiments of the present application identifies regions within a printed document that indicate different document information, extracts features of different sizes for each detection region, and obtains feature information at different scales. This feature information at different scales focuses on detecting defects of different sizes from different information dimensions. Subsequently, this feature information is compared with a reference feature set for the corresponding region, allowing the detection result for each detection region to be determined independently. This approach effectively detects the degree of defects of different defect types within different regions without relying on a large number of negative sample document images, thereby ensuring the accuracy of document detection.

[0136] On the basis of the above-mentioned document defect detection method, as another embodiment of the present application, a document defect detection device is also provided. For details, please refer to Figure 7 , Figure 7 A schematic diagram of the structure of a document defect detection device provided in an embodiment of the present application, specifically comprising:

[0137] A determination module 710 is configured to determine a plurality of detection areas in a printed document to be detected; the plurality of detection areas are configured to respectively indicate areas in the printed document containing different document information;

[0138] An extraction module 720 is configured to perform feature extraction of different sizes on the plurality of detection areas to obtain feature information of each detection area;

[0139] a comparison module 730, configured to compare the feature information with a reference feature set of each region to obtain a detection result for each detection region;

[0140] The detection module 740 is configured to determine a defect detection result of the printed document according to the detection result of each detection area.

[0141] In a feasible embodiment, the comparison module 730 determines the reference feature set through the following steps: inputting the positive sample ID image into a preset feature extraction model to obtain a feature map of the positive sample ID image; wherein the feature map includes a deep feature map and a shallow feature map; the deep feature map and the shallow feature map are used to respectively indicate the receptive fields of different areas in the sample ID image; wherein the sizes of the receptive fields of different areas are different; performing feature fusion on the blocked feature map to obtain a fused feature; the fused feature includes a deep fused feature and a shallow fused feature; performing hash encoding on the fused feature to obtain a reference hash feature, and performing principal component analysis dimensionality reduction on the fused feature to obtain a reference floating-point feature; generating a reference feature set for each area based on the reference hash feature and the reference floating-point feature of the corresponding area in each of the positive sample ID images.

[0142] In a feasible embodiment, the comparison module 730 is further used to deduplicate the reference hash features based on the Hamming distance between the reference hash features of the corresponding areas in each of the positive sample ID images to obtain deduplicated reference hash features; deduplicate the reference floating-point features based on the cosine similarity between the reference floating-point features of the corresponding areas in each of the positive sample ID images to obtain deduplicated reference floating-point features; and determine the deduplicated reference hash features and the deduplicated reference floating-point features as a reference feature set for the corresponding area.

[0143] In a feasible embodiment, the comparison module 730 is also used to input the negative sample document image into a preset feature extraction model to obtain a defect feature map in the negative sample document image; the defect feature map is used to indicate the receptive field of the defect area where defects exist in the sample document image; the defect feature map is clustered to obtain multiple cluster feature sets corresponding to different defect types; the defect features in each of the cluster feature sets are hashed and principal component analysis is performed to reduce the dimensionality to obtain defect hash features and defect floating-point features for each defect type; the defect hash features and the defect floating-point features are added to the reference feature set.

[0144] In a feasible embodiment, the comparison module 730 is also used to calculate the Hamming distance between the hash detection feature of the detection area and the reference hash feature in the corresponding reference feature set; determine the first candidate area in the detection area based on the size relationship between the Hamming distance and the preset distance threshold; calculate the cosine similarity between the floating-point detection feature of the first candidate area and the reference floating-point feature in the corresponding reference feature set to determine the detection result of each detection area.

[0145] In a feasible embodiment, the detection module 740 is also used to weight the detection results of each detection area according to the weight coefficient corresponding to each detection area to obtain a weighted defect detection score; and determine the defect detection result of the printed certificate based on the relationship between the defect detection score and the preset score threshold.

[0146] In a feasible embodiment, the comparison module 730 is also used to calculate the Hamming distance between the hash detection feature of the first candidate area and the defect hash feature in the corresponding reference feature set; determine the second candidate area in the first candidate area based on the size relationship between the Hamming distance and the preset distance threshold; calculate the cosine similarity between the floating-point detection feature of the second candidate area and the defect floating-point feature in the corresponding reference feature set to determine the defect type of the second candidate area; set the weight coefficient corresponding to the defect type of the second candidate area as the weight coefficient of the corresponding detection area, and determine the weight coefficients of other detection areas as preset weight coefficients.

[0147] The specific definitions of the document defect detection device can be found in the definitions of the document defect detection method above and will not be repeated here. Each module in the document defect detection device described above may be implemented in whole or in part via software, hardware, or a combination thereof. Each of these modules may be embedded in or independent of a processor in a computer device in hardware form, or may be stored in a computer device memory in software form, allowing the processor to call and execute the corresponding operations of each module.

[0148] The document defect detection method provided in the embodiments of the present application identifies regions within a printed document that indicate different document information, extracts features of different sizes for each detection region, and obtains feature information at different scales. This feature information at different scales focuses on detecting defects of different sizes from different information dimensions. Subsequently, this feature information is compared with a reference feature set for the corresponding region, allowing the detection result for each detection region to be determined independently. This approach effectively detects the degree of defects of different defect types within different regions without relying on a large number of negative sample document images, thereby ensuring the accuracy of document detection.

[0149] In some embodiments of the present application, the document defect detection device can be implemented in the form of a computer program. The computer program can be used in Figure 8 The computer device is run on the computer device shown. The memory of the computer device can store various program modules that constitute the document defect detection device, such as, Figure 7 The determination module 710, extraction module 720, comparison module 730 and detection module 740 are shown. The computer program composed of various program modules enables the processor to execute the steps of the particle animation generation method of each embodiment of the present application described in this specification.

[0150] For example, Figure 8 The computer device shown can be Figure 7The determination module 710 in the document defect detection device shown executes step S110. The computer device can execute step S120 via the extraction module 720. The computer device can execute step S130 via the comparison module 730. The computer device can execute step S140 via the detection module 740. The computer device includes a processor, a memory, and a network interface connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external computer device via a network connection. When the computer program is executed by the processor, a method is implemented.

[0151] Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.

[0152] In some embodiments of the present application, a computer-readable storage medium is provided, storing a computer program. The computer program is loaded by a processor, causing the processor to perform the following steps:

[0153] Determining a plurality of detection areas in a printed document to be detected; the plurality of detection areas are used to respectively indicate areas of the printed document containing different document information;

[0154] Performing feature extraction of different sizes on the multiple detection areas respectively to obtain feature information of each detection area;

[0155] Comparing the feature information with a reference feature set of each region to obtain a detection result for each detection region;

[0156] The defect detection result of the printed document is determined according to the detection result of each detection area.

[0157] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Any reference to memory, storage, information library or other media used in the embodiments provided in this application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).

[0158] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0159] The above is a detailed introduction to a document defect detection method, device and computer equipment provided in the embodiments of the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, based on the ideas of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A method for detecting document defects, characterized in that: include: determining a plurality of inspection areas in a printed document to be inspected; The plurality of detection areas are used to respectively indicate areas of the printed certificate containing different certificate information; Performing feature extraction of different sizes on the multiple detection areas respectively to obtain feature information of each detection area; Comparing the feature information with a reference feature set of each region to obtain a detection result for each detection region; The defect detection result of the printed document is determined according to the detection result of each detection area.

2. The method according to claim 1, characterized in that The reference feature set is obtained by processing a plurality of sample ID images; the sample ID images include positive sample ID images without defects; wherein the step of determining the reference feature set using the sample ID images comprises: Inputting the positive sample ID image into a preset feature extraction model to obtain a feature map of the positive sample ID image; wherein the feature map includes a deep feature map and a shallow feature map; the deep feature map and the shallow feature map are used to respectively indicate the receptive fields of different regions in the sample ID image; wherein the receptive fields of different regions have different sizes; Performing feature fusion on the divided feature maps to obtain fusion features; the fusion features include deep fusion features and shallow fusion features; Performing hash coding on the fused features to obtain reference hash features, and performing principal component analysis and dimensionality reduction on the fused features to obtain reference floating-point features; A reference feature set for each region is generated based on the reference hash features and reference floating-point features of the corresponding region in each of the positive sample document images.

3. The method according to claim 2, characterized in that Generating a reference feature set for each region based on the reference hash features and reference floating-point features of the corresponding region in each positive sample document image includes: Deduplicating the reference hash features according to the Hamming distance between the reference hash features of the corresponding regions in each of the positive sample document images to obtain deduplicated reference hash features; Deduplicating the reference floating-point features based on the cosine similarity between the reference floating-point features of the corresponding regions in each of the positive sample ID images to obtain deduplicated reference floating-point features; The deduplicated reference hash features and the deduplicated reference floating-point features are determined as a reference feature set for a corresponding area.

4. The method according to claim 2, characterized in that The sample ID image includes a negative sample ID image having defects; and the method further includes: Inputting the negative sample ID image into a preset feature extraction model to obtain a defect feature map in the negative sample ID image; the defect feature map is used to indicate the receptive field of the defect area where defects exist in the sample ID image; Clustering the defect feature graph to obtain a plurality of cluster feature sets corresponding to different defect types; Performing hash coding and principal component analysis dimensionality reduction on the defect features in each of the cluster feature sets to obtain defect hash features and defect floating-point features for each defect type; The defect hash feature and the defect floating point feature are added to a reference feature set.

5. The method according to any one of claims 1 to 4, characterized in that The feature information of the detection area includes hash detection features and floating point detection features; The comparing the feature information with the reference feature set of each area to obtain a detection result for each detection area includes: Calculating the Hamming distance between the hash detection feature of the detection area and the reference hash feature in the corresponding reference feature set; Determining a first candidate area in the detection area based on a magnitude relationship between the Hamming distance and a preset distance threshold; The cosine similarity between the floating-point detection features of the first candidate area and the reference floating-point features in the corresponding reference feature set is calculated to determine a detection result for each detection area.

6. The method according to claim 5, characterized in that Determining the defect detection result of the printed document according to the detection result of each detection area includes: Weighting the detection results of each detection area according to the weight coefficient corresponding to each detection area to obtain a weighted defect detection score; The defect detection result of the printed document is determined based on the size relationship between the defect detection score and a preset score threshold.

7. The method according to claim 6, characterized in that The method further comprises: Calculating the Hamming distance between the hash detection feature of the first candidate area and the defect hash feature in the corresponding reference feature set; Determine a second candidate area in the first candidate area based on a magnitude relationship between the Hamming distance and a preset distance threshold; Calculating the cosine similarity between the floating-point detection features of the second candidate area and the defect floating-point features in the corresponding reference feature set to determine the defect type of the second candidate area; The weight coefficient corresponding to the defect type of the second candidate area is set as the weight coefficient of the corresponding detection area, and the weight coefficients of other detection areas are determined as preset weight coefficients.

8. The method according to claim 1, characterized in that The multiple areas include a first area and a second area; the first area includes at least one of a portrait area, a text area, and a latent image area in the printed document; the second area includes an area outside the first area in the printed document.

9. A document defect detection device, characterized in that: include: A determination module, configured to determine a plurality of detection areas in a printed document to be detected; The plurality of detection areas are used to respectively indicate areas of the printed certificate containing different certificate information; An extraction module, configured to extract features of different sizes from the plurality of detection areas respectively, to obtain feature information of each of the detection areas; A comparison module, configured to compare the feature information with a reference feature set of each region to obtain a detection result for each detection region; The detection module is used to determine the defect detection result of the printed document according to the detection result of each detection area.

10. A computer device, characterized in that: The computer device comprises: one or more processors; Memory; and One or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the processor to implement the document defect detection method according to any one of claims 1 to 8.