Stamp identification method and device, electronic equipment and storage medium

By using a generative adversarial network model to process seal images, the problem of low efficiency and accuracy of traditional seal recognition methods in complex backgrounds is solved, achieving high efficiency and high accuracy in seal recognition.

CN116092106BActive Publication Date: 2026-07-31GRG BANKING EQUIPMENT CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
GRG BANKING EQUIPMENT CO LTD
Filing Date
2023-02-14
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

Traditional seal recognition methods are inefficient and inaccurate in complex document backgrounds, mainly due to the loss of a large amount of information caused by image processing operations.

Method used

A generative adversarial network model is used to remove background noise from seal images. Combined with object detection, cropping, text detection and correction, the efficiency and accuracy of seal recognition are improved.

Benefits of technology

By processing seal images using a generative adversarial network model, background noise can be effectively removed, improving the efficiency and accuracy of seal recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116092106B_ABST
    Figure CN116092106B_ABST
Patent Text Reader

Abstract

This application discloses a seal recognition method, apparatus, electronic device, and storage medium, belonging to the field of image processing technology. The method includes: acquiring a first seal image, the first seal image including a target seal to be recognized; performing target detection and cropping processing on the first seal image to obtain a second seal image; inputting the second seal image into a generative adversarial network (GAN) model to remove background noise from the second seal image, obtaining a third seal image output by the GAN model; performing text detection on the third seal image to obtain a first seal text image; performing correction processing on the first seal text image to obtain a second seal text image; and performing seal text recognition on the second seal text image to obtain the text recognition result of the target seal. This method improves the efficiency and accuracy of seal recognition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of image processing technology, and in particular relates to a seal recognition method, device, electronic device and storage medium. Background Technology

[0002] With the rapid development of artificial intelligence, deep learning has been widely used in technologies such as image recognition and optical character recognition. Machine vision-based seal recognition methods help to achieve efficient and intelligent document analysis.

[0003] Traditional seal recognition methods locate, detect, and extract seals from document images by constructing color space models such as HIS, RGB, and HSV. Then, they use image processing operations and template matching methods to recognize the seal text. This method relies on the color features of the image and manually extracted thresholds when constructing the model. When faced with complex document backgrounds, the complex image processing operations can lead to the loss of a large amount of image information, resulting in low efficiency and accuracy of seal recognition methods. Summary of the Invention

[0004] This application aims to address at least one of the technical problems existing in the prior art. To this end, this application proposes a seal recognition method, apparatus, electronic device, and storage medium, which can improve the accuracy and efficiency of seal recognition.

[0005] Firstly, this application provides a seal recognition method, which includes:

[0006] Acquire a first seal image, the first seal image including the target seal to be identified;

[0007] The first seal image is subjected to target detection and cropping to obtain the second seal image;

[0008] The second seal image is input into the generative adversarial network model to remove background noise from the second seal image, thereby obtaining the third seal image output by the generative adversarial network model.

[0009] The text image of the first seal is obtained by performing text detection on the third seal image;

[0010] The first seal text image is corrected to obtain the second seal text image;

[0011] Perform seal character recognition on the second seal text image to obtain the character recognition result of the target seal;

[0012] The generative adversarial network model is trained based on the training samples of the first model.

[0013] According to the seal recognition method of this application, by performing target detection and cropping processing on the first seal image containing the target seal, removing the image area outside the area where the target seal is located, processing the second seal image using a generative adversarial network model, and restoring the third seal image without background, the influence of background noise is removed, effectively improving the efficiency and accuracy of seal recognition.

[0014] According to one embodiment of this application, the step of performing target detection and cropping processing on the first seal image to obtain a second seal image includes:

[0015] Target detection is performed on the first seal image to determine the seal type information and seal location information of the target seal;

[0016] The first seal image is cropped based on the seal position information to obtain the second seal image.

[0017] According to one embodiment of this application, the step of correcting the first seal text image to obtain the second seal text image includes:

[0018] Based on the seal type information, the first seal text image is corrected to obtain the third seal text image.

[0019] The text direction of the third seal text image is corrected to obtain the second seal text image.

[0020] According to one embodiment of this application, the step of performing text orientation correction on the third seal text image to obtain the second seal text image includes:

[0021] The text image of the third seal is input into the text orientation classification model to obtain the text orientation category of the text image of the third seal output by the text orientation classification model;

[0022] Based on the text direction category of the third seal text image, the third seal text image is corrected to obtain the second seal text image;

[0023] The text direction classification model is trained based on the training samples of the second model.

[0024] According to one embodiment of this application, the step of performing target detection and cropping processing on the first seal image to obtain a second seal image includes:

[0025] The first seal image is input into the target detection model for target detection and cropping to obtain the second seal image output by the target detection model.

[0026] The target detection model is trained based on training samples from the third model.

[0027] According to one embodiment of this application, the step of performing text detection on the third seal image to obtain the first seal text image includes:

[0028] The third seal image is input into the seal text detection model to obtain the first seal text image output by the seal text detection model;

[0029] The seal character detection model is trained based on the training samples of the fourth model.

[0030] According to one embodiment of this application, the step of performing seal character recognition on the second seal text image to obtain the character recognition result of the target seal includes:

[0031] The second seal text image is input into the seal character recognition model to obtain the character recognition result of the target seal output by the seal character recognition model;

[0032] The seal character recognition model is trained based on the training samples of the fifth model.

[0033] Secondly, this application provides a seal recognition device, which includes:

[0034] The acquisition module is used to acquire a first seal image, wherein the first seal image includes the target seal to be identified;

[0035] The first processing module is used to perform target detection and cropping processing on the first seal image to obtain the second seal image;

[0036] The second processing module is used to input the second seal image into the generative adversarial network model, remove the background noise of the second seal image, and obtain the third seal image output by the generative adversarial network model.

[0037] The third processing module is used to perform text detection on the third seal image to obtain the first seal text image;

[0038] The fourth processing module is used to perform correction processing on the first seal text image to obtain the second seal text image;

[0039] The fifth processing module is used to perform seal character recognition on the second seal text image to obtain the character recognition result of the target seal;

[0040] The generative adversarial network model is trained based on the training samples of the first model.

[0041] According to the seal recognition device of this application, by performing target detection and cropping processing on a first seal image containing a target seal to remove the image area outside the area where the target seal is located, processing the second seal image using a generative adversarial network model, and restoring a third seal image without background, the influence of background noise is removed, effectively improving the efficiency and accuracy of seal recognition.

[0042] Thirdly, this application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the seal recognition method as described in the first aspect above.

[0043] Fourthly, this application provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the seal recognition method as described in the first aspect above.

[0044] Fifthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the seal recognition method as described in the first aspect above.

[0045] Additional aspects and advantages of this 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 this application. Attached Figure Description

[0046] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the description of the embodiments taken in conjunction with the following drawings, in which:

[0047] Figure 1 This is one of the flowcharts illustrating the seal recognition method provided in the embodiments of this application;

[0048] Figure 2 This is a second schematic flowchart of the seal recognition method provided in the embodiments of this application;

[0049] Figure 3 This is a schematic diagram of the processing flow of the generator for the generative adversarial network model provided in this application embodiment;

[0050] Figure 4 This is a schematic diagram of the data flow direction of the text orientation classification model provided in the embodiments of this application;

[0051] Figure 5 This is a schematic diagram of the processing flow of the discriminator in the generative adversarial network model provided in the embodiments of this application;

[0052] Figure 6 This is a schematic diagram of the second seal image provided in an embodiment of this application;

[0053] Figure 7 This is a schematic diagram of the third seal image provided in the embodiments of this application;

[0054] Figure 8 This is a binarized image of the third seal image provided in the embodiments of this application;

[0055] Figure 9 This is one of the schematic diagrams of the first seal text image provided in the embodiments of this application;

[0056] Figure 10 This is a second schematic diagram of the first seal text image provided in the embodiments of this application;

[0057] Figure 11 This is a schematic diagram of the third seal text image provided in the embodiments of this application;

[0058] Figure 12 This is a schematic diagram of the second seal text image provided in the embodiments of this application;

[0059] Figure 13 This is a schematic diagram of the structure of the seal recognition device provided in the embodiments of this application;

[0060] Figure 14 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0061] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.

