Seal recognition method and apparatus, electronic device, and storage medium

By generating an adversarial network model to remove background noise from seal images and perform text correction processing, the problems of low efficiency and low accuracy of traditional seal recognition methods in complex backgrounds are solved, and more efficient seal text recognition is achieved.

WO2024169397A9PCT designated stage expired Publication Date: 2024-11-07GRG BANKING EQUIPMENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2023/140591
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-02-14
Filing Date
2023-12-21
Publication Date
2024-11-07

AI Technical Summary

Technical Problem

Traditional seal recognition methods are inefficient and accurate in complex document backgrounds, mainly due to the loss of large amounts of information due to image processing operations, making it difficult to effectively remove background noise.

Method used

The generative adversarial network model is used to remove background noise from the seal image, and the clean seal image is obtained through object detection and cropping, and then text detection and correction are performed to finally realize seal text recognition.

Benefits of technology

It improves the efficiency and accuracy of seal recognition, effectively removes the influence of background noise, and enhances the accuracy of seal text recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2023140591_07112024_PF_FP_ABST
    Figure CN2023140591_07112024_PF_FP_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of image processing, and relates to a seal recognition method and apparatus, an electronic device, and a storage medium. The method comprises: acquiring a first seal image, wherein the first seal image comprises 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 model to remove background noise of the second seal image, so as to obtain a third seal image output by the generative adversarial network model; performing character 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 character recognition on the second seal text image to obtain a character recognition result of the target seal.
Need to check novelty before this filing date? Find Prior Art

Description

Seal recognition method, device, electronic device and storage medium

[0001] Related applications

[0002] This application claims priority to Chinese patent application number 202310120586.4, filed on February 14, 2023, entitled “Seal Identification Method, Device, Electronic Device and Storage Medium,” the entire text of which is hereby incorporated by reference. Technical Field

[0003] The present 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 Art

[0004] With the rapid development of artificial intelligence, deep learning has been widely used in technical fields such as image recognition and optical character recognition. The seal recognition method based on machine vision helps to achieve efficient and intelligent analysis of documents.

[0005] Traditional seal recognition methods locate, detect and extract seals in document images by constructing color space models such as HIS, RGB, and HSV, and then realize seal text recognition through image processing operations and template matching methods. This method relies on the color features of the image and artificial extraction thresholds when constructing the model. When faced with complex document backgrounds, complex image processing operations will cause a large amount of image information to be lost, and the efficiency and accuracy of the seal recognition method are low.

[0006] Summary of the Invention

[0007] According to various embodiments disclosed in the present application, a seal recognition method, device, electronic device, and storage medium are provided.

[0008] A seal recognition method includes:

[0009] Acquire a first seal image, where the first seal image includes a target seal to be identified;

[0010] performing target detection and cropping processing on the first seal image to obtain a second seal image;

[0011] Inputting the second seal image into a generative adversarial network model, removing background noise from the second seal image, and obtaining a third seal image output by the generative adversarial network model;

[0012] Performing text detection on the third seal image to obtain a first seal text image;

[0013] performing correction processing on the first seal text image to obtain a second seal text image; and

[0014] Performing seal character recognition on the second seal text image to obtain a character recognition result of the target seal;

[0015] The generative adversarial network model is obtained by training based on the first model training sample.

[0016] A seal recognition device comprises:

[0017] An acquisition module, configured to acquire a first seal image, wherein the first seal image includes a target seal to be identified;

[0018] a first processing module, configured to perform target detection and cropping processing on the first seal image to obtain a second seal image;

[0019] A second processing module is configured to input the second seal image into a generative adversarial network model, remove background noise from the second seal image, and obtain a third seal image output by the generative adversarial network model;

[0020] A third processing module is used to perform text detection on the third seal image to obtain a first seal text image;

[0021] a fourth processing module, configured to perform correction processing on the first seal text image to obtain a second seal text image; and

[0022] 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;

[0023] The generative adversarial network model is obtained by training based on the first model training sample.

[0024] A computer device includes a memory and one or more processors, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processors, the one or more processors perform the following steps:

[0025] Acquire a first seal image, where the first seal image includes a target seal to be identified;

[0026] performing target detection and cropping processing on the first seal image to obtain a second seal image;

[0027] Inputting the second seal image into a generative adversarial network model, removing background noise from the second seal image, and obtaining a third seal image output by the generative adversarial network model;

[0028] Performing text detection on the third seal image to obtain a first seal text image;

[0029] performing correction processing on the first seal text image to obtain a second seal text image; and

[0030] Performing seal character recognition on the second seal text image to obtain a character recognition result of the target seal;

[0031] The generative adversarial network model is obtained by training based on the first model training sample.

[0032] One or more computer storage media storing computer-readable instructions, which, when executed by one or more processors, cause the one or more processors to perform the following steps:

[0033] Acquire a first seal image, where the first seal image includes a target seal to be identified;

[0034] performing target detection and cropping processing on the first seal image to obtain a second seal image;

[0035] Inputting the second seal image into a generative adversarial network model, removing background noise from the second seal image, and obtaining a third seal image output by the generative adversarial network model;

[0036] Performing text detection on the third seal image to obtain a first seal text image;

[0037] performing correction processing on the first seal text image to obtain a second seal text image; and

[0038] Performing seal character recognition on the second seal text image to obtain a character recognition result of the target seal;

[0039] The generative adversarial network model is obtained by training based on the first model training sample.

[0040] The details of one or more embodiments of the present application are set forth in the accompanying drawings and the description below. Other features and advantages of the present application will become apparent from the description, drawings, and claims. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the conventional technology, the following briefly introduces the drawings required for use in the embodiments or the conventional technology descriptions. Obviously, the drawings described below are merely embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the disclosed drawings without any creative work.

[0042] FIG1 is a schematic diagram of a flow chart of a seal recognition method according to one or more embodiments;

[0043] FIG2 is a second flow chart of a seal recognition method according to one or more embodiments;

[0044] FIG3 is a schematic diagram of a processing flow of a generator for generating a generative adversarial network model according to one or more embodiments;

[0045] FIG4 is a schematic diagram of data flow of a text direction classification model according to one or more embodiments;

[0046] FIG5 is a schematic diagram of a processing flow of a discriminator of a generative adversarial network model according to one or more embodiments;

[0047] FIG6 is a schematic diagram of a second seal image according to one or more embodiments;

[0048] FIG7 is a schematic diagram of a third seal image according to one or more embodiments;

[0049] FIG8 is a binarized image of a third seal image according to one or more embodiments;

[0050] FIG9 is one of schematic diagrams of a first seal text image according to one or more embodiments;

[0051] FIG10 is a second schematic diagram of a first seal text image according to one or more embodiments;

[0052] FIG11 is a schematic diagram of a third seal text image according to one or more embodiments;

[0053] FIG12 is a schematic diagram of a second seal text image according to one or more embodiments;

[0054] FIG13 is a structural block diagram of a seal recognition device according to one or more embodiments;

[0055] FIG14 is a block diagram of an electronic device according to one or more embodiments. DETAILED DESCRIPTION

[0056] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0057] As shown in FIG. 1 , the seal recognition method includes steps 110 to 160 .

[0058] Step 110: Acquire a first seal image.

[0059] The first seal image includes a target seal to be identified. The first seal image may be an image of a document stamped with the target seal, for example, an image of an agreement document stamped with the target seal.

[0060] In this step, the first seal image may be obtained by photographing the document containing the target seal using a camera, or by scanning the document containing the first seal image using a scanner.

[0061] Step 120: Perform object detection and cropping processing on the first seal image to obtain a second seal image.

[0062] Among them, object detection refers to identifying which objects are in a picture or video and their locations.

[0063] In this embodiment, the location of the target seal and the type of the target seal are determined through target detection. The target detection is performed on the first seal image and the first seal image can be processed by the model.

[0064] In this step, cropping the first seal image means cropping and deleting the area other than the target seal area in the first seal image according to the position of the target seal in the first seal image determined by target detection, to obtain a second seal image containing the target seal.

[0065] For example, the first seal image is an image of an agreement with a target seal, which includes an area with a large amount of text information and an area with a target seal. The first seal image can be cropped and deleted by cropping other area images other than the target seal in the image of the agreement, leaving only the area including the target seal.

[0066] The position of the target seal in the first seal image is obtained through target detection, and other areas in the first seal image other than the area where the target seal is located are cropped and deleted, thereby reducing the influence of image information in other areas other than the target seal information on target seal recognition and improving the efficiency of seal recognition.

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

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

[0069] [Corrected 21.02.2024 according to Rule 9.2] For example, as shown in FIG6 , the background noise in the second seal image may be the explanatory text information “XXXXXXXX (stamped with official seal)” of the target seal in FIG6 and the signature information in the lower right corner of the image.

[0070] As shown in FIG7 , the third seal image is a clean seal image obtained by removing background noise from the second seal image.

[0071] In this embodiment, the generative adversarial network model may use a CycleGAN model, which includes a generator and a discriminator.

[0072] In actual implementation, the second seal image with background noise can be input into the CycleGAN model, the background noise in the second seal image can be removed, and the third seal image output by the generator in the CycleGAN model can be obtained, wherein the third seal image does not contain background noise.

[0073] When training the generative adversarial network model, by using the discriminator and generator in the generative adversarial network model together, in the process of joint training and optimization of the discriminator and the generator, the generator of the generative adversarial network model produces a third seal image without background noise, which can accurately remove the background noise in the first noise sample.

[0074] In this embodiment, the generative adversarial network model eliminates background noise in the first noise sample by means of style transfer.

[0075] Among them, style transfer refers to transferring the style of the target image to the source image, so that the source image retains the content while having the style of the target image.

[0076] In this embodiment, the generator of the generative adversarial network model can adopt a U-Net structure, as shown in Figure 3. Compared with the common network of the codec structure that first downsamples to a low dimension and then upsamples to the original resolution, the difference of the U-Net structure is that a skip layer structure skip-connection is added to splice together feature maps of the same size before and after encoding and decoding.

[0077] In this way, pixel-level detail information at different resolutions can be retained, making the U-Net structure very effective in depicting details. In addition, the residual block structure is used in the encoder and the style converter in the middle part of the U-Net. By adding a direct path while transmitting the neural network, it can ensure the effective transmission of gradients and improve the performance of the generative adversarial network model.

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

[0079] Among them, instance normalization is the batch normalization of each data sample. In style conversion, each sample needs to be standardized. Instance normalization is equivalent to contrast normalization for each sample.

[0080] As shown in Figure 4, during the downsampling stage, the U-Net network uses a convolution kernel of 3*3 size and a stride of 2. With each downsampling, the number of channels gradually doubles.

[0081] In the converter stage, 6 defined residual blocks are used to keep the size and number of channels of the feature map unchanged.

[0082] In the decoder stage, upsampling is used to expand the size of the seal image, while gradually decreasing convolution kernels are used to reduce the number of channels to half of the original size, and instance normalization is used for normalization.

[0083] As shown in Figure 5, the discriminator structure of the generative adversarial network model uses four layers of convolution and activation functions to extract and process image features, and then obtains a patch output through a convolution with an output channel of 1, thereby achieving "scoring" of the input image.

[0084] For example, the score range of the discriminator output of the generative adversarial network model can be specified to be between [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.

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

[0086] The first seal text image is a regional image of the seal text outline corresponding to the target seal.

[0087] The text detection is used to determine the regional image of the seal text contour corresponding to the target seal in the third seal image, and process the regional image of the seal text contour to obtain the first seal text image containing the target seal.

[0088] Step 150: Correct the first seal text image to obtain a second seal text image.

[0089] In actual implementation, different people have different stamp directions, tilt angles and types, so these stamp images need to be corrected, and the target seal image and the text direction in the target seal image need to be unified to obtain a target seal image that is more suitable for recognition by the seal recognition model.

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

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

[0092] [Corrected on 21.02.2024 according to Rule 9.2] For example, as shown in FIG12 , text recognition is to obtain the text information “XXXXXXXX” in the fifth row of the figure.

[0093] In this step, performing seal text recognition on the second seal text image is to obtain the text in the second seal text image, that is, the text recognition result of the target seal.

[0094] By performing seal text recognition on the second seal text image, wherein the second seal text image has been corrected, the accuracy of seal text recognition can be improved during seal text recognition.

[0095] In related technologies, seals in document images are located, detected and extracted by constructing a color space model, and then seal text recognition is achieved through image processing and template matching. This method relies on the color features of the image and artificial extraction thresholds when constructing the model. When faced with a noisy background in the document image, the image processing operation will cause a large amount of image information to be lost, and the efficiency and accuracy of seal recognition are low.

[0096] In an embodiment of the present application, a second seal image is obtained by performing target detection and cropping on a first seal image containing a target seal, and the second seal image is input into a generative adversarial network model. According to the style of the background noise-free sample in the first training sample during the training process of the generative adversarial network model, the style of the background noise-free sample in the first training sample is transferred to the second seal image, and the background noise in the second seal image is removed to obtain a third seal image without background noise. Then, text detection, correction processing and text recognition are performed on the third seal image in sequence to obtain the text information in the target seal.

[0097] According to the seal recognition method provided in the embodiment of the present application, target detection and cropping are performed on the first seal image containing the target seal, the area image outside the area where the target seal is located is removed, and the second seal image is processed using a generative adversarial network model to restore the third seal image without background, thereby removing the influence of background noise and effectively improving the efficiency and accuracy of seal recognition.

[0098] In some embodiments, performing object detection and cropping on the first seal image to obtain the second seal image includes:

[0099] Performing target detection on the first seal image to determine seal type information and seal position information of the target seal;

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

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

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

[0103] The cropping process for the first seal image may include cropping the area image other than the target seal in the first seal image, and determining the area image including the target seal as the second seal image.

[0104] In some embodiments, performing correction processing on the first seal text image to obtain the second seal text image includes:

[0105] Based on the seal type information, performing text image correction on the first seal text image to obtain a third seal text image;

[0106] The third seal text image is subjected to text direction correction to obtain a second seal text image.

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

[0108] In some embodiments, as shown in Figure 9, if the text in the target seal of the first seal text image is arc-shaped curved text, the rotation angle of the first seal text image is calculated based on the positions of the center of mass and the geometric center in the first seal text image, and the first seal text image is rotated by the angle, as shown in Figure 10, to obtain the rotated first seal text image.

[0109] As shown in FIG11 , the text area of ​​the first seal text image is flattened by performing polar coordinate transformation on the text area after the rotation angle, thereby obtaining a third seal text image.

[0110] In other embodiments, if the text in the target seal of the first seal text image is tilted text, the circumscribed rectangle of the image of the area where the target seal is located in the first seal text image is obtained, and the circumscribed rectangle is rotated to obtain a third seal text image.

[0111] The text image correction of the first seal text image includes the following four steps:

[0112] [Corrected 24.09.2024 according to Rule 26] Step 1: Get the first seal text image and apply the formula

[0113] Determine the Gaussian area of ​​the first stamp text image.

[0114] [Corrected 24.09.2024 in accordance with Rule 26] where x i is the horizontal coordinate of any point in the first seal text image, y i is the vertical coordinate of the first seal text image, and det() is the determinant of the matrix in the brackets.

[0115] [Corrected 24.09.2024 in accordance with Rule 26] Application formula

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

[0117] Among them, C x is the horizontal coordinate of the centroid of the first seal text image, C y is the vertical coordinate of the first seal text image.

[0118] [Corrected 24.09.2024 according to Rule 26] 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 area where the first seal text image is located and the horizontal direction is the seal rotation angle. 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

[0119] Determine the rotation angle.

[0120] Wherein, θ represents the rotation angle of the first seal text image.

[0121] [Corrected 24.09.2024 according to Rule 26] Step 3: Perform text image correction on the tilted first seal text image. After obtaining the tilt angle, apply the formula

[0122] The coordinates of the tilted first seal text image after text image correction are acquired, and the position of the first seal text image after text image correction is determined.

[0123] Wherein, x is the horizontal coordinate of the region where the characters in the first seal text image are located, and y is the vertical coordinate of the region where the characters in the first seal text image are located.

[0124] Step 4: Flatten the text area in the first seal text image by performing polar coordinate transformation on the text area in the first seal text image.

[0125] Suppose the radius of the circular seal in the third seal text image is R, the length and width of the second seal text image are N and M respectively. After the arc-shaped characters in the third seal text image are expanded vertically, 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.

[0126] [Corrected 24.09.2024 in accordance with Rule 26] Application formula

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

[0128] Wherein, i is the horizontal coordinate of the point in the third seal text image, j is the vertical coordinate of the point in the third seal text image, x is the horizontal coordinate of the point in the second seal text image, and y is the vertical coordinate of the point in the second seal text image.

[0129] In some embodiments, performing text direction correction on the third seal text image to obtain the second seal text image includes:

[0130] Inputting the third seal text image into a text direction classification model to obtain a text direction category of the third seal text image output by the text direction classification model;

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

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

[0133] In this embodiment, as shown in FIG12 , the text direction classification model may use the deep learning classification model ResNet18, 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 horizontally vertical text order.

[0134] In some embodiments, performing object detection and cropping on the first seal image to obtain the second seal image includes:

[0135] Inputting the first seal image into the target detection model, performing target detection and cropping processing, and obtaining a second seal image output by the target detection model;

[0136] Among them, the target detection model is trained based on the third model training samples.

[0137] In this embodiment, the target detection model may be a YOLOv5 model, the third model training sample may be a document image with a seal image, and the target detection model outputs the location information and type information of the seal image in the document image.

[0138] In some embodiments, performing text detection on the third seal image to obtain the first seal text image includes:

[0139] Inputting the third seal image into the seal text detection model to obtain the first seal text image output by the seal text detection model;

[0140] Among them, the seal text detection model is trained based on the fourth model training samples.

[0141] In this embodiment, the seal text detection model may use the DBNet++ model, and the fourth model training sample may be a seal image containing text information.

[0142] As shown in FIG8 , in actual execution, the text detection model obtains the binarized image corresponding to the third seal image, determines the regional image of the text contour corresponding to the target seal in the third seal image, performs a masking operation on the regional image, and obtains the first seal text image.

[0143] Since there are only two gray levels in the binary image and there is no filter value in the middle, each pixel value only requires 1 bit of space, so the storage space required for the binary image is small, and the binary image can show the contour through the density of the pixels.

[0144] In this step, by using a binary image to represent the third seal image, the required storage space is small and the algorithm runs at a fast speed.

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

[0146] Inputting the second seal text image into the seal character recognition model to obtain a character recognition result of the target seal output by the seal character recognition model;

[0147] Among them, the seal text recognition model is trained based on the fifth model training sample.

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

[0149] As shown in FIG2 , a specific embodiment is introduced below to describe the overall process of the seal recognition method.

[0150] In the data acquisition stage, a training data set is prepared for training the target detection model, the generative adversarial network model, the seal text detection model, the text direction classification model and the seal text recognition model, and the first seal image containing the target seal is obtained.

[0151] Among them, the training data set includes data sample A and the label corresponding to data sample A for training the target detection model, data sample B and the label corresponding to data sample B for training the generative adversarial network model, data sample C and the label corresponding to data sample C for training the seal text detection model, data sample D and the label corresponding to data sample D for training the text direction classification model and data sample E and the label corresponding to data sample E for training the seal text recognition model. The first seal image containing the target seal is the input image.

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

[0153] 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 information and type information of the target seal in the first seal image. According to the position information of the seal in the image, the first seal image is cropped to obtain the second seal image.

[0154] The second seal image is input into the generative adversarial network model, background noise in the generative adversarial network model is removed, and a third seal image output by the generative adversarial network model is obtained.

[0155] The third seal image is input into the seal character detection model, and the seal character detection model outputs the first seal character image.

[0156] As shown in FIG9 , the first seal text image is a region image of the target seal text outline.

[0157] Perform text image correction on the first seal text image, combine it with the text image of the target seal, obtain the third seal text image, input the third seal text image into the text direction classification model, perform text direction correction on the text image information in the third seal text image, correct the areas with incorrect text order, and obtain the second seal text image output by the text direction classification model.

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

[0159] The seal recognition method may be applied to a terminal, and may be specifically executed by hardware or software in the terminal.

[0160] The terminal includes, but is not limited to, a portable communication device such as a mobile phone or tablet computer having a touch-sensitive surface (e.g., a touch screen display and / or a touch pad). It should also be understood that, in some embodiments, the terminal may not be a portable communication device, but a desktop computer having a touch-sensitive surface (e.g., a touch screen display and / or a touch pad).

[0161] In the following 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, a mouse, and a joystick.

[0162] The seal recognition method provided in the embodiment of the present application can be executed by a seal recognition device. In the embodiment of the present application, the seal recognition device provided in the embodiment of the present application is described by taking the seal recognition method executed by the seal recognition device as an example.

[0163] An embodiment of the present application also provides a seal recognition device.

[0164] As shown in FIG13 , the seal recognition device includes:

[0165] An acquisition module 1310 is configured to acquire a first seal image, where the first seal image includes a target seal to be identified;

[0166] A first processing module 1320 is configured to perform target detection and cropping on the first seal image to obtain a second seal image;

[0167] The second processing module 1330 is configured to input the second seal image into a generative adversarial network model, remove background noise from the second seal image, and obtain a third seal image output by the generative adversarial network model;

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

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

[0170] The fifth processing module 1360 is configured to perform seal text recognition on the second seal text image to obtain a target seal text recognition result;

[0171] Among them, the generative adversarial network model is trained based on the first model training samples.

[0172] According to the seal recognition device provided in the embodiment of the present application, target detection and cropping are performed on the first seal image containing the target seal, the area image outside the area where the target seal is located is removed, and the second seal image is processed using a generative adversarial network model to restore the third seal image without background, thereby removing the influence of background noise and effectively improving the efficiency and accuracy of seal recognition.

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

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

[0175] 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;

[0176] The third seal text image is subjected to text direction correction to obtain a second seal text image.

[0177] In some embodiments, the fourth processing module 1350 is further configured to input the third seal text image into a text direction classification model to obtain a text direction category of the third seal text image output by the text direction classification model;

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

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

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

[0181] Among them, the target detection model is trained based on the third model training samples.

[0182] 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;

[0183] Among them, the seal text detection model is trained based on the fourth model training samples.

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

[0185] Among them, the seal text recognition model is trained based on the fifth model training sample.

[0186] The seal recognition device in the embodiment of the present application can be an electronic device, or a component in the electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal, or other devices other than a terminal. Exemplarily, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a palmtop computer, an in-vehicle electronic device, a mobile internet device (Mobile Internet Device, MID), an augmented reality (augmented reality, AR) / virtual reality (virtual reality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., and can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., and the embodiment of the present application is not specifically limited.

[0187] The seal recognition device in the embodiment of the present application can be a device having an operating system. The operating system can be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.

[0188] The seal recognition device provided in the embodiment of the present application can implement each process implemented in the method embodiments of Figures 1 to 12. To avoid repetition, they will not be described here.

[0189] In some embodiments, as shown in Figure 14, the embodiment of the present application also provides an electronic device 1400, including a processor 1401, a memory 1402, and computer-readable instructions stored on the memory 1402 and executable on the processor 1401. When the program is executed by the processor 1401, the various processes of the above-mentioned seal recognition method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0190] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.

[0191] An embodiment of the present application also provides a non-transitory computer-readable storage medium, which stores computer-readable instructions. When the computer-readable instructions are executed by a processor, the various processes of the above-mentioned seal recognition method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, they will not be repeated here.

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

[0193] An embodiment of the present application also provides a computer-readable instruction product, including computer-readable instructions, which implement the above-mentioned seal recognition method when executed by a processor.

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

[0195] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.

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

[0197] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course 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 the present application is essentially or the part that contributes to the prior art can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), including a number of instructions for enabling a terminal (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0198] The technical features of the above-mentioned embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the technical features in the above-mentioned embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0199] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the patent application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present patent application shall be determined by the appended claims.

