A zero-sample Chinese word recognition method, system, device and storage medium
By combining learnable category encoding and transformer decoder, the problem of dependence on labeled data in existing Chinese single character recognition methods is solved, achieving zero-shot recognition and high-efficiency recognition, and is applicable to mainstream character recognition frameworks.
Patent Information
- Application Number
- CN202210095194.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-26
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2042-01-26
AI Technical Summary
Existing Chinese character recognition methods rely on a large amount of labeled data, which is time-consuming and expensive. Furthermore, component-based decoding methods have long decoding times, and component-based encoding methods cannot be flexibly adjusted.
A learnable category encoding method is adopted, and the structure of Chinese single-character components is decomposed by a depth-first search algorithm. Visual features are extracted by combining the DenseNet121 model, and mapping and matching are performed using fully connected layers and transformer decoders to achieve zero-shot recognition.
It achieves zero-sample Chinese single-character recognition, reduces dependence on labeled data, improves the generalization ability and recognition efficiency of the recognition model, and is applicable to mainstream text recognition frameworks.
Smart Images

Figure CN114529917B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of pattern recognition and artificial intelligence technology, and in particular to a zero-sample Chinese word recognition method, system, device and storage medium. Background Art
[0002] Chinese is one of the oldest written languages in the world, with a history of thousands of years. Research on Chinese character recognition is of great value and significance to the electronic preservation of ancient books and materials. The current Chinese character recognition method mainly relies on a data-driven deep learning method, which requires a large number of training samples to be labeled. However, the number of Chinese categories is huge. According to the standard of GB18030-2005, there are 70,224 Chinese characters. It is difficult and time-consuming to label sufficient data for each Chinese character. In recent years, some related works have tried to solve the above problems by adopting zero-sample recognition methods based on component decoding or component encoding. However, the method based on component decoding requires a long decoding time and post-processing operations, while the method based on component encoding uses artificially designed encoding, which cannot be flexibly adjusted according to different data. Summary of the invention
[0003] In order to solve at least one of the technical problems existing in the prior art to a certain extent, the present invention aims to provide a zero-sample Chinese character recognition method, system, device and storage medium.
[0004] The technical solution adopted by the present invention is:
[0005] A zero-sample Chinese character recognition method comprises the following steps:
[0006] Extract visual features of Chinese character images;
[0007] Perform learnable category coding on Chinese character categories, use a depth-first search algorithm to decompose the component structure of Chinese characters, and calculate the learnable category coding;
[0008] Mapping the category code of the Chinese character into the visual space, based on a mapping module of a fully connected layer, so that the dimension of the category code of the Chinese character is equal to the dimension of the visual space, and constraining the semantic consistency of the category code before and after the mapping by reconstructing a loss function;
[0009] Through the transformer-based decoder, the category encoding of Chinese characters and the visual features of the image are matched, and the features related to the category encoding are obtained from the visual features of the image, and finally the recognition results of Chinese characters are decoded and output.
[0010] Furthermore, the extraction of visual features of Chinese character images includes:
[0011] An image encoder based on a densely connected convolutional neural network is used to extract visual features of the Chinese character image.
[0012] Furthermore, the image encoder uses a DenseNet121 model as a backbone network to extract visual features of the image;
[0013] The backbone network adopts 8-fold downsampling. In order to make the output visual features better match the category coding, the backbone network removes the last output activation layer and global average pooling layer.
[0014] Further, the Chinese character categories are subjected to learnable category coding, a depth-first search algorithm is used to decompose the component structure of the Chinese characters, and learnable category coding is calculated, including:
[0015] According to the Chinese ideographic character sequence dictionary, a component sequence of a decomposed Chinese character is obtained by a depth-first search algorithm, wherein the component sequence is represented as a tree data structure, and depth information and relative position information of each component are obtained; wherein the depth information represents the depth of the component in the tree, and the relative position information represents the position of the component relative to its parent node;
[0016] The corresponding learnable category code of each Chinese character is calculated, and the calculation process is shown in formula (1):
[0017]
[0018] Where i represents a component in the component sequence R, l i It represents the depth information of the component, γ i It represents the relative position information of the component, α and β are learnable parameters, and y i One-hot encoding for components;
[0019] The learned category code is concatenated with the depth information and relative position information of each component in dimension to obtain the final learned category code. The calculation process is shown in formula (2):
[0020]
[0021] in, and It represents the normalized depth information and relative position information. Represents a concatenation operation.
[0022] Furthermore, the mapping module based on the fully connected layer is composed of a fully connected layer; the output elements of the fully connected layer are all obtained by linear operation of the input elements;
[0023] The fully connected layer maps the category code of the Chinese character into the visual space, so as to make the dimension of the category code equal to the dimension of the visual space.
[0024] Furthermore, the reconstruction loss function is used to calculate the mean square error of the category coding before and after mapping, and the calculation process is expressed as shown in formula (3):
[0025]
[0026] Among them, L re is the reconstruction loss function, It represents the category code after mapping, φ(y i ) represents the category code before mapping, b and w T is the transpose of the bias and weights of the fully connected layer, and N is the number of category encodings.
[0027] Furthermore, the specific operations based on the transformer decoder include:
[0028] A multi-head attention mechanism is used to match the category encoding of Chinese characters and the visual features of the image, and features related to the category encoding are obtained from the visual features of the image. The calculation process is shown in formula (4):
[0029] MultiHead(Q,K,V)=Concat(head 1 , ..., head h )W O
[0030] head i =Attention(QW i Q , KW i K , VW i V )
[0031]
[0032] Among them, multi-head attention is implemented by MultiHead(Q, K, V), and attention is calculated by Attention(Q, K, V). Q represents the category code of Chinese characters, K and V represent the visual features of the image, and W i Q , W i K , W iV are all learnable projection matrices, d k It represents the dimensions of Q, K, V, W O Parameters representing multi-head attention;
[0033] After obtaining the features related to the category coding, a feedforward neural network is used to decode the features. The feedforward neural network consists of three fully connected layers and finally outputs the recognition results of Chinese characters. In the feedforward neural network training stage, the cross entropy loss function is used as the optimization target of the network. The expression of the cross entropy loss function is:
[0034]
[0035] where p i is the label probability of category i, q i is the predicted probability of category i, and k is the total number of categories.
[0036] Another technical solution adopted by the present invention is:
[0037] A zero-sample Chinese character recognition system, comprising:
[0038] Feature extraction module, used to extract visual features of Chinese character images;
[0039] The category coding module is used to perform learnable category coding on the categories of Chinese characters, and uses a depth-first search algorithm to decompose the component structure of Chinese characters and calculate the learnable category coding;
[0040] An information mapping module is used to map the category code of the Chinese character into the visual space. The mapping module based on the fully connected layer makes the dimension of the category code of the Chinese character equal to the dimension of the visual space, and constrains the semantic consistency of the category code before and after the mapping by reconstructing the loss function;
[0041] The information matching module is used to match the category coding of Chinese characters and the visual features of the image through a transformer-based decoder, obtain features related to the category coding from the visual features of the image, and finally decode and output the recognition results of Chinese characters.
[0042] Another technical solution adopted by the present invention is:
[0043] A zero-sample Chinese character recognition device, comprising:
[0044] at least one processor;
[0045] at least one memory for storing at least one program;
[0046] When the at least one program is executed by the at least one processor, the at least one processor implements the above method.
[0047] Another technical solution adopted by the present invention is:
[0048] A computer-readable storage medium stores a program executable by a processor, wherein the program executable by the processor is used to execute the method described above when executed by the processor.
[0049] The beneficial effects of the present invention are as follows: the present invention realizes zero-sample Chinese character recognition through a learnable category encoding method, solving the problem that the existing Chinese character recognition method relies on a large amount of labeled data and requires time and money to label the data. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the embodiments of the present invention or the drawings of related technical solutions in the prior art are introduced below. It should be understood that the drawings introduced below are only for the convenience of clearly describing some embodiments of the technical solutions of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0051] Figure 1 It is a flowchart of the steps of a zero-shot Chinese character recognition method based on learnable category coding in an embodiment of the present invention;
[0052] Figure 2 is a schematic diagram of an image encoder according to an embodiment of the present invention;
[0053] Figure 3 is a schematic diagram of a learnable category code in an embodiment of the present invention;
[0054] Figure 4 is a schematic diagram of a mapping module based on a fully connected layer in an embodiment of the present invention;
[0055] Figure 5 It is a schematic diagram of a transformer-based decoder in an embodiment of the present invention. DETAILED DESCRIPTION
[0056] The embodiments of the present invention are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and are not to be construed as limitations of the present invention. For the step numbers in the following embodiments, they are only provided for the convenience of explanation, and the order between the steps is not limited in any way, and the execution order of each step in the embodiment can be adaptively adjusted according to the understanding of those skilled in the art.
[0057] In the description of the present invention, it should be understood that descriptions involving orientations, such as up, down, front, back, left, right, etc., and orientations or positional relationships indicated are based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present invention.
[0058] In the description of the present invention, "several" means one or more, "more" means more than two, "greater than", "less than", "exceed" etc. are understood as not including the number itself, and "above", "below", "within" etc. are understood as including the number itself. If there is a description of "first" or "second", it is only used for the purpose of distinguishing the technical features, and cannot be understood as indicating or implying the relative importance or implicitly indicating the number of the indicated technical features or implicitly indicating the order of the indicated technical features.
[0059] In the description of the present invention, unless otherwise clearly defined, terms such as setting, installing, connecting, etc. should be understood in a broad sense, and technicians in the relevant technical field can reasonably determine the specific meanings of the above terms in the present invention based on the specific content of the technical solution.
[0060] like Figure 1 As shown, this embodiment provides a zero-sample Chinese character recognition method based on learnable category coding, which adopts a zero-sample Chinese character recognition method based on learnable category coding, and replaces the artificial design method with learnable category coding, so that it can be flexibly adjusted according to different data. The method comprises the following steps:
[0061] S1, extracting visual features of Chinese single word images, using an image encoder based on a densely connected convolutional neural network to extract visual features of the Chinese single word images, specifically:
[0062] The DenseNet121 model is used as the backbone network to extract the visual features of Chinese character images, such as Figure 2As shown, the image encoder takes the RGB three-channel image of a single word as input and outputs a visual feature map after being downsampled 8 times. The DenseNet121 model is composed of densely connected blocks and transition modules. In order to make the output visual features better match the category code, the backbone network removes the last output activation layer and global average pooling layer.
[0063] S2. Perform learnable category coding on the Chinese character categories, use a depth-first search algorithm to decompose the component structure of the Chinese characters, and calculate the learnable category coding, specifically:
[0064] First, according to the Chinese ideographic character sequence dictionary, the component sequence of the decomposed Chinese character is obtained through a depth-first search algorithm. The component sequence can be represented as a tree data structure, such as Figure 3 As shown, the depth information and relative position information of each component can also be obtained; the depth information represents the depth of the component in the tree, and the relative position information represents the position of the component relative to its parent node; then the corresponding learnable category code of each Chinese character is calculated, and the calculation process is shown in formula (1):
[0065]
[0066] Where i represents a component in the component sequence R, l i It represents the depth information of the component, γ i It represents the relative position information of the component. α and β are learnable parameters, and their initial values are set to 0.5 and 0.001 respectively. i One-hot encoding of the component.
[0067] By setting the two learnable parameters α and β, the network can continuously adjust the category encoding during the training process so that it can better match the visual features. Finally, the learnable category encoding is concatenated with the depth information and relative position information of each component in dimension to obtain the final learnable category encoding. The calculation process is shown in formula (2):
[0068]
[0069] in and It represents the normalized depth information and relative position information. It represents the concatenation operation. After concatenating the depth information and relative position information, the category code can not only represent the contained component information, but also the depth and relative position of each component, so that the category code can contain richer information and improve the recognition accuracy of the network.
[0070] S3, a mapping module based on a fully connected layer, maps the category code of the Chinese character to the visual space, specifically:
[0071] The mapping module based on the fully connected layer, such as Figure 4 As shown, it consists of a fully connected layer, and its output elements are all obtained by linear operation of the input elements. The mapping module is used to convert the category code to the same dimension as the image visual features, and at the same time fuse the depth information and relative position information. In order to make the semantic consistency of the category code before and after the mapping module, a reconstruction loss function is used for constraint. The method is to calculate the mean square error of the category code before and after the mapping. The calculation process is shown in formula (3):
[0072]
[0073] Where L re is the reconstruction loss function, It represents the category code after mapping, φ(y i ) represents the category code before mapping, b and w T is the transpose of the bias and weights of the fully connected layer.
[0074] S4, using a transformer-based decoder to match the category encoding of Chinese characters and the visual features of the image, decoding and outputting the recognition results of Chinese characters, specifically:
[0075] The transformer-based decoder, such as Figure 5 As shown in Figure 1, a multi-head attention mechanism is used to match the category encoding of Chinese characters and the visual features of the image, and to obtain features related to the category encoding from the visual features of the image. The calculation process is shown in formula (4):
[0076] MultiHead(Q,K,V)=Concat(head 1 , ..., head h )W O
[0077] head i =Attention(QW i Q , KW i K , VW i V )
[0078]
[0079] The multi-head attention is implemented by MultiHead(Q, K, V), and the attention is calculated by Attention(Q, K, V). Q represents the category code of Chinese characters, K and V represent the visual features of the image, and W i Q , W i K , W i V are all learnable projection matrices, d k It indicates the dimensions of Q, K, and V. i Indicates the attention of a certain head. In the calculation of Attention (Q, K, V), Q representing the category code and K representing the image features are matrix-multiplied, which is equivalent to matching the category code and the visual features. Then the attention matrix is calculated through the softmax function, and finally the attention matrix is multiplied with V representing the visual features to obtain the features related to the category code.
[0080] After obtaining the features related to the category coding, a feedforward neural network is used to decode the features. The feedforward neural network consists of three fully connected layers. In addition, residual connections and layer normalization operations are used to finally output the recognition results of Chinese characters. In the network training stage, in order to fit the distribution of network prediction results and true labels, a cross entropy loss function is used as the optimization target of the network. The expression of the cross entropy loss function is shown in formula (5):
[0081]
[0082] where p i is the label probability of category i, q i is the predicted probability of category i, and K is the total number of categories.
[0083] The present invention realizes zero-sample Chinese character recognition through a method of learnable category coding, and the method can adaptively adjust the category coding according to different data. In addition, the implementation process of the present invention is simple and flexible, and can be transplanted into the mainstream text recognition framework. In general, the method provided by the embodiment of the present invention has at least the following beneficial effects compared with the prior art:
[0084] (1) The present invention designs a zero-sample recognition model for Chinese characters, which solves the problem that existing Chinese character recognition methods rely on a large amount of labeled data and require time and money to label data, so that the recognition model has better generalization ability. In addition, the implementation process of the present invention is simple and flexible and can be transplanted into the mainstream text recognition framework.
[0085] (2) The present invention focuses on the zero-shot recognition problem of Chinese characters. Compared with the existing zero-shot Chinese character recognition method, it adopts a learnable category encoding to replace the manually designed method, so that it can be flexibly adjusted according to different data.
[0086] (3) The present invention adopts a transformer-based decoder, which can decode quickly and does not require post-processing operations, so that it can be easily applied in practical scenarios.
[0087] This embodiment also provides a zero-sample Chinese character recognition system, comprising:
[0088] Feature extraction module, used to extract visual features of Chinese character images;
[0089] The category coding module is used to perform learnable category coding on the categories of Chinese characters, and uses a depth-first search algorithm to decompose the component structure of Chinese characters and calculate the learnable category coding;
[0090] An information mapping module is used to map the category code of the Chinese character into the visual space. The mapping module based on the fully connected layer makes the dimension of the category code of the Chinese character equal to the dimension of the visual space, and constrains the semantic consistency of the category code before and after the mapping by reconstructing the loss function;
[0091] The information matching module is used to match the category coding of Chinese characters and the visual features of the image through a transformer-based decoder, obtain features related to the category coding from the visual features of the image, and finally decode and output the recognition results of Chinese characters.
[0092] A zero-sample Chinese character recognition system of this embodiment can execute a zero-sample Chinese character recognition method provided by the method embodiment of the present invention, can execute any combination of implementation steps of the method embodiment, and has the corresponding functions and beneficial effects of the method.
[0093] This embodiment also provides a zero-sample Chinese character recognition device, comprising:
[0094] at least one processor;
[0095] at least one memory for storing at least one program;
[0096] When the at least one program is executed by the at least one processor, the at least one processor implements Figure 1 The method shown.
[0097] A zero-sample Chinese character recognition device of this embodiment can execute a zero-sample Chinese character recognition method provided by the method embodiment of the present invention, can execute any combination of implementation steps of the method embodiment, and has the corresponding functions and beneficial effects of the method.
[0098] The present application also discloses a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device can read the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes Figure 1 The method shown.
[0099] This embodiment also provides a storage medium, which stores instructions or programs that can execute a zero-sample Chinese word recognition method provided by the method embodiment of the present invention. When the instructions or programs are run, any combination of implementation steps of the method embodiment can be executed, and the corresponding functions and beneficial effects of the method can be obtained.
[0100] In some selectable embodiments, the function / operation mentioned in the block diagram may not occur in the order mentioned in the operation diagram. For example, depending on the function / operation involved, the two boxes shown in succession can actually be executed substantially simultaneously or the boxes can sometimes be executed in reverse order. In addition, the embodiment presented and described in the flow chart of the present invention is provided by way of example, for the purpose of providing a more comprehensive understanding of technology. The disclosed method is not limited to the operation and logic flow presented herein. Selectable embodiments are expected, wherein the order of various operations is changed and the sub-operation of a part for which is described as a larger operation is performed independently.
[0101] In addition, although the present invention is described in the context of functional modules, it should be understood that, unless otherwise specified, one or more of the functions and / or features described may be integrated into a single physical device and / or software module, or one or more functions and / or features may be implemented in separate physical devices or software modules. It is also understood that a detailed discussion of the actual implementation of each module is unnecessary for understanding the present invention. More specifically, in view of the properties, functions, and internal relationships of the various functional modules in the device disclosed herein, the actual implementation of the module will be understood within the conventional skills of the engineer. Therefore, those skilled in the art can implement the present invention set forth in the claims without excessive experimentation using ordinary techniques. It is also understood that the specific concepts disclosed are merely illustrative and are not intended to limit the scope of the present invention, which is determined by the full scope of the appended claims and their equivalents.
[0102] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, 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. The computer software product is stored in a storage medium, including several 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 methods 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, etc., which can store program codes.
[0103] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.
[0104] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.
[0105] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, a plurality of steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0106] In the above description of this specification, the description with reference to the terms "one embodiment / example", "another embodiment / example" or "certain embodiments / examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0107] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.
[0108] The above is a specific description of the preferred implementation of the present invention, but the present invention is not limited to the above embodiments. Those skilled in the art may make various equivalent modifications or substitutions without violating the spirit of the present invention. These equivalent modifications or substitutions are all included in the scope defined by the claims of this application.
Claims
1. A zero-sample Chinese character recognition method, characterized in that: The following steps are involved: Extract visual features of Chinese character images; Perform learnable category coding on Chinese character categories, use a depth-first search algorithm to decompose the component structure of Chinese characters, and calculate the learnable category coding; Mapping the category code of the Chinese character into the visual space, based on a mapping module of a fully connected layer, so that the dimension of the category code of the Chinese character is equal to the dimension of the visual space, and constraining the semantic consistency of the category code before and after the mapping by reconstructing a loss function; Through the transformer-based decoder, the category encoding of Chinese characters and the visual features of the image are matched, and the features related to the category encoding are obtained from the visual features of the image, and finally the recognition results of Chinese characters are decoded and output; The method of performing learnable category coding on Chinese character categories, using a depth-first search algorithm to decompose the component structure of Chinese characters, and calculating the learnable category coding, includes: According to the Chinese ideographic character sequence dictionary, a component sequence of a decomposed Chinese character is obtained by a depth-first search algorithm, wherein the component sequence is represented as a tree data structure, and depth information and relative position information of each component are obtained; wherein the depth information represents the depth of the component in the tree, and the relative position information represents the position of the component relative to its parent node; The corresponding learnable category code of each Chinese character is calculated, and the calculation process is shown in formula (1): Where i represents a component in the component sequence R, l i It represents the depth information of the component, γ i It represents the relative position information of the component, α and β are learnable parameters, and y i One-hot encoding for components; The learned category code is concatenated with the depth information and relative position information of each component in dimension to obtain the final learned category code. The calculation process is shown in formula (2): in, and It represents the normalized depth information and relative position information. It represents the splicing operation; The mapping module based on the fully connected layer is composed of a fully connected layer; the output elements of the fully connected layer are all obtained by linear operation of the input elements; The fully connected layer maps the category code of the Chinese character into the visual space, so as to make the dimension of the category code equal to the dimension of the visual space.
2. A zero-sample Chinese character recognition method according to claim 1, characterized in that: The method of extracting visual features of Chinese single-character images comprises: An image encoder based on a densely connected convolutional neural network is used to extract visual features of the Chinese character image.
3. A zero-sample Chinese character recognition method according to claim 2, characterized in that: The image encoder uses the DenseNet121 model as the backbone network to extract the visual features of the image; The backbone network adopts 8-fold downsampling. In order to make the output visual features better match the category coding, the backbone network removes the last output activation layer and global average pooling layer.
4. A zero-sample Chinese character recognition method according to claim 1, characterized in that: The reconstruction loss function is used to calculate the mean square error of the category encoding before and after mapping. The calculation process is shown in formula (3): Among them, L re is the reconstruction loss function, It represents the category code after mapping, φ(y i ) represents the category code before mapping, b and w T is the transpose of the bias and weights of the fully connected layer, and N is the number of category encodings.
5. A zero-sample Chinese character recognition method according to claim 1, characterized in that: The specific operations based on the transformer decoder include: A multi-head attention mechanism is used to match the category encoding of Chinese characters and the visual features of the image, and features related to the category encoding are obtained from the visual features of the image. The calculation process is shown in formula (4): MultiHead(Q,K,V)=Concat(head1,…,head h )W O head i =Attention(QW i Q ,KW i K ,VW i V ) Among them, multi-head attention is implemented by MultiHead(Q,K,V), and attention is calculated by Attention(Q,K,V). Q represents the category code of Chinese characters, K and V represent the visual features of the image, and W i Q , W i K , W i V are all learnable projection matrices, d k It represents the dimensions of Q, K, V, W O Parameters representing multi-head attention; After obtaining the features related to the category coding, a feedforward neural network is used to decode the features. The feedforward neural network consists of three fully connected layers and finally outputs the recognition results of Chinese characters. In the feedforward neural network training stage, the cross entropy loss function is used as the optimization target of the network. The expression of the cross entropy loss function is: where p i is the label probability of category i, q i is the predicted probability of category i, and k is the total number of categories.
6. A zero-sample Chinese character recognition system, characterized in that: include: Feature extraction module, used to extract visual features of Chinese character images; The category coding module is used to perform learnable category coding on the categories of Chinese characters, and uses a depth-first search algorithm to decompose the component structure of Chinese characters and calculate the learnable category coding; An information mapping module is used to map the category code of the Chinese character into the visual space. The mapping module based on the fully connected layer makes the dimension of the category code of the Chinese character equal to the dimension of the visual space, and constrains the semantic consistency of the category code before and after the mapping by reconstructing the loss function; The information matching module is used to match the category coding of Chinese characters and the visual features of the image through a transformer-based decoder, obtain features related to the category coding from the visual features of the image, and finally decode and output the recognition results of Chinese characters; The method of performing learnable category coding on Chinese character categories, using a depth-first search algorithm to decompose the component structure of Chinese characters, and calculating the learnable category coding, includes: According to the Chinese ideographic character sequence dictionary, a component sequence of a decomposed Chinese character is obtained by a depth-first search algorithm, wherein the component sequence is represented as a tree data structure, and depth information and relative position information of each component are obtained; wherein the depth information represents the depth of the component in the tree, and the relative position information represents the position of the component relative to its parent node; The corresponding learnable category code of each Chinese character is calculated, and the calculation process is shown in formula (1): Where i represents a component in the component sequence R, l i It represents the depth information of the component, γ i It represents the relative position information of the component, α and β are learnable parameters, and y i One-hot encoding for components; The learned category code is concatenated with the depth information and relative position information of each component in dimension to obtain the final learned category code. The calculation process is shown in formula (2): in, and It represents the normalized depth information and relative position information. It represents the splicing operation; The mapping module based on the fully connected layer is composed of a fully connected layer; the output elements of the fully connected layer are all obtained by linear operation of the input elements; The fully connected layer maps the category code of the Chinese character into the visual space, so as to make the dimension of the category code equal to the dimension of the visual space.
7. A zero-sample Chinese character recognition device, characterized in that: include: at least one processor; at least one memory for storing at least one program; When the at least one program is executed by the at least one processor, the at least one processor implements the method according to any one of claims 1 to 5.
8. A computer-readable storage medium storing a program executable by a processor, characterized in that: The processor-executable program is used to perform the method according to any one of claims 1 to 5 when executed by the processor.