[0062] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0063] The following is combined Figures 1-14 The present application provides a detailed description of the seal recognition method, seal recognition device, electronic device, and readable storage medium provided in the embodiments of this application through specific implementation methods and application scenarios.

[0064] like Figure 1 As shown, the seal recognition method includes steps 110 to 160.

[0065] Step 110: Obtain the first seal image.

[0066] The first seal image includes the target seal to be identified. The first seal image can be an image of a document bearing the target seal, such as an image of an agreement document bearing the target seal.

[0067] In this step, the first seal image can be obtained by taking a picture of the document containing the target seal with a camera, or by scanning the document containing the first seal image.

[0068] Step 120: Perform target detection and cropping on the first seal image to obtain the second seal image.

[0069] Object detection refers to identifying which objects are present in an image or video and their locations.

[0070] In this embodiment, the location of the target seal and the type of the target seal are determined through target detection. Target detection of the first seal image can be performed by processing the first seal image using a model.

[0071] In this step, cropping the first seal image means cropping and deleting the areas outside the target seal area in the first seal image based on the location of the target seal determined by target detection, to obtain a second seal image containing the target seal.

[0072] For example, the first stamp image is an image of an agreement bearing the target stamp, which contains an area with a large amount of text information as well as the area of ​​the target stamp. Cropping the first stamp image can be done by cropping and deleting other areas of the image of the agreement except for the target stamp, leaving only the area containing the target stamp.

[0073] By detecting the target seal in the first seal image, the location of the target seal is obtained. Other areas outside the target seal area in the first seal image are cropped and deleted, which reduces the impact of image information from other areas on the target seal recognition and improves the efficiency of seal recognition.

[0074] Step 130: Input the second seal image into the generative adversarial network model, remove the background noise of the second seal image, and obtain the third seal image output by the generative adversarial network model.

[0075] The generative adversarial network model is trained based on the training samples of the first model, and the background noise is information other than the target seal in the second seal image.

[0076] For example, such as Figure 6 As shown, the background noise in the second seal image can be Figure 6 The text describing the target seal reads "Dengfeng Municipal Education and Sports Bureau (Official Seal)" and the signature information in the lower right corner of the image.

[0077] like Figure 7 As shown, the third stamp image is a clean stamp image after removing background noise from the second stamp image.

[0078] In this embodiment, the generative adversarial network model can use the Cyclicgan model, which includes a generator and a discriminator.

[0079] In practice, the second stamp image with background noise can be input into the Cyclegan model to remove the background noise from the second stamp image, and the third stamp image output by the generator in the Cyclegan model can be obtained. The third stamp image does not contain background noise.

[0080] When training a generative adversarial network (GAN) model, the discriminator and generator in the GAN model are used together. During the joint training and optimization process of the discriminator and generator, the generator of the GAN model generates a third stamp image without background noise, which can accurately remove background noise from the first noisy sample.

[0081] In this embodiment, the generative adversarial network model eliminates background noise in the first noise sample through style transfer.

[0082] Style transfer refers to transferring the style of a target image to a source image, so that the source image retains its content while also having the style of the target image.

[0083] In this embodiment, the generator of the generative adversarial network model can adopt a U-Net structure, such as... Figure 3 As shown, compared with the common encoding and decoding structure that first downsamples to a low dimension and then upsamples to the original resolution, the U-Net structure is different in that it adds a skip-connection structure, which concatenates feature maps of the same size before and after encoding and decoding.

[0084] In this way, pixel-level detail information at different resolutions can be preserved, making the U-Net structure very effective in depicting details. Furthermore, the U-Net encoder and the style converter in the middle part use a residual block structure. By adding a direct path during the transmission of the neural network, the gradient can be effectively transmitted, thus improving the performance of the generative adversarial network model.

[0085] like Figure 3 As shown, the specific structure of the U-Net network first sets the number of input image channels to 3 and the size to 256*256. In the first convolution, 64 convolution kernels of size 7*7 with a stride of 1 are used to expand the number of channels. The activation function is LeakyReLU, and instance normalization is used to output the feature vector.

[0086] Instance normalization is the batch normalization of each data sample. In style conversion, each sample needs to be standardized, and instance normalization is equivalent to contrast normalization of each sample.

[0087] like Figure 4 As shown, during the downsampling stage, the U-Net network uses a 3*3 convolutional kernel with a stride of 2. With each downsampling, the number of channels gradually doubles.

[0088] During the converter stage, six predefined residual blocks are used to keep the size of the feature map and the number of channels unchanged.

[0089] In the decoder stage, upsampling is used to enlarge the size of the stamp image, while gradually decreasing the number of channels is used to reduce the number of channels to half of the original size, and instance normalization is used for normalization.

[0090] like Figure 5 The discriminator structure of the generative adversarial network model shown uses four layers of convolution and activation functions to extract and process features from the image, and then performs a convolution with 1 output channel to obtain a patch output, thereby achieving "scoring" of the input image.

[0091] For example, the discriminator output score of the generative adversarial network model can be specified to be in the range of [0, 1]. When the input image is similar to the real image, the discriminator can give the input image a score of 0.9. When the input image is very different from the real image, the discriminator can give the input image a score of 0.3.

[0092] Step 140: Perform text detection on the third seal image to obtain the text image of the first seal.

[0093] Among them, the first seal text image is the region image of the seal text outline corresponding to the target seal.

[0094] Text detection is used to determine the region image of the seal text outline corresponding to the target seal in the third seal image. The region of the seal text outline is processed to obtain the first seal text image containing the target seal.

[0095] Step 150: Correct the text image of the first seal to obtain the text image of the second seal.

[0096] In practice, different people stamp in different directions, at different angles, and with different types of seals. These seal images need to be corrected to unify the direction of the target seal image and the text within it, thus obtaining a target seal image that is more suitable for the seal recognition model.

[0097] Step 160: Perform seal character recognition on the second seal text image to obtain the character recognition result of the target seal.

[0098] Among them, seal character recognition is to obtain the text information in the seal image, and the character recognition result of the target seal is the text in the target seal image.

[0099] For example, such as Figure 12 As shown, text recognition is used to obtain the text information "Dengfeng City Education and Sports Bureau" in the fifth row of the image.

[0100] In this step, performing seal character recognition on the second seal text image means obtaining the text in the second seal text image, which is the character recognition result of the target seal.

[0101] By performing seal text recognition on the second seal text image, which has undergone correction processing, the accuracy of seal text recognition can be improved.

[0102] In related technologies, a color space model is constructed to locate, detect, and extract the seal in the document image. Then, the seal text recognition is achieved through image processing and template matching. However, this method relies on the color features of the image and manually extracted thresholds when constructing the model. When the document image has a noisy background, the image processing operation will result in a large amount of image information loss, leading to low efficiency and accuracy of seal recognition.

[0103] In this embodiment, a second seal image is obtained by performing target detection and cropping on a first seal image containing the target seal. The second seal image is then input into a generative adversarial network (GAN) model. Based on the style of the background noise-free samples in the first training samples during the GAN model training process, the style of the background noise-free samples in the first training samples is transferred to the second seal image. The background noise in the second seal image is then removed to obtain a third seal image without background noise. Finally, text detection, correction, and text recognition are performed on the third seal image in sequence to obtain the text information in the target seal.

[0104] According to the seal recognition method provided in the embodiments of this application, by performing target detection and cropping processing on the first seal image containing the target seal, removing the image area outside the area where the target seal is located, processing the second seal image using a generative adversarial network model, and restoring the third seal image without background, the influence of background noise is removed, effectively improving the efficiency and accuracy of seal recognition.

[0105] In some embodiments, the first seal image is subjected to target detection and cropping to obtain a second seal image, including:

[0106] Target detection is performed on the first seal image to determine the seal type and location information of the target seal;

[0107] The first seal image is cropped based on the seal position information to obtain the second seal image.

[0108] The seal position information represents the regional position of the target seal in the first seal image. For example, the seal position information can be the coordinate information of the target seal in the first seal image.

[0109] In practice, seals can be classified according to their shape, size, or color. For example, target detection can be performed on the first seal image to determine that the seal type information of the target seal is a red circular seal.

[0110] Cropping the first seal image can be done by removing the area of ​​the first seal image other than the target seal, and then determining the area of ​​the first seal image containing the target seal as the second seal image.

[0111] In some embodiments, the first seal text image is corrected to obtain a second seal text image, including:

[0112] Based on the seal type information, the text image of the first seal is corrected to obtain the text image of the third seal.

[0113] The text direction of the third seal text image is corrected to obtain the second seal text image.

[0114] In this embodiment, the first seal text image is classified according to the seal type information. Different physical correction methods are required to correct the text image of the first seal text image according to different types of seal text images. The text image correction only changes the orientation of the first seal text image and corrects the orientation of the target seal text in the first seal text image.

[0115] In some embodiments, such as Figure 9 As shown, if the text in the target seal of the first seal text image is curved text, the rotation angle of the first seal text image is calculated based on the positions of its centroid and geometric center. The first seal text image is then rotated by this angle, as shown below. Figure 10 As shown, the first stamp text image after rotation is obtained.

[0116] like Figure 11 As shown, by performing polar coordinate transformation on the text area after rotation, the text area of ​​the first seal text image is flattened to obtain the third seal text image.

[0117] In other embodiments, if the text in the target seal of the first seal text image is slanted text, the bounding rectangle of the image of the region where the target seal is located in the first seal text image is obtained, and the bounding rectangle is rotated to obtain the third seal text image.

[0118] The text image correction for the first seal image includes the following four steps:

[0119] Step 1: Obtain the first seal text image and apply the formula.

[0120]

[0121] Determine the Gaussian area of ​​the first seal text image.

[0122] Where x i Let y be the x-coordinate of any point in the first seal text image. i `dt()` represents the ordinate of the first seal text image, and `det()` represents the determinant of the matrix within the parentheses.

[0123] Application formula

[0124]

[0125]

[0126] Determine the centroid coordinates of the first seal text image.

[0127] Among them, C x Let C be the x-coordinate of the centroid of the first seal text image.y The vertical coordinate of the first seal text image.

[0128] Step 2: Calculate the rotation angle of the first seal text image. The angle between the line connecting the centroid of the first seal text image and the geometric center of the region containing the first seal text image, and the horizontal direction, is the rotation angle of the seal. Let the coordinates of the centroid be (x1, y1), and the coordinates of the point at the center of the seal be (x2, y2). Apply the formula...

[0129]

[0130]

[0131] Determine the rotation angle.

[0132] Where θ represents the rotation angle of the first seal text image.

[0133] Step 3: Correct the tilted text image of the first seal. After obtaining the tilt angle, apply the formula...

[0134]

[0135] Obtain the coordinates of the tilted first seal text image after text image correction, and determine the position of the first seal text image after text image correction.

[0136] Where x is the horizontal coordinate of the region where the text is located in the first seal text image, and y is the vertical coordinate of the region where the text is located in the first seal text image.

[0137] Step 4: Flatten the text region in the first seal text image by performing polar coordinate transformation.

[0138] Let the radius of the circular seal in the third seal text image be R, and the length and width of the second seal text image be N and M respectively. After unfolding the arc-shaped text in the third seal text image vertically, each row in the second seal text image corresponds to an arc in the third seal text image, and each column in the second seal text image corresponds to an inner diameter in the third text image.

[0139] Application formula

[0140]

[0141] Determine the correspondence between points in the text image of the third seal and points in the text image of the second seal.

[0142] Where i is the x-coordinate of a point in the third seal text image, j is the y-coordinate of a point in the third seal text image, x is the x-coordinate of a point in the second seal text image, and y is the y-coordinate of a point in the second seal text image.

[0143] In some embodiments, text orientation correction is performed on the third seal text image to obtain the second seal text image, including:

[0144] Input the text image of the third seal into the text orientation classification model to obtain the text orientation category of the third seal text image output by the text orientation classification model;

[0145] Based on the text direction category of the third seal text image, the third seal text image is corrected to obtain the second seal text image;

[0146] The text orientation classification model is trained based on the training samples of the second model.

[0147] In this embodiment, such as Figure 12 As shown, the text orientation classification model can use the deep learning classification model ResNet18. The training samples for the second model can be stamp images with curved text orientations. The text orientation classification model outputs the second stamp text image with the text order arranged horizontally.

[0148] In some embodiments, the first seal image is subjected to target detection and cropping to obtain a second seal image, including:

