Multilingual seal character recognition method, device, electronic device and storage medium

Through the combination of SAM segmentation model and Transformer encoder, multiple challenges in seal text recognition are solved, achieving more efficient and accurate recognition effects, especially in multilingual support and non-standardized image processing.

CN118537867BActive Publication Date: 2025-02-07INST OF AUTOMATION CHINESE ACAD OF SCI +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410673996.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-28
Publication Date
2025-02-07
Estimated Expiration
2044-05-28

AI Technical Summary

Technical Problem

Seal text recognition faces many challenges, including size, shape, color differences, rotation deformation, complex background interference, uneven ink marks, uneven lighting and multilingual support requirements, resulting in poor recognition results.

Method used

The seal image is segmented using the SAM segmentation model to obtain the mask and feature vector of the text, and the text lines are obtained through clustering, and the text in the text lines are sorted. The text lines are identified using the Transformer encoder, and the character frames, categories and languages ​​are output.

Benefits of technology

Improves the effectiveness and accuracy of seal image recognition, overcomes the many challenges of seal text recognition, especially in handling non-standardized images and multilingual support.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118537867B_ABST
    Figure CN118537867B_ABST
Patent Text Reader

Abstract

The present invention provides a multilingual seal character recognition method, device, electronic device and storage medium, belonging to the technical field of optical character recognition, the method comprising: using a SAM segmentation model to segment a target seal image, obtaining a mask and a feature vector of each seal character; clustering each seal character based on the mask and the feature vector of each seal character, obtaining at least one text line; sorting the characters in the at least one text line according to relative positions; based on the mask of each seal character, using a Transformer encoder to recognize the at least one sorted text line, and outputting the character frame, character category and language of each seal character. The effect and accuracy of seal image recognition can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of optical character recognition, and in particular to a multilingual seal text recognition method, device, electronic equipment and storage medium. Background Art

[0002] In the related technologies, seal text recognition faces the following challenges: 1. Seals vary greatly in size, shape, color and printing materials, which challenges the generalization ability of the recognition system; 2. Since the seal may rotate or deform when pressed, the text may be distorted, requiring the recognition algorithm to be able to handle non-standardized images; 3. Seals are often stamped on documents with complex backgrounds, such as interference from text, graphics or other stamps, which will affect the accuracy of recognition; 4. When the seal is pressed, the ink may overflow or be uneven due to too much or too little ink, making recognition more difficult; 5. Uneven lighting and reflection during shooting or scanning will cause the seal part to be too bright or too dark, affecting the recognition effect; 6. Commonly used Chinese character recognition systems need to support at least more than 7,000 types of Chinese characters, and multi-language seal recognition further expands the requirements for character sets to be recognized.

[0003] The above problems cannot be solved well by the seal text recognition method in the related art, so the recognition effect is not good. Summary of the invention

[0004] The present invention provides a multilingual seal character recognition method, device, electronic equipment and storage medium, which can overcome the problems faced by seal character recognition and improve the effect and accuracy of seal image recognition.

[0005] The present invention provides a multilingual seal character recognition method, comprising:

[0006] Use the SAM segmentation model to segment the target seal image and obtain the mask and feature vector of each seal character;

[0007] Based on the mask and feature vector of each seal character, clustering each seal character to obtain at least one character line;

[0008] sorting the characters in the at least one character line according to relative positions respectively;

[0009] Based on the mask of each seal character, a Transformer encoder is used to identify the at least one sorted text line, and the character frame, character category and language of each seal character are output.

[0010] According to the multilingual seal character recognition method provided by the present invention, the target seal character image is segmented using the SAM segmentation model to obtain the mask and feature vector of each seal character, including:

[0011] Inputting the RGB three-channel image of the target seal imprint and the corresponding prompt into the trained SAM segmentation model, wherein the corresponding prompt includes three dot arrays evenly distributed on the RGB three-channel image of the target seal imprint;

[0012] Obtain the mask and feature vector of each seal character output by the SAM segmentation model.

