Multi-instance certificate image quality inspection method, device and system and storage medium
By combining the deep learning module of Mask-RCNN and YOLOV8 series algorithms, the problem of incomplete type coverage in multi-instance document image recognition and authentication is solved, and high-precision document quality inspection is achieved to meet the needs of multi-instance document image recognition and authentication. demand, improving the efficiency and accuracy of document quality inspection.
Patent Information
- Application Number
- CN202410336340.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-22
- Publication Date
- 2024-09-10
AI Technical Summary
The existing technology has the problem of incomplete type coverage in ID document quality inspection, which affects the quality of recognition and authentication. Especially when processing multi-instance ID images, the instance segmentation technology is immature, making it difficult to achieve high-precision identification and authentication.
Adopting a strategy that combines multiple deep learning modules, the Mask-RCNN algorithm is used for instance segmentation, and the YOLOV8 series algorithm is used for edge contour verification and internal occlusion and spot detection to achieve comprehensive type inspection and quality assessment of multi-instance document images, and to provide early warning of risks. items, reducing labor investment and helping business automation.
It achieves high-precision recognition and authentication of multi-instance document images, covers various types of document quality inspection risk items, is compatible with multi-instance document images, meets the requirements for document quality inspection capabilities in most scenarios, and improves the efficiency of identification and authentication. Quality and efficiency.
Smart Images

