Seal analysis method and system, electronic equipment and storage medium

Through the end-to-end seal analysis method of image, the combination of feature extraction, encoding and prediction modules is simplified, the seal recognition process is solved, the problems of resource waste and error accumulation in the existing technology are solved, and the accuracy and efficiency of seal recognition are improved.

CN119131818AInactive Publication Date: 2024-12-13南京中孚信息技术有限公司

Patent Information

Application Number
CN202411629315.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-15
Publication Date
2024-12-13
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing seal recognition technology requires multiple steps and models, resulting in waste of resources and accumulation of errors, and the inability to share image feature matrix and transfer gradient for collaborative learning.

Method used

An end-to-end seal analysis method is proposed. Through the feature extraction module, feature encoding module and prediction module in the pre-constructed analysis model, image feature information, location information and global features are obtained, and feature encoding is used to use matrix fusion and transformer structure for feature encoding. and prediction, simplify detection steps, improve coding efficiency and training speed.

Benefits of technology

It improves the efficiency of feature encoding, simplifies detection steps, reduces error accumulation, and improves the accuracy of identification of seal types, borders and text content.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119131818A_ABST
    Figure CN119131818A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a seal analysis method and system, electronic equipment and a storage medium, and belongs to the field of target detection and text recognition. The method comprises the following steps: acquiring a to-be-analyzed image, inputting the to-be-analyzed image into a feature extraction module in a pre-constructed analysis model, extracting image feature information and feature position information, and outputting a fused feature matrix through matrix fusion; inputting the fusion feature matrix into a feature coding module to obtain global features of the fusion feature matrix; and inputting the global feature and the target feature learning matrix into a prediction module to obtain a seal type, a seal frame and seal text content. Image end-to-end seal analysis is provided, a seal detection task and a seal identification task are constructed into an analysis model, the use efficiency of feature coding can be improved, the capability and training speed of a coding module can be further improved through constraint of two prediction heads on the coding module, and the method is more suitable for popularization and application. And error accumulation caused by a plurality of steps is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of target detection and text recognition, and in particular to a seal analysis method, system, electronic equipment and storage medium. Background Art

[0002] As an important means of traditional authentication and authorization, seals are still widely used in many fields such as finance, government affairs, and contract management. With the rapid development of artificial intelligence and image processing technology, automated and high-precision seal recognition technology has become the key to improving work efficiency and reducing errors and fraud.

[0003] At present, with the development of computing equipment and deep learning, the current mainstream technology of seal analysis technology is the seal recognition method based on deep learning. However, the current technical solution needs to distinguish multiple steps and use multiple models such as seal detection model, text detection model, and text recognition model in turn. In practical applications, these models need to prepare data sets for training separately, which consumes more manpower and computing power; and because the models in each step of the entire recognition process are decoupled from each other, it is impossible to share image feature matrices and transfer gradients for collaborative learning. Summary of the invention

[0004] The purpose of the embodiments of the present invention is to provide a seal analysis method, system, electronic device and storage medium, which are used to completely or at least partially solve the technical problems existing in the above-mentioned prior art.

[0005] In order to achieve the above object, an embodiment of the present invention provides a seal analysis method, comprising: Acquire an image to be analyzed, and input the image to be analyzed into a feature extraction module in a pre-built analysis model, extract image feature information and feature position information of the image to be analyzed, and output a fused feature matrix of the image to be analyzed through matrix fusion; Inputting the fused feature matrix into the feature encoding module in the pre-built analysis model to obtain the global features of the fused feature matrix; The global features and the pre-designed target feature learning matrix are input into the prediction module in the pre-built analysis model to obtain the seal type, seal frame and seal text content, wherein the pre-designed target feature learning matrix is ​​used to ensure that the seal frame, category and text content during decoding and recognition are for the same seal target.

[0006] Optionally, an image to be analyzed is obtained, and the image to be analyzed is input into a feature extraction module in a pre-built analysis model, image feature information and feature position information of the image to be analyzed are extracted, and a fusion feature matrix of the image to be analyzed is output through matrix fusion, including: Obtaining an image pixel matrix of an image to be analyzed, and performing feature extraction on the image pixel matrix through a convolutional network to obtain an image feature matrix; The feature position information of each feature point in the image feature matrix is ​​calculated using position feature coding; The image feature matrix and the feature position information are subjected to feature fusion by using a matrix addition operation to obtain a fused feature matrix.

[0007] Optionally, the feature position information of each feature point in the image feature matrix is ​​calculated according to the following formula:

[0008]

[0009] In the formula, represents even-dimensional encoding, represents odd-dimensional encoding, Indicated in Coordinate values ​​when calculating dimensions, is the feature vector dimension subscript, is the empirical parameter value, represents the sine function, represents the cosine function, is the feature dimension of each feature point in the image feature matrix.

[0010] Optionally, the fused feature matrix is ​​input into a feature encoding module in the pre-built analysis model to obtain global features of the fused feature matrix, including: Convert the fusion feature matrix into sequence features; Encode the sequence features using an encoding module in a transformer structure to obtain a feature encoding matrix, wherein the encoding module is composed of a plurality of encoding submodules stacked in sequence, and each encoding submodule is composed of a multi-head attention mechanism module, an FFN module, and a full link; The feature coding matrix explicitly codes the pixel composition features, position information and global information of the image to be analyzed, so that the prediction module effectively uses the pixel composition features, position information and global information to predict the boundary, category and text content of the seal image.

[0011] Optionally, the prediction module includes a seal detection submodule and a seal recognition submodule, wherein the seal detection submodule is used to predict the seal border and seal type, and the seal recognition submodule is used to recognize the seal text content.

[0012] Optionally, the seal recognition submodule is provided with a multi-layer multi-head self-attention layer, a normalization layer and a residual link layer.

[0013] Optionally, the global features and the pre-designed target feature learning matrix are input into a prediction module in a pre-built analysis model to obtain the seal type, seal border and seal text content, including: The image feature information, feature position information and target feature learning matrix are used as the encoding structure output, position encoding and target query of the decoding structure in the seal detection submodule, and the seal type prediction and seal border prediction results are output; Using the seal recognition submodule to obtain the initial Q matrix, initial K matrix and initial V matrix based on the target feature learning matrix; Based on the initial Q matrix, the initial K matrix and the initial V matrix, multi-head attention calculation is performed and normalized to obtain the feature matrix; The feature matrix is ​​used as the target Q matrix, the fused feature matrix is ​​used as the target K matrix, and the image feature information is used as the target V matrix, and multi-head attention calculation is performed, and a text prediction vector matrix is ​​obtained through residual links and normalization layers; Beam search is used to perform text prediction vector matrix recognition to obtain the seal text content.

[0014] On the other hand, the present invention also provides a seal analysis system, comprising: An information extraction unit is used to obtain an image to be analyzed, and input the image to be analyzed into a feature extraction module in a pre-built analysis model, extract image feature information and feature position information of the image to be analyzed, and output a fused feature matrix of the image to be analyzed through matrix fusion; An information fusion unit, used for inputting the fused feature matrix into a feature encoding module in the pre-built analysis model to obtain global features of the fused feature matrix; The information analysis unit is used to input the global features and the pre-designed target feature learning matrix into the prediction module in the pre-built analysis model to obtain the seal type, seal frame and seal text content, wherein the pre-designed target feature learning matrix is ​​used to ensure that the seal frame, category and text content during decoding and recognition are for the same seal target.

[0015] On the other hand, 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 the processor implements the steps of the above-mentioned transformer management method when executing the program.

[0016] On the other hand, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the transformer management method described above when executed by a processor.

[0017] Through the above technical solution, an end-to-end seal analysis of images is proposed, and the seal detection task and the seal recognition task are constructed into an analysis model. This can not only improve the efficiency of feature coding, but also further improve the capacity and training speed of the encoding module through the constraints of the two prediction heads on the encoding module. Moreover, compared with the existing technology, the detection steps are further simplified, reducing the error accumulation caused by multiple steps.

[0018] Other features and advantages of the embodiments of the present invention will be described in detail in the subsequent detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] The accompanying drawings are used to provide a further understanding of the embodiments of the present invention and constitute a part of the specification. Together with the following specific implementations, they are used to explain the embodiments of the present invention, but do not constitute a limitation on the embodiments of the present invention. In the accompanying drawings: Figure 1 is an implementation flow chart of a seal analysis method provided by an embodiment of the present invention; Figure 2 is a structural schematic diagram of an analysis model provided by an embodiment of the present invention; Figure 3 It is a structural schematic diagram of a seal recognition submodule provided by an embodiment of the present invention; Figure 4 It is a structural schematic diagram of a seal analysis system provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0020] The specific implementation of the embodiment of the present invention is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described here is only used to illustrate and explain the embodiment of the present invention, and is not used to limit the embodiment of the present invention.

[0021] See also Figure 1 FIG. 1 is a flowchart of an implementation of a seal analysis method provided by an embodiment of the present invention, comprising the following execution steps: Step 100: Acquire the image to be analyzed, and input the image to be analyzed into a feature extraction module in a pre-built analysis model, extract image feature information and feature position information of the image to be analyzed, and output a fused feature matrix of the image to be analyzed through matrix fusion.

[0022] Specifically, when executing step 100, the following steps may be specifically performed: S1000: Obtain an image pixel matrix of an image to be analyzed, and perform feature extraction on the image pixel matrix through a convolutional network to obtain an image feature matrix.

[0023] S1001: Calculate the feature position information of each feature point in the image feature matrix using position feature coding.

[0024] Specifically, the feature position information of each feature point in the image feature matrix can be calculated according to the following formula:

[0025]

[0026] In the formula, represents even-dimensional encoding, represents odd-dimensional encoding, Indicated in Coordinate values ​​when calculating dimensions, is the feature vector dimension subscript, is the empirical parameter value, represents the sine function, represents the cosine function, is the feature dimension of each feature point in the image feature matrix.

[0027] S1002: Using a matrix addition operation to perform feature fusion on the image feature matrix and the feature position information to obtain a fused feature matrix.

[0028] In some implementations, the feature extraction module extracts image feature information and feature position information, and then outputs a fused feature matrix of the image through matrix fusion. Specifically, the input image pixel matrix ,in is the image channel data, usually 3, , The image features are extracted through the convolutional network, and then the image feature matrix is ​​obtained. , is the feature dimension of each feature point in the feature matrix, , The length and width of the original image after being downsampled by the convolutional network. The convolutional network can be flexibly selected according to the application scenario. ResNet, HRNet, etc. can be selected for high precision requirements and high computing power of the device; MobileNet, LCNet, etc. can be selected for fast computing speed and low computing power device environment. In order to further reduce the computational complexity, after obtaining the feature matrix through the convolutional network, dimensionality reduction convolution can be performed to reduce the feature dimension . Then use the position feature encoding to calculate the position information of each feature point in the feature matrix. Since the transformer structure input is a serialized feature matrix, the spatial distribution information of the feature points will be lost, which cannot be ignored in image tasks. The texture structure of the seal frame and the text structure information have a strong dependence on the position information. Therefore, the position feature encoding is explicitly constructed to integrate the position information into the feature matrix. Position feature encoding uses sine and cosine functions to encode the odd and even dimensions of each position. No additional parameters are required for learning. The encoding is expressed as a formula:

[0029]

[0030] Unlike the text domain, the image domain has two-dimensional position information, horizontally, from left to right. Axis, vertical direction from top to bottom Axis. Position codes are The calculation is performed in the dimension and then concatenated in the feature dimension. Indicates the coordinate value when calculating in this dimension; Then is the feature vector dimension subscript; is the empirical parameter value, usually 10000. This data is set to a larger number, which can ensure that the position encoding can still maintain good periodicity when the sequence is long, which is beneficial for the model to capture position information. According to the above position encoding formula, in the image Dimensions are calculated separately Dimensional features, after matrix concatenation in the first dimension, form Dimensional features, obtain the position information matrix The matrix dimension is the same as the image feature matrix to facilitate feature fusion. Get the image feature matrix , Position feature encoding, through matrix addition operation, that is, two matrices of the same dimension, sequentially add two elements of the same coordinate position to obtain the fused feature matrix , this matrix contains the image depth feature and position feature information, which will be used as the input data of the feature encoding module.

[0031] Step 101: input the fused feature matrix into the feature encoding module in the pre-built analysis model to obtain the global features of the fused feature matrix.

[0032] Specifically, when executing step 101, the following steps may be specifically performed: S1010: Convert the fused feature matrix into sequence features.

[0033] S1011: Use the encoding module in the transformer structure to encode the sequence features to obtain a feature encoding matrix, wherein the encoding module is composed of a plurality of encoding sub-modules stacked in sequence, and each encoding sub-module is composed of a multi-head attention mechanism module, an FFN module, and a full link.

[0034] S1012: The feature coding matrix explicitly encodes the pixel composition features, position information and global information of the image to be analyzed, so that the prediction module effectively uses the pixel composition features, position information and global information to predict the boundary, category and text content of the seal image.

[0035] It should be noted that the encoding module is constructed using deep convolutional structure and transformer structure.

[0036] In some embodiments, the feature encoding module fuses the feature matrix Compared with the regional calculation of the convolution module, the use of the transformer module for feature encoding can more directly integrate the global features of the image and improve the overall feature extraction ability of the model. Specifically, the fusion feature matrix , converted to sequence features , To The feature length after horizontal splicing of dimensional features, the value is . Convert to sequence features After that, the encoding module in the standard transformer structure is used for encoding. The encoding module is composed of 6 encoding submodules stacked in sequence. A single encoding submodule consists of a multi-head attention mechanism module, a FFN module, and a skip link. After the encoding module, the feature encoding matrix is ​​obtained , the matrix explicitly encodes the pixel composition features, location information, and global information of the image, so that the decoding module can effectively use this information to predict the boundary, category, and text content of the target.

[0037] Step 102: Input the global features and the pre-designed target feature learning matrix into a prediction module in a pre-built analysis model to obtain the seal type, seal border and seal text content.

[0038] The pre-designed target feature learning matrix is ​​used to ensure that the seal border, category, and text content during decoding and recognition are for the same seal target.

[0039] In some embodiments, the prediction module includes a seal detection submodule and a seal recognition submodule, wherein the seal detection submodule is used to predict the seal border and seal type, and the seal recognition submodule is used to recognize the seal text content.

[0040] Among them, the seal recognition submodule is provided with a multi-layer multi-head self-attention layer, a normalization layer and a residual link layer.

[0041] Specifically, when executing step 102, the following steps may be specifically performed: S1020: The image feature information, feature position information and target feature learning matrix are used as the encoding structure output, position encoding and target query of the decoding structure in the seal detection submodule respectively, and the seal type prediction and seal border prediction results are output.

[0042] S1021: Using the seal recognition submodule to obtain an initial Q matrix, an initial K matrix, and an initial V matrix based on the target feature learning matrix.

[0043] S1022: Perform multi-head attention calculation based on the initial Q matrix, the initial K matrix and the initial V matrix and perform normalization processing to obtain a feature matrix.

[0044] S1023: Use the feature matrix as the target Q matrix, the fused feature matrix as the target K matrix, and the image feature information as the target V matrix to perform multi-head attention calculation, and obtain the text prediction vector matrix through residual links and normalization layers.

[0045] S1024: Use beam search to perform text prediction vector matrix recognition to obtain the seal text content.

[0046] It should be noted that in the analysis model, i.e. the decoding module, the transformer structure and the standard fully connected structure FFN are used to construct two prediction branches. Branch one is the seal area and seal target prediction branch, and branch two is the seal text prediction branch. For the specific model structure diagram, see Figure 2 As shown, the image to be analyzed is input into the feature extraction module in the pre-built analysis model, the feature matrix and position feature coding are extracted by using the convolutional network, and the fused feature matrix of the image to be analyzed is output through matrix fusion; the fused feature matrix is ​​input into the feature coding module (i.e., transformer encoder) in the pre-built analysis model to obtain the global features of the fused feature matrix, the global features and the pre-designed target feature learning matrix are input into the prediction module (i.e., transformer decoder) in the pre-built analysis model (including the seal target detection submodule and the seal text prediction submodule), and the seal category, area, seal border and seal text content are obtained through the FFN layer, wherein the pre-designed target feature learning matrix is ​​used to ensure that the seal border, category and text content during decoding and recognition are for the same seal target, Figure 2 middle, Represents a matrix addition operation, that is, two matrices of equal dimension are added together to generate a matrix with exactly the same dimension as before the addition.

[0047] In some embodiments, the prediction module is responsible for the detection of the seal target and the recognition of the text content of the seal target. By designing two prediction head modules, the required image seal analysis results are predicted at one time, which further simplifies the current steps of first performing seal detection and then performing end-to-end seal image recognition. In order to align the seal prediction module with the seal recognition module, a learnable and shared target feature learning matrix is ​​designed. , It is the maximum amount of seal data in the image data. This design is used to ensure that the seal border, category, and text content predicted during decoding and recognition are for the same seal target.

[0048] The seal detection submodule is responsible for seal detection, including predicting the border and seal type of the seal target. The module uses the standard decoding architecture in the Dert model. The input is the feature encoding matrix, the position encoding matrix, and the shared target feature learning matrix, which correspond to the encoding structure output, position encoding, and target query in the standard decoding structure respectively; after the decoding layer is stacked with 6 layers, it passes through the FFN structure, and the module outputs a seal type prediction and a seal border prediction. During model training, the Hungarian matching algorithm is used to calculate the optimal matching prediction, and then the loss is calculated to return the loss to the training model. At the same time, the optimal prediction subscript is determined, and the subscript is used in the seal recognition module to constrain the corresponding prediction branch to predict the seal text content. The seal detection submodule will output n predictions. During the training stage, if an image has only two real labels, the model must calculate the loss before it can perform gradient return and continue to learn. The calculation of the loss requires the calculation of the real seal label and the predicted value. In this case, it is the corresponding calculation between 2 and n. First, find the best match for the first two real seals from these n predictions. Since there are two prediction parts, how to align the seal text prediction and the seal area prediction? Simply put, it is to constrain the i-th seal text prediction module to predict the i-th seal area, so that seal a will not predict the text of seal b. The simplest and most effective constraint is to use the same subscript during training to align the two results.

[0049] The seal recognition submodule is responsible for the seal text content recognition. The input of this module is the feature encoding matrix, the position encoding matrix, and the shared target feature learning matrix. Unlike the seal prediction module, this module outputs a seal content recognition text. After the beam search structure, the seal text content recognition result is obtained. For the specific structure of the seal recognition submodule, see Figure 3As shown in Figure 2, Q, K, V, multi-head self-attention structure, and multi-head attention structure are standard components in the transformer. The normalization operation uses layer normalization. Specifically, the seal recognition module first learns the common target feature matrix With the weight matrix Perform matrix multiplication to obtain , , Matrix, where , The residual link is set for the matrix calculation; then the multi-head self-attention structure is used for feature calculation; due to the multiple calculations of the matrix, the distribution of its values ​​will change with the forward propagation, which may lead to instability in the training process. Therefore, layer normalization and residual link operations are used to make the distribution of each layer input more stable, which helps to accelerate model training; multi-head attention calculation is then performed, and the feature matrix generated in the previous step is used as Matrix, feature encoding matrix , position encoding matrix Generated by matrix addition , feature encoding matrix As Matrix; then superimpose residual links and normalization as the end of multi-head attention calculation; then perform linear layer calculation on the calculation output of the above steps to adjust the scale of the feature vector to meet the prediction matrix dimensions required by texts of different lengths and different dictionaries, and intersperse residual links and normalization in the middle. After this step, the text prediction vector matrix is ​​obtained, and then beam search is used to perform text recognition decoding to obtain the predicted text content.

[0050] See also Figure 4 FIG. 1 is a schematic diagram of a seal analysis system provided by an embodiment of the present invention, comprising: The information extraction unit 40 is used to obtain the image to be analyzed, and input the image to be analyzed into the feature extraction module in the pre-built analysis model, extract the image feature information and feature position information of the image to be analyzed, and output the fused feature matrix of the image to be analyzed through matrix fusion; An information fusion unit 41 is used to input the fused feature matrix into a feature encoding module in the pre-built analysis model to obtain global features of the fused feature matrix; The information analysis unit 42 is used to input the global features and the pre-designed target feature learning matrix into the prediction module in the pre-built analysis model to obtain the seal type, seal frame and seal text content, wherein the pre-designed target feature learning matrix is ​​used to ensure that the seal frame, category, and text content during decoding and recognition are for the same seal target.

[0051] On the other hand, 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 the processor implements the steps of the transformer management method described in any one of the above embodiments when executing the program.

[0052] On the other hand, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the steps of the transformer management method described in any one of the above embodiments are implemented.

[0053] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0054] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0055] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0056] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1The steps for the functions specified in one or more boxes.

[0057] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0058] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0059] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0060] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0061] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.

Claims

1. A seal analysis method, characterized in that: include: Acquire an image to be analyzed, and input the image to be analyzed into a feature extraction module in a pre-built analysis model, extract image feature information and feature position information of the image to be analyzed, and output a fused feature matrix of the image to be analyzed through matrix fusion; Inputting the fused feature matrix into the feature encoding module in the pre-built analysis model to obtain the global features of the fused feature matrix; The global features and the pre-designed target feature learning matrix are input into the prediction module in the pre-built analysis model to obtain the seal type, seal frame and seal text content, wherein the pre-designed target feature learning matrix is ​​used to ensure that the seal frame, category and text content during decoding and recognition are for the same seal target.

2. The seal analysis method according to claim 1, characterized in that: Acquire an image to be analyzed, and input the image to be analyzed into a feature extraction module in a pre-built analysis model, extract image feature information and feature position information of the image to be analyzed, and output a fused feature matrix of the image to be analyzed through matrix fusion, including: Obtaining an image pixel matrix of an image to be analyzed, and performing feature extraction on the image pixel matrix through a convolutional network to obtain an image feature matrix; The feature position information of each feature point in the image feature matrix is ​​calculated using position feature coding; The image feature matrix and the feature position information are subjected to feature fusion by using a matrix addition operation to obtain a fused feature matrix.

3. The seal analysis method according to claim 2, characterized in that: The feature position information of each feature point in the image feature matrix is ​​calculated according to the following formula: In the formula, represents even-dimensional encoding, represents odd-dimensional encoding, Indicated in Coordinate values ​​when calculating dimensions, is the feature vector dimension subscript, is the empirical parameter value, represents the sine function, represents the cosine function, is the feature dimension of each feature point in the image feature matrix.

4. The seal analysis method according to claim 1, characterized in that: Inputting the fused feature matrix into the feature encoding module in the pre-built analysis model to obtain the global features of the fused feature matrix includes: Convert the fusion feature matrix into sequence features; Encode the sequence features using an encoding module in a transformer structure to obtain a feature encoding matrix, wherein the encoding module is composed of a plurality of encoding submodules stacked in sequence, and each encoding submodule is composed of a multi-head attention mechanism module, an FFN module, and a full link; The feature coding matrix explicitly codes the pixel composition features, position information and global information of the image to be analyzed, so that the prediction module effectively uses the pixel composition features, position information and global information to predict the boundary, category and text content of the seal image.

5. The seal analysis method according to claim 1, characterized in that: The prediction module includes a seal detection submodule and a seal recognition submodule, wherein the seal detection submodule is used to predict the seal frame and seal type, and the seal recognition submodule is used to recognize the seal text content.

6. The seal analysis method according to claim 5, characterized in that: The seal recognition submodule is provided with a multi-layer multi-head self-attention layer, a normalization layer and a residual connection layer.

7. The seal analysis method according to claim 6, characterized in that: The global features and the pre-designed target feature learning matrix are input into the prediction module in the pre-built analysis model to obtain the seal type, seal border and seal text content, including: The image feature information, feature position information and target feature learning matrix are used as the encoding structure output, position encoding and target query of the decoding structure in the seal detection submodule, and the seal type prediction and seal border prediction results are output; Using the seal recognition submodule to obtain the initial Q matrix, initial K matrix and initial V matrix based on the target feature learning matrix; Based on the initial Q matrix, the initial K matrix and the initial V matrix, multi-head attention calculation is performed and normalized to obtain the feature matrix; The feature matrix is ​​used as the target Q matrix, the fused feature matrix is ​​used as the target K matrix, and the image feature information is used as the target V matrix, and multi-head attention calculation is performed, and a text prediction vector matrix is ​​obtained through residual links and normalization layers; Beam search is used to perform text prediction vector matrix recognition to obtain the seal text content.

8. A seal analysis system, characterized in that: include: An information extraction unit is used to obtain an image to be analyzed, and input the image to be analyzed into a feature extraction module in a pre-built analysis model, extract image feature information and feature position information of the image to be analyzed, and output a fused feature matrix of the image to be analyzed through matrix fusion; An information fusion unit, used for inputting the fused feature matrix into a feature encoding module in the pre-built analysis model to obtain global features of the fused feature matrix; The information analysis unit is used to input the global features and the pre-designed target feature learning matrix into the prediction module in the pre-built analysis model to obtain the seal type, seal frame and seal text content, wherein the pre-designed target feature learning matrix is ​​used to ensure that the seal frame, category and text content during decoding and recognition are for the same seal target.

9. 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 steps of the seal analysis method according to any one of claims 1 to 7 are implemented.

10. 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 steps of the seal analysis method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Seal identification method, device and equipment and storage medium

    CN115995022A

Cited By

  • Radiology report generation method based on semantic alignment

    CN119517277A