[0013] According to the multilingual seal character recognition method provided by the present invention, the training process of the SAM segmentation model includes:

[0014] Training a SAM basic model based on a first data set to obtain a trained first SAM segmentation model, wherein the first data set includes a first number of synthetic seal images generated by fusing seal images without background interference and real document images;

[0015] The first SAM segmentation model is trained based on a second data set to obtain a trained SAM segmentation model, wherein the second data set includes a second number of real seal images with backgrounds.

[0016] According to the multilingual seal character recognition method provided by the present invention, clustering each seal character based on the mask and feature vector of each seal character to obtain at least one character line includes:

[0017] Based on the mask of each seal character, fitting the outer frame corresponding to each seal character;

[0018] Use non-maximum suppression (NMS) to filter repeated characters in each seal character, and retain characters in the filtered seal characters whose intersection over union (IoU) is higher than a preset value;

[0019] Based on the feature vector of each seal character, the characters with an IoU higher than a preset value are clustered using a mean shift clustering algorithm to obtain the at least one character line.

[0020] According to the multilingual seal character recognition method provided by the present invention, the step of sorting the characters in the at least one character line according to relative positions comprises:

[0021] Determine a first character in the at least one character line, respectively, the first character being in the same direction as two characters closest to the first character;

[0022] The character that is closest to the previous character is used as the next character after the previous character until all the characters are traversed.

[0023] According to the multilingual seal character recognition method provided by the present invention, based on the mask of each seal character, using a Transformer encoder to recognize the at least one sorted text line, and outputting the character frame, character category and language of each seal character, the method comprises: based on the mask of each seal character, using a Transformer encoder to recognize the at least one sorted text line, and outputting the character frame, character category and language of each seal character, the method comprises:

[0024] Extracting foreground pixels using the mask of each stamp character;

[0025] Extracting a fixed-length feature vector of the foreground pixel using a single convolutional layer and inputting it into a bidirectional Transformer encoder, fusing the context information of the at least one text line using a multi-head attention mechanism;

[0026] Obtaining the character category, text line language, and text line reading direction of each text output by the bidirectional Transformer encoder;

[0027] Based on the reading direction of the text line, the text order of the at least one text line is adjusted to obtain the character frame, character category and language of each seal character.

[0028] The present invention also provides a multilingual seal character recognition device, comprising:

[0029] The segmentation module is used to segment the target seal image using the SAM segmentation model to obtain the mask and feature vector of each seal character;

[0030] A clustering module, used for clustering each of the seal characters based on the mask and feature vector of each of the seal characters to obtain at least one character line;

[0031] A sorting module, used for sorting the characters in the at least one character line according to relative positions;

[0032] The output module is used to identify the at least one sorted text line based on the mask of each seal character by using a Transformer encoder, and output the character frame, character category and language of each seal character.

[0033] The present invention also provides an electronic device, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, any of the multilingual seal character recognition methods described above is implemented.

[0034] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the multi-language seal character recognition method as described in any one of the above is implemented.

[0035] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the multilingual seal character recognition method as described above is implemented.

[0036] The present invention provides a multilingual seal text recognition method, device, electronic device and storage medium. The SAM segmentation model is used to segment the target seal text image and obtain text lines through clustering. The problem of text line area sticking caused by the close distance between different text lines can be avoided, making it easier to separate different text lines. By sorting the text lines according to relative positions, the starting and ending positions of the text lines can be distinguished, avoiding errors in text line recognition caused by incorrect reading order. The text lines are recognized by the Transformer encoder, which can make the features have stronger semantic expression ability, which is helpful to improve the recognition accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0038] Figure 1 It is a schematic flow chart of the multilingual seal character recognition method provided by the present invention;

[0039] Figure 2 It is a structural schematic diagram of a multilingual seal character recognition device provided by the present invention;

[0040] Figure 3 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0041] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0042] First, the following contents are introduced:

