Disclosure of Invention
In view of the foregoing, it is desirable to provide a certificate verification method, apparatus, computer device and medium based on image recognition, which can improve the accuracy of anti-counterfeit verification.
A method of validating credentials based on image recognition, the method comprising:
acquiring a certificate image to be verified;
Dividing the certificate image to be verified to obtain a plurality of certificate area images;
Acquiring position information of each certificate area image on the certificate image to be verified, and determining the area type of each certificate area image according to the acquired position information;
Determining a processing mode corresponding to each certificate area image according to the area type of each certificate area image, and respectively carrying out identification processing on each certificate area image by each processing mode to obtain an identification processing result of each certificate area image;
And generating a verification result of the certificate image to be verified according to the identification processing results of the plurality of certificate area images of the certificate image to be verified.
In one embodiment, determining a processing mode corresponding to each certificate area image according to an area type of each certificate area image, and respectively performing recognition processing on each certificate area image by each processing mode to obtain a recognition processing result of each certificate area image, including:
text recognition is carried out on each certificate area image, and a first recognition processing result corresponding to each certificate area image is obtained;
Performing image recognition on the certificate area images to obtain second recognition processing results of the certificate area images;
and counting the first recognition processing result and the second recognition processing result of the images of the certificate areas to obtain the recognition processing result of the images of the certificate areas.
In one embodiment, text recognition is performed on each document area image to obtain a first recognition processing result corresponding to each document area image, including:
Performing text recognition on each certificate area image to obtain text content in each certificate area image;
Respectively acquiring a generation rule of text content in each certificate area image according to the type of the area to which each certificate area image belongs;
And judging whether each text content obtained by text recognition accords with the generation rule of the text content in the certificate area image or not so as to obtain a first recognition processing result corresponding to each certificate area image.
In one embodiment, performing image recognition on each document area image to obtain a second recognition processing result of each document area image, including:
Carrying out image recognition on each certificate area image to obtain image characteristics of text content in each certificate area image;
and obtaining a second recognition processing result corresponding to the certificate area images according to the image features.
In one embodiment, before the document image to be verified is segmented to obtain a plurality of document area images, the method further includes:
identifying the certificate type of the certificate image to be verified to obtain the certificate type of the certificate image to be verified;
The method for dividing the certificate image to be verified to obtain a plurality of certificate area images comprises the following steps:
and carrying out segmentation processing on the certificate image to be verified through a pre-trained image segmentation model corresponding to the certificate type so as to obtain a plurality of segmented certificate area images.
In one embodiment, before the document image to be verified is segmented to obtain a plurality of area images, the method further includes:
Adjusting the acquired certificate image to be verified to a preset size to obtain the certificate image to be verified which meets the requirement of the preset size;
The method for dividing the certificate image to be verified to obtain a plurality of certificate area images comprises the following steps:
and dividing the certificate image to be verified, which meets the requirement of the preset size, to obtain a plurality of certificate area images.
In one embodiment, the identifying process is performed on each certificate area image through each processing mode, including:
The identification processing is carried out on the images of the certificate areas in parallel by the corresponding processing mode of the images of the certificate areas;
at least one of the document image to be verified, the document area image, the position information of the document area image on the document image to be verified, the area type of the document area image, the identification processing result of the document area image and the verification result of the document image to be verified is stored in the blockchain.
A credential verification device based on image recognition, the device comprising:
The certificate image acquisition module to be verified is used for acquiring the certificate image to be verified;
the segmentation processing module is used for carrying out segmentation processing on the certificate image to be verified to obtain a plurality of certificate area images;
The regional type determining module is used for acquiring the position information of each certificate regional image on the certificate image to be verified and determining the regional type of each certificate regional image according to the acquired position information;
The identification processing module is used for determining the processing mode corresponding to each certificate area image according to the area type of each certificate area image, and respectively carrying out identification processing on each certificate area image through each processing mode to obtain the identification processing result of each certificate area image;
And the verification result generation module is used for generating a verification result of the certificate image to be verified according to the identification processing results of the plurality of certificate area images of the certificate image to be verified.
A computer device comprising a memory storing a computer program and a processor implementing the steps of any one of the methods described above when the processor executes the computer program.
A computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the method of any of the preceding claims.
According to the certificate verification method, the device, the computer equipment and the storage medium based on image recognition, the certificate images to be verified are obtained, the certificate images to be verified are subjected to segmentation processing, so that a plurality of certificate area images are obtained, then the position information of each certificate area image on the certificate images to be verified is obtained, the area type of each certificate area image is determined according to the obtained position information, the processing mode corresponding to each certificate area image is determined according to the area type of each certificate area image, and the identification processing results of each certificate area image are obtained through the respective processing modes, so that the verification result of the certificate images to be verified is generated. Therefore, the image to be verified is divided into a plurality of certificate area images, and then classification of the affiliated areas is carried out, so that the corresponding processing mode is obtained for identification processing, the accuracy of the identification processing can be improved, and the accuracy of verification can be improved.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
The certificate verification method based on image recognition provided by the application can be applied to an application environment shown in figure 1. Wherein the terminal 102 communicates with the server 104 via a network. In this embodiment, the server terminal 102 collects an image of the document to be authenticated and uploads it to the server 104. After obtaining the certificate image to be verified, the server 104 performs segmentation processing on the certificate image to be verified to obtain a plurality of certificate area images. Further, the server 104 acquires position information of each document area image on the document image to be verified, and determines the type of the area to which each document area image belongs according to the acquired position information. Then, the server 104 determines a processing mode corresponding to each certificate area image according to the area type of each certificate area image, and respectively performs recognition processing on each certificate area image according to each processing mode to obtain a recognition processing result of each certificate area image. The server 104 then generates a verification result of the document image to be verified according to the recognition processing results of the plurality of document area images of the document image to be verified. The terminal 102 may be, but not limited to, various personal computers, notebook computers, smartphones, tablet computers, and portable wearable devices, and the server 104 may be implemented by a stand-alone server or a server cluster composed of a plurality of servers.
In one embodiment, as shown in fig. 2, there is provided a certificate verification method based on image recognition, which is described by taking the application of the method to the server in fig. 1 as an example, and includes the following steps:
step S202, obtaining a certificate image to be verified.
The document image to be verified can refer to various standard images, and can include, but is not limited to, an identity card, a passport, a army card, a harbor-australia countryside card, a cell card, a driving card and the like. In the present embodiment, the server may be a photographed image, or various scanned images, or the like.
In this embodiment, the certificate image to be verified may be an image for performing the application verification, and the object to be applied uploads the corresponding certificate image to be verified to the server through the enterprise or the personal terminal, so as to perform the application verification through the server.
Step S204, segmentation processing is carried out on the certificate image to be verified, and a plurality of certificate area images are obtained.
The document area image refers to a partial image that constitutes a document image to be authenticated, for example, referring to fig. 3, and for an identity card, the document area image may include a name area image, a gender area image, a date of birth area image, a document type area image, a document number area image, a portrait area image, and the like.
In this embodiment, the image to be verified may be segmented by an image segmentation model to obtain a plurality of document area images constituting the image to be verified.
Specifically, the image segmentation model may be a neural network model, an artificial intelligence AI model, or the like, to which the present application is not limited.
In this embodiment, the server may train and verify the image segmentation model by using the certificate images of the correct certificate formats as the training set image and the verification set image, so as to obtain the trained and verified image segmentation model.
Further, the server may input the acquired certificate image to be verified into a trained and verified image segmentation model to perform identification segmentation of the certificate area on the certificate image to be verified, so as to obtain a plurality of segmented certificate area images.
Step S206, acquiring the position information of each certificate area image on the certificate image to be verified, and determining the area type of each certificate area image according to the acquired position information.
As mentioned above, various document images have unique document formats, such as name, date of birth, document number, etc., and have corresponding fixed positions on the document image.
In this embodiment, the server may determine, according to the position information of each document area image on the document image to be verified, obtained in the segmentation process, the document area image so as to determine the type to which each document area image belongs. For example, with continued reference to fig. 3, taking an id card as an example, the document number area image is at the bottom of the document image to be verified, and is fixed at a position away from the bottom edge of the document image to be detected, for the name area image, its position in the document image to be detected is the upper left position, the upper left vertex is the origin, and both the X coordinate and the Y coordinate are the coordinates with the smallest coordinate values.
Step S208, determining the processing mode corresponding to each certificate area image according to the area type of each certificate area image, and respectively carrying out recognition processing on each certificate area image by each processing mode to obtain the recognition processing result of each certificate area image.
The recognition processing mode may include a processing mode such as text recognition, image recognition or generation rule, and the corresponding recognition processing modes may be different corresponding to different document area images, may be a single text recognition, image recognition or generation rule, or may be a recognition processing mode formed by combining 2 or 3 of text recognition, image recognition or generation rules. For example, the corresponding recognition processing method may be a combination of text recognition and image recognition for the name area image, and the corresponding recognition processing method may be only image recognition for the portrait area image, or may include a combination of text recognition and number generation rule and image recognition for the document number area image.
In this embodiment, the identification processing result is a result that the obtained certificate area image is true or false after the certificate area image is identified.
Specifically, the server may determine the recognition processing mode corresponding to each certificate area image according to the association relationship between each certificate area type and the recognition processing mode, and further perform recognition processing on each certificate area image by using the determined recognition processing mode, and output a corresponding recognition processing result.
Step S210, generating a verification result of the certificate image to be verified according to the identification processing results of the plurality of certificate area images of the certificate image to be verified.
Specifically, the server can obtain a statistical result by counting the identification processing results of all the area images of the to-be-detected certificate image, and further judge the statistical result to generate a verification result that the to-be-verified certificate image is a real certificate image or a forged certificate image, so as to realize verification of the to-be-verified certificate image.
In this embodiment, if the server determines that the recognition processing results of all the document area images of the document image to be verified are true, the server may generate a verification result for detecting that the document image is a true document image, and if the server determines that the recognition processing result of at least one document area image in all the document area images of the document image to be verified is false, the server may generate a verification result for detecting that the document image is a counterfeit document image.
In the certificate verification method based on image recognition, the to-be-verified certificate image is obtained, the to-be-verified certificate image is subjected to segmentation processing to obtain a plurality of certificate area images, then the position information of each certificate area image on the to-be-verified certificate image is obtained, the area type of each certificate area image is determined according to the obtained position information, the processing mode corresponding to each certificate area image is determined according to the area type of each certificate area image, and each certificate area image is respectively subjected to recognition processing in each processing mode to obtain the recognition processing result of each certificate area image, and then the verification result of the to-be-verified certificate image is generated. Therefore, the image to be verified is divided into a plurality of certificate area images, and then classification of the affiliated areas is carried out, so that the corresponding processing mode is obtained for identification processing, the accuracy of the identification processing can be improved, and the accuracy of verification can be improved.
In one embodiment, determining a processing mode corresponding to each certificate area image according to the area type of each certificate area image, and respectively performing recognition processing on each certificate area image by each processing mode to obtain a recognition processing result of each certificate area image, wherein the method can comprise the steps of performing text recognition on each certificate area image to obtain a first recognition processing result corresponding to each certificate area image; and counting the first recognition result and the second recognition result of the images of the certificate areas to obtain the recognition result of the images of the certificate areas.
The first recognition processing result is a text recognition result obtained after text recognition is performed on the document area image, and the second recognition processing result is an image recognition result obtained after image recognition is performed on the document area image. In this embodiment, the first recognition processing result and the second recognition processing result may be results indicating that the document area image is true or false.
In this embodiment, the server may perform text recognition and image recognition on each document area image, so as to obtain a corresponding first recognition processing result and a corresponding second recognition processing result, respectively.
Alternatively, the text recognition and the image recognition of the images of the certificate areas by the server may be performed in parallel, or may be performed by performing text recognition first and then performing image recognition, or performing image recognition first and then performing text recognition, etc., which is not limited in the present application.
Further, the server may determine that each document area image is true or false by counting the first recognition result and the second recognition result, for example, if the first recognition result and the second recognition result are both true, then the document area image may be determined to be true, and if at least one of the first recognition result and the second recognition result is false, then the document area image may be determined to be false.
In this embodiment, the server may perform text recognition and image recognition on the area image by using a neural network model, and may perform text recognition and image recognition on each document area image by using a single or neural network model.
In the above embodiment, the text recognition and the image recognition are performed on the document area image respectively, and the recognition processing result of the document area image is obtained based on the obtained first recognition processing result and the second recognition processing result, so that the recognition processing result is obtained according to the combination of the text recognition and the image recognition, and the accuracy of the recognition processing can be improved.
In one embodiment, performing text recognition on each document area image to obtain a first recognition processing result corresponding to each document area image may include performing text recognition on each document area image to obtain text content in each document area image, respectively obtaining generation rules corresponding to the text content in each document area image according to the area type of each document area image, and judging whether each text content obtained by text recognition accords with the generation rules of the text content in the document area image to obtain a first recognition processing result corresponding to each document area image.
The text content refers to text fields in the document area image, such as "name somewhere", "citizen identity number 110102YYYYMMDD888X", and the like.
The generation rule of the text content refers to the generation rule of the text field, for example, for citizen identity numbers, the generation rule is composed of 18 bits, the first 1/2 digit number represents the provincial code where it is located, the first 3/4 digit number represents the city code where it is located, the first 5/6 digit number represents the county code where it is located, the 7 th to 14 th digits represent the date of birth, the 15 th/16 th digit represents the place dispatch code where it is located, the 17 th digit represents gender, the singular number represents male, the double number represents female, the 18 th digit is a check code, and it is represented by 0 to 9, and 10 is represented by X.
In this embodiment, the server may identify the text content, then obtain a rule for generating the text content of each document area image according to the type of the area to which the document area image belongs, and then determine the identified text content, and generate the first identification processing result.
Optionally, the server may also combine text contents of the plurality of certificate area images, determine text contents of a certain certificate area image, and generate a first recognition processing result corresponding to the certificate area image, for example, for a citizen identity number, the server may determine whether a corresponding number in the citizen identity accords with a rule for generating corresponding text contents based on the recognized text recognition results of gender, birth place, birth year and month and the like.
In the above embodiment, text content is obtained by performing text recognition on each document area image, and then, according to the type of the area to which each document area image belongs, the generation rules of the text content in each document area image are respectively obtained and determined, so that based on the generation rules of the text content, the text content can be accurately determined, thereby improving the accuracy of the generated first recognition processing result
In one embodiment, the image recognition is performed on each document area image to obtain a second recognition processing result of each document area image, which may include performing image recognition on each document area image to obtain image features of text content in each document area image, and obtaining a second recognition processing result corresponding to each document area image according to each image feature.
The image feature refers to an image feature of each text content in the area image, for example, whether the text is inclined with respect to the text content, how many characters are the distance between the text, and the like.
Specifically, the server can identify each certificate area image and then obtain the image characteristics of the text content in the certificate area image so as to obtain a corresponding second identification processing result.
In the embodiment, the image characteristics of the text content are obtained by performing image recognition, so that whether the image characteristics of the text content are changed or not can be accurately judged, and the generation of forged certificate images through PS or an equivalent mode is avoided, so that the recognition accuracy is improved.
In one embodiment, before the image of the certificate to be verified is segmented to obtain the multiple region images of the certificate, the method further comprises the step of identifying the type of the certificate of the image of the certificate to be verified to obtain the type of the certificate of the image of the certificate to be verified.
As previously mentioned, the document image to be authenticated may refer to images of a variety of different standard types of documents, and may include, but is not limited to, identification cards, passports, army certificates, kong-Australian return certificates, typhoons, driver licenses, and the like.
In this embodiment, before the server performs the segmentation processing on the image of the document to be verified, the identification determination of the document type may be performed by using the document type identification model, for example, for an identity card and a passport, the object photograph of the identity card is in the upper right position, the object photograph of the passport is in the upper left position, the front image of the identity card includes contents of 7 different areas, and the front image of the passport includes contents of more than 7 different areas. So that the document type of the document image to be authenticated can be determined based on the position information, the quantity information, and the like.
In this embodiment, the method includes performing segmentation processing on the to-be-verified document image to obtain a plurality of document area images, and may include performing segmentation processing on the to-be-verified document image through a pre-trained image segmentation model corresponding to the document type to obtain a plurality of segmented document area images.
Further, the server may select an image segmentation model corresponding to the type of the certificate according to the type of the certificate of the to-be-verified certificate image, and segment the to-be-verified certificate image, for example, if the to-be-verified certificate image is an identity card, select an identity card segmentation model for segmenting the identity card image, and if the to-be-verified certificate image is a passport, select a passport segmentation model for segmenting the passport image.
In the embodiment, the identification of the certificate type is performed on the certificate image to be verified, and then the corresponding image segmentation model is selected to segment the certificate image to be verified, so that the image segmentation model can only segment the certificate image to be verified of one certificate type, the segmentation is more targeted, the accuracy of identification segmentation is improved, the learning difficulty of the model is reduced, and the learning efficiency of the model is improved.
In one embodiment, before the document image to be verified is segmented to obtain the plurality of area images, the method further comprises the step of adjusting the acquired document image to be verified to a preset size to obtain the document image to be verified which meets the requirement of the preset size.
Specifically, the image of the certificate to be verified obtained by the server may be an image with different sizes, and the server may adjust the image of the certificate to be verified to a preset size, for example, may be an actual size of the certificate, for example, for an identity card, the preset size may be 85.6mm×54.mm.
Or the server may adjust the acquired image of the document to be processed to the input size requirements required by the segmentation model, e.g., 865 x 540, etc. In this embodiment, the size of the document image to be detected acquired by the server may not be consistent with the size required by the image segmentation model, and the server may make the size of the document image to be verified consistent with the preset size by performing the process of enlarging or reducing the document image to be detected.
Alternatively, the certificate image to be detected acquired by the server may be an oblique image, and the server may perform rotation processing on the acquired certificate image to be verified to obtain the corrected certificate image to be processed.
In this embodiment, the dividing the to-be-verified document image to obtain a plurality of document area images may include dividing the to-be-verified document image conforming to a preset size requirement to obtain a plurality of document area images.
Specifically, the server may input the document image to be verified after the size adjustment into a trained image cutting model, so as to output a plurality of document area images through the image cutting model.
In the above embodiment, the adjustment of the image size is performed on the document image to be detected, and then the cutting processing is performed, so that the document image to be processed after the adjustment is input can meet a certain size requirement, the accuracy of the segmentation processing can be improved, and the accuracy of verification can be improved.
In one embodiment, the identification processing is performed on each document area image by using each processing mode, which may include performing the identification processing on each document area image in parallel by using the processing mode corresponding to each document area image.
Specifically, the server may perform recognition processing on each corresponding document area image in a parallel manner by each recognition processing method, for example, each document area image may be processed by each recognition processing method of a corresponding name area image, a gender area image, a date of birth area image, a document type area image, and a document number area image.
In this embodiment, at least one of the document image to be authenticated, each document area image, positional information of each document area image on the document image to be authenticated, the area type of each document area image, the recognition processing result of each document area image, and the authentication result of the document image to be authenticated is stored in the blockchain.
Specifically, in order to further ensure the privacy and security of the data, the server may store the to-be-verified document image, each document area image, the position information of each document area image on the to-be-verified document image, the area type of each document area image, the identification processing result of each document area image, and the verification result of the to-be-verified document image in the nodes of the two blocks.
In this embodiment, the blockchain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm, and the like. The blockchain (Blockchain), essentially a de-centralized database, is a string of data blocks that are generated in association using cryptographic methods, each of which contains information from a batch of network transactions for verifying the validity (anti-counterfeit) of its information and generating the next block.
In this embodiment, the blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
In the above embodiment, the identification processing is performed on each certificate area image in parallel, so that the identification processing process of a plurality of certificate area images of the same certificate image to be processed can be performed in parallel, thereby saving the time of data processing and improving the efficiency of identification processing.
It should be understood that, although the steps in the flowchart of fig. 2 are shown in sequence as indicated by the arrows, the steps are not necessarily performed in sequence as indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in fig. 2 may include multiple sub-steps or stages that are not necessarily performed at the same time, but may be performed at different times, nor do the order in which the sub-steps or stages are performed necessarily performed in sequence, but may be performed alternately or alternately with at least a portion of the sub-steps or stages of other steps or other steps.
In one embodiment, as shown in FIG. 4, there is provided an image recognition-based document authentication apparatus, including a document image acquisition module 100 to be authenticated, a segmentation processing module 200, a region type determination module 300, an identification processing module 400, and an authentication result generation module 500, wherein:
The certificate image acquisition module to be verified 100 is used for acquiring the certificate image to be verified.
The segmentation processing module 200 is configured to perform segmentation processing on the document image to be verified, so as to obtain a plurality of document area images.
The region type determining module 300 is configured to obtain location information of each document region image on the document image to be verified, and determine a region type to which each document region image belongs according to each obtained location information.
The recognition processing module 400 is configured to determine a processing mode corresponding to each document area image according to the area type of each document area image, and perform recognition processing on each document area image according to each processing mode, so as to obtain a recognition processing result of each document area image.
The verification result generation module 500 is configured to generate a verification result of the to-be-verified document image according to recognition processing results of the plurality of document area images of the to-be-verified document image.
In one embodiment, the identification processing module 400 may include:
And the first recognition processing result generation sub-module is used for carrying out text recognition on the certificate area images to obtain first recognition processing results corresponding to the certificate area images.
The second recognition processing result generation sub-module is used for carrying out image recognition on the certificate area images to obtain second recognition processing results of the certificate area images;
and the third recognition processing result generation sub-module is used for counting the first recognition processing result and the second recognition processing result of each certificate area image to obtain the recognition processing result of each certificate area image.
In one embodiment, the first recognition processing result generation sub-module may include:
And the text content generation unit is used for carrying out text recognition on the certificate area images to obtain text content in the certificate area images.
And the generation rule acquisition unit is used for respectively acquiring the generation rule of the text content in each certificate area image according to the type of the area to which each certificate area image belongs.
And the judging unit is used for judging whether each text content obtained by text recognition accords with the generation rule of the text content in the certificate area image so as to obtain a first recognition processing result corresponding to each certificate area image.
In one embodiment, the second recognition processing result generation sub-module may include:
and the image recognition unit is used for carrying out image recognition on the images of the certificate areas to obtain the image characteristics of the text content in the images of the certificate areas.
And the second recognition result generating unit is used for obtaining a second recognition processing result corresponding to each certificate area image according to each image characteristic.
In one embodiment, the apparatus may further include:
the certificate type determining module is used for identifying the certificate type of the certificate image to be verified before the segmentation processing module 200 performs segmentation processing on the certificate image to be verified to obtain a plurality of certificate area images, so as to obtain the certificate type of the certificate image to be verified.
In this embodiment, the segmentation processing module 200 may be configured to perform segmentation processing on the document image to be verified through a pre-trained image segmentation model corresponding to the document type, so as to obtain a plurality of segmented document area images.
In one embodiment, the apparatus may further include:
The size adjustment module is used for adjusting the acquired certificate image to be verified to a preset size before the segmentation processing module 200 performs segmentation processing on the certificate image to be verified to obtain a plurality of area images so as to obtain the certificate image to be verified which meets the requirement of the preset size.
In this embodiment, the segmentation processing module 200 is configured to perform segmentation processing on the document image to be verified, which meets a preset size requirement, to obtain a plurality of document area images.
In one embodiment, the recognition processing module 400 performs recognition processing on each document area image in parallel through a processing manner corresponding to each document area image.
In this embodiment, at least one of the document image to be authenticated, each document area image, positional information of each document area image on the document image to be authenticated, the area type of each document area image, the recognition processing result of each document area image, and the authentication result of the document image to be authenticated is stored in the blockchain.
For specific limitations on the image-recognition-based document authentication device, reference may be made to the above limitations on the image-recognition-based document authentication method, and no further description is given here. The various modules in the image recognition-based credential verification device described above can be implemented in whole or in part in software, hardware, and combinations thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a server, the internal structure of which may be as shown in fig. 5. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer equipment is used for storing data such as the certificate image to be verified, the certificate area image, the position information, the identification processing result of the certificate area image, the verification result and the like. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program, when executed by a processor, implements a method of authentication of credentials based on image recognition.
It will be appreciated by those skilled in the art that the structure shown in FIG. 5 is merely a block diagram of some of the structures associated with the present inventive arrangements and is not limiting of the computer device to which the present inventive arrangements may be applied, and that a particular computer device may include more or fewer components than shown, or may combine some of the components, or have a different arrangement of components.
In one embodiment, a computer device is provided, which comprises a memory and a processor, wherein the memory stores a computer program, and the processor performs the steps of acquiring a to-be-verified certificate image, dividing the to-be-verified certificate image to obtain a plurality of certificate area images, acquiring position information of each certificate area image on the to-be-verified certificate image, determining the area type of each certificate area image according to the acquired position information, determining the processing mode corresponding to each certificate area image according to the area type of each certificate area image, respectively performing recognition processing on each certificate area image through each processing mode to obtain a recognition processing result of each certificate area image, and generating a verification result of the to-be-verified certificate image according to the recognition processing results of a plurality of certificate area images of the to-be-verified certificate image.
In one embodiment, the processor determines a processing mode corresponding to each certificate area image according to the area type of each certificate area image when executing the computer program, and respectively performs recognition processing on each certificate area image through each processing mode to obtain a recognition processing result of each certificate area image, and the method can comprise the steps of performing text recognition on each certificate area image to obtain a first recognition processing result corresponding to each certificate area image; and counting the first recognition result and the second recognition result of the images of the certificate areas to obtain the recognition result of the images of the certificate areas.
In one embodiment, the processor performs text recognition on each document area image when executing the computer program to obtain a first recognition processing result corresponding to each document area image, and the method comprises the steps of performing text recognition on each document area image to obtain text content in each document area image, respectively obtaining generation rules corresponding to the text content in each document area image according to the type of the area of each document area image, and judging whether each text content obtained by text recognition accords with the generation rules of the text content in the document area image to obtain the first recognition processing result corresponding to each document area image.
In one embodiment, the processor performs image recognition on each document area image when executing the computer program to obtain a second recognition result of each document area image, and the method may include performing image recognition on each document area image to obtain image features of text content in each document area image, and obtaining a second recognition result corresponding to each document area image according to each image feature.
In one embodiment, the processor performs segmentation processing on the to-be-verified certificate image when executing the computer program, and before obtaining the plurality of certificate area images, the method can further perform the step of identifying the certificate type of the to-be-verified certificate image to obtain the certificate type of the to-be-verified certificate image. The method comprises the steps of obtaining a plurality of certificate area images by dividing the certificate image to be verified through an image division model which is trained in advance and corresponds to the type of the certificate.
In one embodiment, the processor performs segmentation processing on the certificate image to be verified when executing the computer program, and before obtaining the plurality of area images, the step of adjusting the obtained certificate image to be verified to a preset size to obtain the certificate image to be verified meeting the requirement of the preset size can be further performed. The method for obtaining the plurality of certificate area images comprises the steps of carrying out segmentation processing on the certificate image to be verified, which meets the requirement of the preset size, to obtain the plurality of certificate area images.
In one embodiment, the processor, when executing the computer program, implements the identification processing of each document area image by each processing mode, and may include performing the identification processing of each document area image in parallel by the processing mode corresponding to each document area image. At least one of the document image to be verified, the document area image, the position information of the document area image on the document image to be verified, the area type of the document area image, the identification processing result of the document area image and the verification result of the document image to be verified is stored in the blockchain.
In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, which when executed by a processor performs the steps of obtaining a document image to be authenticated, performing segmentation processing on the document image to be authenticated to obtain a plurality of document area images, obtaining positional information of each document area image on the document image to be authenticated, determining a type of an area to which each document area image belongs according to the obtained positional information, determining a processing mode corresponding to each document area image according to the type of the area to which each document area image belongs, performing recognition processing on each document area image by each processing mode to obtain a recognition processing result of each document area image, and generating a verification result of the document image to be authenticated according to the recognition processing results of a plurality of document area images of the document image to be authenticated.
In one embodiment, the computer program when executed by the processor determines a processing mode corresponding to each certificate area image according to the area type of each certificate area image, and respectively performs recognition processing on each certificate area image through each processing mode to obtain a recognition processing result of each certificate area image, and the method can comprise the steps of performing text recognition on each certificate area image to obtain a first recognition processing result corresponding to each certificate area image; and counting the first recognition result and the second recognition result of the images of the certificate areas to obtain the recognition result of the images of the certificate areas.
In one embodiment, the computer program when executed by the processor performs text recognition on each document area image to obtain a first recognition processing result corresponding to each document area image, and the method includes performing text recognition on each document area image to obtain text content in each document area image, respectively obtaining generation rules corresponding to the text content in each document area image according to the area type of each document area image, and judging whether each text content obtained by text recognition accords with the generation rules of the text content in the document area image to obtain a first recognition processing result corresponding to each document area image.
In one embodiment, the computer program when executed by the processor performs image recognition on each document area image to obtain a second recognition result of each document area image, and the method may include performing image recognition on each document area image to obtain image features of text content in each document area image, and obtaining a second recognition result corresponding to each document area image according to each image feature.
In one embodiment, the computer program when executed by the processor performs segmentation processing on the to-be-verified document image, and before obtaining the plurality of document area images, the method further includes the step of performing document type identification on the to-be-verified document image to obtain the document type of the to-be-verified document image. The computer program, when executed by the processor, performs a segmentation process on the document image to be verified to obtain a plurality of document area images, and may include performing a segmentation process on the document image to be verified by means of a pre-trained image segmentation model corresponding to the document type to obtain a plurality of segmented document area images.
In one embodiment, the computer program when executed by the processor performs segmentation processing on the to-be-verified document image, and before obtaining the plurality of area images, the method may further include adjusting the obtained to-be-verified document image to a preset size to obtain the to-be-verified document image meeting the requirement of the preset size. The computer program, when executed by the processor, performs a segmentation process on the document image to be verified to obtain a plurality of document area images, and may include performing a segmentation process on the document image to be verified that meets a preset size requirement to obtain a plurality of document area images.
In one embodiment, the computer program when executed by the processor performs the identification processing on each document area image by each processing mode, and may include performing the identification processing on each document area image in parallel by the processing mode corresponding to each document area image. At least one of the document image to be verified, the document area image, the position information of the document area image on the document image to be verified, the area type of the document area image, the identification processing result of the document area image and the verification result of the document image to be verified is stored in the blockchain.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in embodiments provided herein may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (SYNCHLINK) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples illustrate only a few embodiments of the application, which are described in detail and are not to be construed as limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of protection of the present application is to be determined by the appended claims.