Card identification method and device
By collecting card certificate images in various ways on the client and using card certificate identification models, the problem of forging card certificate images in the existing technology is solved, the security of the eKYC system is improved, and the accuracy of authenticity identification of card certificates is ensured. .
Patent Information
- Application Number
- CN202411312059.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-19
- Publication Date
- 2024-12-13
AI Technical Summary
The prior art is difficult to effectively identify forged card certificate images, which has led to the threat of the security of the eKYC system. A method is needed to distinguish between real and forged card certificate images.
By instructing the user to acquire card certificate images in multiple ways, such as acquisition under different angles and flash conditions, multi-frame images are generated, and the trained card certificate authentication model is used to determine whether the image is collected in multiple ways on the server. To determine the authenticity of the card certificate.
It realizes the authenticity of card certificates, improves the security of the eKYC system, prevents injection attacks of forged card certificate images, and ensures the security of customer information and property.
Smart Images

Figure CN119131565A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and more particularly to a card identification method and device. Background Art
[0002] At present, in order to provide users with better and safer services, institutions in the fields of financial services, banking, insurance, telecommunications and e-commerce generally use online eKYC (electronic know your customer) systems to enable relevant institutions to understand the identity and background of customers with whom they establish business relationships, in order to prevent risks such as money laundering, fraud and illegal financing.
[0003] In the eKYC system, the customer's card needs to be verified and identified to verify the customer's identity. At present, there are some malicious parties who use image generation technology to forge card images (for example, card images generated by AIGC (Artificial Intelligence Generated Content)), and then use such forged card images to attack the eKYC system through injection attacks. In order to improve the security of their eKYC systems and protect customer information and property safety, relevant institutions need to identify and defend against injection attacks using such forged card images. Among them, the identification and defense of injection attacks using such forged card images depends to a certain extent on the identification of such forged card images.
[0004] Therefore, how to provide a card identification method that can identify the forged card images becomes an urgent problem to be solved. Summary of the invention
[0005] One or more embodiments of the present specification provide a card authentication method and device to authenticate the authenticity of a card.
[0006] According to a first aspect, a card authentication method is provided, which is applied to a server, and the method comprises:
[0007] receiving a plurality of frames of first card images for the card to be authenticated from a client, wherein the client is used to instruct a user to capture the image of the card to be authenticated in a plurality of ways, wherein the plurality of ways enables the client to capture different images of the card to be authenticated;
[0008] Using the trained card identification model, it is determined whether the multiple frames of first card images are collected in the multiple ways to determine the authenticity identification result of the card to be identified.
[0009] According to a second aspect, a card authentication method is provided, which is applied to a client and includes:
[0010] In the process of instructing the user to capture an image of the card to be authenticated in multiple ways, acquiring multiple frames of first card images of the card to be authenticated, wherein the multiple ways enable the client to capture different images of the card to be authenticated;
[0011] The multiple frames of first card images are sent to a server, so that after receiving the multiple frames of first card images, the server uses a trained card identification model to determine whether the multiple frames of first card images are collected in the multiple ways, so as to determine the authenticity identification result of the card to be identified.
[0012] According to a third aspect, a card authentication device is provided, which is deployed on a server and includes:
[0013] a receiving module configured to receive multiple frames of first card images of a card to be authenticated from a client, wherein the client is used to instruct a user to capture images of the card to be authenticated in multiple ways, and the multiple ways enable the client to capture different images of the card to be authenticated;
[0014] The first determination module is configured to use a trained card identification model to determine whether the multiple frames of first card images are collected in the multiple ways, so as to determine an authenticity identification result for the card to be identified.
[0015] According to a fourth aspect, a card authentication device is provided, which is deployed on a client, and the method includes:
[0016] an acquisition module, configured to acquire multiple frames of first card images of the card to be authenticated in a process of instructing the user to acquire images of the card to be authenticated in multiple ways, wherein the multiple ways enable the client to acquire different images of the card to be authenticated;
[0017] The sending module is configured to send the multiple frames of first card images to the server, so that after receiving the multiple frames of first card images, the server uses a trained card identification model to determine whether the multiple frames of first card images are collected in the multiple ways, so as to determine the authenticity identification result of the card to be identified.
[0018] According to a fifth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed in a computer, the computer is caused to execute the method described in the first aspect or the second aspect.
[0019] According to a sixth aspect, a computing device is provided, comprising a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method described in the first aspect or the second aspect is implemented.
[0020] According to the card identification method and device provided by the embodiment of this specification, the server receives multiple frames of first card images for the card to be identified from the client, wherein the client is used to instruct the user to collect the images of the card to be identified in multiple ways, and the multiple ways enable the client to collect different images of the card to be identified; using the trained card identification model, it is determined whether the multiple frames of first card images are collected in multiple ways to determine the authenticity identification result of the card to be identified. In the above process, considering that there is generally no change between the multiple frames of images injected by the injection attack method, when the client collects images for the card to be identified, it instructs the user to collect the images of the card to be identified in multiple ways, so that the multiple frames of card images obtained for the real card are different images; subsequently, after the server obtains the multiple frames of first card images for the card to be identified, it uses the trained card identification model to determine whether the multiple frames of first card images are collected in multiple ways, so as to determine whether the images collected by the client are real images, and then determine the authenticity identification result of the card to be identified, so as to identify the authenticity of the card. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0022] Figure 1 A schematic diagram of an implementation framework of an embodiment disclosed in this specification;
[0023] Figure 2 A flowchart of the training process of the card authentication model provided in the embodiment;
[0024] Figure 3 A schematic diagram of a process flow of a card authentication method provided in an embodiment;
[0025] Figure 4 A schematic diagram of another process flow of the card authentication method provided in the embodiment;
[0026] Figure 5 A schematic diagram of another process flow of the card authentication method provided in the embodiment;
[0027] Figure 6 A schematic diagram of another process flow of the card authentication method provided in the embodiment;
[0028] Figure 7 A schematic block diagram of a card authentication device deployed by a server provided in an embodiment;
[0029] Figure 8 A schematic block diagram of a card authentication device deployed by a client provided in an embodiment. DETAILED DESCRIPTION
[0030] The technical solutions of the embodiments of this specification will be described in detail below with reference to the accompanying drawings.
[0031] The embodiments of this specification disclose a card authentication method and device. The application scenarios and technical concepts of the method are first introduced as follows:
[0032] As mentioned above, in the eKYC system, it is necessary to verify and identify the customer's card (for example, including but not limited to bank cards, identity documents, etc.) to verify and identify the customer's identity. At present, there are some malicious parties that use image generation technology to forge card images (for example, card images generated by AIGC (Artificial Intelligence Generated Content), and then use such forged card images to inject attacks on the eKYC system through injection attacks. In order to improve the security of the eKYC system and protect customer information and property safety, relevant institutions need to identify and defend against injection attacks using such forged card images. Among them, the identification and defense of injection attacks using such forged card images depends to a certain extent on the identification of such forged card images.
[0033] When analyzing the forged card images used in the scenario of attacking the eKYC system through injection attacks, it was found that the multiple frames of forged card images used in an injection attack generally do not change, for example, their corresponding acquisition angles are often the same, that is, for the multiple frames of forged card images injected through the injection attack, their respective corresponding acquisition angles are generally unchanged (for example, the multiple frames of forged card images used in an injection attack may all be the same images).
[0034] In view of this, the inventor proposes a card authentication method to achieve the authentication of the authenticity of the card, and further achieve the authentication defense against the injection attack of the forged card image. Figure 1 FIG. 1 is a schematic diagram of an implementation scenario according to an embodiment disclosed in this specification. In this implementation scenario, an exemplary structure of a card authentication system is shown. Figure 1 As shown, the card authentication system includes a client and a server.
[0035] In some possible examples, the card identification system can be an associated system of any authentication system (such as an eKYC system) that needs to use a card to verify the identity of a customer, so that the authenticity of the card in the card image uploaded by the client is first verified through the associated system, and when it is verified that the card in the card image uploaded by the client is a genuine card, the authentication system is triggered to perform a process of authenticating the customer's identity using the genuine card. In some other possible examples, the card identification system is the aforementioned authentication system, so that the authenticity of the card in the card image uploaded by the client is first verified, and when it is verified that the card in the card image uploaded by the client is a genuine card, the process of authenticating the customer's identity using the genuine card is triggered.
[0036] On the client side, it is used to instruct the user to capture images of the card to be identified in a variety of ways, and obtain multiple frames of image X during the instruction process; then the client sends the multiple frames of image X to the server. The aforementioned multiple ways enable the client to capture different images of the card to be identified. Exemplarily, the multiple acquisition methods may include, but are not limited to, acquisition methods for capturing images of the card at different acquisition angles, and / or acquisition methods for capturing images of the card under conditions of setting a flash and without a flash. The acquisition methods for capturing images of the card at different acquisition angles may include: front acquisition methods and other non-front acquisition methods. The front acquisition methods and other non-front acquisition methods may be acquisition methods under conditions of setting no flash, or may be acquisition methods under conditions of setting a flash.
[0037] Subsequently, when referring to capturing images of cards and certificates by front-facing capturing methods and other non-front-facing capturing methods, without mentioning whether a flash is set or not, it may refer to capturing images of cards and certificates by front-facing capturing methods and other non-front-facing capturing methods under the condition of no flash being set.
[0038] Exemplarily, the frontal acquisition method may refer to an acquisition method in which the card is not tilted, for example, the plane where the card is located is parallel to the plane where the display page of the client is located. It may also be considered that the plane where the card is located is parallel to the plane where the image acquisition device called by the client is located. The parallelism may refer to that the angle between the plane where the card is located and the plane where the display page of the client is located is less than a preset angle threshold.
[0039] The other non-frontal collection methods may include but are not limited to: a collection method in which the card is tilted upward by X degrees, for example, the included angle between the plane where the card is located and the plane where the display page of the client is located is X degrees in the vertical direction; a collection method in which the card is tilted downward by Y degrees, for example, the included angle between the plane where the card is located and the plane where the display page of the client is located is -Y degrees in the vertical direction; a collection method in which the card is tilted to the left by Z degrees, for example, the included angle between the plane where the card is located and the plane where the display page of the client is located is Z degrees in the horizontal direction; a collection method in which the card is tilted to the right by Q degrees, for example, the included angle between the plane where the card is located and the plane where the display page of the client is located is -Q degrees in the horizontal direction. In some examples, considering that the user may need to manually assist in achieving the above (tilted) angle, the above (tilted) angle may be allowed to have an error, and the error may be within the allowable range. Among them, the aforementioned preset angle threshold is numerically smaller than the above X degrees, Y degrees, Z degrees and Q degrees.
[0040] like Figure 1 As shown, the process in which the client instructs the user to capture the image of the card in multiple ways may include: first instructing the user to capture the image of the card in a front capture mode (without flash) to obtain a first frame image X1; after the client obtains the first frame image X1, it can then randomly determine other capture modes 1 to instruct the user to capture the image of the card in the other capture mode 1 to obtain a second frame image X2.
[0041] Among them, the other acquisition method 1 can be any one of the other non-frontal acquisition methods mentioned above, or a acquisition method with a flash light condition (that is, the client can call the flash light of its device to allow the user to capture the image of the card with a flash light condition, and at this time, the card does not need to be tilted).
[0042] In some examples, such as Figure 1 As shown, the client obtains the aforementioned first frame image X1 and the second frame image X2, that is, obtains a multi-frame image X, and can directly upload (send) the multi-frame image X including the first frame image X1 and the second frame image X2 to the server. In some other examples, after obtaining the second frame image X2, the client can continue to randomly determine other acquisition methods 2 (which may be different from the aforementioned other acquisition methods 1) to instruct the user to acquire the image of the card with the other acquisition method 2 to obtain the third frame image X3, and so on, to obtain a multi-frame image X.
[0043] If the user is a normal user, that is, a real user who needs to authenticate his real card, he will cooperate with the instructions of the client and collect the image of the real card that needs to be authenticated through the image acquisition device called by the client in multiple ways. Correspondingly, the multiple frames of images X obtained by the client are different images collected by the client for the user's real card in the aforementioned multiple ways. If the user is an abnormal user (such as a malicious user who has stolen other users, such as other users' accounts), that is, a user who needs to attack the corresponding authentication system by injection attack (for example, a user who needs to pretend to be another user stolen by him), although the client will instruct the user to collect the image of the card that needs to be authenticated by the image acquisition device called by the client in multiple ways, this type of user will inject the card image forged in advance (for example, the card image forged by image generation technology, the card image forged in advance includes the card of the other user stolen in the aforementioned way) by injection attack, that is, the card image forged in advance is used as the image collected by the called image acquisition device and is obtained by the client. Correspondingly, the multiple frames of images X obtained by the client are the forged card images injected by the injection attack.
[0044] It is understandable that there are differences between the multiple frames of images actually acquired in various ways on the client side, and the differences include, but are not limited to: different acquisition angles leading to different card imaging angles and / or different flash settings during acquisition leading to different brightness presentation effects in the image (for example, bright spots exist in the image acquired when the flash is set, while bright spots do not exist in the image acquired without the flash). And as mentioned above, the acquisition angles corresponding to the multiple frames of forged card images injected by the injection attack are generally unchanged, that is, there will be no angle differences between the multiple frames of forged card images, and it is impossible to forge different brightness presentation effects when the flash is set and when there is no flash (for example, bright spots exist in the image acquired when the flash is set, while bright spots do not exist in the image acquired when there is no flash).
[0045] In view of the above situation, the server side has a pre-stored trained card identification model, which is used to determine whether the input multiple frames of images are collected in multiple ways indicated by the client, such as Figure 1As shown, after the server obtains the multi-frame image X uploaded by the client, in order to verify whether the multi-frame image X uploaded by the client is an image actually collected by the user for the card certificate to be authenticated, or a forged card certificate image injected by injection attack. In one implementation, the server can directly input the multi-frame image X received from the client into the card certificate authentication model, so as to use the card certificate authentication model to determine whether the multi-frame image X is collected in multiple ways indicated by the client, so as to determine the authenticity authentication result of the aforementioned card certificate to be authenticated. If it is determined that the multi-frame image X is an image collected in multiple ways indicated by the client, it is determined that the card certificate to be authenticated is a real card certificate; if it is determined that the multi-frame image X is not an image collected in multiple ways indicated by the client, it is determined that the card certificate to be authenticated is a forged card certificate.
[0046] In another implementation, after the server obtains the multi-frame image X uploaded by the client, it can generate the differential image C and / or the spectrum map P corresponding to the multi-frame image X based on the multi-frame image X received from the client, wherein the differential image C and / or the spectrum map P corresponding to the multi-frame image X can better highlight the differences between the multi-frame images X from the gradient dimension and the frequency domain dimension, respectively, to help improve the accuracy of the card authenticity identification result. Afterwards, the server inputs the multi-frame image X and the differential image C and / or the spectrum map P corresponding to the multi-frame image X into the card authentication model, so as to use the card authentication model to determine whether the multi-frame image X is collected in the multiple ways indicated by the client, so as to determine the authenticity identification result of the aforementioned card that needs to be authenticated.
[0047] The aforementioned trained card identification model may be a network model trained based on designated training data. The training data for training the card identification model may at least include a number of sample image groups and their corresponding label data, wherein a single sample image group at least includes: a plurality of sample card images obtained from real sample cards collected in the aforementioned multiple ways, and the label data corresponding to the sample image group includes: data indicating that the sample card corresponding to the sample image group is a real card. The multiple ways may include but are not limited to: collecting images of the card at different collection angles, and / or collecting images of the card with and without a flash.
[0048] In some examples, when a single sample image group includes multiple frames of sample card images, it may also include sample differential images and / or sample spectrum graphs generated based on the multiple frames of sample card images.
[0049] In some possible examples, the training data may also include a sample image group containing forged card images and label data thereof, wherein a single sample image group in such sample image group includes at least multiple frames of forged card images for forged cards (there may be no difference between the multiple frames of forged card images, or there may be some forged differences), and the label data of such sample image group includes data indicating that the corresponding card is a forged card. A single sample image group in such sample image group may also include a sample differential image and / or a sample frequency spectrum generated based on the frame of forged card image.
[0050] In the above process, considering that there is generally no change between the multiple frames of images injected by the injection attack method, when the client collects images for the card to be identified, the user is instructed to collect images of the card to be identified in multiple ways, so that the multiple frames of images obtained for the real card are different images; subsequently, after the server obtains the multiple frames of image X, it uses the trained card identification model to determine whether the multiple frames of image X are collected in multiple ways, and determines whether the images collected by the client are real images, and determines the authenticity identification results of the card corresponding to the multiple frames of image X, so as to identify the authenticity of the card.
[0051] The card authentication method provided in this specification is described in detail below in conjunction with specific embodiments.
[0052] During the card authentication process, the server needs to use the card authentication model to verify the authenticity of the card in the multiple frames of images uploaded by the client. The present specification also provides a training process for the card authentication model, which is first introduced below.
[0053] like Figure 2 As shown, a schematic diagram of a training process for a card identification model is shown. The training process for the card identification model can be performed by a first electronic device, and the first electronic device can be implemented by any device, equipment, platform, device cluster, etc. with computing and processing capabilities. The training process for the card identification model can include the following steps S210-S230:
[0054] In step S210, a card identification model to be trained is obtained, wherein the card identification model to be trained can be any network model in the related art that can classify image sequences, such as a network model based on a transformer, a long short-term memory neural network model, and other network models for image classification processing. Specifically, it can be a neural network model based on ViT (Visual Transformer). The first electronic device can obtain the card identification model to be trained in a preset storage location.
[0055] After the first electronic device obtains the card identification model to be trained, in step S220, it obtains a first sample image group and its first label data, wherein the first label data at least includes data indicating whether the card corresponding to the first sample image group is authentic.
[0056] The first sample image group and its first label data may be any sample image group and its label data obtained from the aforementioned training data. In one case, the first sample image group may at least include sample card images obtained from real sample cards collected in a variety of ways, that is, the card corresponding to the first sample image group is a real card, and accordingly, its corresponding first label data includes data indicating that the card corresponding to the first sample image group is a real card. The card corresponding to the first sample image group may be a bank card or an identity document.
[0057] Exemplarily, the multiple frames of sample card images in the first sample image group may include images of real card images captured at different acquisition angles, that is, the multiple frames of images in the first sample image group correspond to different acquisition angles.
[0058] Also exemplarily, the multiple frames of sample card images in the first sample image group may include images obtained by capturing sample card images under conditions of setting a flash and no flash, and the multiple frames of sample card images include images of real card images captured under conditions of setting no flash and images of real card images captured under conditions of setting a flash.
[0059] Also exemplarily, the multiple frames of sample card images in the first sample image group may include images obtained by capturing real card certificates at different acquisition angles, and images obtained by capturing real card certificates with and without a flash. Specifically, the first sample image group includes images obtained by capturing real card certificates at acquisition angle 1 and without a flash, images obtained by capturing real card certificates at acquisition angle 2 (different from acquisition angle 1) and without a flash, and images obtained by capturing real card certificates at acquisition angle 3 (the same as, or different from, acquisition angle 1 or 2) and with a flash set.
[0060] In another case, the first sample image group may at least include multiple sample card images containing forged cards, that is, the card corresponding to the first sample image group is a forged card, and accordingly, the corresponding first label data at least includes data indicating that the card corresponding to the first sample image group is a forged card (i.e., a false card). The forged card may be a forged bank card or a forged identity document.
[0061] In some examples, considering that the differential images between images can better highlight the differences between images collected in various ways, the first sample image group may also include a first sample differential image generated based on the multiple frames of sample card images included therein. In some possible examples, the multiple frames of sample card images include images collected with and without flash, and when the real card corresponding to the multiple frames of sample card images has an anti-counterfeiting mark, the image collected under the flash condition can better highlight the anti-counterfeiting mark, and accordingly, the differential image generated using such multiple frames of sample card images can better characterize that the card corresponding to the multiple frames of sample card images is a real card.
[0062] In some other examples, considering that the spectrogram generated based on the image can reflect the characteristics of the image from the frequency domain dimension, it can better help to identify the authenticity of the card. Accordingly, the first sample image group can also include a first sample spectrogram generated based on a specified sample card image in the multiple frames of sample card images included therein. The specified sample card image can be one or more frames of the multiple frames of sample card images.
[0063] Exemplarily, when the first sample image group corresponds to a real card, and when multiple frames of sample card images in the first sample image group include images obtained by capturing the real card under the condition of setting a flash, a first sample frequency spectrum diagram can be generated based on the images obtained by capturing the real card under the condition of setting a flash, so that the obtained frequency spectrum diagram can reflect the characteristics of the image from the frequency domain dimension, and can better assist in distinguishing the detailed information of the card material (for example, highlighting that under the effect of the flash, the card material causes the image to have a light spot feature); when multiple frames of sample card images in the first sample image group include images obtained by capturing the real card at different capture angles, the images obtained by capturing the real card can be based on the aforementioned non-frontal capture method (for example, the aforementioned capture method of capturing at an upward tilt of X degrees, a downward tilt of Y degrees, etc.) to generate a first sample frequency spectrum diagram.
[0064] In the embodiments of the present specification, the multiple frames of sample card images, the first sample differential images and / or the first sample spectrum graph included in the first sample image group may be referred to as sample images in the first sample image group.
[0065] In some other examples, when the card corresponding to the first sample image group is a real card, the first label data corresponding to the first sample image group may further include data indicating multiple modes corresponding to the multiple frames of sample images in the first sample image group. For example, when the multiple frames of sample card images in the first sample image group are images obtained by capturing real card images at different capture angles, the multiple modes of data corresponding to the multiple frames of sample card images in the first sample image group include data indicating different capture angles, or may further include specific tilt directions (e.g., tilt upward, tilt downward, tilt left, or tilt right).
[0066] For another example, the multiple frames of sample card images in the first sample image group include images obtained by capturing real card images at different acquisition angles, and images obtained by capturing real card images with and without a flash. The multiple modes of data corresponding to the multiple frames of sample images in the first sample image group include data indicating different acquisition angles and different flash settings.
[0067] For another example, the multiple frames of sample card images in the first sample image group include images of real card images captured under conditions of respectively setting a flash and no flash. The multiple modes of data corresponding to the multiple frames of sample images in the aforementioned first sample image group include data indicating different flash settings.
[0068] In the case that the card corresponding to the first sample image group is a forged card, the first label data corresponding to the first sample image group may also include data indicating multiple modes corresponding to multiple frames of sample images in the first sample image group. The data may be absent.
[0069] Next, in step S230, the card identification model to be trained is trained using the first sample image group and the first label data.
[0070] In a specific example, step S230 may include the following steps 01-02. In step 01, the first electronic device may use the aforementioned card identification model to be trained to process the aforementioned first sample image group, determine whether the first sample image group is collected in the aforementioned multiple ways, and determine the prediction result corresponding to the first sample image group, and the prediction result at least includes data indicating whether the card corresponding to the first sample image group is a genuine certificate. Then, in step 02, the model parameters of the card identification model to be trained are adjusted using the first label data of the aforementioned first sample image group and the aforementioned prediction result.
[0071] Exemplarily, the first electronic device may input the first sample image group into the card identification model to be trained, so as to process the sample images in the first sample image group through the card identification model to be trained, so as to determine whether the first sample image group is collected in multiple ways, so as to determine the prediction result corresponding to the first sample image group, and the prediction result at least includes data indicating whether the card corresponding to the first sample image group is authentic. Then, a preset loss function is used to construct a prediction loss based on the difference between the data indicating whether the card corresponding to the first sample image group is authentic in the prediction result and the data indicating whether the card corresponding to the first sample image group is authentic in the first label data, and then the model parameters of the card identification model to be trained are adjusted with the goal of minimizing the prediction loss, that is, minimizing the difference between the prediction result and the first label data.
[0072] In some examples, the data in the first label data indicating whether the card corresponding to the first sample image group is authentic may be a label value to indicate whether the card corresponding to the first sample image group is authentic, wherein if the label value is 1, it indicates that the card corresponding to the first sample image group is a real card, and if the label value is 0, it indicates that the card corresponding to the first sample image group is a forged card. The data in the prediction data indicating whether the card corresponding to the first sample image group is authentic may be a probability value, which indicates whether the card corresponding to the first sample image group predicted by the model is authentic, wherein the closer the probability value is to 1, the greater the possibility that the card corresponding to the first sample image group predicted by the model is authentic.
[0073] Subsequently, the first electronic device adopts a preset loss function and can use the difference between the predicted data (probability value) and the first label data (label value) to construct a prediction loss, with the goal of minimizing the prediction loss, that is, minimizing the difference between the predicted data and the first label data, and adjusting the model parameters of the card identification model to be trained, so that the card identification model has the ability to authenticate the authenticity of the card corresponding to the input image sequence.
[0074] In some other examples, when the first label data includes data indicating whether the card certificate corresponding to the first sample image group is authentic, and also includes the aforementioned data indicating multiple modes corresponding to multiple frames of sample images in the first sample image group, the predicted data may include the data indicating whether the card certificate corresponding to the first sample image group is authentic predicted by the card identification model, and the predicted data of multiple modes corresponding to multiple frames of sample images in the first sample image group.
[0075] In the above example, the first electronic device adopts a preset loss function and utilizes the difference between the predicted data and the first label data (i.e., the first difference between the data in the first label data indicating whether the card certificate corresponding to the first sample image group is authentic and the data in the predicted data indicating whether the card certificate corresponding to the first sample image group is authentic predicted by the card identification model, and the second difference between the data in the first label data indicating multiple modes corresponding to multiple frames of sample images in the first sample image group and the data in the predicted data indicating multiple modes corresponding to multiple frames of sample images in the first sample image group predicted by the card identification model) to construct a predicted loss.
[0076] Next, with the goal of minimizing the prediction loss, that is, minimizing the difference between the predicted data and the first label data (that is, minimizing the aforementioned first difference and second difference), the model parameters of the card identification model to be trained are adjusted so that the card identification model has the ability to authenticate the authenticity of the card corresponding to the input image sequence, and the ability to correspond in multiple ways between multiple frames in the input image sequence (that is, predict whether the multiple frames in the input image sequence have different acquisition angles, different flash settings, or different acquisition angles and different flash settings).
[0077] It can be understood that the above steps S210-S230 are a model iterative training process for the card identification model. In order to train a better card identification model, the above process can be iterated multiple times. That is, after step S230, based on the model parameters adjusted by the card identification model, the process returns to step S220.
[0078] The stopping conditions of the above-mentioned model iterative training process may include: the number of iterative training times reaches a preset number threshold, or the iterative training duration reaches a preset duration, or the predicted loss is less than a set loss threshold, etc.
[0079] In the above-mentioned model iterative training process, a sample image group of multiple frames of sample certificates containing real card pins and their label data, and a sample image group of multiple frames of sample certificates containing forged cards and their label data are used to jointly train the card identification model to improve the accuracy and stability of the card authenticity identification results of the trained card identification model.
[0080] In some possible examples, the card identification model to be trained includes a segmentation layer, a mapping layer, an extraction layer based on an attention mechanism, and a classification layer. Exemplarily, the segmentation layer in the card identification model to be trained can segment the input image based on a preset size w0*h0, and the preset size can be set according to actual needs. The mapping layer can be set as a linear mapping layer or as other types of mapping layers (such as a nonlinear mapping layer) to map each input image group into a feature vector (i.e., a token) of a preset length. The extraction layer based on the attention mechanism can be an extraction layer of a Transformer structure, and the classification layer can be implemented by a fully connected layer, such as a multi-layer perceptron or other classifiers.
[0081] Accordingly, the aforementioned step 01 may include the following steps 011-015:
[0082] In step 011, the sample images in the first sample image group are divided into blocks using the block layer to obtain sample image blocks corresponding to each sample image. In this step, after the first electronic device obtains the first sample image group and its first label data, the sample images in the first sample image group are grouped into an image sequence and input into the block layer, so as to divide the sample images in the first sample image group into blocks through the block layer to obtain sample image blocks corresponding to each sample image. Among them, when the block layer divides the sample images in the first sample image group into blocks, each sample image is divided into non-overlapping blocks according to a preset size.
[0083] It can be understood that the sample images in the first sample image group are sorted according to a specified sorting order. For example, the first sample image group includes a sample card image 1 collected in a frontal collection mode, one or more sample card images 2 collected in other non-frontal collection modes or under flash conditions, and a first sample differential image and a first sample spectrum image generated based on the sample card image 1 and the sample card image 2. Accordingly, the sorting order between the sample images can be: the sample card image 1 is in the first place, each sample card image 2 is located after the sample card image 1, the first sample differential image is located after the last frame of the sample card image 2, and the first sample spectrum graph is located after the first sample differential image. Among them, the sample images in the first sample image group can also be sorted according to other sorting orders, for example, the first sample spectrum graph is located before the first sample differential image, etc.
[0084] Then in step 012, the sample image blocks corresponding to each sample image are combined using the inter-frame relationship between the sample images to obtain multiple groups of sample image block groups, wherein each group of sample image block groups includes one or more sample image blocks, and the multiple sample image blocks in a single sample image block group have the same position in their respective sample images.
[0085] In this step, the card identification model to be trained not only considers the spatial dimension information between the two-dimensional image blocks in a single frame image in the image group (i.e., image sequence) during the card identification process, but also combines the temporal dimension information between multiple frames in the image group, that is, by combining the image blocks at corresponding positions in the multiple frames in the image group to form a three-dimensional image block group to reflect the temporal dimension information between the multiple frames; then, by combining the spatial dimension information between the two-dimensional image blocks and the temporal dimension information between the multiple frames reflected by the three-dimensional image block group, the authenticity identification of the card corresponding to the multiple frames in the image group is comprehensively realized.
[0086] Specifically, the first electronic device utilizes the inter-frame relationship between each sample image to combine the sample image blocks corresponding to each sample image to obtain multiple groups of sample image block groups, wherein each group of sample image block groups includes one or more sample image blocks, and the multiple sample image blocks in a single sample image block group have the same position in their respective sample images.
[0087] Exemplarily, the first sample image group includes sample image A, sample image B, sample image C and sample image D, and a certain sample image block group includes multiple sample image blocks, for example, when including sample image block A1 and sample image block B1, the position of the sample image block A1 in the sample image A is the area indicated by the upper left pixel position (1,1) and the lower right pixel position (w0, h0), and correspondingly, the position of the sample image block B1 in the sample image B is the area indicated by the upper left pixel position (1,1) and the lower right pixel position (w0, h0); and further exemplary, a certain sample image block group includes multiple sample image blocks, for example, including sample image blocks A2, sample image blocks B2, sample image blocks C2 and In the case of sample image block D2, the position of sample image block A2 in the sample image block group in the sample image A is the area indicated by the upper left pixel position (1, 1+h0) and the lower right pixel position (w0, 2h0), and correspondingly, the position of sample image block B1 in the sample image B is the area indicated by the upper left pixel position (1, 1+h0) and the lower right pixel position (w0, 2h0), the position of sample image block C2 in the sample image C is the area indicated by the upper left pixel position (1, 1+h0) and the lower right pixel position (w0, 2h0), and the position of sample image block D2 in the sample image D is the area indicated by the upper left pixel position (1, 1+h0) and the lower right pixel position (w0, 2h0).
[0088] It can be understood that, when the first sample image group includes N sample images, the number of sample image blocks included in a sample image block group can be an integer from 1 to N. Wherein, N is an integer greater than or equal to 2.
[0089] After the first electronic device obtains multiple groups of sample image block groups, it uses the mapping layer to process each group of sample image block groups to obtain a sample mapping sequence in step 013. In this step, the first electronic device inputs each group of sample image block groups into the mapping layer respectively, so as to use the mapping layer to process each group of sample image block groups to obtain a sample mapping (i.e., the aforementioned feature vector of a preset length, i.e., a token) corresponding to each group of sample image block groups.
[0090] After the first electronic device obtains the sample mappings corresponding to each of the multiple groups of sample image block groups, in order to preserve the spatiotemporal position information of the sample image blocks in each sample image block group and in the image sequence composed of each sample image in the first sample image group, the first electronic device may use a preset position coding algorithm to perform position coding on the sample mappings corresponding to each group of sample image block groups, and obtain the position coding of the sample mappings corresponding to each group of sample image block groups; then, the sample mappings corresponding to each group of sample image block groups with the position coding are sorted in the sorting order indicated by the position coding, and obtain a sample mapping sequence.
[0091] Among them, the preset position coding algorithm may include but is not limited to a sine position coding algorithm, a cosine position coding algorithm, or a position coding algorithm based on a trainable embedded vector, which carries the model parameters that need to be trained.
[0092] Then, in step 014, the sample mapping sequence is processed using the extraction layer to obtain a sample image representation. In this step, the first electronic device inputs the sample mapping sequence into the extraction layer based on the attention mechanism, so that the extraction layer performs self-attention calculation on the sample mapping sequence based on the attention mechanism to capture the spatiotemporal dependency between each sample mapping in the sample mapping sequence, so as to obtain an image representation that can better represent the feature information of each sample image in the first sample image group, which is hereinafter referred to as the sample image representation, and the sample image representation may include more image feature information that is conducive to card authentication.
[0093] Next, in step 015, the sample image representation is processed by the classification layer to determine the prediction data. After the first electronic device obtains the sample image representation, the sample image representation is input into the classification layer to process the sample image representation by the classification layer to obtain the prediction data. Then, based on the prediction data and the aforementioned first label data, the model parameters of the card identification model to be trained are adjusted.
[0094] After the card identification model training is completed, that is, after the model iterative training process of the card identification model reaches the stopping condition, the first electronic device obtains the trained card identification model, that is, the trained card identification model mentioned later, and stores it in the designated storage space; thereafter, the trained card identification model can be used to perform card identification.
[0095] Figure 3 The flowchart of the card authentication method in one embodiment of the present specification is shown. The method is applied to the client and server in the card authentication system, and the server and client can run in different electronic devices, and any electronic device can be implemented by any device, equipment, platform, device cluster, etc. with computing and processing capabilities.
[0096] The card identification system may be an embedded system of any authentication system (such as an eKYC system) that needs to use a card to verify the identity of a customer, or the card identification system may be the aforementioned authentication system.
[0097] During the card authentication process, Figure 3 As shown, the method includes the following steps S310-S340:
[0098] In step S310, the client obtains multiple frames of first card images for the card to be authenticated while instructing the user to capture images of the card to be authenticated in multiple ways, wherein the multiple ways enable the client to capture different images of the card to be authenticated.
[0099] In some exemplary scenarios, when the client determines that the user has a need to upload a card image, the client can call the image acquisition device of the device where the client is located, in order to acquire an image through the image acquisition device of the device where the client is located. The client calls the image acquisition device of the device where the client is located, that is, starts the image acquisition device of the device where the client is located to acquire an image. Subsequently, the client can output first instruction information to instruct the user to acquire the image of the card to be identified in a corresponding manner (for example, the aforementioned front acquisition manner) to obtain the card image; thereafter, the client can randomly determine the acquisition manner of the next frame, and instruct the user to acquire the image of the card to be identified based on the randomly determined acquisition manner of the next frame; for example, the client continues to output second instruction information to continue to instruct the user to acquire the image of the card to be identified in the acquisition manner of the next frame (for example, the aforementioned other non-front acquisition manner), or the client can directly call to start the flashlight to instruct the user to acquire the image of the card to be identified under the condition of setting the flashlight to obtain the card image.
[0100] In one possible example, the client obtains two frames of card images, and uses the two frames of card images as the multiple frames of first card images. In another possible example, after the client obtains the two frames of card images, the client may continue to randomly determine the acquisition method of the next frame, and instruct the user to acquire the image of the card to be identified based on the randomly determined acquisition method of the next frame; for example, output the third instruction information to continue to instruct the user to acquire the image of the card to be identified in a new manner (for example, the aforementioned other non-front acquisition methods or the acquisition method of acquiring images under flash conditions), and so on, to obtain a specified number of multiple frames of card images, and determine to obtain multiple frames of first card images.
[0101] In some possible cases, the card image obtained above can be a real image acquired by the image acquisition device, which includes a real card. In some other possible cases, a malicious party may use an injection attack to replace the image actually acquired by the image acquisition device with a card image forged in advance. Accordingly, the card image obtained above can be a card image forged in advance injected by the injection attack to forge the card image acquired by the client instructing the user through the image acquisition device, which includes a forged card (i.e., a fake card).
[0102] In some examples, the multiple methods include a method of capturing images at different capture angles, and / or a method of capturing images with and without a flash. In some possible examples, when the client is in H5 browser mode, there may be a situation where the client cannot call the image capture device (such as a camera) of the device where it is located. Accordingly, the client can instruct the user to capture images of the card to be identified at different capture angles. In some other possible examples, when the client is in native SDK (Software Development Kit) mode, the client can instruct the user to capture images of the card to be identified at different capture angles, and / or capture images of the card to be identified with and without a flash.
[0103] In some possible examples, in order to ensure the accuracy of the identification results obtained by the server, it is necessary to ensure that the image quality of the multiple frames of the first card image obtained by the client is high (for example, including a clear and complete card to be identified). Specifically, the multiple frames of the first card image all meet the preset image quality conditions, and the preset image quality conditions may include at least one of the following conditions: the image clarity is not lower than a preset clarity threshold, the image brightness value is not lower than a preset brightness threshold, the image contains the specified corner points of the card to be identified, and the card to be identified is located in the specified acquisition area when the image is captured.
[0104] In some specific examples, after the client instructs the user to capture the image of the card to be authenticated in a manner a to obtain a frame of card image a (wherein the card image a may be an image captured by the client through the image acquisition device called, or may be an image containing a forged card injected in an injection attack manner), it may be determined whether the card image a meets the preset image quality condition. If it is determined that the card image a does not meet the preset image quality condition, the card image a may be discarded, and the user may be re-instructed to capture the image of the card to be authenticated in a manner b (wherein the manner may be the same as or different from the aforementioned manner a) to obtain a new frame of card image b (wherein the card image b may be an image captured by the client through the image acquisition device called The captured image may also be an image containing a forged card injected in an injection attack manner), and whether the card image b meets the preset image quality condition is continued to be determined; if the card image b meets the preset image quality condition, the card image b is used as the first card image, and then the user is continued to be instructed to capture the image of the card to be identified in another manner c (a manner different from manner b) to obtain another frame of card image c (wherein, the card image b may be an image captured by the client through the called image acquisition device, or may be an image containing a forged card injected in an injection attack manner), and whether the card image c meets the preset image quality condition is continued to be determined, and so on, until a specified number of frames of first card image are obtained.
[0105] After the client obtains the multiple frames of the first card image, in step S320, the client sends the multiple frames of the first card image to the server. Correspondingly, in step S330, the server receives the multiple frames of the first card image from the client.
[0106] After the server receives multiple frames of first card images from the client, in order to ensure the security of the corresponding authentication system, after receiving the multiple frames of first card images from the client, the server needs to determine whether the card to be identified corresponding to the multiple frames of first card images is a genuine card. Accordingly, in step S340, the server uses the trained card identification model to determine whether the multiple frames of first card images are collected in multiple ways to determine the authenticity identification result of the card to be identified.
[0107] In some examples, after receiving the aforementioned multiple frames of first card images from the client, the server, in step S340, assembles the multiple frames of first card images into an image sequence, and inputs the image sequence into the card identification model to obtain an authenticity identification result. In this step, after the server obtains the multiple frames of first card images, it directly assembles the multiple frames of first card images into an image sequence, wherein the multiple frames of first card images can be sorted in a specified sorting order (for example, in the order in which the client instructs the user to collect images) to assemble the image sequence; then the image sequence (the multiple frames of first card images to be sorted) is input into the card identification model, so that the card identification model processes the image sequence, determines whether the multiple frames of first card images are collected in the aforementioned multiple ways, and determines the authenticity identification result for the card to be identified.
[0108] In some other examples, considering that the difference map between images can better highlight the differences between images collected in various ways, in order to better improve the accuracy of the identification result, after receiving the aforementioned multiple frames of the first card image from the client, the server may include the following steps 11-12 in step S340:
[0109] In step 11, the server determines a differential image between the multiple frames of first card images based on the multiple frames of first card images. In this step, when the multiple frames of first card images are two frames, a differential image between the two frames of first card images can be determined based on the two frames of first card images. The differential image can reflect the gradient information between the two frames of first card images, and can better highlight the difference between the two frames of first card images.
[0110] In the case where the number of the multiple first card images is three or more, a differential image frame may be generated based on every two frames of the multiple first card images, so as to obtain the differential images between the multiple first card images. Exemplarily, the multiple first card images may be sorted in the order of capturing images as instructed by the client, and accordingly, the differential images between every two adjacent frames of the multiple first card images may be calculated in sequence in the order, so as to obtain the differential images between the multiple first card images.
[0111] Afterwards, in step 12, the server forms an image sequence with the multiple frames of first card certificate images and the differential image, and inputs the image sequence into the card certificate identification model to obtain the authenticity identification result. In this step, the server forms an image sequence with the multiple frames of first card certificate images and the differential image, and illustratively, in the image sequence, the multiple frames of first card certificate images are in front and the differential image is in the back; the image sequence is input into the card certificate identification model to process the image sequence through the card certificate identification model to obtain the authenticity identification result. In some possible examples, in the image sequence, the multiple frames of first card certificate images are sorted in the order of image acquisition indicated by the client, and the differential images between the multiple frames of first card certificate images calculated in sequence according to the order are sorted according to the front and back order of their respective corresponding first card certificate images.
[0112] In some other examples, considering that the spectrum diagram generated based on the image can reflect the characteristics of the image from the frequency domain dimension, it can better help to realize the authenticity identification of the card. Accordingly, in order to better improve the accuracy of the identification result, after receiving the aforementioned multiple frames of the first card image from the client, the server may include the following steps 21-22 in step S340:
[0113] In step 21, the server determines the frequency spectrum corresponding to the plurality of first card images based on a designated image in the plurality of first card images, wherein the designated image may be any one or more frames of the plurality of first card images.
[0114] In some possible examples, when the multiple frames of the first card image include images acquired under the condition of setting a flash, the designated image may be an image acquired under the condition of setting a flash among the multiple frames of the first card image, so that the obtained spectrum diagram can reflect the characteristics of the image from the frequency domain dimension, and can better assist in distinguishing the detailed information of the card material (for example, highlighting that the card material causes the image to have a light spot under the effect of the flash), so as to better help to achieve the identification of the authenticity of the card. When the multiple frames of the first card image include images acquired at different acquisition angles, the designated image may be an image acquired by other non-frontal acquisition methods among the multiple frames of the first card image, so that the obtained spectrum diagram can reflect the characteristics of the image from the frequency domain dimension, so as to better help to achieve the identification of the authenticity of the card.
[0115] Afterwards, in step 22, the server forms an image sequence with the multiple frames of the first card certificate image and the spectrum map, and inputs the image sequence into the card certificate identification model to obtain the authenticity identification result. In this step, the server forms an image sequence with the multiple frames of the first card certificate image and the spectrum map, and illustratively, in the image sequence, the multiple frames of the first card certificate image are in front and the spectrum map is in the back; the image sequence is input into the card certificate identification model to process the image sequence through the card certificate identification model to obtain the authenticity identification result. In some possible examples, in the image sequence, the multiple frames of the first card certificate image are sorted in the order of collecting images as instructed by the client.
[0116] In some other examples, in order to better improve the accuracy of the identification result, after receiving the aforementioned multiple frames of the first card image from the client, the server may include the following steps 31-33 in step S340:
[0117] In step 31, the server determines the difference image between the multiple frames of first card images based on the multiple frames of first card images. The specific implementation process of step 31 can refer to the specific implementation process of the aforementioned step 11, which will not be described in detail here.
[0118] In step 32, the server determines the frequency spectrum corresponding to the multiple frames of the first card image based on the designated image in the multiple frames of the first card image. The specific implementation process of step 32 can refer to the specific implementation process of the aforementioned step 21, which will not be repeated here.
[0119] In step 33, the server forms an image sequence with multiple frames of first card images, differential images and spectrograms, and inputs the image sequence into the card identification model to obtain the authenticity identification result. In this step, the server forms an image sequence with multiple frames of first card images, differential images and spectrograms. Exemplarily, in the image sequence, multiple frames of first card images are in front, differential images are after multiple frames of first card images, and spectrograms are at the end; or multiple frames of first card images are in front, spectrograms are after multiple frames of first card images, and spectrograms are at the end. Then, the server inputs the image sequence into the card identification model to process the image sequence through the card identification model to obtain the authenticity identification result. Among them, the sorting order between multiple frames of first card images and the sorting order between differential images when there are multiple frames can refer to the sorting order between multiple frames of first card images and the sorting order between differential images when there are multiple frames, which will not be repeated here.
[0120] In the above example, multiple frames of first card images, differential images and spectrum diagrams are combined as a card identification model, so that the card identification model can combine multi-dimensional features such as spatial domain, time domain, gradient and frequency domain in multiple frames of first card images to determine the authenticity of the card to be identified corresponding to the multiple frames of first card images, so as to obtain a more accurate identification result.
[0121] In some possible examples, the card authentication model includes a block layer, a mapping layer, an extraction layer based on an attention mechanism, and a classification layer; accordingly, in step S340, the following steps 41-45 may be included:
[0122] In step 41, the first card images in the plurality of frames of first card images are divided into blocks using the block layer to obtain image blocks corresponding to the first card images. The implementation principle of step 41 is similar to that of the aforementioned step 011, and its implementation process can refer to the implementation process of the aforementioned step 011, which will not be described in detail here.
[0123] In step 42, the image blocks corresponding to the first card images are combined by using the inter-frame relationship between the first card images to obtain multiple groups of image block groups, wherein each group of image block groups includes one or more image blocks, and the multiple image blocks in a single image block group have the same position in their respective first card images. The implementation principle of step 42 is similar to that of the aforementioned step 012, and its implementation process can refer to the implementation process of the aforementioned step 012, which will not be described in detail here.
[0124] In step 43, the mapping layer is used to process each group of image blocks to obtain a mapping sequence. The implementation principle of step 43 is similar to that of the aforementioned step 013. The implementation process can refer to the implementation process of the aforementioned step 013, and will not be repeated here.
[0125] In step 44, the mapping sequence is processed using the extraction layer to obtain an image representation. The implementation principle of step 44 is similar to that of the aforementioned step 014. The implementation process can refer to the implementation process of the aforementioned step 014, and will not be repeated here.
[0126] In step 45, the classification layer is used to process the image representation and determine the authenticity identification result of the card to be identified. The implementation principle of step 45 is similar to that of the aforementioned step 015. The implementation process can refer to the implementation process of the aforementioned step 015, and will not be repeated here.
[0127] In one example, when the aforementioned authenticity identification result indicates that the card to be identified is authentic, it is determined that the card to be identified is authentic. Subsequently, the server can continue to trigger the user identity authentication process using the card to be identified to provide subsequent business services to the user. In another example, when the aforementioned authenticity identification result indicates that the card to be identified is a forged card (i.e., false evidence), it is determined that the card to be identified is false evidence, that is, it is determined that the multiple frames of the first card image are images injected by injection attack. Subsequently, the server can lock the client and perform subsequent designated security processes to protect the account security of the real user.
[0128] In some possible examples, in the process of training a card identification model, when its label data includes data indicating whether a sample card corresponding to a corresponding sample image group is an authentic card, and data indicating multiple modes corresponding to multiple frames of sample images in the corresponding sample image group, the card identification model can not only determine the authenticity identification result of the card to be identified, but also determine the multiple modes corresponding to multiple frames of first card images (for example, whether the predicted multiple frames of first card images have different acquisition angles, different flash settings, or different acquisition angles and different flash settings).
[0129] In this example, in order to better improve the accuracy of the authenticity identification results of the card to be identified, the client can also send the multiple methods indicated by it when instructing the user to collect the image of the card to be identified to the server. Accordingly, the server can determine the final authenticity identification result for the card to be identified by combining the authenticity identification result for the card to be identified determined based on the card identification model, the multiple methods corresponding to the multiple frames of first card images determined based on the card identification model, and the multiple methods sent by the client when instructing the user to collect the image of the card to be identified.
[0130] For example, when the multiple modes corresponding to the multiple frames of first card images determined based on the card identification model are the same as the multiple modes sent by the client when instructing the user to capture images of the card to be identified, then the authenticity identification result for the card to be identified determined by the card identification model is considered to be accurate.
[0131] If the multiple methods corresponding to the multiple frames of first card images determined based on the card identification model are different from the multiple methods sent by the client to instruct the user to collect images of the card to be identified, if the authenticity identification result of the card to be identified determined by the card identification model indicates that the card to be identified is a false certificate, then the result is determined to be accurate; if the authenticity identification result of the card to be identified determined by the card identification model indicates that the card to be identified is a genuine certificate, then it can be determined that the result is questionable. In order to better protect the security of the user account, information requiring the user to re-upload the card image can be fed back to the client, so that the client can re-instruct the user to collect images of the card in multiple methods.
[0132] In this embodiment, considering that there is generally no change between the multiple frames of images injected by the injection attack method, when the client collects images for the card to be identified, the user is instructed to collect images of the card to be identified in multiple ways, so that the multiple frames of card images obtained for the real card are different images; subsequently, after the server obtains the multiple frames of images for the card to be identified, it uses the trained card identification model to determine whether the multiple frames of images are collected in multiple ways, and determines whether the images collected by the client are truly collected images, and then determines the authenticity identification result of the card to be identified, and realizes the identification of the authenticity of the card.
[0133] Figure 4 The flowchart of the card authentication method in another embodiment of the present specification is shown. The method is applied to the client and server in the card authentication system. The server and client can run in different electronic devices. Any electronic device can be implemented by any device, equipment, platform, device cluster, etc. with computing and processing capabilities. In the card authentication process, if Figure 4 As shown, the method includes the following steps S410-S450:
[0134] In step S410, the client obtains multiple frames of first card images for the card to be authenticated while instructing the user to capture images of the card to be authenticated in multiple ways, wherein the multiple ways enable the client to capture different images of the card to be authenticated.
[0135] In step S420, the client sends multiple frames of the first card image to the server. The implementation principle of steps S410-S420 is similar to that of the aforementioned steps S310-S320. The implementation process can refer to the implementation process of the aforementioned steps S310-S320, and will not be repeated here.
[0136] In step S430, the server receives multiple frames of the first card image from the client. The implementation principle of step S430 is similar to that of the aforementioned step S330, and its implementation process can refer to the implementation process of the aforementioned step S330, which will not be repeated here.
[0137] In step S440, the server uses a preset content recognition algorithm to detect whether the image contents of multiple frames of the first card image are consistent.
[0138] In some possible examples, in order to better confuse the server in identifying the authenticity of the card certificate, the malicious party may inject different forged card certificate images when the client instructs the user to collect card certificate images in multiple ways, so that there are differences between the multiple frames of forged card certificate images injected by the injection attack. Considering that the real card certificate images collected by the client instructing the user in multiple ways correspond to the same card certificate, the image content of the corresponding multiple frames of real card certificate images (that is, the content in the card certificate) is consistent. In view of the above situation, after receiving multiple frames of the first card certificate image, the server can perform a consistency check on the image content of the multiple frames of the first card certificate image. Specifically, a preset content recognition algorithm is used to detect whether the image content of the multiple frames of the first card certificate image is consistent, and a detection result is obtained; then, the subsequent process is executed based on the detection result.
[0139] Exemplarily, the aforementioned preset content recognition algorithm may include but is not limited to an OCR (Optical Character Recognition) algorithm, a neural network-based content recognition algorithm, or any other algorithm that can recognize text and / or non-text content in an image. In some other possible examples, the server may also combine the preset content recognition algorithm (such as the OCR algorithm) with an angle verification and classification algorithm used in the related technology to detect the tilt angle of a target in an image, and jointly detect whether the image content of multiple frames of the first card image is consistent.
[0140] The server can identify the image content of each first card certificate image based on a preset content recognition algorithm, and then determine the similarity value between the image contents of each first card certificate image based on a preset similarity algorithm and the image content of each first card certificate image; then determine whether the image content of multiple frames of first card certificate images is consistent based on the similarity value between the image content of each first card certificate image and a certain threshold. If the similarity value of the image content between multiple frames of first card certificate images exceeds a certain threshold, it is determined that the detection result indicates that the image content of multiple frames of first card certificate images is consistent; if the similarity of the image content between multiple frames of first card certificate images does not exceed a certain threshold, it is determined that the detection result indicates that the image content of multiple frames of first card certificate images is inconsistent.
[0141] In step S450, if the detection result indicates that the image contents of the multiple frames of the first card image are consistent, the server uses the card identification model to determine whether the multiple frames of the first card image are collected in the aforementioned multiple ways to determine the authenticity identification result of the card to be identified. The implementation principle of step S450 is similar to that of the aforementioned step S340, and its implementation process can refer to the implementation process of the aforementioned step S340, which will not be described in detail here.
[0142] In some other examples, if the aforementioned detection result indicates that the image contents of multiple frames of card images are inconsistent, such as Figure 4 As shown, the method may further include step S460. Accordingly, in step S460, the server determines that the card to be identified is a false certificate. If the aforementioned detection result indicates that the image contents of the multiple frames of card images are inconsistent, the server may consider that the multiple frames of the first card images are multiple frames of different forged card images injected by a malicious party to confuse the server, and then determine that the card to be identified is a false certificate. This can achieve the identification of the authenticity of the card and better improve the accuracy of the identification result of the authenticity of the card.
[0143] Corresponding to the above method embodiment, the embodiment of this specification provides a card authentication method, which is applied to the server in the card authentication system. The card authentication system also includes a client. The server and the client can be run in different electronic devices. Any electronic device can be implemented by any device, equipment, platform, device cluster, etc. with computing and processing capabilities. Figure 5 As shown, during the card authentication process, the method includes the following steps S510-S520:
[0144] In step S510, multiple frames of first card images for the card to be authenticated are received from the client, wherein the client is used to instruct the user to collect images of the card to be authenticated in multiple ways, and the multiple ways enable the client to collect different images of the card to be authenticated. The implementation principle of step S510 is similar to that of the aforementioned step S330, and its implementation process can refer to the implementation process of the aforementioned step S330, which will not be described in detail here.
[0145] In step S520, the trained card identification model is used to determine whether the plurality of frames of the first card image are collected in the plurality of ways, so as to determine the authenticity identification result of the card to be identified. The implementation principle of step S520 is similar to that of the aforementioned step S340, and its implementation process can refer to the implementation process of the aforementioned step S340, which will not be described in detail here.
[0146] In some possible implementations, the multiple methods include: a method of acquiring images at different acquisition angles, and / or a method of acquiring images with and without a flash.
[0147] In some possible implementations, step S520 includes: determining a differential image between the multiple frames of first card images based on the multiple frames of first card images; forming an image sequence with the multiple frames of first card images and the differential image, and inputting the image sequence into the card identification model to obtain the authenticity identification result.
[0148] In some possible implementations, step S520 includes: determining a frequency spectrum graph corresponding to the multiple frames of first card images based on a designated image in the multiple frames of first card images; combining the multiple frames of first card images and the frequency spectrum graph into an image sequence, and inputting the image sequence into the card identification model to obtain the authenticity identification result.
[0149] In some possible implementations, step S520 includes: combining the multiple frames of first card image into an image sequence, and inputting the image sequence into the card identification model to obtain the authenticity identification result.
[0150] In some possible implementations, step S520 includes: using a preset content recognition algorithm to detect whether the image contents of the multiple frames of first card images are consistent; if the detection result indicates that the image contents of the multiple frames of first card images are consistent, using the card identification model to determine whether the multiple frames of first card images are collected in the multiple ways, so as to determine the authenticity identification result of the card to be identified.
[0151] In some possible implementations, step S520 further includes: if the detection result indicates that the image contents of the multiple frames of card images are inconsistent, determining that the card to be authenticated is a false certificate.
[0152] In some possible implementations, the card authentication model is a converter-based network model.
[0153] In some possible implementations, the card identification model includes a block layer, a mapping layer, an extraction layer based on an attention mechanism, and a classification layer; in step S520, the method includes: using the block layer to block each first card identification image in the multiple frames of first card identification images to obtain an image block corresponding to each first card identification image;
[0154] By utilizing the inter-frame relationship between the first card images, the image blocks corresponding to the first card images are combined to obtain a plurality of image block groups, wherein each image block group includes one or more image blocks, and the positions of the plurality of image blocks in a single image block group are the same in their respective first card images;
[0155] Using the mapping layer, processing each group of image blocks to obtain a mapping sequence;
[0156] Processing the mapping sequence using the extraction layer to obtain an image representation;
[0157] The image representation is processed by utilizing the classification layer to determine the authenticity identification result of the card to be identified.
[0158] In some possible implementations, the training data for training the card identification model includes several sample image groups and their corresponding label data, and a single sample image group includes at least: sample card images obtained by collecting sample cards in the multiple ways.
[0159] In some optional embodiments, the single sample image group further includes a first sample differential image and / or a first sample spectrum diagram generated based on the multiple frames of first sample card images.
[0160] Corresponding to the above method embodiment, the embodiment of this specification provides a card authentication method, which is applied to the client in the card authentication system. The card authentication system also includes a server. The server and the client can be run in different electronic devices. Any electronic device can be implemented by any device, equipment, platform, device cluster, etc. with computing and processing capabilities. Figure 6 As shown, during the card authentication process, the method includes the following steps S610-S620:
[0161] In step S610, in the process of instructing the user to collect the image of the card to be authenticated in multiple ways, multiple frames of the first card image for the card to be authenticated are obtained, wherein the multiple ways enable the client to collect different images of the card to be authenticated. The implementation principle of step S610 is similar to that of the aforementioned step S310, and its implementation process can refer to the implementation process of the aforementioned step S310, which will not be described in detail here.
[0162] In step S620, the multiple frames of the first card image are sent to the server, so that after receiving the multiple frames of the first card image, the server uses the trained card identification model to determine whether the multiple frames of the first card image are collected in the multiple ways, so as to determine the authenticity identification result of the card to be identified. The implementation principle of step S620 is similar to that of the aforementioned step S320, and its implementation process can refer to the implementation process of the aforementioned step S320, which will not be described in detail here.
[0163] The foregoing describes certain embodiments of the present specification, and other embodiments are within the scope of the appended claims. In some cases, the actions or steps described in the claims may be performed in an order different from that in the embodiments, and the desired results may still be achieved. In addition, the processes depicted in the accompanying drawings do not necessarily have to be performed in the specific order or sequential order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0164] Corresponding to the above method embodiment, the present specification embodiment provides a card authentication device 700, which is deployed on the server side, and its schematic block diagram is as follows: Figure 7 As shown, it includes: a receiving module 710, configured to receive multiple frames of first card images for a card to be authenticated from a client, wherein the client is used to instruct a user to capture images of the card to be authenticated in multiple ways, and the multiple ways enable the client to capture different images of the card to be authenticated; a first determining module 720, configured to use a trained card authentication model to determine whether the multiple frames of first card images are captured in the multiple ways, so as to determine the authenticity authentication result of the card to be authenticated.
[0165] In some optional implementations, the multiple methods include: a method of acquiring images at different acquisition angles, and / or a method of acquiring images with and without a flash.
[0166] In some optional implementations, the first determination module 720 is specifically configured to determine a differential image between the multiple frames of first card identification images based on the multiple frames of first card identification images;
[0167] The multiple frames of first card identification images and the differential image are combined into an image sequence, and the image sequence is input into the card identification model to obtain the authenticity identification result.
[0168] In some optional implementations, the first determination module 720 is specifically configured to determine the frequency spectrum corresponding to the multiple frames of first card images based on a designated image in the multiple frames of first card images;
[0169] The multiple frames of first card images and the frequency spectrum are combined into an image sequence, and the image sequence is input into the card identification model to obtain the authenticity identification result.
[0170] In some optional implementations, the first determination module 720 is specifically configured to combine the multiple frames of first card image into an image sequence, and input the image sequence into the card identification model to obtain the authenticity identification result.
[0171] In some optional implementations, the first determination module 720 is specifically configured to use a preset content recognition algorithm to detect whether the image contents of the multiple frames of first card images are consistent;
[0172] If the detection result indicates that the image contents of the multiple frames of first card images are consistent, the card identification model is used to determine whether the multiple frames of first card images are collected in the multiple ways to determine the authenticity identification result of the card to be identified.
[0173] In some optional implementations, the first determination module 720 is further configured to determine that the card to be authenticated is a false certificate if the detection result indicates that the image contents of the multiple frames of card images are inconsistent.
[0174] In some optional implementations, the card authentication model is a converter-based network model.
[0175] In some optional implementations, the card authentication model includes a block layer, a mapping layer, an attention mechanism-based extraction layer, and a classification layer;
[0176] The first determining module 720 is specifically configured to use the blocking layer to block each first card image in the multiple frames of first card images to obtain an image block corresponding to each first card image;
[0177] By utilizing the inter-frame relationship between the first card images, the image blocks corresponding to the first card images are combined to obtain a plurality of image block groups, wherein each image block group includes one or more image blocks, and the positions of the plurality of image blocks in a single image block group are the same in their respective first card images;
[0178] Using the mapping layer, processing each group of image blocks to obtain a mapping sequence;
[0179] Processing the mapping sequence using the extraction layer to obtain an image representation;
[0180] The image representation is processed by utilizing the classification layer to determine the authenticity identification result of the card to be identified.
[0181] In some optional implementations, the training data for training the card identification model includes several sample image groups and their corresponding label data, and a single sample image group includes at least: sample card images obtained by collecting sample cards in the multiple ways.
[0182] In some optional embodiments, the single sample image group further includes a first sample differential image and / or a first sample spectrum diagram generated based on the multiple frames of first sample card images.
[0183] Corresponding to the above method embodiment, the present specification embodiment provides a card authentication device 800, which is deployed at the client. Its schematic block diagram is as follows: Figure 8As shown, it includes: an instruction module 810, configured to obtain multiple frames of first card images for the card to be identified in the process of instructing the user to collect images of the card to be identified in multiple ways, wherein the multiple ways enable the client to collect different images of the card to be identified; a sending module 820, configured to send the multiple frames of first card images to the server, so that after the server receives the multiple frames of first card images, it uses a trained card identification model to determine whether the multiple frames of first card images are collected in the multiple ways, so as to determine the authenticity identification result of the card to be identified.
[0184] The above device embodiments correspond to the method embodiments. For specific descriptions, please refer to the description of the method embodiments, which will not be repeated here. The device embodiments are obtained based on the corresponding method embodiments and have the same technical effects as the corresponding method embodiments. For specific descriptions, please refer to the corresponding method embodiments.
[0185] The embodiment of the present specification also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed in a computer, the computer is caused to execute the card authentication method provided in the present specification.
[0186] The embodiment of the present specification also provides a computing device, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the card authentication method provided in the present specification is implemented.
[0187] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the storage medium and computing device embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0188] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the embodiments of the present invention may be implemented using hardware, software, firmware, or any combination thereof. When implemented using software, these functions may be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium.
[0189] The specific implementation methods described above further describe the purpose, technical solutions and beneficial effects of the embodiments of the present invention in detail. It should be understood that the above description is only a specific implementation method of the embodiments of the present invention and is not intended to limit the scope of protection of the present invention. Any modification, equivalent replacement, improvement, etc. made on the basis of the technical solution of the present invention shall be included in the scope of protection of the present invention.
Claims
1. A card authentication method, applied to a server, comprising: receiving a plurality of frames of first card images of the card to be authenticated from a client, wherein the client is used to instruct a user to capture the image of the card to be authenticated in a plurality of ways, wherein the plurality of ways enables the client to capture different images of the card to be authenticated; Using the trained card identification model, it is determined whether the multiple frames of first card images are collected in the multiple ways to determine the authenticity identification result of the card to be identified.
2. The method of claim 1, wherein: The multiple methods include: a method of acquiring images at different acquisition angles, and / or a method of acquiring images under conditions of setting a flash and without a flash.
3. The method of claim 1, wherein: Determining the authenticity identification result of the card to be identified, including: Based on the multiple frames of first card identification images, determining a differential image between the multiple frames of first card identification images; The multiple frames of first card identification images and the differential image are combined into an image sequence, and the image sequence is input into the card identification model to obtain the authenticity identification result.
4. The method of claim 1, wherein: Determining the authenticity identification result of the card to be identified, including: Determine, based on a designated image in the plurality of frames of first card images, a frequency spectrum corresponding to the plurality of frames of first card images; The multiple frames of first card images and the frequency spectrum are combined into an image sequence, and the image sequence is input into the card identification model to obtain the authenticity identification result.
5. The method of claim 1, wherein: Determining the authenticity identification result of the card to be identified, including: The multiple frames of first card identification images are combined into an image sequence, and the image sequence is input into the card identification model to obtain the authenticity identification result.
6. The method of claim 1, wherein: Determining the authenticity identification result of the card to be identified, including: Using a preset content recognition algorithm, detecting whether the image contents of the multiple frames of first card images are consistent; If the detection result indicates that the image contents of the multiple frames of first card images are consistent, the card identification model is used to determine whether the multiple frames of first card images are collected in the multiple ways to determine the authenticity identification result of the card to be identified.
7. The method of claim 6, further comprising: If the detection result indicates that the image contents of the multiple frames of card images are inconsistent, it is determined that the card to be authenticated is a false certificate.
8. The method according to any one of claims 1 to 7, wherein: The card authentication model is a converter-based network model.
9. The method according to any one of claims 1 to 7, wherein: The card authentication model includes a block layer, a mapping layer, an extraction layer based on an attention mechanism, and a classification layer; The using the trained card identification model to determine whether the plurality of frames of first card images are collected in the plurality of ways to determine the authenticity identification result of the card to be identified includes: Using the blocking layer, each first card image in the plurality of frames of first card images is blocked to obtain an image block corresponding to each first card image; By utilizing the inter-frame relationship between the first card images, the image blocks corresponding to the first card images are combined to obtain a plurality of image block groups, wherein each image block group includes one or more image blocks, and the positions of the plurality of image blocks in a single image block group are the same in their respective first card images; Using the mapping layer, processing each group of image blocks to obtain a mapping sequence; Processing the mapping sequence using the extraction layer to obtain an image representation; The image representation is processed by utilizing the classification layer to determine the authenticity identification result of the card to be identified.
10. The method according to any one of claims 1 to 7, wherein: The training data for training the card identification model includes a plurality of sample image groups and their corresponding label data, and a single sample image group includes at least: sample card images obtained by collecting sample cards in the plurality of ways.
11. A card authentication method, applied to a client, comprising: In the process of instructing the user to capture an image of the card to be authenticated in multiple ways, acquiring multiple frames of first card images of the card to be authenticated, wherein the multiple ways enable the client to capture different images of the card to be authenticated; The multiple frames of first card images are sent to a server, so that after receiving the multiple frames of first card images, the server uses a trained card identification model to determine whether the multiple frames of first card images are collected in the multiple ways, so as to determine the authenticity identification result of the card to be identified.
12. A card authentication device, deployed on a server, comprising: a receiving module configured to receive multiple frames of first card images of a card to be authenticated from a client, wherein the client is used to instruct a user to capture images of the card to be authenticated in multiple ways, and the multiple ways enable the client to capture different images of the card to be authenticated; The first determination module is configured to use a trained card identification model to determine whether the multiple frames of first card images are collected in the multiple ways, so as to determine an authenticity identification result for the card to be identified.
13. A card authentication device, deployed on a client, comprising: an acquisition module, configured to acquire multiple frames of first card images of the card to be authenticated in a process of instructing the user to acquire images of the card to be authenticated in multiple ways, wherein the multiple ways enable the client to acquire different images of the card to be authenticated; The sending module is configured to send the multiple frames of first card images to the server, so that after receiving the multiple frames of first card images, the server uses a trained card identification model to determine whether the multiple frames of first card images are collected in the multiple ways, so as to determine the authenticity identification result of the card to be identified.
14. A computing device comprising a memory and a processor, wherein: The memory stores executable code, and when the processor executes the executable code, the method according to any one of claims 1 to 10 or 11 is implemented.
