CN116092106A - Seal identification method, device, electronic equipment and storage medium - Google Patents

Seal identification method, device, electronic equipment and storage medium Download PDF

Info

Publication number
CN116092106A
CN116092106A CN202310120586.4A CN202310120586A CN116092106A CN 116092106 A CN116092106 A CN 116092106A CN 202310120586 A CN202310120586 A CN 202310120586A CN 116092106 A CN116092106 A CN 116092106A
Authority
CN
China
Prior art keywords
seal
image
text
model
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310120586.4A
Other languages
Chinese (zh)
Inventor
黄康华
徐天适
黄宇恒
张华俊
梁天恺
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
GRG Banking Equipment Co Ltd
Original Assignee
GRG Banking Equipment Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by GRG Banking Equipment Co Ltd filed Critical GRG Banking Equipment Co Ltd
Priority to CN202310120586.4A priority Critical patent/CN116092106A/en
Publication of CN116092106A publication Critical patent/CN116092106A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/40Document-oriented image-based pattern recognition
    • G06V30/41Analysis of document content
    • G06V30/413Classification of content, e.g. text, photographs or tables
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/82Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/16Image preprocessing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/19Recognition using electronic means
    • G06V30/191Design or setup of recognition systems or techniques; Extraction of features in feature space; Clustering techniques; Blind source separation
    • G06V30/19173Classification techniques

Abstract

The application discloses a seal identification method, a seal identification device, electronic equipment and a storage medium, and belongs to the technical field of image processing. The method comprises the following steps: acquiring a first seal image, wherein the first seal image comprises a target seal to be identified; performing target detection and cutting processing on the first seal image to obtain a second seal image; inputting the second seal image into a generated countermeasure network model, removing background noise of the second seal image, and obtaining a third seal image output by the generated countermeasure network model; performing text detection on the third seal image to obtain a first seal text image; correcting the first seal text image to obtain a second seal text image; and performing seal character recognition on the second seal text image to obtain a character recognition result of the target seal. The method improves the efficiency and accuracy of seal identification.

Description