[0043] The automatic seal text recognition technology has a wide range of application needs in the fields of processing legal documents, financial records, contract audits, and administrative processes. By identifying the text in the seal, the type of the seal can be obtained, and then identity authentication, compliance review, automatic document type calibration, etc. can be achieved. For example, government documents often require official seals to prove their validity and authority.

[0044] Seal text recognition can help quickly electronically process a large number of paper documents and improve the efficiency of government services. It is suitable for identity verification, license issuance, legal document review, etc. In banks and insurance companies, seals are used to mark important documents such as loan contracts, insurance documents, and savings account documents.

[0045] Automatic recognition of text in seals can improve the automation of document processing and regulatory compliance checks. Law firms and court systems involve a large number of seal documents, such as written judgments, contracts, and legal opinions. Seal text recognition helps with document classification, archiving, and retrieval, thereby improving work efficiency and service quality.

[0046] Combine the following Figure 1 The invention describes a multilingual seal character recognition method.

[0047] Figure 1 FIG. 1 is a flow chart of a multilingual seal character recognition method provided by the present invention. Figure 1 As shown, the following steps are included:

[0048] Step 100, using the SAM segmentation model to segment the target seal image, and obtain the mask and feature vector of each seal character;

[0049] The core idea of ​​the present invention is to utilize the advantage of deep learning technology that can automatically learn more discriminative features from samples, and apply it to seal text recognition, which can overcome the problems faced by seal text recognition and further improve the recognition performance.

[0050] Optionally, the feature vector of the seal text may represent style information such as color, size, font, etc. of the text.

[0051] Step 110, clustering each of the seal characters based on the mask and feature vector of each of the seal characters to obtain at least one character line;

[0052] Optionally, the seal characters may be clustered based on the mask and feature vector of each seal character to obtain at least one character line, and each cluster may correspond to one character line.

[0053] Optionally, a clustering algorithm may be used to cluster the seal characters, and the present invention does not limit the specific clustering algorithm used.

[0054] Step 120, sorting the characters in the at least one character line according to relative positions;

[0055] Optionally, after clustering to obtain at least one text line, the characters in the at least one text line may be sorted according to relative positions.

[0056] Specifically, the characters in the text line may be sorted according to their relative positions so that they are arranged in a smooth curve starting from any end.

[0057] Step 130, based on the mask of each seal character, use a Transformer encoder to identify the at least one sorted text line, and output the character frame, character category and language of each seal character.

[0058] The multilingual seal text recognition method provided by the present invention uses the SAM segmentation model to segment the target seal text image and obtains text lines through clustering, which can avoid the problem of text line area sticking caused by the close distance between different text lines, making it easier to separate different text lines. By sorting the text lines according to relative positions, the starting and ending positions of the text lines can be distinguished, avoiding errors in text line recognition caused by incorrect reading order. By recognizing the text lines through the Transformer encoder, the features can have stronger semantic expression capabilities, which is helpful to improve the recognition accuracy.

[0059] Optionally, the use of the SAM segmentation model to segment the target seal image to obtain a mask and a feature vector of each seal character includes:

[0060] Inputting a red, green, blue (RGB) three-channel image of the target seal imprint and a corresponding prompt into the trained SAM segmentation model, wherein the corresponding prompt includes three dot arrays evenly distributed on the RGB three-channel image of the target seal imprint;

[0061] Obtain the mask and feature vector of each seal character output by the SAM segmentation model.

[0062] Optionally, a trained SAM segmentation model may be used to segment the target seal imprint image, the input of the model being an RGB three-channel seal imprint image.

[0063] Since SAM is an interactive model that requires input prompts, in order to obtain the segmentation results of all texts, the input prompts can be fixed to three dot matrices evenly distributed on the image, with dot matrices sizes of 16×16, 8×8, and 4×4, respectively, to accommodate texts of different sizes.

[0064] Optionally, for each cue point, the SAM segmentation model outputs a mask, a feature vector, and an intersection over union (IoU) with the real text of the text at the point.

[0065] Optionally, the mask output by the SAM segmentation model only contains the seal foreground text, while interference information such as background text and shading is filtered out.

[0066] In some embodiments, in order to segment the target seal image, the input seal image is first scaled, the aspect ratio of the image is maintained during scaling, and the long side is 448 pixels and the short side is a multiple of 32, and then the image and the prompt are encoded separately, wherein the image is encoded using a Transformer network, and the length and width of the output feature map are one-fourth of the input image. For the prompt, in order to extract seal text of different sizes, three evenly distributed dot matrices are used, and the dot matrices are 16×16, 8×8, and 4×4 in size, respectively, and each point is encoded as a fixed-length feature according to its coordinate position. Finally, the Transformer decoder is used to fuse the image and prompt information to obtain the mask, IoU value, and feature vector of the predicted text corresponding to each prompt point.

[0067] Optionally, the training process of the SAM segmentation model includes:

[0068] Training a SAM basic model based on a first data set to obtain a trained first SAM segmentation model, wherein the first data set includes a first number of synthetic seal images generated by fusing seal images without background interference and real document images;

[0069] The first SAM segmentation model is trained based on a second data set to obtain a trained SAM segmentation model, wherein the second data set includes a second number of real seal images with backgrounds.

[0070] Optionally, when training the SAM segmentation model, firstly, a clean seal image without background interference is fused with a real document image to generate a large number of synthetic seal images as the first data set.

[0071] Optionally, the first number may be any number, which is not limited in the present invention, but it is understandable that the larger the number, the better the training effect.

[0072] Optionally, the SAM basic model can be trained based on the first data set to achieve a fine-tuning effect.

[0073] Optionally, after training with the first data set, a small amount of real printed images with backgrounds can be obtained as the second data set.

[0074] Optionally, the second number may be any number, which is not limited in the present invention, but it is understandable that the second number does not need to be too large.

[0075] Optionally, the fine-tuned SAM segmentation model may be trained based on the second data set to achieve a further fine-tuning effect, and finally obtain a trained SAM segmentation model.

[0076] Optionally, clustering each seal character based on the mask and feature vector of each seal character to obtain at least one character line includes:

[0077] Based on the mask of each seal character, fitting the outer frame corresponding to each seal character;

[0078] Use non-maximum suppression (NMS) to filter repeated characters in each seal character, and retain the characters in the filtered seal characters whose intersection over union (IoU) is higher than a preset value;

[0079] Based on the feature vector of each seal character, the characters with an IoU higher than a preset value are clustered using a mean shift clustering algorithm to obtain the at least one character line.

[0080] Optionally, the feature vectors corresponding to the characters belonging to the same text line are similar, and the characters can be divided into different text lines by clustering the feature vectors.

[0081] Optionally, the step of respectively sorting the characters in the at least one character line according to relative positions comprises:

[0082] Determine a first character in the at least one character line, respectively, the first character being in the same direction as two characters closest to the first character;

[0083] The character that is closest to the previous character is used as the next character after the previous character until all the characters are traversed.

[0084] Optionally, in the same direction refers to in the same direction of the selected text, such as on the left side of the two nearest texts, or the direction angle is less than 90 degrees, etc.

[0085] Optionally, after determining the first character, the character closest to the character is the second character, and then the neighboring characters of the newly added character are traversed in turn until all the characters are traversed, and the sorting is completed.

[0086] Optionally, based on the mask of each seal character, using a Transformer encoder to identify the at least one sorted text line, and outputting a character frame, a character category, and a language of the text line of each seal character, comprises:

[0087] Extracting foreground pixels using the mask of each stamp character;

[0088] Extracting a fixed-length feature vector of the foreground pixel using a single convolutional layer and inputting it into a bidirectional Transformer encoder, fusing the context information of the at least one text line using a multi-head attention mechanism;

[0089] Obtaining the character category, text line language, and text line reading direction of each text output by the bidirectional Transformer encoder;

[0090] Based on the reading direction of the text line, the text order of the at least one text line is adjusted to obtain the character frame, character category and language of each seal character.

[0091] Optionally, a bidirectional Transformer encoder model can be used to recognize text lines. The input sequence length of the network is equal to the number of characters, and the output of the model is the number of input characters plus two, corresponding to the character category of each character, the language of the text line, and the reading direction.

[0092] Specifically, the mask of each seal character is first used to extract the foreground pixels, and then a single convolutional layer is used to extract the fixed-length feature vector of the foreground pixels as the input of the bidirectional Transformer encoder. The encoder fuses the context information through multiple multi-head attention layers, and finally uses a fully connected layer to output the recognition results, including the character category, text line language and reading direction corresponding to each character.

[0093] Optionally, the reading direction can be forward or reverse.

[0094] Optionally, for each text line, the text can be reordered according to its reading direction, and then the character frame, character category and language of each text line are output in sequence.

[0095] The multilingual seal character recognition device provided by the present invention is described below. The multilingual seal character recognition device described below and the multilingual seal character recognition method described above can be referred to each other.

[0096] Figure 2 is a schematic diagram of the structure of the multilingual seal character recognition device 200 provided by the present invention. Figure 2 As shown, the device 200 includes a segmentation module 210, a clustering module 220, a sorting module 230 and an output module 240, wherein:

[0097] The segmentation module 210 is used to segment the target seal image using the SAM segmentation model to obtain a mask and a feature vector of each seal character;

[0098] A clustering module 220, configured to cluster each of the seal characters based on the mask and feature vector of each of the seal characters to obtain at least one character line;

[0099] A sorting module 230, used to sort the characters in the at least one character line according to relative positions;

[0100] The output module 240 is used to identify the at least one sorted text line based on the mask of each seal character by using a Transformer encoder, and output the character frame, character category and language of each seal character.

[0101] The multilingual seal text recognition device provided by the present invention uses the SAM segmentation model to segment the target seal image and obtains text lines through clustering, which can avoid the problem of text line area sticking caused by the close distance between different text lines, making it easier to separate different text lines. By sorting the text lines according to relative positions, the starting and ending positions of the text lines can be distinguished, avoiding errors in text line recognition caused by incorrect reading order. By recognizing the text lines through the Transformer encoder, the features can have stronger semantic expression capabilities, which is helpful to improve the recognition accuracy.

[0102] It can be understood that the multilingual seal character recognition device provided by the present invention corresponds to the multilingual seal character recognition method provided by the above-mentioned embodiments. The relevant technical features of the multilingual seal character recognition device provided by the present invention can refer to the relevant technical features of the multilingual seal character recognition method provided by the above-mentioned embodiments, which will not be repeated here.

[0103] Figure 3 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 3As shown, the electronic device may include: a processor 310, a communication interface 320, a memory 330 and a communication bus 340, wherein the processor 310, the communication interface 320 and the memory 330 communicate with each other through the communication bus 340. The processor 310 may call the logic instructions in the memory 330 to execute the multilingual seal character recognition method, which includes: using the SAM segmentation model to segment the target seal image to obtain the mask and feature vector of each seal character; based on the mask and feature vector of each seal character, clustering each seal character to obtain at least one character line; sorting the characters in the at least one character line according to relative positions; based on the mask of each seal character, using the Transformer encoder to recognize the at least one sorted character line, and outputting the character frame, character category and language of each seal character.

[0104] In addition, the logic instructions in the above-mentioned memory 330 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0105] On the other hand, the present invention also provides a computer program product, which includes a computer program, and the computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the multilingual seal character recognition method provided by the above-mentioned methods, and the method includes: using the SAM segmentation model to segment the target seal image to obtain the mask and feature vector of each seal character; based on the mask and feature vector of each seal character, clustering each seal character to obtain at least one text line; sorting the characters in the at least one text line according to relative positions; based on the mask of each seal character, using a Transformer encoder to identify the at least one sorted text line, and outputting the character frame, character category and language of the text line of each seal character.

[0106] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the multilingual seal character recognition method provided by the above-mentioned methods, the method comprising: using a SAM segmentation model to segment the target seal image to obtain a mask and a feature vector of each seal character; clustering each seal character based on the mask and the feature vector of each seal character to obtain at least one text line; sorting the characters in the at least one text line according to relative positions; based on the mask of each seal character, using a Transformer encoder to identify the at least one sorted text line, and outputting the character frame, character category and language of the text line of each seal character.

[0107] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0108] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0109] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A multilingual seal character recognition method, characterized in that: include: Use the SAM segmentation model to segment the target seal image and obtain the mask and feature vector of each seal character; Based on the mask and feature vector of each seal character, clustering each seal character to obtain at least one character line; sorting the characters in the at least one character line according to relative positions respectively; Based on the mask of each seal character, using a Transformer encoder to identify the at least one sorted character line, and outputting the character frame, character category and language of each seal character line; The method of using the SAM segmentation model to segment the target seal image to obtain the mask and feature vector of each seal character includes: Inputting the RGB three-channel image of the target seal imprint and the corresponding prompt into the trained SAM segmentation model, wherein the corresponding prompt includes three dot arrays evenly distributed on the RGB three-channel image of the target seal imprint; Obtaining the mask and feature vector of each seal character output by the SAM segmentation model; The step of clustering each seal character based on the mask and feature vector of each seal character to obtain at least one character line includes: Based on the mask of each seal character, fitting the outer frame corresponding to each seal character; Use non-maximum suppression (NMS) to filter repeated characters in each seal character, and retain characters in the filtered seal characters whose intersection over union (IoU) is higher than a preset value; Based on the feature vector of each seal character, the characters with an IoU higher than a preset value are clustered using a mean shift clustering algorithm to obtain the at least one character line.

2. The multilingual seal character recognition method according to claim 1, characterized in that: The training process of the SAM segmentation model includes: Training a SAM basic model based on a first data set to obtain a trained first SAM segmentation model, wherein the first data set includes a first number of synthetic seal images generated by fusing seal images without background interference and real document images; The first SAM segmentation model is trained based on a second data set to obtain a trained SAM segmentation model, wherein the second data set includes a second number of real seal images with backgrounds.

3. The multilingual seal character recognition method according to claim 1, characterized in that: The step of respectively sorting the characters in the at least one character line according to relative positions comprises: Determine a first character in the at least one character line, respectively, the first character being in the same direction as two characters closest to the first character; The character that is closest to the previous character is used as the next character after the previous character until all the characters are traversed.

4. The multilingual seal character recognition method according to claim 1, characterized in that: The method of using a Transformer encoder to identify the at least one sorted text line based on the mask of each seal character and outputting a character frame, a character category and a language of the text line of each seal character includes: Extracting foreground pixels using the mask of each stamp character; Extracting a fixed-length feature vector of the foreground pixel using a single convolutional layer and inputting it into a bidirectional Transformer encoder, fusing the context information of the at least one text line using a multi-head attention mechanism; Obtaining the character category, text line language, and text line reading direction of each text output by the bidirectional Transformer encoder; Based on the reading direction of the text line, the text order of the at least one text line is adjusted to obtain the character frame, character category and language of each seal character.

5. A multilingual seal character recognition device corresponding to the multilingual seal character recognition method as claimed in claim 1, characterized in that: include: The segmentation module is used to segment the target seal image using the SAM segmentation model to obtain the mask and feature vector of each seal character; A clustering module, used for clustering each of the seal characters based on the mask and feature vector of each of the seal characters to obtain at least one character line; A sorting module, used for sorting the characters in the at least one character line according to relative positions; The output module is used to identify the at least one sorted text line based on the mask of each seal character by using a Transformer encoder, and output the character frame, character category and language of each seal character.

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, the multilingual seal character recognition method as claimed in any one of claims 1 to 4 is implemented.

7. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the multilingual seal character recognition method as claimed in any one of claims 1 to 4 is implemented.

8. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the multilingual seal character recognition method as claimed in any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • Seal text recognition method, device and equipment and computer readable storage medium

    CN112926511A

  • Stamp character recognition method and device, processor and electronic equipment

    CN115731552A