[0149] The first seal image is input into the object detection model for object detection and cropping to obtain the second seal image output by the object detection model.

[0150] The object detection model is trained based on the training samples of the third model.

[0151] In this embodiment, the object detection model can be the YOLOv5 model, the third model training sample can be a document image with a stamp image, and the object detection model outputs the position information and type information of the stamp image in the document image.

[0152] In some embodiments, text detection is performed on the third seal image to obtain the first seal text image, including:

[0153] The third seal image is input into the seal text detection model to obtain the first seal text image output by the seal text detection model.

[0154] The seal character detection model is trained based on the training samples of the fourth model.

[0155] In this embodiment, the seal text detection model can use the DBNet++ model, and the training samples for the fourth model can be seal images containing text information.

[0156] like Figure 8 As shown, in actual execution, the text detection model obtains the binarized image corresponding to the third seal image, determines the region image of the text outline corresponding to the target seal in the third seal image, performs a masking operation on the region image, and obtains the first seal text image.

[0157] Since there are only two gray levels in a binarized image and no intermediate filter values, each pixel value only requires 1 bit of space. Therefore, the storage space required for a binarized image is small, and the binarized image can show the outline through the density of pixels.

[0158] In this step, the third seal image is represented by a binarized image, which requires little storage space and has a fast algorithm speed.

[0159] In some embodiments, performing seal character recognition on the second seal text image to obtain the character recognition result of the target seal includes:

[0160] The second seal text image is input into the seal character recognition model to obtain the character recognition result of the target seal output by the seal character recognition model.

[0161] The seal character recognition model was trained based on the training samples of the fifth model.

[0162] In this embodiment, the seal character recognition model can use the TrOCR model. The fifth model training sample can be horizontally arranged seal characters. The seal character recognition model performs character recognition on the horizontally arranged seal characters and outputs the character recognition result.

[0163] like Figure 2 As shown below, a specific embodiment is introduced to describe the overall process of the seal recognition method.

[0164] In the data acquisition phase, training datasets are prepared for training the object detection model, generative adversarial network model, seal text detection model, text orientation classification model, and seal text recognition model, and the first seal image containing the target seal is acquired.

[0165] The training dataset includes data sample A and its corresponding label for training the target detection model, data sample B and its corresponding label for training the generative adversarial network model, data sample C and its corresponding label for training the seal text detection model, data sample D and its corresponding label for training the text orientation classification model, and data sample E and its corresponding label for training the seal text recognition model. The first seal image containing the target seal is the input image.

[0166] Among them, data sample A corresponds to the training sample of the third model, data sample B corresponds to the training sample of the first model, data sample C corresponds to the training sample of the fourth model, data sample D corresponds to the training sample of the second model, and data sample E corresponds to the training sample of the fifth model.

[0167] In the target seal recognition stage, the first seal image containing the target seal is input into the target detection model to obtain the position and type information of the target seal in the first seal image. Based on the position information of the seal in the image, the first seal image is cropped to obtain the second seal image.

[0168] The second seal image is input into the generative adversarial network (GAN) model. Background noise in the GAN model is removed to obtain the third seal image output by the GAN model.

[0169] The third seal image is input into the seal text detection model to obtain the first seal text image output by the seal text detection model.

[0170] like Figure 9 As shown, the first seal text image is a region image of the outline of the target seal text.

[0171] Text image correction is performed on the first seal text image. Combined with the text image of the target seal, the third seal text image is obtained. The third seal text image is input into the text orientation classification model. Text orientation correction is performed on the text image information in the third seal text image to correct areas where the text order is incorrect. The second seal text image output by the text orientation classification model is then obtained.

[0172] The second seal text image is input into the seal text recognition model to obtain the seal text output result of the seal text recognition model.

[0173] The seal recognition method can be applied to a terminal, specifically executed by the hardware or software within the terminal.

[0174] The terminal includes, but is not limited to, portable communication devices such as mobile phones or tablets with touch-sensitive surfaces (e.g., touchscreen displays and / or touchpads). It should also be understood that, in some embodiments, the terminal may not be a portable communication device, but rather a desktop computer with touch-sensitive surfaces (e.g., touchscreen displays and / or touchpads).

[0175] The following embodiments describe a terminal including a display and a touch-sensitive surface. 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.