Seal identification method, device, electronic equipment and storage medium
Technical Field
The application belongs to the technical field of image processing, and particularly relates to a seal identification method, a seal identification device, electronic equipment and a storage medium.
Background
With the rapid development of artificial intelligence, deep learning is widely applied to the technical fields of image recognition, optical character recognition and the like, and a seal recognition method based on machine vision is beneficial to realizing efficient and intelligent analysis of documents.
The traditional seal identification method realizes the positioning detection and extraction of the seal in the document image by constructing a HIS, RGB, HSV color space model, and then realizes the seal character identification by an image processing operation and a template matching method.
Disclosure of Invention
The present application aims to solve at least one of the technical problems existing in the prior art. Therefore, the application provides a seal identification method, a seal identification device, electronic equipment and a storage medium, which can improve the accuracy and efficiency of seal identification.
In a first aspect, the present application provides a seal identification method, including:
acquiring a first seal image, wherein the first seal image comprises a target seal to be identified;
Performing target detection and cutting processing on the first seal image to obtain a second seal image;
inputting the second seal image into a generated countermeasure network model, removing background noise of the second seal image, and obtaining a third seal image output by the generated countermeasure network model;
performing text detection on the third seal image to obtain a first seal text image;
correcting the first seal text image to obtain a second seal text image;
performing seal character recognition on the second seal text image to obtain a character recognition result of the target seal;
wherein the generating the challenge network model is trained based on a first model training sample.
According to the seal identification method, the first seal image containing the target seal is subjected to target detection and cutting processing, the area image except the area where the target seal is located is removed, the second seal image is processed by using the generated countermeasures network model, the third seal image without the background is restored, the influence of background noise is removed, and the seal identification efficiency and accuracy are effectively improved.
According to an embodiment of the present application, the performing object detection and cropping on the first seal image to obtain a second seal image includes:
Performing target detection on the first seal image, and determining seal type information and seal position information of the target seal;
and cutting the first seal image based on the seal position information to obtain the second seal image.
According to an embodiment of the present application, the correcting the first seal text image to obtain a second seal text image includes:
based on the seal type information, carrying out text image correction on the first seal text image to obtain a third seal text image;
and correcting the text direction of the third seal text image to obtain the second seal text image.
According to an embodiment of the present application, the correcting the text direction of the third seal text image to obtain the second seal text image includes:
inputting the third seal text image into a text direction classification model to obtain the text direction category of the third seal text image output by the text direction classification model;
correcting the third seal text image based on the text direction category of the third seal text image to obtain the second seal text image;
The text direction classification model is trained based on a second model training sample.
According to an embodiment of the present application, the performing object detection and cropping on the first seal image to obtain a second seal image includes:
inputting the first seal image into a target detection model, and performing target detection and cutting processing to obtain the second seal image output by the target detection model;
the target detection model is obtained by training based on a third model training sample.
According to an embodiment of the present application, the text detection of the third seal image to obtain a first seal text image includes:
inputting the third seal image into a seal character detection model to obtain the first seal text image output by the seal character detection model;
the seal character detection model is obtained based on a fourth model training sample.
According to an embodiment of the present application, the performing seal text recognition on the second seal text image to obtain a text recognition result of the target seal includes:
inputting the second seal text image into a seal character recognition model to obtain a character recognition result of the target seal output by the seal character recognition model;
The seal character recognition model is obtained based on training of a fifth model training sample.
In a second aspect, the present application provides a stamp identification apparatus, the apparatus comprising:
the device comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring a first seal image, and the first seal image comprises a target seal to be identified;
the first processing module is used for carrying out target detection and cutting processing on the first seal image to obtain a second seal image;
the second processing module is used for inputting the second seal image into a generated countermeasure network model, removing background noise of the second seal image and obtaining a third seal image output by the generated countermeasure network model;
the third processing module is used for performing text detection on the third seal image to obtain a first seal text image;
the fourth processing module is used for correcting the first seal text image to obtain a second seal text image;
a fifth processing module, configured to perform seal text recognition on the second seal text image, to obtain a text recognition result of the target seal;
wherein the generating the challenge network model is trained based on a first model training sample.
According to the seal identification device, the first seal image containing the target seal is subjected to target detection and cutting processing, the area image except the area where the target seal is located is removed, the second seal image is processed by using the generated countermeasures network model, the third seal image without the background is restored, the influence of background noise is removed, and the seal identification efficiency and accuracy are effectively improved.
In a third aspect, the present application provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor implements the stamp identifying method according to the first aspect when executing the computer program.
In a fourth aspect, the present application provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the stamp identification method as described in the first aspect above.
In a fifth aspect, the present application provides a computer program product comprising a computer program which, when executed by a processor, implements the stamp identification method as described in the first aspect above.
Additional aspects and advantages of the application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the application.
Drawings
The foregoing and/or additional aspects and advantages of the present application will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings, wherein:
FIG. 1 is a schematic flow chart of a seal identification method according to an embodiment of the present application;
FIG. 2 is a second flow chart of a seal identification method according to an embodiment of the present disclosure;
FIG. 3 is a schematic diagram of a process flow of a generator for generating an countermeasure network model provided by an embodiment of the present application;
FIG. 4 is a schematic diagram of a data flow of a text direction classification model according to an embodiment of the present application;
FIG. 5 is a schematic diagram of a process flow of a arbiter for generating an countermeasure network model according to an embodiment of the present application;
FIG. 6 is a schematic diagram of a second stamp image provided in an embodiment of the present application;
FIG. 7 is a schematic view of a third stamp image provided in an embodiment of the present application;
FIG. 8 is a binarized image of a third stamp provided in an embodiment of the present application;
FIG. 9 is one of the schematic diagrams of a first stamp text image provided in an embodiment of the present application;
FIG. 10 is a second schematic representation of a first stamp text image provided in an embodiment of the present application;
FIG. 11 is a schematic view of a third stamp text image provided in an embodiment of the present application;
FIG. 12 is a schematic view of a second stamp text image provided in an embodiment of the present application;
fig. 13 is a schematic structural view of a stamp identifying apparatus according to an embodiment of the present application;
fig. 14 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
Technical solutions in the embodiments of the present application will be clearly described below with reference to the drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present application are within the scope of the protection of the present application.
The terms first, second and the like in the description and in the claims, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged, as appropriate, such that embodiments of the present application may be implemented in sequences other than those illustrated or described herein, and that the objects identified by "first," "second," etc. are generally of a type and not limited to the number of objects, e.g., the first object may be one or more. Furthermore, in the description and claims, "and/or" means at least one of the connected objects, and the character "/", generally means that the associated object is an "or" relationship.
The seal identification method, the seal identification device, the electronic device and the readable storage medium provided in the embodiments of the present application are described in detail below with reference to fig. 1 to 14 by means of specific embodiments and application scenarios thereof.
As shown in fig. 1, the stamp identifying method includes steps 110 to 160.
Step 110, a first stamp image is acquired.
The first seal image includes the target seal to be identified, and the first seal image may be an image of a document with the target seal, for example, may be a protocol document image with the target seal.
In this step, the first stamp image may be obtained by photographing a document containing the target stamp using a camera, or may be obtained by scanning a document containing the first stamp image using scanning.
And 120, performing target detection and clipping processing on the first seal image to obtain a second seal image.
Wherein, the object detection refers to identifying which objects in the picture or video and the positions of the objects.
In this embodiment, the position of the target stamp and the type of the target stamp are determined by target detection, and the first stamp image may be processed by the model by performing target detection on the first stamp image.
In the step, the cutting processing of the first seal image refers to cutting and deleting other areas except the area where the target seal is located in the first seal image according to the position where the target seal is located in the first seal image determined by target detection, so as to obtain a second seal image containing the target seal.
For example, the first stamp image is an image of a protocol with a target stamp, wherein the image of the first stamp is a region with a large amount of text information and a region with the target stamp, and the cropping processing may be that images of other regions except the target stamp in the image of the protocol are cropped and deleted, and finally only the region including the target stamp is left.
The position of the target seal in the first seal image is obtained through target detection, other areas except the area of the target seal in the first seal image are cut and deleted, the influence of image information of other areas except the target seal information on the target seal identification is reduced, and the seal identification efficiency is improved.
And 130, inputting the second seal image into the generated countermeasure network model, removing the background noise of the second seal image, and obtaining a third seal image output by the generated countermeasure network model.
The generation of the countermeasure network model is trained based on the first model training sample, and the background noise is information except for the target seal in the second seal image.
For example, as shown in fig. 6, the background noise in the second stamp image may be the explanatory text information "seal city education sports bureau (seal official)" for the target stamp in fig. 6 and signature information in the lower right corner of the drawing.
As shown in fig. 7, the third stamp image is a clean stamp image from which background noise in the second stamp image is removed.
In this embodiment, the generation of the countermeasure network model may use a cyclegan model that includes a generator and a arbiter.
In actual implementation, the second seal image with the background noise can be input into the periodic egan model, the background noise in the second seal image is removed, and a third seal image output by a generator in the periodic egan model is obtained, wherein the third seal image does not contain the background noise.
When the countermeasure network model is generated through training, the common use of the discriminator and the generator in the countermeasure network model is generated, and in the process of jointly training and optimizing the discriminator and the generator, the generator for generating the countermeasure network model generates a third seal image without background noise, so that the background noise in the first noise sample can be accurately removed.
In this embodiment, background noise in the first noise sample is eliminated by generating an countermeasure network model by means of style migration.
The style migration refers to migrating the style of the target image into the source image, so that the source image has the style of the target image while retaining the content.
In this embodiment, the generator for generating the countermeasure network model may employ a U-Net structure, as shown in fig. 3, which is different from a common network of a codec structure that downsampled to a low dimension and then upsampled to an original resolution, in that a skip layer structure skip-connection is added, so that feature maps with the same size before and after the codec are spliced together.
In this way, the detail information of pixel level under different resolutions can be kept, so that the effect of describing details of the U-Net structure is very remarkable, and the residual block structure is used in the encoder of the U-Net and the style converter of the middle part, and the gradient effective transmission can be ensured by adding a direct connection path while the transmission of the neural network, so that the performance of generating an antagonistic network model is improved.
As shown in fig. 3, the specific structure of the U-Net network first sets the number of channels of the input image to 3, the size of the input image is 256×256, and the number of channels is enlarged by adopting 64 convolution kernels with the size of 7*7 and the step length of 1 in the first convolution, and the activation function selects the LeakyReLU and performs feature vector output by using instance normalization.
Wherein, the instance normalization is batch normalization of each data sample, in style conversion, each sample needs to be normalized, and the instance normalization is equivalent to performing contrast normalization on each sample.
As shown in fig. 4, in the downsampling stage, the U-Net network uses a convolution kernel of 3*3 size and step size of 2, and the number of channels is gradually doubled with each downsampling.
In the converter stage, 6 defined residual blocks are adopted, and the size and the channel height of the feature map are kept unchanged.
In the decoder stage, upsampling is used to enlarge the size of the stamp image, while the number of channels is reduced using a progressively smaller convolution kernel, which is progressively reduced to half of the original, and normalization is performed using instance normalization.
The arbiter structure for generating the countermeasure network model as shown in fig. 5 adopts four layers of convolution and activation functions to extract and process the characteristics of the image, and then the output of a Patch is obtained through convolution with the number of output channels being 1, so that the "scoring" of the input image is realized.
For example, it may be provided that the score of the output of the arbiter that generates the countermeasure network model ranges between [0,1], when the input image is similar to the real image, the arbiter may score the input image by 0.9, and when the input image is far from the real image, the arbiter may score the input image by 0.3.
And 140, performing text detection on the third seal image to obtain a first seal text image.
The first seal text image is an area image of seal text outline corresponding to the target seal.
The text detection is used for determining an area image of a seal text outline corresponding to the target seal in the third seal image, and the area of the seal text outline is processed, so that a first seal text image containing the target seal is obtained.
And 150, correcting the first seal text image to obtain a second seal text image.
In actual implementation, the stamping directions, the inclined angles and the seal types of different people are different, correction processing is needed to be carried out on the seal images, unified processing is carried out on the target seal images and the text directions in the target seal images, and the target seal images which are more suitable for the identification of the seal identification model are obtained.
And 160, performing seal character recognition on the second seal text image to obtain a character recognition result of the target seal.
The character recognition of the seal is to acquire character information in the seal image, and the character recognition result of the target seal is the character in the target seal image.
For example, as shown in fig. 12, the character recognition is to obtain the character information "check-in education sports office" in the fifth line in the figure.
In this step, the stamp text image is subjected to stamp text recognition to obtain the text in the second stamp text image, that is, the text recognition result of the target stamp.
And performing seal character recognition on the second seal text image, wherein the second seal text image is subjected to correction processing, and the accuracy of seal character recognition can be improved during seal character recognition.
In the related art, a seal in a document image is subjected to positioning detection and extraction by constructing a color space model, and seal character recognition is realized by an image processing and template matching method.
In the embodiment of the application, a second seal image is obtained by carrying out target detection and cutting processing on a first seal image containing a target seal, the second seal image is input into a generated countermeasure network model, the style of a sample without background noise in a first training sample in the training process of generating the countermeasure network model is migrated to the second seal image according to the style of the sample without background noise in the first training sample, background noise in the second seal image is removed, a third seal image without background noise is obtained, and then character detection, correction processing and character recognition are sequentially carried out on the third seal image to obtain character information in the target seal.
According to the seal identification method provided by the embodiment of the application, the first seal image containing the target seal is subjected to target detection and cutting processing, the area image outside the area where the target seal is located is removed, the second seal image is processed by using the generated countermeasures network model, the third seal image without background is restored, the influence of background noise is removed, and the seal identification efficiency and accuracy are effectively improved.
In some embodiments, performing object detection and cropping on the first seal image to obtain a second seal image, including:
performing target detection on the first seal image, and determining seal type information and seal position information of a target seal;
and cutting the first seal image based on the seal position information to obtain a second seal image.
The stamp location information characterizes the location of the region of the target stamp in the first stamp image, e.g., the stamp location information may be coordinate information of the target stamp in the first stamp image.
In practical implementation, the seals may be classified according to the shape, size or color of the seal, for example, the first seal image is subjected to target detection, and the seal type information of the target seal is determined to be a red circular seal.
The cropping of the first seal image may be performed by cropping out an area image except the target seal in the first seal image, and determining the area image including the target seal as the second seal image.
In some embodiments, the correcting the first seal text image to obtain a second seal text image includes:
based on seal type information, carrying out text image correction on the first seal text image to obtain a third seal text image;
and correcting the text direction of the third seal text image to obtain a second seal text image.
In this embodiment, the first seal text image is classified according to seal type information, and according to different seal text images, the first seal text image needs to be corrected by using different physical correction modes, the text image correction only changes the direction of the first seal text image, and the direction of the target seal text in the first seal text image is corrected and developed.
In some embodiments, as shown in fig. 9, if the text in the target seal of the first seal text image is an arc-shaped curved text, a rotation angle of the first seal text image is calculated according to the positions of the centroid and the geometric center in the first seal text image, and the first seal text image is rotated by the angle, as shown in fig. 10, and the rotated first seal text image is obtained.
As shown in fig. 11, the text region of the first stamp text image is flattened by performing polar coordinate transformation on the text region after the rotation angle, to obtain a third stamp text image.
In other embodiments, if the text in the target seal of the first seal text image is an oblique text, an circumscribed rectangle of the region image of the target seal in the first seal text image is obtained, and the circumscribed rectangle is subjected to rotation transformation, so that a third seal text image is obtained.
The text image correction of the first seal text image comprises the following four steps:
step one, acquiring a first seal text image and applying a formula
Figure BDA0004079834130000081
A Gaussian area of the first stamp text image is determined.
Wherein x is i Y is the abscissa of any point in the first stamp text image i Let det () be the determinant of the matrix in brackets, which is the ordinate of the first stamp text image.
Applying the formula
Figure BDA0004079834130000091
Figure BDA0004079834130000095
And determining the barycenter coordinates of the first seal text image.
Wherein C is x Is the abscissa of the centroid of the text image of the first seal, C y Is the ordinate of the first stamp text image.
Calculating the rotation angle of the first seal text image, namely the included angle between the horizontal direction and the line connecting the centroid of the first seal text image and the geometric center of the area where the first seal text image is located is the rotation angle of the seal, the centroid coordinates are (x 1, y 1), the coordinates of the point at the center of the seal are (x 2, y 2), and the formula is applied
Figure BDA0004079834130000092
Figure BDA0004079834130000094
The rotation angle is determined.
Wherein θ represents the rotation angle of the first stamp text image.
Step three, correcting the text image of the inclined first seal text image, and applying a formula after obtaining the inclination angle
Figure BDA0004079834130000093
/>
And acquiring coordinates of the inclined first seal text image after text image correction, and determining the position of the first seal text image after text image correction.
Wherein x is the abscissa of the region in which the Chinese character in the first seal text image is located, and y is the ordinate of the region in which the Chinese character in the first seal text image is located.
And fourthly, flattening the text area in the first seal text image through polar coordinate transformation on the text area in the first seal text image.
And after the arc characters in the third seal text image are unfolded in a straight line, each row in the second seal text image corresponds to an arc line on the third seal text image, and each column in the second seal text image corresponds to an inner diameter on the third text image.
Applying the formula
Figure BDA0004079834130000101
And determining the corresponding relation between the points in the three-seal text image and the points in the second seal text image.
Where i is the abscissa of the point in the third stamp text image, j is the ordinate of the point in the third stamp text image, x is the abscissa of the point in the second stamp text image, and y is the ordinate of the point in the second stamp text image.
In some embodiments, performing text direction correction on the third seal text image to obtain a second seal text image includes:
inputting the third seal text image into a text direction classification model to obtain the text direction category of the third seal text image output by the text direction classification model;
correcting the third seal text image based on the text direction category of the third seal text image to obtain a second seal text image;
the text direction classification model is trained based on a second model training sample.
In this embodiment, as shown in fig. 12, the text-direction classification model may use a deep-learning classification model res net18, and the second model training sample may be a seal image with curved text direction, and the text-direction classification model outputs a second seal text image with a horizontal inline of text order.
In some embodiments, performing object detection and cropping on the first seal image to obtain a second seal image, including:
Inputting the first seal image into a target detection model, and performing target detection and cutting processing to obtain a second seal image output by the target detection model;
the target detection model is obtained through training based on a third model training sample.
In this embodiment, the object detection model may be a YOLOv5 model, and the third model training sample may be a document image with a stamp image, and the object detection model outputs position information and type information of the stamp image in the document image.
In some embodiments, performing text detection on the third seal image to obtain a first seal text image includes:
inputting the third seal image into the seal character detection model to obtain a first seal text image output by the seal character detection model;
the seal character detection model is obtained based on the training sample training of the fourth model.
In this embodiment, the stamp text detection model may use a dbnet++ model, and the fourth model training sample may be a stamp image containing text information.
As shown in fig. 8, in actual implementation, the text detection model acquires a binarization map corresponding to the third seal image, determines an area image of a text contour corresponding to the target seal in the third seal image, and performs a masking operation on the area image to obtain a first seal text image.
Since there are only two gray levels in the binarized map and there is no filter value in between, each pixel value only needs 1 bit of space, so the storage space required for the binarized map is small and the binarized map can exhibit a contour by the degree of density of the pixel points.
In the step, the binarization graph is used for representing the third seal image, so that the required storage space is small, and the algorithm running speed is high.
In some embodiments, performing seal text recognition on the second seal text image to obtain a text recognition result of the target seal, including:
inputting the second seal text image into a seal character recognition model to obtain a character recognition result of the target seal output by the seal character recognition model;
the seal character recognition model is obtained through training based on a fifth model training sample.
In this embodiment, the stamp character recognition model may use a TrOCR model, and the fifth model training sample may be a horizontal inline stamp character, and the stamp character recognition model performs character recognition on the horizontal inline stamp character, and outputs a character recognition result.
Referring now to fig. 2, a specific embodiment will be described for describing the overall flow of the stamp identification method.
The method comprises a data acquisition stage for preparing a training data set for training a target detection model, generating an countermeasure network model, a seal character detection model, a text direction classification model and a seal character recognition model, and acquiring a first seal image containing a target seal.
The training data set comprises a data sample A and a label corresponding to the data sample A, which are used for training a target detection model, a data sample B and a label corresponding to the data sample B, which are used for training a generated countermeasure network model, a data sample C and a label corresponding to the data sample C, which are used for training a seal character detection model, a data sample D and a label corresponding to the data sample D, which are used for training a text direction classification model, and a label corresponding to the data sample E and the data sample E, which are used for training a seal character recognition model, wherein a first seal image containing a target seal is an input image.
The data sample a corresponds to the third model training sample, the data sample B corresponds to the first model training sample, the data sample C corresponds to the fourth model training sample, the data sample D corresponds to the second model training sample, and the data sample E corresponds to the fifth model training sample.
And in the target seal identification stage, a first seal image containing the target seal is input into the target detection model, the position information and the type information of the target seal in the first seal image are obtained, and the first seal image is cut according to the position information of the seal in the image, so that a second seal image is obtained.
And inputting the second seal image into the generated countermeasure network model, removing background noise in the generated countermeasure network model, and obtaining a third seal image output by the generated countermeasure network model.
And inputting the third seal image into the seal character detection model, obtaining the seal character detection model and outputting the first seal character image.
As shown in fig. 9, the first stamp text image is a region image of the outline of the target stamp text.
And correcting the text image of the first seal text image, combining the text image of the target seal to obtain a third seal text image, inputting the third seal text image into a text direction classification model, correcting the text direction of text image information in the third seal text image, correcting the region with incorrect text sequence, and obtaining a second seal text image output by the text direction classification model.
And inputting the second seal text image into the seal character recognition model to obtain a seal character output result output by the seal character recognition model.
The seal identification method can be applied to the terminal, and can be specifically executed by hardware or software in the terminal.
The terminal includes, but is not limited to, a portable communication device such as a mobile phone or tablet having a touch sensitive surface (e.g., a touch screen display and/or a touch pad). It should also be appreciated that in some embodiments, the terminal may not be a portable communication device, but rather a desktop computer having a touch-sensitive surface (e.g., a touch screen display and/or a touch pad).
In the following various embodiments, a terminal including a display and a touch sensitive surface is described. However, it should be understood that the terminal may include one or more other physical user interface devices such as a physical keyboard, mouse, and joystick.
According to the seal identification method provided by the embodiment of the application, the execution main body can be a seal identification device. In the embodiment of the application, a method for executing seal identification by using a seal identification device is taken as an example, and the seal identification device provided in the embodiment of the application is described.
The embodiment of the application also provides a seal identification device.
As shown in fig. 13, the stamp identifying apparatus includes:
an obtaining module 1310, configured to obtain a first stamp image, where the first stamp image includes a target stamp to be identified;
a first processing module 1320, configured to perform target detection and cropping processing on the first seal image to obtain a second seal image;
the second processing module 1330 is configured to input the second stamp image to the generation of the countermeasure network model, remove background noise of the second stamp image, and obtain a third stamp image output by the generation of the countermeasure network model;
a third processing module 1340, configured to perform text detection on the third seal image to obtain a first seal text image;
A fourth processing module 1350, configured to perform correction processing on the first seal text image to obtain a second seal text image;
a fifth processing module 1360, configured to perform seal text recognition on the second seal text image, so as to obtain a text recognition result of the target seal;
wherein generating the challenge network model is trained based on the first model training sample.
According to the seal identification device provided by the embodiment of the application, the first seal image containing the target seal is subjected to target detection and cutting processing, the area image outside the area where the target seal is located is removed, the second seal image is processed by using the generated countermeasures network model, the third seal image without the background is restored, the influence of background noise is removed, and the seal identification efficiency and accuracy are effectively improved.
In some embodiments, the first processing module 1320 is configured to perform target detection on the first stamp image, and determine stamp type information and stamp location information of the target stamp;
and cutting the first seal image based on the seal position information to obtain a second seal image.
In some embodiments, the fourth processing module 1350 is configured to perform text image correction on the first seal text image based on the seal type information to obtain a third seal text image;
And correcting the text direction of the third seal text image to obtain a second seal text image.
In some embodiments, the fourth processing module 1350 is further configured to input the third seal text image into the text direction classification model to obtain a text direction category of the third seal text image output by the text direction classification model;
correcting the third seal text image based on the text direction category of the third seal text image to obtain a second seal text image;
the text direction classification model is trained based on a second model training sample.
In some embodiments, the first processing module 1320 is further configured to input the first stamp image to the target detection model, perform target detection and clipping processing, and obtain a second stamp image output by the target detection model;
the target detection model is obtained through training based on a third model training sample.
In some embodiments, the third processing module 1340 is configured to input a third seal image to the seal text detection model, and obtain a first seal text image output by the seal text detection model;
the seal character detection model is obtained based on the training sample training of the fourth model.
In some embodiments, the fifth processing module 1360 is configured to input the second seal text image into the seal text recognition model, and obtain a text recognition result of the target seal output by the seal text recognition model;
the seal character recognition model is obtained through training based on a fifth model training sample.
The stamp identifying apparatus in the embodiment of the present application may be an electronic device, or may be a component in an electronic device, for example, an integrated circuit or a chip. The electronic device may be a terminal, or may be other devices than a terminal. By way of example, the electronic device may be a mobile phone, tablet computer, notebook computer, palm computer, vehicle-mounted electronic device, mobile internet appliance (Mobile Internet Device, MID), augmented reality (augmented reality, AR)/Virtual Reality (VR) device, robot, wearable device, ultra-mobile personal computer, UMPC, netbook or personal digital assistant (personal digital assistant, PDA), etc., but may also be a server, network attached storage (Network Attached Storage, NAS), personal computer (personal computer, PC), television (TV), teller machine or self-service machine, etc., and the embodiments of the present application are not limited in particular.
The stamp identifying apparatus in the embodiment of the present application may be an apparatus having an operating system. The operating system may be an Android operating system, an IOS operating system, or other possible operating systems, which is not specifically limited in the embodiments of the present application.
The stamp identifying apparatus provided in the embodiment of the present application can implement each process implemented by the method embodiments of fig. 1 to 12, and in order to avoid repetition, a detailed description is omitted here.
In some embodiments, as shown in fig. 14, the embodiment of the present application further provides an electronic device 1400, including a processor 1401, a memory 1402, and a computer program stored in the memory 1402 and capable of running on the processor 1401, where the program when executed by the processor 1401 implements the respective processes of the above seal identification method embodiment, and the same technical effects can be achieved, and for avoiding repetition, a detailed description is omitted herein.
The electronic device in the embodiment of the application includes the mobile electronic device and the non-mobile electronic device described above.
The embodiment of the application further provides a non-transitory computer readable storage medium, on which a computer program is stored, which when executed by a processor, implements each process of the above-mentioned stamp identification method embodiment, and can achieve the same technical effect, so that repetition is avoided, and no further description is provided here.
Wherein the processor is a processor in the electronic device described in the above embodiment. The readable storage medium includes computer readable storage medium such as computer readable memory ROM, random access memory RAM, magnetic or optical disk, etc.
The embodiment of the application also provides a computer program product, which comprises a computer program, and the computer program realizes the seal identification method when being executed by a processor.
Wherein the processor is a processor in the electronic device described in the above embodiment. The readable storage medium includes computer readable storage medium such as computer readable memory ROM, random access memory RAM, magnetic or optical disk, etc.
It should be noted that, in this document, 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 one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
Furthermore, it should be noted that the scope of the methods and apparatus in the embodiments of the present application is not limited to performing the functions in the order shown or discussed, but may also include performing the functions in a substantially simultaneous manner or in an opposite order depending on the functions involved, e.g., the described methods may be performed in an order different from that described, and various steps may also be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solutions of the present application may be embodied essentially or in a part contributing to the prior art in the form of a computer software product stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk), comprising several instructions for causing a terminal (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the methods described in the embodiments of the present application.
The embodiments of the present application have been described above with reference to the accompanying drawings, but the present application is not limited to the above-described embodiments, which are merely illustrative and not restrictive, and many forms may be made by those of ordinary skill in the art without departing from the spirit of the present application and the scope of the claims, which are also within the protection of the present application.
In the description of the present specification, reference to the terms "one embodiment," "some embodiments," "illustrative embodiments," "examples," "specific examples," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present application. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiments or examples. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
While embodiments of the present application have been shown and described, it will be understood by those of ordinary skill in the art that: many changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the application, the scope of which is defined by the claims and their equivalents.

Claims (10)

1. A method of stamp identification, comprising:
acquiring a first seal image, wherein the first seal image comprises a target seal to be identified;
performing target detection and cutting processing on the first seal image to obtain a second seal image;
inputting the second seal image into a generated countermeasure network model, removing background noise of the second seal image, and obtaining a third seal image output by the generated countermeasure network model;
performing text detection on the third seal image to obtain a first seal text image;
correcting the first seal text image to obtain a second seal text image;
performing seal character recognition on the second seal text image to obtain a character recognition result of the target seal;
wherein the generating the challenge network model is trained based on a first model training sample.
2. The seal identification method according to claim 1, wherein the performing object detection and cropping processing on the first seal image to obtain a second seal image includes:
performing target detection on the first seal image, and determining seal type information and seal position information of the target seal;
And cutting the first seal image based on the seal position information to obtain the second seal image.
3. The seal identification method according to claim 2, wherein the correcting the first seal text image to obtain a second seal text image includes:
based on the seal type information, carrying out text image correction on the first seal text image to obtain a third seal text image;
and correcting the text direction of the third seal text image to obtain the second seal text image.
4. A seal identification method according to claim 3, wherein said performing text direction correction on said third seal text image to obtain said second seal text image comprises:
inputting the third seal text image into a text direction classification model to obtain the text direction category of the third seal text image output by the text direction classification model;
correcting the third seal text image based on the text direction category of the third seal text image to obtain the second seal text image;
the text direction classification model is trained based on a second model training sample.
5. The seal identification method according to any one of claims 1 to 4, wherein the performing object detection and cropping on the first seal image to obtain a second seal image includes:
inputting the first seal image into a target detection model, and performing target detection and cutting processing to obtain the second seal image output by the target detection model;
the target detection model is obtained by training based on a third model training sample.
6. The seal identification method according to any one of claims 1 to 4, wherein the performing text detection on the third seal image to obtain a first seal text image includes:
inputting the third seal image into a seal character detection model to obtain the first seal text image output by the seal character detection model;
the seal character detection model is obtained based on a fourth model training sample.
7. The seal recognition method according to any one of claims 1 to 4, wherein the performing seal text recognition on the second seal text image to obtain a text recognition result of the target seal includes:
Inputting the second seal text image into a seal character recognition model to obtain a character recognition result of the target seal output by the seal character recognition model;
the seal character recognition model is obtained based on training of a fifth model training sample.
8. A seal recognition device, comprising:
the device comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring a first seal image, and the first seal image comprises a target seal to be identified;
the first processing module is used for carrying out target detection and cutting processing on the first seal image to obtain a second seal image;
the second processing module is used for inputting the second seal image into a generated countermeasure network model, removing background noise of the second seal image and obtaining a third seal image output by the generated countermeasure network model;
the third processing module is used for performing text detection on the third seal image to obtain a first seal text image;
the fourth processing module is used for correcting the first seal text image to obtain a second seal text image;
a fifth processing module, configured to perform seal text recognition on the second seal text image, to obtain a text recognition result of the target seal;
Wherein the generating the challenge network model is trained based on a first model training sample.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the stamp identification method of any of claims 1-7 when the program is executed by the processor.
10. A non-transitory computer readable storage medium having stored thereon a computer program, which when executed by a processor implements the stamp identification method according to any of claims 1-7.
CN202310120586.4A 2023-02-14 2023-02-14 Seal identification method, device, electronic equipment and storage medium Pending CN116092106A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310120586.4A CN116092106A (en) 2023-02-14 2023-02-14 Seal identification method, device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310120586.4A CN116092106A (en) 2023-02-14 2023-02-14 Seal identification method, device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116092106A true CN116092106A (en) 2023-05-09

Family

ID=86202422

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310120586.4A Pending CN116092106A (en) 2023-02-14 2023-02-14 Seal identification method, device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116092106A (en)

Similar Documents

Publication Publication Date Title
CN110232311B (en) Method and device for segmenting hand image and computer equipment
US11830230B2 (en) Living body detection method based on facial recognition, and electronic device and storage medium
US10902283B2 (en) Method and device for determining handwriting similarity
CN112733797B (en) Method, device and equipment for correcting sight of face image and storage medium
CN111563502A (en) Image text recognition method and device, electronic equipment and computer storage medium
CN111401266B (en) Method, equipment, computer equipment and readable storage medium for positioning picture corner points
CN107545223B (en) Image recognition method and electronic equipment
CN111626297A (en) Character writing quality evaluation method and device, electronic equipment and recording medium
US11663463B2 (en) Center-biased machine learning techniques to determine saliency in digital images
CN114402369A (en) Human body posture recognition method and device, storage medium and electronic equipment
CN113221897B (en) Image correction method, image text recognition method, identity verification method and device
CN111353325A (en) Key point detection model training method and device
CN109376618A (en) Image processing method, device and electronic equipment
Wang et al. Perception-guided multi-channel visual feature fusion for image retargeting
CN111275610B (en) Face aging image processing method and system
CN116912604A (en) Model training method, image recognition device and computer storage medium
CN116798041A (en) Image recognition method and device and electronic equipment
CN108255298B (en) Infrared gesture recognition method and device in projection interaction system
CN116342519A (en) Image processing method based on machine learning
CN116092106A (en) Seal identification method, device, electronic equipment and storage medium
CN115345895A (en) Image segmentation method and device for visual detection, computer equipment and medium
CN112348069B (en) Data enhancement method, device, computer readable storage medium and terminal equipment
US11783625B2 (en) Method for verifying the identity of a user by identifying an object within an image that has a biometric characteristic of the user and separating a portion of the image comprising the biometric characteristic from other portions of the image
CN114758145A (en) Image desensitization method and device, electronic equipment and storage medium
CN114387315A (en) Image processing model training method, image processing device, image processing equipment and image processing medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination