Disclosure of Invention
The application provides a method, a device, equipment and a storage medium for identifying certificate photo camouflage in a certificate, which are used for effectively identifying the certificate covered by a sticker with the certificate photo camouflage and improving the accuracy of certificate authenticity identification.
In a first aspect, an embodiment of the present application provides a method for identifying a certificate photo masquerading in a certificate, including:
acquiring a certificate image, wherein the certificate image comprises a certificate photo;
determining a face area in the certificate image certificate photo;
according to the face area, obtaining a certificate photo image from the certificate image in a cutting mode, wherein the certificate photo image comprises a certificate photo boundary;
acquiring the characteristics of the certificate photo in the certificate photo image;
and judging whether the certificate photo camouflage exists in the certificate image or not according to the characteristics.
Optionally, capturing a certificate image from the certificate image according to the face region, including:
and taking the face area as a central area, expanding the central area outwards to the periphery to set the area, and taking the expanded area as the certificate photo image.
Optionally, the feature is used for indicating whether a pasting effect of the certificate photo and the certificate exists in the certificate photo image.
Optionally, judging whether the certificate image has the certificate photo camouflage according to the characteristics includes:
if the fact that the characteristic indicates that the certificate photo image has the sticking effect of the certificate photo and the certificate is determined, judging that certificate photo camouflage exists in the certificate photo image;
and if the characteristic indicates that the certificate photo image has the pasting effect of the certificate photo and the certificate, judging that the certificate photo camouflage does not exist in the certificate image.
Optionally, the obtaining of the feature of the identification photo in the identification photo image includes:
inputting the certificate photo image into an identification model to obtain the characteristics of the certificate photo in the certificate photo image output by the identification model;
wherein the identification model is: the method comprises the steps of training a preset model by adopting a set of sample certificate images, wherein the set of the sample certificate images comprises the corresponding relation between the sample certificate images and characteristics, and the characteristics are used for indicating whether the certificate images have the pasting effect between certificate photos and certificates.
Optionally, removing features of the face region in the sample certificate image;
before calculating features in the document image, the method further comprises:
and removing the characteristics of the face area in the certificate image.
Optionally, the ratio of the area occupied by the area with the set size to the area of the certificate image is a set value.
In a second aspect, an embodiment of the present application provides an apparatus for identifying a photo camouflage in a document, including:
the acquisition module is used for acquiring a certificate image, wherein the certificate image comprises a certificate photo;
the determining module is used for determining a face area in the certificate image certificate photo;
the intercepting module is used for intercepting a certificate photo image from the certificate image according to the face area, wherein the certificate photo image comprises a certificate photo boundary;
the identification module is used for acquiring the characteristics of the certificate photo in the certificate photo image;
and the judging module is used for judging whether the certificate photo camouflage exists in the certificate image according to the characteristics.
In a third aspect, an embodiment of the present application provides an electronic device, including: the system comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
the memory for storing a computer program;
the processor is configured to execute the program stored in the memory to implement the method for identifying the certificate photo camouflage in the certificate according to the first aspect.
In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program, and the computer program, when executed by a processor, implements the method for identifying camouflaging in a certificate according to the first aspect.
Compared with the prior art, the technical scheme provided by the embodiment of the application has the following advantages: according to the method provided by the embodiment of the application, the face area in the certificate image certificate photo is identified, the certificate photo image is obtained by intercepting from the certificate image according to the face area, and the certificate photo characteristics in the certificate photo image are obtained, so that whether the head portrait camouflage certificate photo such as a photo sticker exists in the certificate image can be effectively identified according to the characteristics, and the accuracy of certificate authenticity identification is improved.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In the embodiment of the application, in order to solve the problem that the authenticity of the certificate cannot be effectively identified and identification errors are caused after the certificate is disguised by the photo sticker, the method for identifying the certificate photo disguise in the certificate is provided, and the method can be applied to any electronic equipment, wherein the electronic equipment can be terminal equipment or a server.
As shown in fig. 1, the specific process of identifying the certificate photo camouflage in the certificate is as follows:
step 101, acquiring a certificate image, wherein the certificate image comprises a certificate photo.
If the certificate photo camouflage in the certificate is identified by the terminal equipment, the terminal equipment acquires the certificate image, and if the certificate photo camouflage in the certificate is identified by the server, the terminal equipment acquires the certificate image and transmits the certificate image to the server.
In a specific embodiment, the terminal device, taking a mobile phone as an example, collects the certificate image in the following process: the mobile phone client displays a guide frame for collecting the certificate image on a screen, prompts (voice or text prompting) a user to enable the front face of the certificate to face the mobile phone screen, places the certificate in the guide frame, adjusts the shooting posture to ensure that the brightness, the fuzziness, the frame and the like meet the collection requirements, and collects the image in the guide frame to obtain the certificate front image. The process of capturing the reverse image of the document is similar and will not be repeated here.
The certificate image can be an image of one side of the certificate containing the certificate photo, such as a front image of the identity card.
And 102, determining a face area in the certificate photo in the certificate image.
The face region in the certificate image may be determined by any one of face feature recognition and positioning algorithms, for example, the face region in the certificate image may be positioned by a conventional face detection method based on a histogram of oriented gradients (hog), or by a face detection method based on a Convolutional Neural Network (CNN).
And 103, intercepting a certificate photo image from the certificate image according to the face area in the certificate image, wherein the certificate photo image comprises a certificate photo boundary.
In a specific embodiment, a face area in a certificate image is used as a central area, the central area is expanded outwards to the periphery to form an area with a set size, and the area obtained after the expansion is used as the certificate image. For example, as shown in fig. 2, the face region is expanded to obtain a shadow region, which can cover the complete identification photo region and includes the adjacent region of the identification photo region.
Wherein, the ratio of the area occupied by the area with the set size to the area of the certificate image is a set value.
Specifically, after the face area is identified, the external rectangle of the face area is expanded, wherein the horizontal axis direction is expanded by a first proportion, the vertical axis direction is expanded by a second proportion, and the area covered after the external expansion is used as a certificate photo image. The first example was determined as follows: and counting the proportion of the length of the face area in the abscissa axis of the sample certificate image to the length of the certificate photo area in the abscissa axis, and taking the average value of the proportions as a first proportion. Similarly, the second ratio is determined as follows: and counting the proportion of the length of the face area in the ordinate axis in the sample certificate image to the length of the certificate photo area in the ordinate axis, and taking the average value of the counted proportion as a second proportion. The first ratio was found to be 1.3 and the second ratio was found to be 1.6 by statistics.
The adjacent area occupies a very small proportion in the identification picture image, and only the boundary of the identification picture area needs to be completely contained in the identification picture image.
And 104, acquiring the characteristics of the certificate photo in the certificate photo image.
The characteristics are used for indicating whether the certificate photo has the pasting effect of the certificate photo and the certificate or not.
In one embodiment, the process of identifying the characteristics of the identification photograph in the image of the identification photograph is as follows: inputting the certificate photo image into an identification model to obtain the characteristics of the certificate photo in the certificate photo image output by the identification model; wherein, the identification model is as follows: and training a preset model by adopting a set of sample certificate images, wherein the set of sample certificate images comprises a corresponding relation between the sample certificate images and characteristics, and the characteristics are used for indicating whether a pasting effect between the certificate photo and the certificate exists in the certificate images.
The sample certificate images comprise a plurality of real certificate images and a plurality of certificate images forged by the photo stickers, the characteristics of the certificate photos in each sample certificate image are marked, and the preset model is trained by adopting the set of the sample certificate images until whether the sticking effect of the photo stickers and the certificates is contained in the certificate images can be judged correctly.
The preset model may be a residual neural network model, such as Resnet50 or Resnet18, or other network models, such as GoogleNet, densnet, etc.
In order to improve the recognition accuracy of the trained recognition model, before training, the features of the face region in the sample certificate image are removed, for example, the face region in the sample certificate image is masked by an occlusion template, which may be a single-color occlusion image, such as a black image or a white image. The interference of the facial features on training can be removed in a shielding mode. Compared with the mode of carrying out model training by adopting the whole collected image, the method reduces interference factors and improves the identification accuracy.
And before the characteristics of the certificate photo in the certificate photo image are acquired, the characteristics of the face area in the certificate image or the certificate photo image are removed, namely the face area in the certificate photo image is covered by adopting a shielding template, so that the interference is reduced, and the identification accuracy is improved.
In a similar way, before the face region is positioned, the characters region and other features which are not the position of the certificate photo can be shielded clearly, so that the complexity of face positioning is reduced, and the accuracy of face positioning is improved.
The method has the advantages that the method is obtained through experiments, under the condition that the human face area is not shielded, most of attention points during model training and feature recognition are concentrated on the human face part, after the facial features are shielded, most of attention points during model training and feature recognition are concentrated on the boundary of the certificate photo, and the recognition accuracy rate of the model is greatly improved.
And 105, judging whether the certificate photo camouflage exists in the certificate image according to the characteristics.
Specifically, if the characteristic indication certificate photo image has the certificate photo and certificate pasting effect, judging that certificate photo camouflage exists in the certificate image; and if the characteristic indication certificate photo image has the pasting effect of the certificate photo and the certificate, judging that certificate photo camouflage does not exist in the certificate image.
After the certificate photo camouflage is judged not to exist in the certificate image, other detection can be further carried out on the certificate image.
According to product requirements, after the certificate is judged to have certificate photo camouflage, information of the certificate can be added into a blacklist, or certificate images are required to be collected again.
In the embodiment of the application, the face area in the certificate image certificate photo is identified, the certificate photo image is obtained by intercepting from the certificate image according to the face area, and the certificate photo feature in the certificate photo image is obtained, so that whether the head photo such as a photo sticker exists in the certificate image or not can be effectively identified according to the feature, and the accuracy of certificate authenticity identification is improved. Moreover, the method of shielding the face area is adopted, and the accuracy of certificate authenticity identification is further improved.
Based on the same concept, the embodiment of the present application provides a device for identifying a certificate photo camouflage in a certificate, the specific implementation of the device may refer to the description of the embodiment of the method, and repeated descriptions are omitted, as shown in fig. 3, the device mainly includes:
the acquisition module 301 is configured to acquire a certificate image, where the certificate image includes a certificate photo;
a determining module 302, configured to determine a face region in the certificate image certificate;
the intercepting module 303 is configured to intercept a certificate photo image from the certificate image according to the face region, where the certificate photo image includes a certificate photo boundary;
the identification module 304 is used for acquiring the characteristics of the certificate photo in the certificate photo image;
the judging module 305 is configured to judge whether the certificate photo camouflage exists in the certificate image according to the characteristic.
Specifically, the intercept module 303 is specifically configured to: and taking the face area as a central area, expanding the central area outwards to the periphery to set the area, and taking the expanded area as the certificate photo image. And the ratio of the area occupied by the area with the set size to the area of the certificate image is a set value.
Specifically, the characteristic is used for indicating whether a pasting effect of the certificate photo and the certificate exists in the certificate photo image.
Specifically, if the judging module 305 determines that the characteristic indicates that the certificate photo and the certificate pasting effect exist in the certificate photo image, it judges that certificate photo camouflage exists in the certificate photo image; and if the characteristic indicates that the certificate photo image has the pasting effect of the certificate photo and the certificate, judging that the certificate photo camouflage does not exist in the certificate image.
Specifically, the recognition module 304 is specifically configured to input the identification image to a recognition model, and obtain a feature of the identification image in the identification image output by the recognition model; wherein the identification model is: the method comprises the steps of training a preset model by adopting a set of sample certificate images, wherein the set of the sample certificate images comprises the corresponding relation between the sample certificate images and characteristics, and the characteristics are used for indicating whether the certificate images have the pasting effect between certificate photos and certificates.
Wherein features of the face region in the sample document image are removed.
Before the recognition module 304 recognizes the features of the certificate photo in the certificate photo sub-image, the features of the face area in the certificate photo sub-image are removed.
Based on the same concept, an embodiment of the present application further provides an electronic device, as shown in fig. 4, the electronic device mainly includes: a processor 401, a communication interface 402, a memory 403 and a communication bus 404, wherein the processor 401, the communication interface 402 and the memory 403 communicate with each other via the communication bus 404. Wherein, the memory 403 stores programs executable by the processor 401, and the processor 401 executes the programs stored in the memory 403, implementing the following steps: acquiring a certificate image, wherein the certificate image comprises a certificate photo; determining a face area in the certificate image certificate photo; according to the face area, obtaining a certificate photo image from the certificate image in a cutting mode, wherein the certificate photo image comprises a certificate photo boundary; acquiring the characteristics of the certificate photo in the certificate photo image; and judging whether the certificate photo camouflage exists in the certificate image or not according to the characteristics.
The communication bus 404 mentioned in the above electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus 404 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown in FIG. 4, but this does not indicate only one bus or one type of bus.
The communication interface 402 is used for communication between the above-described electronic apparatus and other apparatuses.
The Memory 403 may include a Random Access Memory (RAM) or a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Alternatively, the memory may be at least one memory device located remotely from the aforementioned processor 401.
The Processor 401 may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc., and may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic devices, discrete gates or transistor logic devices, and discrete hardware components.
In yet another embodiment of the present application, there is also provided a computer-readable storage medium having stored therein a computer program which, when run on a computer, causes the computer to execute the method of identifying a photo masquerading in a document described in the above embodiments.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the application to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored on a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wire (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wirelessly (e.g., infrared, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that includes one or more of the available media. The available media may be magnetic media (e.g., floppy disks, hard disks, tapes, etc.), optical media (e.g., DVDs), or semiconductor media (e.g., solid state drives), among others.
It is noted that, in this document, relational terms such as "first" and "second," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The foregoing are merely exemplary embodiments of the present invention, which enable those skilled in the art to understand or practice the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.