Claims

1. A seal recognition method comprising: Acquire a first seal image, where the first seal image includes a target seal to be identified; 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 model, removing background noise from the second seal image, and obtaining a third seal image output by the generative adversarial network 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 character recognition on the second seal text image to obtain a character recognition result of the target seal; The generative adversarial network model is obtained by training based on the first model training sample.

2. The seal recognition method according to claim 1, wherein: The performing target detection and cropping processing on the first seal image to obtain a second seal image includes: Performing target detection on the first seal image to determine seal type information and seal position information of the target seal; and The first seal image is cropped based on the seal position information to obtain the second seal image.

3. The seal recognition 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, performing text image correction on the first seal text image to obtain a third seal text image; and Perform text direction correction on the third seal text image to obtain the second seal text image.

4. The seal recognition method according to claim 3, wherein: The step of performing text direction correction on 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 a text direction category of the third seal text image output by the text direction classification model; and 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 obtained by training based on the second model training samples.

5. The seal recognition method according to any one of claims 1 to 4, wherein: The performing target detection and cropping processing on the first seal image to obtain a second seal image includes: The first seal image is input into the target detection model to perform target detection and cropping to obtain the target detecting the second seal image output by the model; The target detection model is obtained by training based on the third model training sample.

6. The seal recognition method according to any one of claims 1 to 4, wherein: The performing text detection on the third seal image to obtain the first seal text image includes: Inputting the third seal image into a seal text detection model to obtain the first seal text image output by the seal text detection model; The seal character detection model is obtained by training based on the 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 the 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 by training based on the fifth model training sample.

8. A seal recognition device comprising: An acquisition module, configured to acquire a first seal image, wherein the first seal image includes a target seal to be identified; a first processing module, configured to perform target detection and cropping processing on the first seal image to obtain a second seal image; A second processing module is configured to input the second seal image into a generative adversarial network model, remove background noise from the second seal image, and obtain a third seal image output by the generative adversarial network model; A third processing module is used to perform text detection on the third seal image to obtain a first seal text image; a fourth processing module, configured to perform correction processing on the first seal text image to obtain a second seal text image; and 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; The generative adversarial network model is obtained by training based on the first model training sample.

9. An electronic device comprising a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor, wherein: When the processor executes the program, the seal recognition method according to any one of claims 1 to 7 is implemented.

10. A non-transitory computer-readable storage medium having computer-readable instructions stored thereon, wherein: When the computer-readable instructions are executed by a processor, the seal recognition method according to any one of claims 1 to 7 is implemented.