Certificate verification method, device, electronic device and storage medium
By obtaining document video data, extracting multiple video frames and verifying them using a pre-trained model, it solves the problems of time-consuming, labor-intensive and low-accuracy existing document verification detection, and achieves more efficient document verification.
Patent Information
- Application Number
- CN202110778885.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-09
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2041-07-09
AI Technical Summary
Existing document verification and testing technology is time-consuming and labor-intensive, has low accuracy, and is difficult to improve work efficiency and verification accuracy.
By obtaining the video data of the document to be verified, multiple video frames are extracted, and the pre-trained document verification model is used to verify these frames. The factors of multiple video frames are comprehensively considered to improve verification accuracy and reduce labor consumption.
It effectively improves the accuracy and work efficiency of document verification, avoids unreliable results caused by insufficient information in single-frame image determination, saves labor, and improves the accuracy of verification.
Smart Images

Figure CN113591603B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of artificial intelligence technology, and in particular to a certificate verification method, device, electronic device and storage medium. Background Art
[0002] At present, relevant documents are required to prove personal identity in various places. For example, when handling business at a bank, an ID card is required to prove personal identity. Therefore, document verification is gaining more and more attention. Document verification refers to the technology that can automatically determine whether the document in a given document image or video is from a real document or a fake document (photocopy, remake, etc.). Document verification is an important technical means to prevent attacks and frauds, and is widely used in industries and occasions involving remote identity authentication, such as banking, insurance, Internet finance, and e-commerce.
[0003] At present, the existing document verification technology generally relies on human eyes to detect, which is very labor-intensive, time-consuming, and has low accuracy. Therefore, how to improve the efficiency and accuracy of document verification has become an urgent problem to be solved. Summary of the invention
[0004] The embodiments of the present application provide a certificate verification method, device, electronic device and storage medium to solve the technical problems of time-consuming, labor-intensive and low-accuracy certificate verification in the prior art.
[0005] On the one hand, an embodiment of the present application provides a method for verifying a certificate, the method comprising:
[0006] Obtain video data of the document to be verified;
[0007] Extracting multiple video frames from the video data;
[0008] The authenticity of the certificate to be verified is verified based on the multiple video frames and the pre-trained certificate verification model.
[0009] In a feasible embodiment, the authenticity of the document to be verified based on the multiple video frames and the pre-trained document verification model includes:
[0010] Input the multiple video frames into the document verification model, and evaluate the authenticity of the document to be verified based on the multiple video frames by the document verification model to obtain an evaluation value corresponding to the document to be verified; wherein the evaluation value includes a score value or a label value, and the score value includes a score value indicating that the document to be verified is authentic and / or a score value indicating that the document to be verified is fake;
[0011] The evaluation value output by the certificate verification model is obtained, and the authenticity of the certificate to be verified is determined based on the evaluation value.
[0012] In a feasible embodiment, the authenticity of the certificate to be verified is evaluated based on the multiple video frames by the certificate verification model to obtain the evaluation value corresponding to the certificate to be verified, including:
[0013] Determine the sub-feature vectors corresponding to each of the video frames through the document verification model;
[0014] Determine the fusion feature vector corresponding to each of the above video frames;
[0015] Based on each of the above sub-feature vectors and the above fused feature vector, an evaluation value corresponding to the above document to be verified is determined.
[0016] In a feasible embodiment, the determining of the fusion feature vector corresponding to each of the video frames includes:
[0017] Obtaining convolution features corresponding to each of the above video frames;
[0018] Concatenate the above convolutional features to obtain concatenated convolutional features;
[0019] The fused feature vector is determined based on the concatenated convolutional features.
[0020] In a feasible embodiment, the authenticity of the certificate to be verified is evaluated based on the multiple video frames by the certificate verification model to obtain the evaluation value corresponding to the certificate to be verified, including:
[0021] Determine the sub-feature vectors corresponding to each of the video frames through the document verification model;
[0022] The above sub-feature vectors are fused to obtain the evaluation value corresponding to the above-mentioned certificate to be verified.
[0023] In a feasible embodiment, the video data includes the front video data of the document to be verified and the back video data of the document to be verified;
[0024] The authenticity of the document to be verified based on the multiple video frames and the pre-trained document verification model is verified, including:
[0025] Based on the plurality of first video frames extracted from the front video data and the document verification model, the authenticity of the document to be verified is verified to obtain a first verification result; and based on the plurality of second video frames extracted from the back video data and the document verification model, the authenticity of the document to be verified is verified to obtain a second verification result;
[0026] Based on the first verification result and the second verification result, the authenticity of the certificate to be verified is determined.
[0027] In a feasible embodiment, the determining the authenticity of the document to be verified based on the first verification result and the second verification result includes:
[0028] If the first verification result and the second verification result both indicate that the document to be verified is a genuine document, then the document to be verified is determined to be a genuine document; otherwise, the document to be verified is determined to be a forged document.
[0029] In a feasible embodiment, the video data includes the front video data of the document to be verified and the back video data of the document to be verified;
[0030] The extracting of multiple video frames from the video data includes:
[0031] Extracting a plurality of first video frames from the front video data, and extracting a plurality of second video frames from the back video data;
[0032] Accordingly, the authenticity of the certificate to be verified based on the multiple video frames and the pre-trained certificate verification model is verified, including:
[0033] Inputting the plurality of first video frames and the plurality of second video frames into the document verification model, and evaluating the authenticity of the document to be verified based on the plurality of first video frames and the plurality of second video frames by the document verification model to obtain an evaluation value corresponding to the document to be verified;
[0034] The evaluation value output by the certificate verification model is obtained, and the authenticity of the certificate to be verified is determined based on the evaluation value.
[0035] In a feasible embodiment, extracting a plurality of video frames from the video data includes:
[0036] Dividing the video data into a plurality of video segments, and extracting at least one video frame from each video segment;
[0037] or,
[0038] Determine a video frame sequence corresponding to the video data, and extract video frames from the video frame sequence according to a set extraction rule; wherein the set extraction rule includes: setting a time interval or setting a video frame interval.
[0039] In a feasible embodiment, the above-mentioned document verification model is trained in the following manner:
[0040] Acquire a video sample set; wherein the video sample set includes video data of multiple sample certificates and annotation data of each of the sample certificates; the annotation data of the sample certificates indicates whether the sample certificates are authentic certificates or forged certificates;
[0041] Input the video sample set into the initial certificate verification model to obtain the evaluation value corresponding to each sample certificate in the video sample set;
[0042] The loss calculation is performed based on the annotated data of each of the above-mentioned sample certificates and each of the above-mentioned evaluation values, and the model parameters of the above-mentioned initial certificate verification model are updated based on the result of the loss calculation to obtain the above-mentioned certificate verification model.
[0043] On the other hand, an embodiment of the present application provides a device for verifying a certificate, the device comprising:
[0044] A video data acquisition module, used to acquire video data of the document to be verified;
[0045] A video frame extraction module, used to extract multiple video frames from the above video data;
[0046] The verification module is used to verify the authenticity of the above-mentioned document to be verified based on the above-mentioned multiple video frames and a pre-trained document verification model.
[0047] In one aspect, an embodiment of the present application provides an electronic device, including a processor and a memory, wherein the processor and the memory are connected to each other;
[0048] The memory is used to store computer programs;
[0049] The processor is configured to execute the method provided by any optional implementation of the document verification method when calling the computer program.
[0050] On the one hand, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the method provided by any possible implementation of the above-mentioned certificate verification method.
[0051] The beneficial effects of the solution provided by the embodiment of the present application are:
[0052] The certificate verification method, device, electronic device and storage medium provided in the embodiments of the present application, when verifying the certificate, obtain video data of the certificate to be verified, and then extract multiple video frames from the video data; finally, verify the authenticity of the certificate to be verified based on the multiple video frames and a pre-trained certificate verification model. The method provided in the embodiments of the present application, when verifying the authenticity of the certificate to be verified, verifies the authenticity of the certificate to be verified based on multiple video frames extracted from the video data of the certificate to be verified and a pre-trained certificate verification model. Since multiple video frames are used, the problem of unreliable verification results of the certificate to be verified due to insufficient information when only a single frame image is used for judgment can be avoided. When verifying the certificate, the factors of multiple video frames can be comprehensively considered, thereby effectively improving the accuracy of certificate verification. In addition, the use of a pre-trained certificate verification model to verify the authenticity of the certificate is time-consuming, which can greatly save labor and improve work efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0054] Figure 1 It is a schematic diagram of an implementation flow of a certificate verification method provided in an embodiment of the present application in an application scenario;
[0055] Figure 2 It is a flowchart of a method for verifying a certificate provided in an embodiment of the present application;
[0056] Figure 3 It is a schematic diagram of the principle of a certificate verification model provided in an embodiment of the present application;
[0057] Figure 4 It is a structural schematic diagram of a certificate verification device provided in an embodiment of the present application;
[0058] Figure 5 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0059] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0060] In recent years, research on computer vision, deep learning, machine learning, image processing, image recognition and other technologies based on artificial intelligence has made important progress. Artificial Intelligence (AI) is an emerging science and technology that studies and develops theories, methods, technologies and application systems for simulating and extending human intelligence. Artificial intelligence is a comprehensive discipline involving many types of technologies such as chips, big data, cloud computing, the Internet of Things, distributed storage, deep learning, machine learning, neural networks, etc. Computer vision, as an important branch of artificial intelligence, specifically allows machines to recognize the world. Computer vision technology usually includes face recognition, liveness detection, fingerprint recognition and anti-counterfeiting verification, biometric recognition, face detection, pedestrian detection, target detection, pedestrian recognition, image processing, image recognition, image semantic understanding, image retrieval, text recognition, video processing, video content recognition, behavior recognition, 3D reconstruction, virtual reality, augmented reality, simultaneous localization and mapping (SLAM), computational photography, robot navigation and positioning and other technologies. With the research and progress of artificial intelligence technology, this technology has been applied in many fields, such as security, urban management, traffic management, building management, park management, face access, face attendance, logistics management, warehouse management, robots, intelligent marketing, computational photography, mobile phone imaging, cloud services, smart homes, wearable devices, unmanned driving, automatic driving, smart medical care, face payment, face unlocking, fingerprint unlocking, person-document verification, smart screen, smart TV, camera, mobile Internet, live webcasting, beauty, beauty, medical beauty, intelligent temperature measurement, etc. For example, the certificate verification method in the embodiment of the present application uses technologies such as video content recognition, image processing, and image recognition.
[0061] As an example, Figure 1 It is a schematic diagram of an implementation flow of a certificate verification method provided in an embodiment of the present application in an application scenario. It can be understood that the certificate verification method provided in the embodiment of the present application can be applied to but not limited to the following applications: Figure 1 In the application scenario shown.
[0062] In this example, Figure 1As shown, the system for verifying the authenticity of the certificate in this example may include but is not limited to a user terminal 101, a network 102, and a server 103. The user terminal 101 (such as a user's smart phone) can communicate with the server 103 through the network 102, and the user terminal 101 can send video data of the certificate to be verified to the server 103 through the network. A target application is running in the user terminal 101, and the target application has the need for verifying the authenticity of the user's certificate. For example, one or some functions of the target application require the authenticity verification of the user's identity document, and the next operation can only be continued after the verification is passed. The target application can be a web application, an application program (Application, referred to as APP), etc. The above-mentioned user terminal 101 may include a human-computer interaction screen 1011, a processor 1012 and a memory 1013. The user can interact with the user terminal 101 through the human-computer interaction screen 1011 to implement operations on the target application, such as triggering the collection of video data of the document to be verified through the human-computer interaction screen 1011, and uploading the video data of the document to be verified to the server 103 through the video upload operation, so that the server 103 can verify the authenticity of the video data. The processor 1012 is used to process the relevant operations of the user. The memory 1013 is used to store various data of the user terminal 101, such as the user-side application code of the above-mentioned target application and various data that need to be stored or cached by the user terminal 101 during the identity authentication process. The server 103 may include a database 1031 and a processing engine 1032. The database 1031 may store, including but not limited to, the server-side application code of the target application, various data involved in the identity authentication process, etc., and may also include the login information of the user logging into the target application, the data records generated by the user when using the target application, etc.
[0063] The following example takes the user's ID card as the document to be verified. Figure 1 The certificate authenticity verification system shown illustrates the certificate verification method provided by this application.
[0064] like Figure 1 As shown, the specific implementation process of the certificate verification method in this example may include steps S101-S103:
[0065] In step S101 , a user uploads video data of a document to be verified through a target application in a user terminal 101 , where the video data includes at least two frames of images. The user terminal 101 sends the video data of the document to be verified to a server 103 corresponding to the target application through a network 102 .
[0066] Specifically, when a user uses a function of a target application that requires identity card verification, the user interface of the target application may display corresponding prompt information, such as "Start identity card verification" or "Identity card video capture" information displayed in the user interface. After the user clicks the corresponding button to confirm the identity card verification, the user terminal can start the video capture device of the user terminal (such as the terminal's built-in or external camera) to trigger video capture, and can end the capture after capturing a certain length of video to obtain video data.
[0067] Step S102: extract multiple video frames from the video data.
[0068] Optionally, a certain frame extraction strategy is used to extract multiple video frames from the video data. The step of extracting frames from the video data can be performed on the user terminal or on the server, which is not limited here.
[0069] In step S103, the processing engine 1032 in the server 103 verifies the authenticity of the document to be verified based on multiple video frames and a pre-trained document verification model.
[0070] It is understandable that the above is only an example and this embodiment is not limited here.
[0071] Among them, the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server or server cluster that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. The above-mentioned network may include but is not limited to: wired network, wireless network, wherein the wired network includes: local area network, metropolitan area network and wide area network, and the wireless network includes: Bluetooth, Wi-Fi and other networks that realize wireless communication. The user terminal can be a smart phone (such as Android mobile phone, iOS mobile phone, etc.), a tablet computer, a laptop computer, a digital broadcast receiver, MID (Mobile Internet Devices, mobile Internet device), PDA (personal digital assistant), desktop computer, vehicle terminal (such as vehicle navigation terminal), smart speaker, smart watch, etc. The user terminal and the server can be directly or indirectly connected by wired or wireless communication, but it is not limited to this. The specific can also be determined based on the actual application scenario requirements, and is not limited here.
[0072] See also Figure 2 , Figure 21 is a flow chart of a method for verifying a certificate provided in an embodiment of the present application. The method can be executed by any electronic device, such as a server or a user terminal, or by interaction between a user terminal and a server. Figure 2 As shown, the certificate verification method provided in the embodiment of the present application includes the following steps:
[0073] Step S201, obtaining video data of the document to be verified;
[0074] Step S202, extracting a plurality of video frames from the video data;
[0075] Step S203: verifying the authenticity of the document to be verified based on the multiple video frames and the pre-trained document verification model.
[0076] Optionally, the document to be verified may be any identity document, such as a resident identity card, a work certificate, a social medical insurance card, etc., which is not limited here. The video data may be obtained by shooting the document to be verified, and may include only the front video of the document to be verified, or only the back video of the document to be verified, or may also include both the front video and the back video of the document to be verified, which is not limited here.
[0077] The video data includes at least two frames of images. Through multiple frames of images, you can see the reflection, texture and other information of the certificate to be verified at different angles, and extract more information about the certificate to be verified. Since a single frame image may present different forms of attack, for example, covering the name of the user corresponding to the certificate to be verified, or covering the user's head portrait, etc., by extracting multiple frames of images from the video data and verifying the authenticity of the certificate to be verified based on the multiple frames of images, it can avoid the problem of unreliable verification results of the certificate to be verified due to insufficient information when judging only with a single frame of images.
[0078] Video data of the document to be verified is obtained. The video data can be a locally stored video or a real-time captured video. The embodiment of the present application does not limit how to obtain the video data. Optionally, when the user's document needs to be verified, the user can upload the video data through the user terminal. For example, the video capture device of the user terminal (such as the terminal's built-in or external camera) can be started to capture the user's document to be verified in real-time, and then the video data captured by the user terminal is sent to the server, and the server can obtain the video data.
[0079] After acquiring the video data, the video data is subjected to frame extraction processing to obtain multiple video frames, and the multiple video frames are input into a pre-trained document verification model. The multiple video frames are verified through the document verification model, that is, the authenticity of the document to be verified is verified to determine the authenticity of the document to be verified.
[0080] Through the embodiments of the present application, when performing document verification, video data of the document to be verified is obtained, and then multiple video frames are extracted from the video data; finally, the authenticity of the document to be verified is verified based on the multiple video frames and a pre-trained document verification model. The method provided by the embodiments of the present application verifies the authenticity of the document to be verified based on multiple video frames extracted from the video data of the document to be verified and a pre-trained document verification model. Since multiple video frames are used, the problem of unreliable verification results of the document to be verified due to insufficient information when only a single frame image is used for judgment can be avoided. When verifying the document, the factors of multiple video frames can be comprehensively considered, thereby effectively improving the accuracy of document verification. In addition, the use of a pre-trained document verification model to verify the authenticity of the document takes a short time, which can greatly save labor and improve work efficiency.
[0081] In an optional embodiment, the authenticity of the document to be verified based on the multiple video frames and the pre-trained document verification model includes:
[0082] Input the multiple video frames into the document verification model, and evaluate the authenticity of the document to be verified based on the multiple video frames by the document verification model to obtain an evaluation value corresponding to the document to be verified; wherein the evaluation value includes a score value or a label value, and the score value includes a score value indicating that the document to be verified is authentic and / or a score value indicating that the document to be verified is fake;
[0083] The evaluation value output by the certificate verification model is obtained, and the authenticity of the certificate to be verified is determined based on the evaluation value.
[0084] Optionally, multiple video frames extracted based on the video data of the document to be verified are input into a document verification model, and then the document verification model is used to evaluate the authenticity of the document to be verified based on the multiple video frames to obtain an evaluation value of the document to be verified.
[0085] In an optional embodiment, the evaluation value of the document to be verified can be a score value of the document to be verified, and the score value can be a score value of the document to be verified being authentic, or a score value of the document to be verified being a false document, or a score value of the document to be verified being authentic and a score value of the document to be verified being a false document. For example, suppose that the score value obtained for the document to be verified being authentic is 80; suppose that the score value obtained for the document to be verified being a false document is 20; suppose that the score value obtained for the document to be verified being authentic is 90, and the score value for the document to be verified being a false document is 10. In the embodiment of the present application, the specific form of the score value is not limited, and it can be an integer between 0 and 100, an integer between 0 and 10, or a numerical value between 0 and 1. It can be understood that the above is only an example, and the present embodiment does not make any limitation here.
[0086] In an optional embodiment, the evaluation value of the document to be verified can also be a label value of the document to be verified, and the label value indicates whether the document to be verified is a genuine document or a forged document. For example, the label value can be 1 or 0, where 1 indicates that the document to be verified is a forged document, and 0 indicates that the document to be verified is a genuine document; of course, 1 can also indicate that the document to be verified is a genuine document, and 0 indicates that the document to be verified is a forged document; this embodiment does not make any limitation here.
[0087] In one example, the evaluation value of the document to be verified can be a probability value of the document to be verified, which represents the probability that the document to be verified is a genuine document and / or a forged document. The probability value can be a probability value that the document to be verified is a genuine document, or a probability value that the document to be verified is a forged document, or a probability value that the document to be verified is a genuine document and a probability value that the document to be verified is a forged document.
[0088] Then, the evaluation value output by the document verification model is obtained, and the authenticity of the document to be verified is determined based on the evaluation value. The following are two possible ways to determine the authenticity of the document to be verified:
[0089] Method 1: If the score value is the score of a genuine certificate, the score value can be compared with the genuine certificate evaluation threshold to determine whether the certificate to be verified is a genuine certificate or a forged certificate. That is, if the score value is the score of a genuine certificate and the score value is greater than or equal to the genuine certificate evaluation threshold, the certificate to be verified can be determined to be a genuine certificate. If the score value is the score of a fake certificate, the score value can be compared with the fake certificate evaluation threshold to determine whether the certificate to be verified is a genuine certificate or a forged certificate. That is, if the score value is the score of a fake certificate and the score value is greater than or equal to the fake certificate evaluation threshold, the certificate to be verified can be determined to be a forged certificate. Among them, the genuine certificate evaluation threshold and the fake certificate evaluation threshold can be the same or different, and are not limited here.
[0090] Method 2: If the evaluation value is a label value, the authenticity of the document to be verified is determined according to the meaning represented by the label value. For example, if the output label value is 1, it means that the document to be verified is a forged document, and if the output label value is 0, it means that the document to be verified is a real document.
[0091] Through the embodiments of the present application, the authenticity of the certificate to be verified can be determined by the evaluation value output by the certificate verification model. Since the evaluation value can be in multiple forms, the method of determining the certificate to be verified is also more diverse, thereby improving the diversity of certificate verification methods.
[0092] In an optional embodiment, the authenticity of the certificate to be verified is evaluated based on the multiple video frames by the certificate verification model to obtain the evaluation value corresponding to the certificate to be verified, including:
[0093] Determine the sub-feature vectors corresponding to each of the video frames through the document verification model;
[0094] Determine the fusion feature vector corresponding to each of the above video frames;
[0095] Based on each of the above sub-feature vectors and the above fused feature vector, an evaluation value corresponding to the above document to be verified is determined.
[0096] Optionally, multiple video frames of the document to be verified can be input into the document verification model to obtain a sub-feature vector corresponding to each video frame, wherein the above sub-feature vector actually represents the sub-evaluation value corresponding to each video frame, and each sub-evaluation value is used to represent the score value of whether the document to be verified in the corresponding video frame is a true certificate and / or a false certificate, or each sub-evaluation value is used to represent the label value of the document to be verified in the corresponding video frame (that is, whether the document to be verified in the corresponding video frame is a true certificate or a false certificate). Determine the fusion feature vector corresponding to each video frame, wherein the above sub-fusion feature vector actually represents the fusion evaluation value corresponding to each video frame, that is, the fusion evaluation value after all video frames are fused. Finally, based on the sub-feature vectors and fusion feature vectors corresponding to multiple video frames, respectively, determine the evaluation value corresponding to the document to be verified. The following are several possible ways to determine the evaluation value corresponding to the document to be verified, wherein the sub-evaluation value corresponding to each sub-feature vector is recorded as the first evaluation value, and the fusion evaluation value corresponding to the fusion feature vector is recorded as the second evaluation value:
[0097] Method 1: The average value of the sum of the first evaluation values and the second evaluation values is used as the evaluation value corresponding to the document to be verified.
[0098] Method 2: The median of each of the first evaluation value and the second evaluation value is used as the evaluation value corresponding to the document to be verified.
[0099] Method 3: The maximum value of the first evaluation value and the second evaluation value is used as the evaluation value corresponding to the document to be verified.
[0100] Method 4: Taking the average value of the maximum value and the minimum value among the first evaluation values and the second evaluation values as the evaluation value corresponding to the document to be verified.
[0101] Method 5: The first evaluation values and the second evaluation values may be weightedly summed, and the evaluation value corresponding to the document to be verified may be determined based on the evaluation value obtained by the weighted sum.
[0102] The sum of the first weight of each first evaluation value and the second weight of the second evaluation value is 1. The second weight may be set higher than the sum of the first weights.
[0103] Among them, the first weight of each first evaluation value can be determined based on each video frame. For example, the weight of each video frame can be determined according to the acquisition time corresponding to each video frame. The weight of the video frame in the middle time period of the video data can be set relatively high, and then the weight of each video frame is used as the weight of each sub-feature vector.
[0104] Through the embodiments of the present application, the evaluation value of the document to be verified can be obtained through the sub-feature vectors corresponding to multiple video frames and the fused feature vector obtained by fusing the sub-feature vectors, and then the authenticity of the document to be verified can be verified based on the evaluation value. In this process, multiple factors of each sub-feature vector and the fused feature vector are comprehensively considered. This method of comprehensively considering multiple information can comprehensively consider various aspects of information to perform document verification, thereby improving the accuracy of the verification results.
[0105] In an optional embodiment, the determining of the fusion feature vector corresponding to each of the video frames includes:
[0106] Obtaining convolution features corresponding to each of the above video frames;
[0107] Concatenate the above convolutional features to obtain concatenated convolutional features;
[0108] The fused feature vector is determined based on the concatenated convolutional features.
[0109] Optionally, after each video frame is input into the document verification model, the document verification model first extracts the convolution features corresponding to each video frame, and then splices the convolution features, that is, stacks these multiple convolution features to form a larger convolution feature to obtain a spliced convolution feature, and then determines the fusion feature vector based on the spliced convolution feature.
[0110] In an embodiment of the present application, in addition to the above-mentioned method of determining the fused feature vector and determining the evaluation value corresponding to the document to be verified based on the sub-feature vector and the fused feature vector, the evaluation value corresponding to the document to be verified can also be determined by other methods.
[0111] In an optional embodiment, the authenticity of the certificate to be verified is evaluated based on the multiple video frames by the certificate verification model to obtain the evaluation value corresponding to the certificate to be verified, which can also be achieved in the following manner:
[0112] Determine the sub-feature vectors corresponding to each of the video frames through the document verification model;
[0113] The above sub-feature vectors are fused to obtain the evaluation value corresponding to the above-mentioned certificate to be verified.
[0114] Optionally, multiple video frames are input into the document verification model to obtain sub-feature vectors corresponding to each video frame, and then each sub-feature vector is fused to determine the evaluation value corresponding to the document to be verified. Each sub-feature vector represents a sub-evaluation value of the document to be verified in the corresponding video frame. Specifically, each sub-evaluation value is used to represent the score value / probability value of whether the document to be verified in the corresponding video frame is a true document and / or a false document, or each sub-evaluation value is used to represent the label value of the document to be verified in the corresponding video frame (that is, whether the document to be verified in the corresponding video frame is a true document or a false document).
[0115] For example, suppose that 8 video frames are obtained by extracting frames based on the video data of the document to be verified, and the evaluation values corresponding to the sub-feature vectors of the 8 video frames are sub-evaluation value 1, sub-evaluation value 2, ..., sub-evaluation value 8, and then the evaluation value of the document to be verified is determined based on the 8 sub-evaluation values. The evaluation value of the document to be verified can be the weighted average, mean, median, maximum value, etc. of the 8 evaluation values, which is not limited here.
[0116] In specific implementation, when verifying the document to be verified, the video data corresponding to the front side of the document to be verified can be used, or the video data corresponding to the back side of the document to be verified can be used; of course, the video data used can also include both the video data corresponding to the front side of the document to be verified and the video data corresponding to the back side of the document to be verified.
[0117] In an optional embodiment, the video data includes the front video data of the document to be verified and the back video data of the document to be verified;
[0118] In the case where the video data includes the front video data and the back video data of the front side to be verified, video frames can be extracted from the front video data and the back video data respectively, and input into the document verification model for verification; therefore, in this case:
[0119] The above step of extracting a plurality of video frames from the video data may include:
[0120] Extracting a plurality of first video frames from the front video data, and extracting a plurality of second video frames from the back video data;
[0121] Accordingly, the authenticity of the certificate to be verified based on the multiple video frames and the pre-trained certificate verification model is verified, including:
[0122] Input multiple first video frames and multiple second video frames into a document verification model, evaluate the authenticity of the document to be verified based on the multiple first video frames and the multiple second video frames through the document verification model, and obtain an evaluation value corresponding to the document to be verified; obtain the evaluation value output by the document verification model, and determine the authenticity of the document to be verified based on the evaluation value.
[0123] When verifying the certificate to be verified through the certificate verification model, since the certificate verification model has the ability to identify the authenticity of both the front video data and the back video data of the certificate, it is not necessary to distinguish between the front video data and the back video data in the video data of the certificate to be verified. Multiple first video frames extracted from the front video data of the certificate to be verified and multiple second video frames extracted from the back video data of the certificate to be verified are input into the certificate verification model, that is, the multiple first video frames and the multiple second video frames are mixed together to verify the authenticity of the certificate to be verified.
[0124] Among them, since the video data of the document to be verified includes front video data and / or the document to be verified, the video data input into the document verification model may only include video frames corresponding to the front video data, or only include video frames corresponding to the back video data, or include video frames corresponding to both the front video data and the back video data. In other words, the document verification model in the embodiment of the present application can adapt to a variety of possible situations without distinguishing the input video data of the document to be verified.
[0125] Through the embodiments of the present application, since the certificate verification model has the ability to identify the authenticity of both the front and back video data of the certificate, when verifying the certificate to be verified through the certificate verification model, it can adapt to various business needs, thereby improving the adaptability and versatility of the certificate verification model.
[0126] Of course, when verifying the document to be verified, the front video data of the document to be verified and the back video data of the document to be verified can also be distinguished. The specific process is as follows:
[0127] In an optional embodiment, the video data includes the front video data of the document to be verified and the back video data of the document to be verified;
[0128] The authenticity of the document to be verified based on the multiple video frames and the pre-trained document verification model is verified, including:
[0129] Based on the plurality of first video frames extracted from the front video data and the document verification model, the authenticity of the document to be verified is verified to obtain a first verification result; and based on the plurality of second video frames extracted from the back video data and the document verification model, the authenticity of the document to be verified is verified to obtain a second verification result;
[0130] Based on the first verification result and the second verification result, the authenticity of the certificate to be verified is determined.
[0131] Since a certificate usually has two sides, the information on the front and back sides is usually different, therefore, in order to better ensure the accuracy of verification, the front video data of the certificate to be verified and the back video data of the certificate to be verified can be verified separately.
[0132] Optionally, the video data of the document to be verified may include the front video data of the document to be verified and the back video data of the document to be verified. For example, taking an ID card as an example, the front video data may be the video data of the national emblem side of the ID card, and the back video data may be the video data of the portrait side of the ID card, and both the front video data and the back video data include at least two frames of images.
[0133] When verifying the authenticity of the document to be verified based on multiple video frames and a pre-trained document verification model, the front video data and the back video data can be respectively input into the document verification model, and the front video data and the back video data are respectively verified and processed by the document verification model to obtain a first verification result corresponding to the front video data and a second verification result corresponding to the back video data, and the authenticity of the document to be verified is determined based on the first verification result and the second verification result.
[0134] In an optional embodiment, determining the authenticity of the document to be verified based on the first verification result and the second verification result includes:
[0135] If the first verification result and the second verification result both indicate that the document to be verified is a genuine document, then the document to be verified is determined to be a genuine document; otherwise, the document to be verified is determined to be a forged document.
[0136] For example, a user can upload a video of the national emblem side (front video data) and a video of the portrait side (back video data) of an ID card. For the video of the national emblem side, the video can be decomposed into N video clips, and at least one video frame is extracted from each video clip to obtain the video frame corresponding to the video of the national emblem side. For the video of the portrait side, the video can be decomposed into N video clips, and at least one RGB color mode image is extracted from each video clip to obtain the video frame corresponding to the video of the portrait side.
[0137] In the embodiment of the present application, there is no limitation on the image format of each video frame in the multiple video frames. It can be an image in RGB color mode or an image in other color modes. RGB is a color standard in the industry. Various colors are obtained by changing the three color channels of red (Red, R for short), green (Green, G for short), and blue (Blue, B for short) and superimposing them with each other. RGB represents the colors of the three channels of red, green, and blue.
[0138] Then, the extracted video frame of the national emblem is input into the document verification model, and the document to be verified is evaluated based on the video frame corresponding to the national emblem, and the first verification result corresponding to the video of the national emblem is obtained. The extracted video frame of the portrait is input into the document verification model, and the document to be verified is evaluated based on the video frame corresponding to the portrait, and the second verification result corresponding to the video of the portrait is obtained. The first verification result and the second verification result are used as the basis for judging whether the ID card is authentic. Only when the verification results of the two videos are both judged to be authentic, the verification result of the ID card is authentic. In one example, the authenticity of the document to be verified can be the classification result of the document to be verified, for example, 1 represents that the document to be verified is a fake document, and 0 represents that the document to be verified is authentic.
[0139] Through the embodiments of the present application, the authenticity of the certificate to be verified can be determined by the verification results corresponding to the front video data and the back video data of the certificate to be verified. Only when the verification results of the two videos are both authentic can the certificate to be verified be determined to be authentic. This double verification method improves the accuracy and security of certificate verification.
[0140] Optionally, when determining the authenticity of the document to be verified based on the first verification result of the front video data of the document to be verified and the second verification result of the back video data of the document to be verified, there may be the following situations:
[0141] Case 1: If the first verification result indicates that the certificate to be verified is a genuine certificate, and the second verification result indicates that the certificate to be verified is a genuine certificate, then the certificate to be verified is a genuine certificate.
[0142] Scenario 2: If the first verification result indicates that the document to be verified is a genuine document, and the second verification result indicates that the document to be verified is a fake document, then the document to be verified is a fake document.
[0143] Scenario 3: If the first verification result indicates that the document to be verified is a false document, and the second verification result indicates that the document to be verified is a true document, then the document to be verified is a false document.
[0144] Scenario 4: If the first verification result indicates that the document to be verified is a false document, and the second verification result indicates that the document to be verified is a false document, then the document to be verified is a false document.
[0145] That is, only if both the first verification result and the second verification result indicate that the certificate to be verified is a genuine certificate, the certificate to be verified is determined to be a genuine certificate; otherwise, the certificate to be verified is determined to be a forged certificate.
[0146] In addition, it should be noted that, in an optional implementation, the certificate verification model used in the embodiment of the present application may include a first sub-verification model and a second sub-verification model. When verifying the certificate to be verified, multiple first video frames extracted from the front video data can be input into the first sub-model of the certificate verification model to obtain a first verification result, and multiple second video frames extracted from the back video data can be input into the second sub-model of the certificate verification model to obtain a second verification result; then, based on the first verification result and the second verification result, the authenticity of the certificate to be verified is determined.
[0147] In an optional embodiment, extracting a plurality of video frames from the video data includes:
[0148] Dividing the video data into a plurality of video segments, and extracting at least one video frame from each video segment;
[0149] or,
[0150] Determine a video frame sequence corresponding to the video data, and extract video frames from the video frame sequence according to a set extraction rule; wherein the set extraction rule includes: setting a time interval or setting a video frame interval.
[0151] Of course, extracting multiple first video frames from the front video data and extracting multiple second video frames from the back video data can be performed in the above manner; of course, other methods can also be used for extraction, and the embodiments of the present application are not limited to this.
[0152] Optionally, if the executor of the method for verifying the certificate in the embodiment of the present application is a user terminal, then the video data of the certificate to be verified can be obtained by the user terminal, and then multiple video frames are extracted according to a certain frame extraction strategy. Optionally, if the executor of the method for verifying the certificate in the embodiment of the present application is a server, the video data of the certificate to be verified can be obtained by the user terminal, and then multiple video frames are extracted according to a certain frame extraction strategy, and the user terminal sends the extracted multiple video frames to the server, or the video data of the certificate to be verified can be obtained by the user terminal, and the user terminal sends the video data to the server, and the server extracts multiple video frames according to a certain frame extraction strategy. It can be understood that the step of extracting frames from video data to obtain multiple video frames can be combined with the various embodiments in the text. The following are several possible scenarios provided in the embodiments of the present application.
[0153] In one example, the video data is divided into at least two video segments (such as 2, 10, etc.), and then a certain frame image is extracted from each video segment according to a certain frame extraction strategy to obtain multiple video frames. Specifically, at least one frame image can be extracted from each video segment, and the frame images extracted from each video segment are used as multiple video frames.
[0154] When dividing the video data into at least two video segments, the video data may be divided into at least two video segments at a fixed time interval (e.g., every 3 seconds), or the video data may be divided into a fixed number (e.g., 10) of video segments. Alternatively, the video data may be evenly divided into at least two video segments based on the total duration of the video data. This is not limited herein.
[0155] In one example, a video frame sequence corresponding to the video data is determined, and video frames can be extracted from the video sequence according to a set extraction rule. For example, video frames can be extracted from the video sequence at a set time interval (such as every 1 second), or video frames can be extracted from the video sequence at a set video frame interval (such as every 3 video frames).
[0156] Through the embodiments of the present application, a frame extraction method is adopted to extract certain frame images from a video sequence to obtain multiple video frames, which can remove some redundant information, reduce the amount of calculation, and improve calculation efficiency.
[0157] The following is a detailed description in conjunction with a specific embodiment. Taking the document to be verified as a resident identity card (hereinafter referred to as the identity card), and the video data as two videos of the national emblem side and the portrait side of the identity card as an example, the specific process of the document verification processing is described. The specific processing steps for the identity card verification judgment are as follows:
[0158] Step 1: Take two videos (i.e. video data) of the national emblem side and the portrait side of the ID card;
[0159] The duration of each video segment can be set according to demand, and is not limited in the embodiment of the present application. For example, it can be 1 to 3 seconds. Among them, the image format of each video frame in the video can be an RGB format image. It is understandable that it can also be an image in other image formats, which is not limited in the present embodiment.
[0160] Step 2: split the national emblem video and the portrait video into N video segments (N≥1, optional, N≥2).
[0161] Step 3: Extract one RGB image from each of the N videos of the national emblem surface after the splitting, and form a total of N images of the national emblem surface, and input these N images of the national emblem surface into the document verification model for evaluation. And extract one RGB image from each of the N videos of the portrait surface after the splitting, and form a total of N images of the portrait surface, and input these N images of the portrait surface into the document verification model for evaluation.
[0162] Optionally, there may be multiple ways to input the N images of the national emblem side and the N images of the portrait side into the document verification model. For example, the N images of the national emblem side and the N images of the portrait side may be input into the document verification model at the same time, or the N images of the national emblem side and the N images of the portrait side may be input separately. The input method of the N images of the national emblem side and the N images of the portrait side is not limited in the embodiments of the present application.
[0163] Among them, the N images corresponding to the video of the national emblem side and the N images corresponding to the video of the portrait side are multiple video frames of the above video data.
[0164] Step 4: Determine whether the ID card in the input video is real or fake based on the evaluation result (i.e., evaluation value) obtained by the document verification model.
[0165] Among them, the first verification result corresponding to the national emblem face video can be obtained through the document verification model, and the second verification result corresponding to the portrait face video can be obtained through the document verification model.
[0166] Step 5, based on the verification results of the two videos of the national emblem and the portrait, the final verification result is returned to the user. When both the national emblem and the portrait images are detected, it is considered that the ID card verification test has passed; otherwise, the verification test has failed.
[0167] In one example, the video data may also include a first facial image of a target object holding an ID to be verified, and then a first similarity between the first facial image and a second facial image on the ID to be verified is determined. Based on the first similarity, prompt information is obtained. The prompt information is used to prompt whether the holder of the ID to be verified is the target object himself. For example, the prompt information may be “Please note that the ID is not held by the person himself!” The prompt information may be set according to the actual application scenario and is not limited here.
[0168] Optional, see Figure 3 , Figure 3 is a schematic diagram of the principle of a certificate verification model provided in an embodiment of the present application, such as Figure 3 As shown, the document verification model includes a convolutional layer, a first fully connected layer, a second fully connected layer and a third fully connected layer, wherein the input of the convolutional layer is video data, the output of the convolutional layer is respectively connected to the input of the first fully connected layer and the second fully connected layer, and the output of the first fully connected layer and the output of the second fully connected layer are respectively connected to the input of the third fully connected layer.
[0169] in, Figure 3 In the example shown, the number of the first fully connected layer, the second fully connected layer, and the third fully connected layer is one. In practical applications, the number of the first fully connected layer, the second fully connected layer, and the third fully connected layer can be at least one, which is not limited here. The specific training process can be referred to the description below and will not be repeated here.
[0170] Optionally, in a specific implementation, the first fully connected layer and the second fully connected layer may be the same fully connected layer or different fully connected layers.
[0171] like Figure 3 As shown, multiple video frames of the document to be verified are input into the convolution layer to obtain convolution features of the multiple video frames, and the convolution features of the multiple video frames are extracted by the first fully connected layer to obtain sub-feature vectors of the multiple video frames. The sub-feature vectors of the multiple video frames are feature fused by the second fully connected layer to obtain fused feature vectors of the multiple video frames. The sub-feature vectors of the multiple video frames and the fused feature vectors of the video data are processed by the third fully connected layer to determine the authenticity of the document to be verified.
[0172] Through the embodiments of the present application, most of the existing document verification methods are based on single-frame RGB images, which lose a lot of useful information. In the embodiments of the present application, multiple RGB images are extracted by sparse frame extraction, and the information between frames in the video is utilized, which not only removes redundant information and reduces the amount of calculation, but also improves the accuracy and work efficiency of document verification.
[0173] The training process of the certificate verification model is described in detail below. It can be understood that the training process of the certificate verification model can be combined with any embodiment of the present application.
[0174] In an optional embodiment, the above-mentioned document verification model is trained in the following manner:
[0175] Acquire a video sample set; wherein the video sample set includes video data of multiple sample certificates and annotation data of each of the sample certificates; the annotation data of the sample certificates indicates whether the sample certificates are authentic certificates or forged certificates;
[0176] Input the video sample set into the initial certificate verification model to obtain the evaluation value corresponding to each sample certificate in the video sample set;
[0177] The loss calculation is performed based on the annotated data of each of the above-mentioned sample certificates and each of the above-mentioned evaluation values, and the model parameters of the above-mentioned initial certificate verification model are updated based on the result of the loss calculation to obtain the above-mentioned certificate verification model.
[0178] Optionally, the video sample set includes video data of multiple sample certificates and annotation data of each sample certificate. The video sample set may include a true certificate video set and a false certificate video set. In the embodiment of the present application, there is no limitation on the proportion of the true certificate video set and the false certificate video set. For example, the proportion of the true certificate video set and the false certificate video set in the video sample set may be equal. The true certificate video set includes video data of at least two sample certificates and annotation data of each sample certificate, and the false certificate video set includes video data of at least two sample certificates and annotation data of the certificates of each sample video. Among them, the annotation data of each sample certificate indicates whether the sample certificate is a real certificate or a forged certificate.
[0179] After obtaining the video sample set, the video data of each sample certificate in the video sample set can be input into the initial certificate verification model one by one, wherein the initial certificate verification model can be a neural network model. Then, the evaluation value corresponding to each sample certificate in the video sample set is obtained through the initial certificate verification model, and the loss calculation is performed based on the labeled data of each sample certificate and each evaluation value to obtain the value of the total loss function corresponding to the initial certificate verification model. The initial certificate verification model is iteratively trained based on the total loss function, the value of the total loss function, and the video data of each sample certificate in the video sample set, and the model parameters of the initial certificate verification model are continuously updated until the preset training end condition is met. The training end condition can be the convergence of the total loss function. If the total loss function converges, the initial certificate verification model at the time of convergence is used as the final certificate verification model. If the total loss function does not converge, the initial certificate verification model is continuously trained until the total loss function converges.
[0180] Optionally, for each sample ID, the video data of the sample ID includes each frame of sample image, and the annotation data of the sample ID includes first annotation data of each frame of sample image of the video data of the sample ID and second annotation data of the video data of the sample ID, wherein each first annotation data represents whether the ID to be verified in the corresponding sample image is a real ID or a forged ID, and the second annotation data represents whether the ID to be verified corresponding to the entire video data of the sample ID is a real ID or a forged ID.
[0181] It should be noted that, in actual applications, the first annotation results of each frame of sample images and the second annotation data of the video data of the sample certificate are consistent. When annotating each frame of sample images, the second annotation results can be directly used as the first annotation results. Alternatively, each frame of sample images is not annotated, and the second annotation results are directly used to characterize the authenticity of each frame of sample images.
[0182] For any of the above sample ID video data, each frame of sample image of the sample ID video data can be input into the initial ID verification model, and the initial ID verification model performs the following processing:
[0183] Extracting the first sample convolution feature of each frame of sample image; obtaining the first prediction evaluation value of the frame of sample image based on the first sample convolution feature of each frame of sample image; obtaining the fused convolution feature of the video data of the sample certificate by fusing the first sample convolution feature of each frame of sample image, and obtaining the second prediction evaluation value of the video data of the sample certificate based on the first sample convolution feature of each frame of sample image and the fused convolution feature of the video data of the sample certificate, wherein the prediction verification result corresponding to the video data of the sample certificate includes the first prediction evaluation value of each frame of sample image and the second prediction evaluation value of the video data of the sample certificate;
[0184] Calculate a first loss value of a first loss function based on a first predicted evaluation value of each frame of sample image of the video data of each sample document and the first labeled data;
[0185] Calculating a second loss value of a second loss function based on a second predicted evaluation value of the video data of each sample certificate and the second labeled data;
[0186] The total loss value of the total loss function is determined based on the first loss value of the first loss function and the second loss value of the second loss function, and the model parameters of the initial document verification model are adjusted based on the total loss value of the total loss function.
[0187] Optionally, taking the identity card as an example, the specific training process of the document verification model is described. The specific steps are as follows:
[0188] Data preprocessing: Collect a batch of ID card videos and annotate them, extract the video frames into RGB images, obtain a video sample set, and use the video sample set to train a document verification model (also called a document authentication model).
[0189] Among them, short videos of real and fake ID cards can be collected to form a real ID video set and a fake ID video set. The video sample set includes the real ID video set and the fake ID video set. Then, each video in the real ID video set and the fake ID video set is split into N (N>= 1) intervals, and an RGB image is extracted from each interval. The video of each interval is sparsely extracted to obtain N RGB images, which removes some redundant information and reduces the amount of calculation.
[0190] For the video data of each sample certificate in the video sample set, the neural network model is trained using each frame of sample images (such as N RGB images) generated in the video data of each sample certificate;
[0191] The evaluation results of the RGB images are integrated to determine whether the ID card in the video is authentic.
[0192] Specifically, for the video data of each sample certificate in the video sample set, the N RGB images extracted are sent to the initial certificate verification model (which can be a convolutional neural network model) to obtain N three-dimensional convolution features. Next, these N convolution features will be processed in two aspects. On the one hand, these N convolution features are passed through a fully connected layer to obtain N (1, 2) vectors (denoted as A) (i.e., the evaluation values corresponding to each sample certificate). Each vector is two scores, one for the true certificate and the other for the false certificate. These N vectors are actually the scores of each of the N images. On the other hand, these N convolution features are stacked to form a larger convolution feature. The stacked convolution features are then passed through a fully connected layer to obtain a (1, 2) vector. A total of N+1 (1, 2) vectors are obtained. These N+1 (1, 2) vectors are finally passed through a fully connected layer to obtain the final (1, 2) vector (denoted as B), which is the score of the final sample certificate video data.
[0193] The final loss function is composed of score A and score B. The cross entropy loss function (not limited to this loss function) can be used as the loss function. The loss function of score A (that is, the first loss function) is as follows:
[0194] (1)
[0195] Where N is the N sample images fed into the initial document verification model, represents the original annotation result of the i-th image among the N sample images (i.e., the annotation data of the i-th frame image of the video data of the sample ID, which is consistent with the annotation result of the video data of the sample ID), The value can be 0 or 1, 1 represents a false certificate, and 0 represents a true certificate. Represents the evaluation value of the i-th frame image of the video data of the sample certificate, ( ) represents the evaluation value of the i-th image, represents the probability that the certificate in the i-th sample image is a real certificate, Represents the probability that the certificate in the i-th sample image is a fake certificate.
[0196] Formula (1) gives the loss value corresponding to the video data of a sample certificate. In practical applications, the first loss value corresponding to the first loss function is the sum of the loss values of the video data of all sample certificates.
[0197] The loss function of score B (i.e. the second loss function) is as follows:
[0198] (2)
[0199] in, is the second annotation data representing the video data of the sample document, represents the second predicted evaluation value of the sample video, The probability that the ID in the video data representing the sample ID is a genuine ID.
[0200] Formula (2) gives the loss value corresponding to the video data of a sample certificate. In practical applications, the second loss value corresponding to the second loss function is the sum of the loss values of the video data of all sample certificates.
[0201] The final loss function is:
[0202] (3)
[0203] in, and They are the coefficients or weights of losses A and B respectively, which can be set according to actual needs, for example, they can be set to 1 / 2.
[0204] For each training, whether the training is finished can be judged according to the value of the total loss function. If the total loss function converges, the model training can be ended. If it does not converge, the gradient descent algorithm can be used to update the model parameters of the initial document verification model and repeat the above training steps.
[0205] The initial document verification model is iteratively trained, and after a certain number of cycles, the final document verification model is obtained.
[0206] Among them, the embodiments of the present application do not limit the specific structure of the document verification model. For example, it can be a network model based on a convolutional neural network, or a network model based on a recurrent neural network, etc.
[0207] Through the embodiments of the present application, the final certificate verification model can be obtained by training the initial certificate verification model, so that the obtained certificate verification model has the ability to evaluate the authenticity of the certificate, and then the certificate to be verified is verified by the trained certificate verification model, thereby improving the verification efficiency.
[0208] See also Figure 4 , Figure 4 1 is a schematic diagram of a structure of a certificate verification device provided in an embodiment of the present application. The certificate verification device 1 provided in an embodiment of the present application comprises:
[0209] The video data acquisition module 11 is used to acquire the video data of the document to be verified;
[0210] A video frame extraction module 12, used to extract multiple video frames from the above video data;
[0211] The verification module 13 is used to verify the authenticity of the above-mentioned document to be verified based on the above-mentioned multiple video frames and a pre-trained document verification model.
[0212] In a feasible embodiment, the verification module 13 includes:
[0213] A first processing unit is used to input the above-mentioned multiple video frames into the above-mentioned certificate verification model, and evaluate the authenticity of the above-mentioned certificate to be verified based on the above-mentioned multiple video frames through the above-mentioned certificate verification model to obtain an evaluation value corresponding to the above-mentioned certificate to be verified; wherein the above-mentioned evaluation value includes a score value or a label value, and the above-mentioned score value includes a score value of the above-mentioned certificate to be verified being a genuine certificate and / or a score value of the above-mentioned certificate to be verified being a fake certificate;
[0214] The second processing unit is used to obtain the evaluation value output by the certificate verification model, and determine the authenticity of the certificate to be verified based on the evaluation value.
[0215] In a feasible embodiment, the first processing unit is specifically used to:
[0216] Determine the sub-feature vectors corresponding to each of the video frames through the document verification model;
[0217] Determine the fusion feature vector corresponding to each of the above video frames;
[0218] Based on each of the above sub-feature vectors and the above fused feature vector, an evaluation value corresponding to the above document to be verified is determined.
[0219] In a feasible embodiment, the first processing unit is specifically configured to:
[0220] Obtaining convolution features corresponding to each of the above video frames;
[0221] Concatenate the above convolutional features to obtain concatenated convolutional features;
[0222] The fused feature vector is determined based on the concatenated convolutional features.
[0223] In a feasible embodiment, the first processing unit is specifically used to:
[0224] Determine the sub-feature vectors corresponding to each of the video frames through the document verification model;
[0225] The above sub-feature vectors are fused to obtain the evaluation value corresponding to the above-mentioned certificate to be verified.
[0226] In a feasible embodiment, the video data includes the front video data of the document to be verified and the back video data of the document to be verified; the video frame extraction module 12 is specifically used for:
[0227] Extracting a plurality of first video frames from the front video data, and extracting a plurality of second video frames from the back video data;
[0228] Accordingly, the verification module 13 includes:
[0229] A third processing unit is used to input the plurality of first video frames and the plurality of second video frames into the document verification model, and evaluate the authenticity of the document to be verified based on the plurality of first video frames and the plurality of second video frames through the document verification model to obtain an evaluation value corresponding to the document to be verified;
[0230] The first determination unit is used to obtain the evaluation value output by the certificate verification model, and determine the authenticity of the certificate to be verified based on the evaluation value.
[0231] In a feasible embodiment, the video data includes the front video data of the document to be verified and the back video data of the document to be verified; the verification module includes:
[0232] A verification unit, configured to verify the authenticity of the document to be verified based on the plurality of first video frames extracted from the front video data and the document verification model, and obtain a first verification result; and to verify the authenticity of the document to be verified based on the plurality of second video frames extracted from the back video data and the document verification model, and obtain a second verification result;
[0233] The second determination unit is used to determine the authenticity of the document to be verified based on the first verification result and the second verification result.
[0234] In a feasible embodiment, the second determining unit is configured to:
[0235] If the first verification result and the second verification result both indicate that the document to be verified is a genuine document, then the document to be verified is determined to be a genuine document; otherwise, the document to be verified is determined to be a forged document.
[0236] In a feasible embodiment, the video frame extraction module is specifically used for:
[0237] Dividing the video data into a plurality of video segments, and extracting at least one video frame from each video segment;
[0238] or,
[0239] Determine a video frame sequence corresponding to the video data, and extract video frames from the video frame sequence according to a set extraction rule; wherein the set extraction rule includes: setting a time interval or setting a video frame interval.
[0240] In a feasible embodiment, the above device further includes a training module, wherein the training module is specifically used to:
[0241] Acquire a video sample set; wherein the video sample set includes video data of multiple sample certificates and annotation data of each of the sample certificates; the annotation data of the sample certificates indicates whether the sample certificates are authentic certificates or forged certificates;
[0242] Input the video sample set into the initial certificate verification model to obtain the evaluation value corresponding to each sample certificate in the video sample set;
[0243] The loss calculation is performed based on the annotated data of each of the above-mentioned sample certificates and each of the above-mentioned evaluation values, and the model parameters of the above-mentioned initial certificate verification model are updated based on the result of the loss calculation to obtain the above-mentioned certificate verification model.
[0244] The device provided in the embodiment of the present application obtains video data of the document to be verified, and then extracts multiple video frames from the video data; finally, the authenticity of the document to be verified is verified based on the multiple video frames and a pre-trained document verification model. The method provided in the embodiment of the present application, when verifying the authenticity of the document to be verified, verifies the authenticity of the document to be verified based on the multiple video frames extracted from the video data of the document to be verified and the pre-trained document verification model. Since multiple video frames are used, it can avoid the problem of unreliable verification results of the document to be verified due to insufficient information when only a single frame image is used for judgment, so that the factors of multiple video frames can be comprehensively considered when verifying the document, thereby effectively improving the accuracy of document verification.
[0245] In a specific implementation, the above-mentioned device 1 can execute the above-mentioned functions through its built-in functional modules. Figure 2 For the implementation methods provided in each step, please refer to the implementation methods provided in the above steps for details, which will not be repeated here.
[0246] See also Figure 5 , Figure 5 Schematic diagram of the structure of the electronic device provided in the embodiment of the present application. Figure 5As shown, the electronic device 1000 in this embodiment may include: a processor 1001, a network interface 1004 and a memory 1005. In addition, the above-mentioned electronic device 1000 may also include: a user interface 1003, and at least one communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. Among them, the user interface 1003 may include a display screen (Display), a keyboard (Keyboard), and the user interface 1003 may optionally include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or it may be a non-volatile memory (non-volatile memory), such as at least one disk storage. The memory 1005 may optionally also be at least one storage device located away from the aforementioned processor 1001. As Figure 5 As shown, the memory 1005 as a computer-readable storage medium may include an operating system, a network communication module, a user interface module, and a device control application program.
[0247] exist Figure 5 In the electronic device 1000 shown, the network interface 1004 can provide a network communication function; the user interface 1003 is mainly used to provide an input interface for the user; and the processor 1001 can be used to call the device control application stored in the memory 1005.
[0248] It should be understood that in some feasible implementations, the processor 1001 may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The memory may include a read-only memory and a random access memory, and provide instructions and data to the processor. A portion of the memory may also include a non-volatile random access memory. For example, the memory may also store information about the type of device.
[0249] In a specific implementation, the electronic device 1000 can execute the above-mentioned functions through its built-in functional modules. Figure 2For the implementation methods provided in each step, please refer to the implementation methods provided in the above steps for details, which will not be repeated here.
[0250] The present application also provides a computer-readable storage medium, which stores a computer program and is executed by a processor to implement Figure 2 For the methods provided in each step, please refer to the implementation methods provided in the above steps for details, which will not be repeated here.
[0251] The computer-readable storage medium may be an internal storage unit of the task processing device provided in any of the aforementioned embodiments, such as a hard disk or memory of an electronic device. The computer-readable storage medium may also be an external storage device of the electronic device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device. The computer-readable storage medium may also include a magnetic disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc. Further, the computer-readable storage medium may also include both an internal storage unit of the electronic device and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by the electronic device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.
[0252] The embodiment of the present application provides a computer program product or a computer program, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes Figure 2 The methods provided in each step.
[0253] The terms "first", "second", etc. in the claims, specification and drawings of the present application are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, system, product or electronic device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or electronic devices. Mentioning "embodiment" in this article means that the specific features, structures or characteristics described in conjunction with the embodiment may be included in at least one embodiment of the present application. Displaying the phrase at various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments. The term "and / or" used in the present application specification and the attached claims refers to any combination of one or more of the items listed in association and all possible combinations, and includes these combinations.
[0254] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Professional and technical personnel may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0255] The above disclosure is only the preferred embodiment of the present application, which cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
Claims
1. A method for verifying a certificate, characterized in that: include: Obtain video data of the document to be verified; Extracting a plurality of video frames from the video data; Verifying the authenticity of the document to be verified based on the multiple video frames and a pre-trained document verification model; The document verification model is trained in the following way: Acquire a video sample set; wherein the video sample set includes video data of multiple sample certificates and annotation data of each sample certificate in the multiple sample certificates, and the annotation data of each sample certificate is used to characterize whether each sample certificate is a real certificate or a forged certificate; Inputting the video sample set into an initial certificate verification model to obtain an evaluation value corresponding to each sample certificate; Based on the labeled data of each sample certificate and the evaluation value corresponding to each sample certificate, loss calculation is performed, and based on the result of the loss calculation, the model parameters of the initial certificate verification model are updated to obtain the certificate verification model; The step of inputting the video sample set into an initial certificate verification model to obtain an evaluation value corresponding to each sample certificate includes: Extracting a first sample convolution feature of each frame of sample image of the video data of any sample certificate among the sample certificates; Based on the first sample convolution feature of each frame of the sample image, obtaining a first prediction evaluation value of each frame of the sample image; Obtaining fused convolution features of the video data of any sample certificate by fusing the first sample convolution features of each frame of sample image; Based on the first sample convolution features of the sample images of each frame and the fused convolution features of the video data of any sample certificate, a second predicted evaluation value of the video data of any sample certificate is obtained.
2. The method according to claim 1, characterized in that The verifying the authenticity of the document to be verified based on the multiple video frames and the pre-trained document verification model includes: Inputting the multiple video frames into the certificate verification model, and evaluating the authenticity of the certificate to be verified based on the multiple video frames by the certificate verification model to obtain an evaluation value corresponding to the certificate to be verified; wherein the evaluation value includes a score value or a label value, and the score value includes a score value indicating that the certificate to be verified is a genuine certificate and / or a score value indicating that the certificate to be verified is a fake certificate; The evaluation value output by the certificate verification model is obtained, and the authenticity of the certificate to be verified is determined based on the evaluation value.
3. The method according to claim 2, characterized in that The step of evaluating the authenticity of the certificate to be verified based on the multiple video frames by using the certificate verification model to obtain an evaluation value corresponding to the certificate to be verified includes: Determine the sub-feature vectors corresponding to each of the video frames respectively through the document verification model; Determining a fusion feature vector corresponding to each of the video frames; Based on each of the sub-feature vectors and the fused feature vector, an evaluation value corresponding to the document to be verified is determined.
4. The method according to claim 3, characterized in that The determining of the fusion feature vector corresponding to each of the video frames includes: Obtaining convolution features corresponding to each of the video frames; Concatenating the convolutional features to obtain concatenated convolutional features; The fused feature vector is determined based on the concatenated convolutional features.
5. The method according to claim 2, characterized in that The step of evaluating the authenticity of the certificate to be verified based on the multiple video frames by using the certificate verification model to obtain an evaluation value corresponding to the certificate to be verified includes: Determine the sub-feature vectors corresponding to each of the video frames respectively through the document verification model; Each of the sub-feature vectors is fused to obtain an evaluation value corresponding to the document to be verified.
6. The method according to any one of claims 1 to 5, characterized in that The video data includes the front video data of the document to be verified and the back video data of the document to be verified; The verifying the authenticity of the document to be verified based on the multiple video frames and the pre-trained document verification model includes: Based on a plurality of first video frames extracted from the front video data and the document verification model, verifying the authenticity of the document to be verified to obtain a first verification result; and based on a plurality of second video frames extracted from the back video data and the document verification model, verifying the authenticity of the document to be verified to obtain a second verification result; Based on the first verification result and the second verification result, the authenticity of the document to be verified is determined.
7. The method according to claim 6, characterized in that The determining the authenticity of the document to be verified based on the first verification result and the second verification result includes: If both the first verification result and the second verification result indicate that the document to be verified is a genuine document, then the document to be verified is determined to be a genuine document; otherwise, the document to be verified is determined to be a forged document.
8. The method according to any one of claims 1 to 5, characterized in that The video data includes the front video data of the document to be verified and the back video data of the document to be verified; The extracting a plurality of video frames from the video data comprises: Extracting a plurality of first video frames from the front video data, and extracting a plurality of second video frames from the back video data; Accordingly, the verifying the authenticity of the document to be verified based on the multiple video frames and the pre-trained document verification model includes: Inputting the plurality of first video frames and the plurality of second video frames into the document verification model, and evaluating the authenticity of the document to be verified based on the plurality of first video frames and the plurality of second video frames by the document verification model to obtain an evaluation value corresponding to the document to be verified; The evaluation value output by the certificate verification model is obtained, and the authenticity of the certificate to be verified is determined based on the evaluation value.
9. The method according to any one of claims 1 to 5, characterized in that: The extracting a plurality of video frames from the video data comprises: Dividing the video data into a plurality of video segments, and extracting at least one video frame from each video segment; or, Determine a video frame sequence corresponding to the video data, and extract video frames from the video frame sequence according to a set extraction rule; wherein the set extraction rule includes: setting a time interval or setting a video frame interval.
10. A device for verifying a certificate, characterized in that: The device comprises: A video data acquisition module, used to acquire video data of the document to be verified; A video frame extraction module, used for extracting a plurality of video frames from the video data; A verification module, used to verify the authenticity of the document to be verified based on the multiple video frames and a pre-trained document verification model; The device further comprises a training module, wherein the training module is used to: Acquire a video sample set; wherein the video sample set includes video data of multiple sample certificates and annotation data of each sample certificate in the multiple sample certificates, and the annotation data of each sample certificate is used to characterize whether each sample certificate is a real certificate or a forged certificate; Inputting the video sample set into an initial certificate verification model to obtain an evaluation value corresponding to each sample certificate; Based on the labeled data of each sample certificate and the evaluation value corresponding to each sample certificate, loss calculation is performed, and based on the result of the loss calculation, the model parameters of the initial certificate verification model are updated to obtain the certificate verification model; The training module is specifically used for: Extracting a first sample convolution feature of each frame of sample image of the video data of any sample certificate among the sample certificates; Based on the first sample convolution feature of each frame of the sample image, obtaining a first prediction evaluation value of each frame of the sample image; Obtaining fused convolution features of the video data of any sample certificate by fusing the first sample convolution features of each frame of sample image; Based on the first sample convolution features of the sample images of each frame and the fused convolution features of the video data of any sample certificate, a second predicted evaluation value of the video data of any sample certificate is obtained.
11. An electronic device, characterized in that: comprising a processor and a memory, wherein the processor and the memory are connected to each other; The memory is used to store computer programs; The processor is configured to execute the method according to any one of claims 1 to 9 when calling the computer program.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the method according to any one of claims 1 to 9.