[0176] The seal recognition method provided in this application can be executed by a seal recognition device. This application uses a seal recognition device executing the seal recognition method as an example to illustrate the seal recognition device provided in this application.

[0177] This application also provides a seal recognition device.

[0178] like Figure 13 As shown, the seal recognition device includes:

[0179] The acquisition module 1310 is used to acquire a first seal image, the first seal image including the target seal to be identified;

[0180] The first processing module 1320 is used to perform target detection and cropping on the first seal image to obtain the second seal image;

[0181] The second processing module 1330 is used to input the second seal image into the generative adversarial network model, remove the background noise of the second seal image, and obtain the third seal image output by the generative adversarial network model.

[0182] The third processing module 1340 is used to perform text detection on the third seal image to obtain the first seal text image;

[0183] The fourth processing module 1350 is used to perform correction processing on the first seal text image to obtain the second seal text image;

[0184] The fifth processing module 1360 is used to perform seal character recognition on the second seal text image to obtain the character recognition result of the target seal.

[0185] The generative adversarial network model is trained based on the training samples of the first model.

[0186] According to the seal recognition device provided in the embodiments of this application, by performing target detection and cropping processing on a first seal image containing a target seal, removing the image area outside the area where the target seal is located, processing the second seal image using a generative adversarial network model, and restoring a third seal image without background, the influence of background noise is removed, effectively improving the efficiency and accuracy of seal recognition.

[0187] In some embodiments, the first processing module 1320 is used to perform target detection on the first seal image to determine the seal type information and seal position information of the target seal;

[0188] The first seal image is cropped based on the seal position information to obtain the second seal image.

[0189] In some embodiments, the fourth processing module 1350 is used to perform text image correction on the first seal text image based on seal type information to obtain a third seal text image.

[0190] The text direction of the third seal text image is corrected to obtain the second seal text image.

[0191] 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 the text direction category of the third seal text image output by the text direction classification model.

[0192] Based on the text direction category of the third seal text image, the third seal text image is corrected to obtain the second seal text image;

[0193] The text orientation classification model is trained based on the training samples of the second model.

[0194] In some embodiments, the first processing module 1320 is further configured to input the first seal image into the target detection model, perform target detection and cropping processing, and obtain the second seal image output by the target detection model;

[0195] The object detection model is trained based on the training samples of the third model.

[0196] In some embodiments, the third processing module 1340 is used to input the third seal image into the seal text detection model to obtain the first seal text image output by the seal text detection model.

[0197] The seal character detection model is trained based on the training samples of the fourth model.

[0198] In some embodiments, the fifth processing module 1360 is used to input the second seal text image into the seal character recognition model to obtain the character recognition result of the target seal output by the seal character recognition model.

[0199] The seal character recognition model was trained based on the training samples of the fifth model.

[0200] The seal recognition device in this application embodiment can be an electronic device or a component within an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices besides a terminal. For example, the electronic device can be a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc. It can also be a server, network attached storage (NAS), personal computer (PC), television set (TV), ATM, or self-service machine, etc. This application embodiment does not specifically limit the device.

[0201] The seal recognition device in this application embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit it.

[0202] The seal recognition device provided in this application embodiment can achieve... Figures 1 to 12 The various processes implemented in the method implementation examples will not be described again here to avoid repetition.

[0203] In some embodiments, such as Figure 14 As shown, this application embodiment also provides an electronic device 1400, including a processor 1401, a memory 1402, and a computer program stored in the memory 1402 and executable on the processor 1401. When the program is executed by the processor 1401, it implements the various processes of the above-described seal recognition method embodiment and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0204] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.

[0205] This application also provides a non-transitory computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the various processes of the above-described seal recognition method embodiments and achieves the same technical effect. To avoid repetition, it will not be described again here.

[0206] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.

[0207] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described seal recognition method.

[0208] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.

[0209] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0210] Furthermore, it should be noted that the scope of the methods and apparatus in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. In addition, features described with reference to certain examples may be combined in other examples.

[0211] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0212] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

[0213] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "illustrative embodiment," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0214] Although embodiments of this application have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of this application, the scope of which is defined by the claims and their equivalents.

Claims