Figure CN118629062A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer vision, and in particular to a method, device, system and storage medium for quality inspection of multiple instance document images. Background Art
[0002] The quality inspection technology of certificates, especially identity certificates, refers to the technology for testing and evaluating the quality of certificates. The quality inspection of certificates mainly includes the following aspects: certificate authenticity, certificate photo watermark, certificate photo occlusion, certificate photo deformation, certificate photo edge cutting, certificate photo light spot, etc. The above risk types will significantly affect the ability to identify certificate content and the effectiveness of certificate photo authentication.
[0003] Taking identity documents as an example, the application scenarios of identity document quality inspection technology include both online and offline methods:
[0004] When conducting online authentication, you need to submit a photo of your ID. Due to the varying quality of photos, some photos may be watermarked or deformed, making it difficult for them to meet the authentication clarity requirements. ID photo quality inspection technology can automatically identify quality issues with ID photos, thereby reducing the investment in manual review.
[0005] When performing offline registration, you need to take an electronic photo of your ID card. Due to differences in shooting conditions and shooting skills, some photos have quality problems. ID photo quality inspection technology can screen out ID photos with quality problems to avoid operation failures and errors during recognition and authentication.
[0006] Currently, the industry's identity quality inspection technology has the potential problem of incomplete coverage of quality inspection types. Quality issues that affect document authentication and recognition often need to be summarized in actual business and have high requirements for accuracy.
[0007] In addition, a document usually involves multiple certificates, i.e., multiple instance certificate images (e.g. Figure 1 Due to the complexity of multi-instance images and the immaturity of instance segmentation technology, the recognition and authentication of multi-instance document images are more difficult. Summary of the invention
[0008] In order to solve the above problems, the present invention relates to a multi-instance document image quality inspection method, device, system and storage medium. The method can distinguish multiple instances of the provided document photos, conduct comprehensive type inspection and quality assessment, warn of various risk items, reduce manpower investment and help business automation, and has the characteristics of universality, high efficiency and high precision.
[0009] According to a first aspect of the technical solution of the present invention, a multi-instance document image quality inspection method is provided, wherein the document image includes multiple document instances, wherein the method comprises:
[0010] S1 instance segmentation step: inputting a document image to be inspected, segmenting a plurality of document instance images from the document image to be inspected, and classifying all the document instance images into a first normal document image or a first defect type document image according to the document type;
[0011] S2 image edge quality inspection step: perform edge contour verification on all first normal document images, and classify them into second normal document images or second defect type document images according to whether the document edge contours are complete and deformed;
[0012] S3 image internal quality inspection step: perform internal occlusion and light spot detection on all second normal document images, and classify them into third normal document images or third defect type document images according to whether there are internal occlusion and / or light spots;
[0013] S4 quality inspection result output step: output the third normal document image, and all defect type document images.
[0014] Furthermore, in S1, the image of the document to be inspected includes but is not limited to an identity card image, a household register image, a social security card image, a driver's license image, etc.
[0015] Furthermore, the S1 specifically includes:
[0016] S11: Input the image of the document to be inspected into the Mask-RCNN deep learning network model;
[0017] S12: Obtaining coordinates of a rectangular regression box and a first mask (Mask) of multiple certificate instances, and certificate types of all certificate instance images;
[0018] S13: performing boundary fitting according to the coordinates of the rectangular regression frame and the first mask, and locating and segmenting a plurality of document instance images;
[0019] S14: Classify all the document instance images into first normal document images or first defect type document images according to the document type.
[0020] Furthermore, in S12, the certificate types include normal certificates, watermark certificates, screen-shot certificates, fake certificates and photocopied certificates.
[0021] Furthermore, in S14, the first defect type document image includes a watermarked document image, a screen-shot document image, a fake document image, and a photocopied document image.
[0022] Furthermore, the S2 specifically includes:
[0023] S21: Determine a second mask of all first normal document images in the document image to be inspected by using a YOLOv8-seg deep learning model;
[0024] S22: Obtaining accurate contour points of all normal document images according to the second mask;
[0025] S23: Fitting the precise contour points into edge line segments and performing edge contour verification to determine whether the edge contour of the document is complete and deformed;
[0026] S24: The first normal document image with a complete document edge contour and no deformation is used as the second normal document image, and the others are used as the second defect type document images.
[0027] Furthermore, in S23, the conditions for determining whether the edge contour of the document is complete and deformed include:
[0028] For the fitted edge segments:
[0029] If the width-to-height ratio of the smallest circumscribed rectangle corresponding to the starting point and the intersection of the fitted line segment is greater than 3 or less than 1 / 3, it is determined that the edge contour of the document is blocked, resulting in an incomplete edge contour of the document;
[0030] If there are more than 10 contour points whose distance from the minimum circumscribed rectangle is greater than the set threshold, it is determined that the document edge contour is blocked, resulting in an incomplete document edge contour (the threshold here is dynamically determined according to the length of the fitted edge during the quality inspection process, which is equal to the length of the nearest edge / 55);
[0031] If there are less than two horizontal or vertical lines of the fitting line segment, it is determined that the edge contour of the document is blocked, resulting in an incomplete edge contour of the document;
[0032] If there is a contour point that is less than four pixels away from the edge of the image, it is determined that the edge contour of the document is cut, resulting in an incomplete edge contour of the document;
[0033] If the angles of a set of horizontal or vertical lines of the fitted line segment differ by more than 10 degrees, it is determined that the edge contour of the document is distorted and deformed;
[0034] If the aspect ratio of the fitted minimum circumscribed rectangle is greater than 1.25 times the standard card aspect ratio, it is determined that the edge contour of the document is distorted and deformed.
[0035] Furthermore, in S3, image correction is first performed on all second normal document images, and then internal occlusion and light spot detection are performed.
[0036] Furthermore, the second normal document image is corrected by perspective transformation.
[0037] Furthermore, in S3, the internal occlusion and light spot detection is performed on the corrected second normal document image through the YOLOv8 detection model to determine whether there is internal occlusion and / or light spot, and the rectangular regression frame coordinates of the internal occlusion and / or light spot.
[0038] According to a second aspect of the technical solution of the present invention, a multi-instance document image quality inspection device is provided, and the multi-instance document image quality inspection device operates based on the multi-instance document image quality inspection method according to any one of the above aspects, including:
[0039] An instance segmentation unit, configured to input a document image to be inspected, segment a plurality of document instance images from the document image to be inspected, and classify all the document instance images into a first normal document image or a first defect type document image according to the document type;
[0040] An image edge quality inspection unit, used to perform edge contour verification on all first normal document images, and classify the second normal document image or the second defect type document image according to whether the document edge contour is complete and deformed;
[0041] An image internal quality inspection unit, used to perform internal occlusion and light spot detection on all second normal document images, and classify them into third normal document images or third defect type document images according to whether there are internal occlusions and / or light spots;
[0042] The quality inspection result output unit is used to output the third normal document image and all defect type document images.
[0043] According to a third aspect of the technical solution of the present invention, a multi-instance document image quality inspection system is provided, the system comprising: a processor and a memory for storing executable instructions; wherein the processor is configured to execute the executable instructions to execute the multi-instance document image quality inspection method as described in any of the above aspects.
[0044] According to a fourth aspect of the technical solution of the present invention, there is provided a computer-readable storage medium, characterized in that a computer program is stored thereon, and when the computer program is executed by a processor, the multi-instance document image quality inspection method as described in any of the above aspects is implemented.
[0045] Beneficial effects of the present invention:
[0046] 1. Reasonableness: In order to take into account different downstream tasks such as classification, segmentation, and detection in risk item verification, the present invention adopts a strategy of combining multiple deep learning modules. The Mask-RCNN algorithm used in the instance segmentation module shows higher accuracy on the card data set, which is beneficial to the subsequent image cutting processing. The YOLOV8 series algorithm used in the subsequent module can greatly improve the reasoning speed while maintaining high accuracy, which is beneficial to the application of actual scenarios;
[0047] 2. Versatility: It covers various types of document quality inspection risk items, is compatible with multiple instance document images, and can meet the requirements for document quality inspection capabilities in most scenarios;
[0048] 3. Simple and efficient: Based on the current mainstream deep learning model, it can evaluate different types of risk items at the same time, and set whether to verify all risk items according to usage requirements;
[0049] 4. High accuracy: With the powerful classification, detection and segmentation capabilities of deep learning models, high prediction accuracy can be achieved in the verification of different types of risk items. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the structures shown in these drawings without paying creative work.
[0051] Figure 1 A schematic diagram of multiple instance images is shown.
[0052] Figure 2 A schematic diagram of an embodiment of the technical solution of the present invention is shown.
[0053] Figure 3 A schematic diagram of risk items of an instance segmentation module according to an embodiment of the technical solution of the present invention is shown.
[0054] Figure 4 A schematic diagram of risk items of a precise contour segmentation module according to an embodiment of the technical solution of the present invention is shown.
[0055] Figure 5 A schematic diagram of risk items of an occlusion and light spot detection module according to an embodiment of the technical solution of the present invention is shown.
[0056] Figure 6 A schematic diagram showing the quality inspection results of an embodiment of the technical solution of the present invention is shown.
[0057] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0058] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0059] The terms "first", "second", etc. in the specification and claims of the present disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein, for example.
[0060] In addition, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus that includes a series of steps or elements is not necessarily limited to those steps or elements explicitly listed, but may include other steps or elements not explicitly listed or inherent to such process, method, product, or apparatus.
[0061] Multiple includes two or more.
[0062] And / or, it should be understood that the term "and / or" used in this disclosure is only a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. It reduces manpower input and helps business automation, with the characteristics of universality, efficiency, and high precision.
[0063] The technical solution of the present invention first provides a multi-instance document image quality inspection method, wherein the document image includes multiple document instances, wherein the method comprises:
[0064] S1 instance segmentation step: input the document image to be inspected, segment a plurality of document instance images from the document image to be inspected, and classify all the document instance images into a first normal document image or a first defect type document image according to the document type.
[0065] In a preferred embodiment, in S1, the image of the document to be inspected includes but is not limited to an identity card image, a household register image, a social security card image, a driver's license image, etc.
[0066] In a preferred embodiment, the S1 may specifically include:
[0067] S11: Input the image of the document to be inspected into the Mask-RCNN deep learning network model;
[0068] S12: Obtaining coordinates of a rectangular regression box and a first mask (Mask) of multiple certificate instances, and certificate types of all certificate instance images;
[0069] S13: performing boundary fitting according to the coordinates of the rectangular regression frame and the first mask, and locating and segmenting a plurality of document instance images;
[0070] S14: Classify all the document instance images into first normal document images or first defect type document images according to the document type.
[0071] In a preferred embodiment, in S12, the certificate types may include normal certificates, watermark certificates, screen-shot certificates, fake certificates, and photocopied certificates.
[0072] In a preferred embodiment, in said S14, said first defect type document image may include a watermarked document image, a screen shot document image, a fake document image and a photocopied document image.
[0073] Here, Mask-RCNN is mainly used for segmentation based on target detection. The Mask-RCNN algorithm is mainly Faster R-CNN+FCN, or more specifically ResNeXt+RPN+Rol Align+FCN.
[0074] S2 image edge quality inspection step: perform edge contour verification on all first normal document images, and classify them into second normal document images or second defect type document images based on whether the document edge contour is complete and deformed.
[0075] In a preferred embodiment, S2 may specifically include:
[0076] S21: Determine a second mask of all first normal document images in the document image to be inspected by using a YOLOv8-seg deep learning model;
[0077] S22: Obtaining accurate contour points of all normal document images according to the second mask;
[0078] S23: Fitting the precise contour points into edge line segments and performing edge contour verification to determine whether the edge contour of the document is complete and deformed;
[0079] S24: The first normal document image with a complete document edge contour and no deformation is used as the second normal document image, and the others are used as the second defect type document images.
[0080] In a preferred embodiment, in S23, the conditions for determining whether the edge contour of the document is complete and deformed may include:
[0081] For the fitted edge segments:
[0082] If the width-to-height ratio of the smallest circumscribed rectangle corresponding to the starting point and the intersection of the fitted line segment is greater than 3 or less than 1 / 3, it is determined that the edge contour of the document is blocked, resulting in an incomplete edge contour of the document;
[0083] If there are more than 10 contour points whose distance from the minimum circumscribed rectangle is greater than the set threshold, it is determined that the document edge contour is blocked, resulting in an incomplete document edge contour (the threshold here is dynamically determined according to the length of the fitted edge during the quality inspection process, which is equal to the length of the nearest edge / 55);
[0084] If there are less than two horizontal or vertical lines of the fitting line segment, it is determined that the edge contour of the document is blocked, resulting in an incomplete edge contour of the document;
[0085] If there is a contour point that is less than four pixels away from the edge of the image, it is determined that the edge contour of the document is cut, resulting in an incomplete edge contour of the document;
[0086] If the angles of a set of horizontal or vertical lines of the fitted line segment differ by more than 10 degrees, it is determined that the edge contour of the document is distorted and deformed;
[0087] If the aspect ratio of the fitted minimum circumscribed rectangle is greater than 1.25 times the standard card aspect ratio, it is determined that the edge contour of the document is distorted and deformed.
[0088] Here, YOLOV8 is another SOTA model in the YOLO series, which is updated relative to YOLOV5. Its main structural network is divided into three parts: backbone network (backbone), feature enhancement network (neck) and detection head (head).
[0089] Backbone network: Using the idea of CSP, the main improvements are: 1. The C3 module in YOLOV5 is replaced by the C2f module; the rest is basically the same as the backbone network of YOLOV5.
[0090] Feature enhancement network: YOLOv8 uses the idea of PA-FPN. In the specific implementation process, the convolution of the PA-FPN upsampling stage in YOLOV5 is removed, and the C3 module is replaced by the C2f module.
[0091] Detection head: Different from the coupled head of YOLOV5, YOLOV8 uses Decoupled-Head.
[0092] S3 image internal quality inspection step: perform internal occlusion and light spot detection on all second normal document images, and classify them into third normal document images or third defect type document images based on whether there are internal occlusions and / or light spots.
[0093] In a preferred embodiment, in S3, image correction may be performed on all second normal document images first, and then internal occlusion and light spot detection may be performed. In a preferred embodiment, image correction may be performed on the second normal document images by perspective transformation.
[0094] In a preferred embodiment, in S3, the internal occlusion and light spot detection can be performed on the corrected second normal document image through the YOLOv8 detection model to determine whether there is internal occlusion and / or light spot, as well as the rectangular regression frame coordinates of the internal occlusion and / or light spot.
[0095] S4 quality inspection result output step: output the third normal document image, and all defect type document images.
[0096] The technical solution of the present invention further provides a multi-instance document image quality inspection device, which operates based on the multi-instance document image quality inspection method described above, including:
[0097] An instance segmentation unit, configured to input a document image to be inspected, segment a plurality of document instance images from the document image to be inspected, and classify all the document instance images into a first normal document image or a first defect type document image according to the document type;
[0098] An image edge quality inspection unit, used to perform edge contour verification on all first normal document images, and classify the second normal document image or the second defect type document image according to whether the document edge contour is complete and deformed;
[0099] An image internal quality inspection unit, used to perform internal occlusion and light spot detection on all second normal document images, and classify them into third normal document images or third defect type document images according to whether there are internal occlusions and / or light spots;
[0100] The quality inspection result output unit is used to output the third normal document image and all defect type document images.
[0101] The technical solution of the present invention also provides a multi-instance document image quality inspection system, which includes: a processor and a memory for storing executable instructions; wherein the processor is configured to execute the executable instructions to execute the multi-instance document image quality inspection method as described above.
[0102] The technical solution of the present invention further provides a computer-readable storage medium, characterized in that a computer program is stored thereon, and when the computer program is executed by a processor, the multi-instance document image quality inspection method as described above is implemented.
[0103] Example
[0104] Figure 2 is the overall principle diagram of this embodiment. This method uses multiple deep learning modules, such as Figure 2 As shown, each step is introduced:
[0105] 1. Quality inspection parameter setting
[0106] This method uses multiple deep learning modules to detect multiple types of risk items. Before the detection starts, the parameters of whether to force verification are set. If the forced verification is not turned on, the quality inspection process ends after the first risk item is detected and the corresponding risk item is returned; if the forced verification is turned on, the quality inspection process ends after all risk items are detected and all detected risk items are returned comprehensively. In order to introduce the quality inspection functions of each module, the following process of this embodiment turns on forced verification by default.
[0107] 2. ID card classification and regional positioning
[0108] The ID image is first input into the instance segmentation module, which uses the Mask-RCNN deep learning algorithm. The training set includes five types of ID documents: normal, watermark, screen shot, fake, and photocopy. The card area is marked with a quadrilateral. The classification output of the model corresponds to the five results of normal, watermark, screen shot, fake, and photocopy. In addition, the quadrilateral area of the ID card can be obtained by boundary fitting based on the card area mask output by the model.
[0109] Here, this embodiment uses the Mask-RCNN algorithm to perform the quality inspection instance segmentation task.
[0110] The Mask-RCNN algorithm has three output heads: classification head, detection head, and segmentation head. The dataset used for model training includes several types of ID documents: normal, watermarked, screen shot, fake, and photocopied. The fake ID samples are manually photoshopped based on normal ID photos.
[0111] After the image to be inspected is input into the quality inspection instance segmentation module, the image will be classified (the classification result will be matched with the above-mentioned risk items), and the predicted document positioning regression frame and the corresponding document mask will be obtained. After post-processing, the four-corner positioning coordinates of the identity document will be obtained. The coordinates can be used to perform perspective transformation on the document image to obtain a cut-out image of the card.
[0112] 3. ID card edge contour verification
[0113] Since the training set for the instance segmentation module is a standard quadrilateral card area, the situation where the card edge is blocked by fingers or other objects cannot be detected. The quality inspection precise contour segmentation module uses the YOLOv8-seg deep learning algorithm to predict the pixel-level mask of the original image document area, obtains the precise contour point list of the document based on the mask, and analyzes the card edge by merging the contour points into line segments. This stage mainly verifies the three situations of document deformation, document cutting, and document edge occlusion.
[0114] Here, this embodiment uses the YOLOV8-seg algorithm to perform the precise contour segmentation task.
[0115] Some methods that use semantic segmentation models to obtain the contour of ID cards cannot distinguish different instances with the same semantics, resulting in the fact that at most one ID card can be fitted during contour segmentation. In order to identify multiple ID card instances in an image, the image is firstly subjected to target detection, and then the mask of the area within each target detection frame is obtained, i.e., instance segmentation. Since it is necessary to accurately locate the target area and perform pixel-level segmentation on the ID card target in the area, this method requires high accuracy of target detection and segmentation mask. The YOLOV8-seg algorithm can distinguish the target from the background image at the pixel level in the ID card image containing multiple instances and maintain a high accuracy rate. Therefore, in the ID card quality inspection task, the YOLOV8-seg algorithm is used to detect the precise contour of the ID card. First, the quality inspection image is passed into the quality inspection precise contour segmentation module to obtain the precisely segmented ID card mask, and then the contour point list corresponding to each card instance is obtained according to the binary mask.
[0116] Secondly, for the list of contour points corresponding to each instance, the probabilistic Hough transform method is used to fit several line segments, and then the obtained straight line segments are classified into horizontal and vertical categories according to the angle. The line segments are further merged to obtain the two longest horizontal and vertical lines for fitting the card edge.
[0117] According to the fitted card edge line segments, if the aspect ratio of the minimum circumscribed rectangle corresponding to the starting point and intersection of these line segments is too large or too small, it can be determined that there is occlusion on the card edge, resulting in an incomplete edge contour; if the starting point of the fitted line segment is too far from the minimum circumscribed rectangle, it can be determined that there is occlusion on the card edge; if there are less than two fitted horizontal or vertical lines, it can be determined that there is occlusion on the card edge; if the fitted card edge line segment is too close to the edge of the image, it can be determined that the card is trimmed; a set of horizontal and vertical lines fitted by a standard identity document should be parallel. If the angles of a set of horizontal or vertical lines differ too much, it can be determined that the card is distorted; a standard identity document should follow a fixed aspect ratio. If the aspect ratio of the fitted card rectangle differs too much, it can be determined that the card is distorted.
[0118] 4. ID card image correction
[0119] According to the result of region positioning, the ID card image can be perspective transformed to obtain the corrected ID card region cut image. Perspective transformation is a common operation in image processing and will not be described here. The corrected image can avoid the potential interference of the image background on the detection of ID card risk items. Here, the perspective change depends on the card region positioning output of instance segmentation, corresponding to the crop image line connection in the schematic diagram.
[0120] 5. Occlusion and light spot detection
[0121] The corrected ID card image is sent to the occlusion and light spot detection module, which uses the YOLOv8 target detection algorithm. The training set includes two types of ID card data sets containing occlusion and light spot. The occlusion and light spot areas are marked with rectangles. If there is occlusion or light spot in the ID card image area, the model outputs the detected occlusion or light spot category and the target detection frame of the corresponding area, marked with a rectangle.
[0122] Here, the technical solution of the present invention uses the YOLOv8 detection algorithm to perform the target detection task.
[0123] The YOLOv8 detection algorithm has two output heads, namely the classification head and the detection head. After the document image to be inspected enters the occlusion and light spot detection module, if occlusion or light spot is detected, the classification head will output the corresponding classification result (occlusion, light spot), and the detection head will output the regression frame coordinates corresponding to the detected occlusion or light spot. Since the detection of occlusion or light spot has a corresponding confidence level, a suitable threshold should be set according to the actual scene and experience to determine the degree to which occlusion or light spot is judged to exist, so as to avoid false detection.
[0124] 6. Comprehensively output quality inspection results and risk items
[0125] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0126] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0127] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present invention.
[0128] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation modes, which are merely illustrative rather than restrictive. Under the guidance of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims, all of which are within the protection of the present invention.
Claims
1. A method for quality inspection of a multi-instance document image, wherein the document image comprises a plurality of document instances, It is characterized in that The method comprises: S1 instance segmentation step: inputting a document image to be inspected, segmenting a plurality of document instance images from the document image to be inspected, and classifying all the document instance images into a first normal document image or a first defect type document image according to the document type; S2 image edge quality inspection step: perform edge contour verification on all first normal document images, and classify them into second normal document images or second defect type document images according to whether the document edge contours are complete and deformed; S3 image internal quality inspection step: perform internal occlusion and light spot detection on all second normal document images, and classify them into third normal document images or third defect type document images according to whether there are internal occlusion and / or light spots; S4 quality inspection result output step: output the third normal document image, and all defect type document images.
2. The quality inspection method according to claim 1, It is characterized in that The S1 specifically includes: S11: Input the image of the document to be inspected into the Mask-RCNN deep learning network model; S12: Obtaining rectangular regression box coordinates and a first mask of multiple document instances, and document types of all document instance images; S13: performing boundary fitting according to the coordinates of the rectangular regression frame and the first mask, and locating and segmenting a plurality of document instance images; S14: Classify all the document instance images into first normal document images or first defect type document images according to the document type.
3. The quality inspection method according to claim 2, It is characterized in that In S12, the certificate types include normal certificates, watermark certificates, screen-shot certificates, fake certificates and photocopied certificates.
4. The quality inspection method according to claim 2, It is characterized in that In S14, the first defect type document image includes a watermark document image, a screen shot document image, a fake document image, and a photocopied document image.
5. The quality inspection method according to claim 1, It is characterized in that The S2 specifically includes: S21: Determine a second mask of all first normal document images in the document image to be inspected by using a YOLOv8-seg deep learning model; S22: Obtaining accurate contour points of all normal document images according to the second mask; S23: Fitting the precise contour points into edge line segments and performing edge contour verification to determine whether the edge contour of the document is complete and deformed; S24: The first normal document image with a complete document edge contour and no deformation is used as the second normal document image, and the others are used as the second defect type document images.
6. The quality inspection method according to claim 5, It is characterized in that In S23, the conditions for determining whether the edge contour of the document is complete and deformed include: For the fitted edge segments: If the width-to-height ratio of the smallest circumscribed rectangle corresponding to the starting point and the intersection of the fitted line segment is greater than 3 or less than 1 / 3, it is determined that the edge contour of the document is blocked, resulting in an incomplete edge contour of the document; If there are more than 10 contour points whose distance from the minimum circumscribed rectangle is greater than the set threshold, it is determined that the edge contour of the document is blocked, resulting in an incomplete edge contour of the document, where the threshold is equal to the length of the nearest edge / 55; If there are less than two horizontal or vertical lines of the fitting line segment, it is determined that the edge contour of the document is blocked, resulting in an incomplete edge contour of the document; If there is a contour point that is less than four pixels away from the edge of the image, it is determined that the edge contour of the document is cut, resulting in an incomplete edge contour of the document; If the angles of a set of horizontal or vertical lines of the fitted line segment differ by more than 10 degrees, it is determined that the edge contour of the document is distorted and deformed; If the aspect ratio of the fitted minimum circumscribed rectangle is greater than 1.25 times the standard card aspect ratio, it is determined that the edge contour of the document is distorted and deformed.
7. The quality inspection method according to claim 1, It is characterized in that In S3, image correction is first performed on all second normal document images, and then internal occlusion and light spot detection are performed.
8. The quality inspection method according to claim 7, It is characterized in that The second normal document image is corrected by perspective transformation.
9. The quality inspection method according to claim 1, It is characterized in that In S3, internal occlusion and light spot detection is performed on the corrected second normal document image through the YOLOv8 detection model to determine whether internal occlusion and / or light spot exist, and the rectangular regression frame coordinates of the internal occlusion and / or light spot.
10. The quality inspection method according to claim 1, It is characterized in that In S1, the document image to be inspected is an identity card image, a household register image, a social security card image or a driver's license image.
11. A multi-instance document image quality inspection device, It is characterized in that The multi-instance document image quality inspection device operates based on the multi-instance document image quality inspection method according to any one of claims 1 to 10, including: An instance segmentation unit, configured to input a document image to be inspected, segment a plurality of document instance images from the document image to be inspected, and classify all the document instance images into a first normal document image or a first defect type document image according to the document type; An image edge quality inspection unit, used to perform edge contour verification on all first normal document images, and classify the second normal document image or the second defect type document image according to whether the document edge contour is complete and deformed; An image internal quality inspection unit, used to perform internal occlusion and light spot detection on all second normal document images, and classify them into third normal document images or third defect type document images according to whether there are internal occlusions and / or light spots; The quality inspection result output unit is used to output the third normal document image and all defect type document images.
12. A multi-instance document image quality inspection system, the system include: A processor and a memory for storing executable instructions; characterized in that the processor is configured to execute the executable instructions to perform the multi-instance document image quality inspection method as described in any one of claims 1 to 10.
13. A computer-readable storage medium, It is characterized in that A computer program is stored thereon, and when the computer program is executed by a processor, the multi-instance document image quality inspection method as described in any one of claims 1 to 10 is implemented.