1. A seal identification method characterized by comprising: include: Acquire a first seal image, the first seal image including the target seal to be identified; The first seal image is subjected to target detection and cropping to obtain the second seal image; The second seal image is input into the generative adversarial network model to remove background noise from the second seal image, thereby obtaining the third seal image output by the generative adversarial network model. The text image of the first seal is obtained by performing text detection on the third seal image; The first seal text image is corrected to obtain the second seal text image; Perform seal character recognition on the second seal text image to obtain the character recognition result of the target seal; The generative adversarial network model is obtained by training based on the training samples of the first model; The step of performing target detection and cropping processing on the first seal image to obtain the second seal image includes: Target detection is performed on the first seal image to determine the seal type information and seal location information of the target seal; The first seal image is cropped based on the seal position information to obtain the second seal image; The step of correcting the first seal text image to obtain the second seal text image includes: Based on the seal type information, when it is determined that the text in the first seal text image is curved text, the rotation angle of the first seal text image is calculated according to the position of the centroid and geometric center in the first seal text image. After rotating the first seal text image by the rotation angle, polar coordinate transformation is performed on the rotated text area to flatten the text area of ​​the first seal text image and obtain the third seal text image. The text direction of the third seal text image is corrected to obtain the second seal text image; The step of correcting the text orientation of the third seal text image to obtain the second seal text image includes: The text image of the third seal is input into the text orientation classification model to obtain the text orientation category of the text image of the third seal output by the text orientation classification model; Based on the text direction category of the third seal text image, the third seal text image is corrected to obtain the second seal text image; The text direction classification model is trained based on the training samples of the second model.

2. The seal identification method according to claim 1, characterized by, The step of performing target detection and cropping processing on the first seal image to obtain the second seal image includes: The first seal image is input into the target detection model for target detection and cropping to obtain the second seal image output by the target detection model. The target detection model is trained based on training samples from the third model.

3. The seal recognition method according to claim 1, characterized in that, The step of performing text detection on the third seal image to obtain the first seal text image includes: The third seal image is input into the seal text detection model to obtain the first seal text image output by the seal text detection model; The seal character detection model is trained based on the training samples of the fourth model.

4. The seal recognition method according to claim 1, characterized in that, The step of performing seal character recognition on the second seal text image to obtain the character recognition result of the target seal includes: The second seal text image is input into the seal character recognition model to obtain the character recognition result of the target seal output by the seal character recognition model; The seal character recognition model is trained based on the training samples of the fifth model.

5. A seal recognition device, characterized in that, include: The acquisition module is used to acquire a first seal image, wherein the first seal image includes the target seal to be identified; The first processing module is used to perform target detection and cropping processing on the first seal image to obtain the second seal image; Target detection is performed on the first seal image to determine the seal type information and seal location information of the target seal; The first seal image is cropped based on the seal position information to obtain the second seal image; The second processing module is used to input the second seal image into the generative adversarial network model, remove the background noise of the second seal image, and obtain the third seal image output by the generative adversarial network model. The third processing module is used to perform text detection on the third seal image to obtain the first seal text image; The fourth processing module is used to perform correction processing on the first seal text image to obtain the second seal text image; The fifth processing module is used to perform seal character recognition on the second seal text image to obtain the character recognition result of the target seal; The generative adversarial network model is obtained by training based on the training samples of the first model; If the text in the target seal of the first seal text image is curved, the rotation angle of the first seal text image is calculated based on the position of the centroid and geometric center of the first seal text image. The first seal text image is then rotated by this angle to obtain the rotated first seal text image. By performing polar coordinate transformation on the text area after the rotation angle, the text area of ​​the first seal text image is flattened to obtain the third seal text image. The text direction of the third seal text image is corrected to obtain the second seal text image; The step of correcting the text orientation of the third seal text image to obtain the second seal text image includes: The text image of the third seal is input into the text orientation classification model to obtain the text orientation category of the text image of the third seal output by the text orientation classification model; Based on the text direction category of the third seal text image, the third seal text image is corrected to obtain the second seal text image; The text direction classification model is trained based on the training samples of the second model.

6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the seal recognition method as described in any one of claims 1-4.

7. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the seal recognition method as described in any one of claims 1-4.