Lightweight ancient Chinese character recognition method and system

CN117456541BActive Publication Date: 2026-09-08HUZHOU UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311519108.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-15
Publication Date
2026-09-08
Estimated Expiration
2043-11-15

AI Technical Summary

Technical Problem

然而,这些经典的网络模型作为通用视觉框架,其参数量和计算量相对较大,特别是DenseNet,其稠密连接的设计方式使得网络的计算复杂度和内存需求进一步增大

Benefits of technology

[0028] This invention cleverly embeds a simple, computationally inexpensive Residual Fusion Block (ResLT Block) between the visual backbone and the classification head as the network's neck, effectively integrating and enhancing features, thereby significantly improving the network's ability and accuracy in recognizing ancient Chinese characters. Compared to methods that directly use general classic network models as the visual backbone, this invention uses three different meta-modules in the early, middle, and late stages of the backbone to perform low-level local feature extraction, intermediate feature interaction and enhancement, and high-level global semantic feature extraction and modeling of ancient Chinese characters. This network backbone design allows the network to learn both local and global features of ancient Chinese characters, while each type of meta-module maintains simplicity and focuses more on extracting a specific type of feature from ancient Chinese characters, thus better improving the accuracy and efficiency of ancient Chinese character recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117456541B_ABST
    Figure CN117456541B_ABST
Patent Text Reader

Abstract

The application discloses a kind of light-weighted ancient Chinese character recognition method and system, wherein method steps include: based on ancient Chinese character features, construct ancient Chinese character recognition network model;Optimize ancient Chinese character recognition network model;Using ancient Chinese character image data, train optimized ancient Chinese character recognition network model;Utilize the trained ancient Chinese character recognition network model to complete the recognition of ancient Chinese character.The application ingeniously embeds a residual fusion module with simple implementation and small parameter quantity and calculation amount between visual backbone and classification head as the network Neck, effectively integrates and enhances features, thereby greatly improving the recognition ability and accuracy of the network to ancient Chinese character.Meanwhile, while maintaining simplicity, the application is more focused on the extraction of certain features of ancient Chinese characters, thereby better improving the accuracy and efficiency of ancient Chinese character recognition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of deep learning character recognition, specifically to a lightweight method and system for recognizing ancient Chinese characters. Background Technology

[0002] Deep learning technology has seen significant development in recent years. Among these, many classic Convolutional Neural Network (CNN) models, such as ResNet, GoogLeNet, and DenseNet, are widely used for ancient Chinese character recognition. However, as general-purpose visual frameworks, these classic network models have relatively large parameter counts and computational demands. DenseNet, in particular, with its densely connected design, further increases computational complexity and memory requirements. This leads to several problems when using these CNNs for ancient Chinese character recognition: First, the high parameter count and computational demands increase the training and inference costs of the model, requiring more computational resources during training and inference. Second, these models exhibit high inference latency on resource-constrained devices. Third, the complex model structure and high memory footprint make deployment difficult on resource-limited devices.

[0003] To address the aforementioned issues, lightweight convolutional neural networks, such as MobileNets and ShuffleNets, have been introduced into the field of ancient Chinese character recognition. While these lightweight networks reduce computational costs to some extent, the reduction in model parameters leads to an overall decrease in ancient Chinese character recognition performance. Furthermore, compared to the currently popular ViT model, CNNs primarily process information through local receptive fields, exhibiting weaker ability to capture global information. Additionally, CNNs are highly sensitive to geometric transformations such as translation and rotation. Therefore, existing methods for ancient Chinese character recognition using both conventional and classic lightweight convolutional neural networks have not achieved a good balance between speed and accuracy.

[0004] Furthermore, most current deep learning-based ancient Chinese character recognition technologies employ softmax-based cross-entropy loss to supervise model training. However, this method has inherent drawbacks. Cross-entropy loss imposes a significant penalty on misclassified samples, which can negatively impact model training if the dataset contains many outliers or mislabeled data. Simultaneously, softmax-based cross-entropy loss is prone to overfitting and is sensitive to class imbalance. Ancient Chinese character recognition involves numerous character types and a large number of characters; therefore, related datasets typically exhibit characteristics such as large data volume, complex data types, data imbalance, and long-tail distribution. Directly using cross-entropy loss to train ancient Chinese character recognition models on such large-scale and complex datasets limits the model's performance on the test set. For example, in ancient Chinese character recognition datasets, the "head" category of characters usually contains a large number of ancient character categories, and the same category of characters includes different writing styles and variations, resulting in relatively complex data types and significant intra-class variability in the head category. The "tail" category of characters, due to its lower usage frequency, makes it difficult to collect a large number of samples. Using the conventional network training method described above, insufficient sample size will prevent the model from accurately learning the features of tail-like Chinese characters.

[0005] Traditional softmax-based loss functions are widely used in image classification tasks. However, the softmax loss function does not explicitly optimize feature embeddings to force higher similarity among intra-class samples and higher diversity among inter-class samples. Since Chinese characters of different types, styles, and background colors all correspond to the same modern simplified character in the recognition results, models trained using softmax-based cross-entropy loss cannot achieve alignment of image features for the same Chinese character, thus affecting the recognition results of ancient Chinese characters. Furthermore, softmax loss requires a large number of labeled training samples. For tasks with few labels, or where a large number of training samples are unavailable, using softmax loss will lead to poor model performance. Therefore, in ancient Chinese character recognition tasks with significant intra-class differences, directly using softmax loss to supervise model training will result in a bottleneck in overall recognition performance, preventing further improvement. Summary of the Invention

[0006] To address the technical problems mentioned above, this invention embeds a simple, computationally inexpensive residual fusion module (ResLT Block) between the visual backbone and the classification head as the network's neck, effectively integrating and enhancing features, thereby greatly improving the network's ability and accuracy in recognizing ancient Chinese characters.

[0007] To achieve the above objectives, this invention provides a lightweight method for recognizing ancient Chinese characters, comprising the following steps:

[0008] Based on the features of ancient Chinese characters, a network model for ancient Chinese character recognition is constructed.

[0009] Optimize the ancient Chinese character recognition network model;

[0010] The optimized ancient Chinese character recognition network model was trained using ancient Chinese character image data.

[0011] The trained ancient Chinese character recognition network model is used to complete the recognition of ancient Chinese characters.

[0012] Preferably, the ancient Chinese character recognition network model includes: a lightweight backbone, a neck network, and a head network.

[0013] Preferably, the first two stages of the lightweight backbone are local feature extraction stages, with multiple FastMix Blocks stacked in each stage after the downsampling layer; the last two stages of the lightweight backbone are global feature extraction stages, with multiple Shift Blocks stacked in each stage after the downsampling layer; finally, an efficient channel attention module is inserted as an independent feature interaction layer between the local and global stages.

[0014] Preferably, the neck network enhances the ability to extract features from the head and tail of Chinese characters to improve overall recognition performance; the neck network also uses ResTL Block to add two independent branches outside the main branch.

[0015] Preferably, the head network uses an MLP layer to classify the extracted 1280-dimensional features, thereby completing the construction of the ancient Chinese character recognition network model.

[0016] Preferably, the method for optimizing the ancient Chinese character network recognition model includes: improving the ancient Chinese character recognition network model by training the network model using an optimized loss-supervised model; simultaneously employing a weighted loss calculation method, by using a joint loss of fusion loss and branch loss, to increase the attention of the ancient Chinese character recognition network model to complex head-type Chinese characters and data-scarce tail-type Chinese characters; and combining conventional data augmentation methods with GridMask-like advanced data augmentation to improve the recognition performance of the ancient Chinese character recognition network model.

[0017] Preferably, the method for training the ancient Chinese character network recognition model includes:

[0018] First, initialize the ancient Chinese character recognition network model;

[0019] The collected ancient Chinese character image data is divided into training and testing sets for training and evaluation of the ancient Chinese character recognition network model.

[0020] When training the ancient Chinese character recognition network model, the hyperparameters are initialized;

[0021] Finally, the performance of the ancient Chinese character recognition network model was evaluated, and the training was completed.

[0022] The present invention also provides a lightweight ancient Chinese character recognition system, the system being used to implement the above method, comprising: a construction module, an optimization module, a training module, and a recognition module;

[0023] The construction module is used to build an ancient Chinese character recognition network model based on the features of ancient Chinese characters;

[0024] The optimization module is used to optimize the ancient Chinese character recognition network model;

[0025] The training module is used to train the optimized ancient Chinese character recognition network model;

[0026] The recognition module is used to recognize ancient Chinese characters using the trained ancient Chinese character recognition network model.

[0027] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0028] This invention cleverly embeds a simple, computationally inexpensive Residual Fusion Block (ResLT Block) between the visual backbone and the classification head as the network's neck, effectively integrating and enhancing features, thereby significantly improving the network's ability and accuracy in recognizing ancient Chinese characters. Compared to methods that directly use general classic network models as the visual backbone, this invention uses three different meta-modules in the early, middle, and late stages of the backbone to perform low-level local feature extraction, intermediate feature interaction and enhancement, and high-level global semantic feature extraction and modeling of ancient Chinese characters. This network backbone design allows the network to learn both local and global features of ancient Chinese characters, while each type of meta-module maintains simplicity and focuses more on extracting a specific type of feature from ancient Chinese characters, thus better improving the accuracy and efficiency of ancient Chinese character recognition. Attached Figure Description

[0029] To more clearly illustrate the technical solution of the present invention, the drawings used in the embodiments are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0030] Figure 1 This is a schematic diagram of the method flow according to an embodiment of the present invention;

[0031] Figure 2 This is a schematic diagram of the FastMix Block structure according to an embodiment of the present invention;

[0032] Figure 3 This is a schematic diagram illustrating the calculation and processing method of feature maps in the MixStyle Module of this invention.

[0033] Figure 4 This is a schematic diagram of the ECA channel attention module according to an embodiment of the present invention;

[0034] Figure 5 This is a detailed structural diagram of the Shift Block according to an embodiment of the present invention;

[0035] Figure 6 This is a schematic diagram illustrating the change in the spatial position of the feature map after a Shift operation in the Shift Block of this embodiment of the invention;

[0036] Figure 7 This is a schematic diagram of the ResLT Block structure according to an embodiment of the present invention;

[0037] Figure 8 This is a schematic diagram of the ancient Chinese character recognition network model according to an embodiment of the present invention;

[0038] Figure 9 This is a schematic diagram showing the performance comparison results of an embodiment of the present invention. Detailed Implementation

[0039] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0040] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0041] like Figure 1 The diagram shown is a schematic representation of the method flow in this embodiment, and the steps include:

[0042] S1. Based on the features of ancient Chinese characters, construct an ancient Chinese character recognition network model (FLENet).

[0043] The network model includes a lightweight backbone, a neck network, and a head network.

[0044] Specifically, a lightweight backbone consisting of four layers is employed. Each layer is preceded by a downsampling layer that spatially downsamples the feature map using a 2D convolution with a kernel of 2 and a stride of 2. The first two layers of the backbone are local feature extraction layers, with multiple FastMix Blocks stacked after the downsampling layer in each layer. The next two layers are global feature extraction layers, with multiple ShiftBlocks stacked after the downsampling layer in each layer. Furthermore, an efficient channel attention (ECA) module is inserted as a separate feature interaction layer between the local and global layers.

[0045] The aforementioned Backbone local feature extraction stage uses Figure 2 The FastMix Block in FasterNet is an improved module that adds a MixStyle Module after the partial convolutions (PConv) of the FasterNet Block. The FasterNetBlock mainly consists of PConv and two PWConvs. An efficient BatchNorm (BN) and ReLU activation function are added between the two PWConvs, and a residual connection is set to reuse input features. Together, they form an inverted residual block, expanding the number of channels in the intermediate layers. The MixStyle Module is inserted between PConv and PWConv as a feature-level data augmentation module. The MixStyle Module is only used during the training phase; it is removed during the testing phase. Figure 3 This describes how the MixStyle Module processes and calculates intermediate feature maps. In the diagram, λ represents instance-specific random weights sampled from the beta distribution; γ... mix β represents the statistical characteristic of a mixture of the means of different sample instances. mix This represents the statistical characteristic of the variance mixture of different sample instances. Using γ... mix and β mix Style blending is performed on the original feature map, which involves data augmentation at the feature level by mixing statistical features between different instances. Specifically, the batch dimension of the original feature map is shuffled, and then the mean and variance of each channel of the feature map are recalculated; μ(f) and σ(f) are the mean and variance of each channel of the feature map, calculated using the following formulas:

[0046]

[0047]

[0048] In the formula, f represents the intermediate feature map; μ(f) is the mean of each channel of the feature map; σ(f) is the standard deviation of each channel of the feature map; H is the height of the feature map; W is the width of the feature map; c is a channel of the feature map; and C is the number of channels of the intermediate feature map.

[0049] PConv applies ordinary convolutions to only a portion of the input channels for spatial feature extraction, leaving the remaining channels unaffected. Compared to ordinary convolutions, PConv reduces redundant computation and memory access, resulting in faster inference speeds and enabling rapid recognition of ancient Chinese characters. The MixStyle Module, a plug-and-play CNN module, requires no parameters or buffers. It normalizes CNN training by perturbing the style information of source domain instances, thereby improving the model's generalization performance in unknown domains. Therefore, in the first two stages of the model, the improved FastMix Block (a version of FasterNetBlock) is used for local feature extraction of ancient Chinese character images. This module, on the one hand, uses the lightweight and efficient FasterNet Block convolution module to reduce model parameters and computational cost, thus reducing the overall inference time of FLENet. On the other hand, by adding a parameterless MixStyle Module to the FasterNet Block, it achieves perturbation and style fusion of the model's feature maps at the feature level, thereby improving the model's generalization performance with a small increase in computation.

[0050] Backbone adds an ECA (Efficient Channel Attention) module after the first two local feature extraction stages. Figure 4 ECA (Electronic Channel Attention) is used for inter-channel feature interaction. It is an extremely concise yet efficient channel attention module that requires only a small number of parameters to achieve significant performance gains. ECA uses one-dimensional convolutions to achieve cross-channel interaction without dimensionality reduction, while adaptively selecting the size of the one-dimensional convolution kernel to determine the coverage of local cross-channel interactions. Cross-channel interaction can significantly reduce model complexity while maintaining performance, avoiding dimensionality reduction, and effectively capturing information interaction between channels. Backbone enhances high-quality features and suppresses low-quality features by inserting the ECA module after the local feature extraction stage.

[0051] To enable the model to learn higher-level semantic features, such as the position and combination relationships of various components in a Chinese character, Backbone stacks Shift Blocks in the latter two global feature extraction stages. Figure 5This method performs global feature extraction and semantic information modeling for ancient Chinese characters. The Shift Block consists of a parameterless Partial Shift operation, Layer Normalization (LN), and two PWConv layers. GELU is used as a non-linear activation function between the two PWConv layers, and feature reuse is achieved through residual connections. The Shift operation in the Shift Block can be viewed as a special token-mixing layer; it contains no parameters or arithmetic calculations, and its only implementation is memory copying. The Shift operation is not only easy to implement but also highly efficient. Assume the input feature map z has a shape of H×W×C, where C is the number of channels, and H and W are the height and width of the feature map. After the Shift operation, the output feature map... The shape is the same as the input (effect as shown) Figure 6 (As shown). The specific execution process of the Shift operation is as follows:

[0052]

[0053]

[0054]

[0055]

[0056]

[0057] The scaling factor γ controls the proportion of channels performing Shift operations. γ is set to... Stacking multiple layers of Shift Blocks in the Backbone global stage serves both to enhance features within the model and to allow the model to indirectly learn the combination relationships between components in a Chinese character.

[0058] Subsequently, the Neck network enhances the feature extraction capabilities of head and tail Chinese characters to improve overall recognition performance; the Neck part uses ResTL Block to add two independent branches outside the main branch to enhance the model's feature extraction capabilities for head and tail ancient Chinese characters.

[0059] like Figure 7As shown, the Neck section is a ResLT Block that uses three 1x1 convolutional groups (GConv) to extract and optimize features for the entire class, head class, and tail class. The first group of parameters is optimized using head class Chinese character training samples, the second group uses all training samples, and the third group uses tail class Chinese character training samples. In this embodiment, the training samples for each Chinese character are sorted in descending order, with the first 2000 characters representing the head class, the last 2000 representing the tail class, and the entire class consisting of the 8105 characters in the "General Standard Chinese Characters Table".

[0060] Finally, the head network is used to classify the multidimensional features of the ancient Chinese character images; the head part uses an MLP layer to classify the 1280-dimensional features extracted by the model, thereby realizing the recognition of ancient Chinese characters.

[0061] Specifically, the Head layer uses an MLP layer to classify the ancient Chinese character image features extracted by the model. First, global average pooling is applied to the feature map output from the Neck layer. Then, the feature map is split into three parts along the channel dimension, with each part having the same number of channels. The three sets of features obtained from the splitting are then stacked along the batch dimension. A convolution operation with a kernel size of 1 is performed on a feature map of size (where B is the batch dimension), reducing the feature map size to (3×B)×1280×1×1. Then, a squeeze operation is performed on the feature map, reducing its size to (3×B)×1280. Finally, a fully connected (FC) layer outputs logits of size (3×B)×num_characters, which are then split into three groups of logits of size (3×B)×num_characters. These three groups of logits represent the final outputs of the three branches of the Neck part after computation by the MLP layer in the Head part. During training, each branch's output corresponds to a loss; during testing, the outputs of the three branches are summed to obtain the final logits, which are then converted into probabilities for each category (modern simplified characters) using a softmax function.

[0062] The above process constructs a complete lightweight ancient Chinese character recognition network model (FLENet), whose overall architecture is as follows: Figure 8 As shown.

[0063] S2. Optimize the ancient Chinese character recognition network model.

[0064] By training with an optimized loss-supervised model, the feature extraction capability of the lightweight ancient Chinese character recognition network can be improved, enhancing its intra-class compactness and inter-class separability. A weighted loss calculation method is employed, using a joint loss combining fusion loss and branch loss to increase the model's attention to complex head-type characters and data-scarce tail-type characters, thus demonstrating a significant advantage in improving the recognition performance of these two types of characters. Furthermore, this embodiment combines conventional data augmentation methods with GridMask-like advanced data augmentation, successfully further improving the ancient Chinese character recognition performance of the FLENet architecture network.

[0065] Specifically, the improved loss (as shown in Equation 6) is obtained by adding the fusion loss (as shown in Equation 4) and the branching loss (as shown in Equation 5), and the weights of these two losses in the total loss are controlled by hyperparameters. Both the fusion loss and the branching loss are calculated using the improved softmax loss (ArcFace) (as shown in Equation 3). Compared with the conventional softmax loss, the improved softmax loss (ArcFace) can enhance the intra-class compactness and inter-class diversity of feature embeddings. By using the comprehensive loss obtained by weighting the fusion loss and the branching loss to supervise the training of FLENet, the differences in recognition performance among various types of Chinese characters can be balanced, thereby further improving the recognition performance of head-class and tail-class Chinese characters without reducing the overall recognition performance. The special data augmentation methods mainly include color jitter, Gaussian blur, and GridMask. Experimental comparisons show that during the training of the FLENet model, compared with using a single data augmentation method, using these three data augmentation methods in combination can further improve FLENet's generalization ability on the ancient Chinese character test set.

[0066]

[0067]

[0068]

[0069]

[0070] In the formula, N represents the batch size of the data input to the network model; i represents a specific sample instance, and is obtained through... Calculate the average loss for all sample instances in a batch of data; The angle between the embedding features of the i-th sample instance output by the FLENet network Head part and the weight parameters of the last layer in the network (FC layer in the network model) represents the class center of the yi-th class. This represents adding the cosine value of the boundary angle of size m to the original angle (the cosine similarity between two vectors). By introducing an angular interval m for the feature distribution of each category, the features of different categories are better separated, thereby improving the model's discriminative ability. and cosθ j represents the logit value of the target category and the logit value of other categories, respectively; s represents the scaling factor, which controls the length of the feature vector. The larger the scaling factor s, the longer the feature vector. This means that the model is more sensitive to the angular differences between different categories and can better distinguish between different categories; n represents the number of predefined Chinese characters (number of categories) participating in the model training; j represents a certain category; e is the base of the natural logarithm, i.e., Euler's number.

[0071] S3. Use ancient Chinese character image data to train and optimize the ancient Chinese character recognition network model.

[0072] By controlling the width and depth of the FLENet architecture, the aforementioned lightweight network is trained using improved joint loss and data augmentation methods. The specific process includes:

[0073] Network initialization: First, the FLENet network is initialized, which includes determining parameters such as the size of the input image, the number of input channels, the number of predefined Chinese characters to be recognized, the initial embedding dimension, the depth of each layer in the local feature extraction stage and the global feature extraction stage, the proportion of partial convolution (PConv) performed in each FastMix Block in the local stage, and the proportion of shift operations performed in each ShiftBlock in the global stage.

[0074] Dataset Partitioning: The collected and organized ancient Chinese character image data is divided into a training set and a test set. The training set is used for training the network model, and the test set is used for testing and evaluating the model. To train the model using the joint loss supervision model proposed in this invention, the training set needs to be partitioned a second time based on the number of predefined recognizable Chinese characters and the sample size of each character in the training set. The characters in the training set are divided into head, middle, and tail classes. In this embodiment, the partitioning criterion is the sample size of each character in the training set. Besides considering the sample size, factors such as the type of Chinese character and the number of variants can also be considered for partitioning. The predefined recognizable Chinese characters are sorted in descending order according to the sample size in the training set. Based on the actual situation, the first M characters are designated as head class characters, and the last N characters as tail class characters.

[0075] Initialization of hyperparameters: During model training, PyTorch 1.12.1 was used to construct the FLENet lightweight ancient character recognition model. The AdamW optimizer and cosine learning rate scheduler were used, and the model was trained for 50 epochs on an Nvidia RXT 3090 GPU. During training, the batch size was set to 256, and the input image size was adjusted to 128×128. The initial learning rate was set to 0.001, the betas value was set to (0.9, 0.999), and the weight decay was 0.01. Simultaneously, to enhance data diversity, three data augmentation techniques were introduced: ColorJitter, GaussianBlur, and GridMask.

[0076] Model Training and Testing: When training the model using the initialization parameters described above, this embodiment requires supervising the model training by applying the joint loss from Formula 6 to the FLENet head output. The head output consists of three logits of size B × num_characters, where B is the batch size and num_characters is the predefined number of Chinese characters to be recognized. The three logits are tensor format data, and in Formula 6, they are respectively used... The method is as follows: When calculating the fusion loss, the three logits are first summed to obtain the final output. Then, the labels are converted to one-hot encoding, and the cross-entropy loss between the two is calculated using Equation 3. When calculating the branch loss, Equation 3 is used to calculate the cross-entropy loss on each of the three branches. The first branch uses all labels, the second branch uses only labels belonging to the head category of Chinese characters, and the third branch uses only labels belonging to the tail category of Chinese characters. Finally, the joint loss obtained by weighting the fusion loss and the branch loss is used for backpropagation to supervise model training.

[0077] Analysis Results: In the final step, this embodiment uses test data to evaluate the model's performance, analyzing its performance by measuring criteria such as recognition accuracy, recognition speed, and model complexity. In the scenario of ancient Chinese character recognition, compared with existing lightweight models, the lightweight ancient Chinese character recognition network model and training method proposed in this invention can not only improve recognition accuracy but also increase recognition speed. Furthermore, the model architecture is simpler and more suitable for real-world applications. Figure 9 The performance of FLENet compared with other lightweight networks on the ancient Chinese character test set is shown.

[0078] S4. Use the trained ancient Chinese character recognition network model to complete the recognition of ancient Chinese characters.

[0079] Example 2

[0080] This embodiment also provides a lightweight ancient Chinese character recognition system, including: a construction module, an optimization module, a training module, and a recognition module; the construction module is used to construct an ancient Chinese character recognition network model based on ancient Chinese character features; the optimization module is used to optimize the ancient Chinese character recognition network model; the training module is used to train the optimized ancient Chinese character recognition network model using ancient Chinese character image data; and the recognition module is used to complete the recognition of ancient Chinese characters using the trained ancient Chinese character recognition network model.

[0081] The embodiments described above are merely preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Various modifications and improvements made to the technical solutions of the present invention by those skilled in the art without departing from the spirit of the present invention should fall within the protection scope defined by the claims of the present invention.

Claims

1. A lightweight method for recognizing ancient Chinese characters, characterized by the following steps: include: Based on the features of ancient Chinese characters, a network model for ancient Chinese character recognition is constructed. The ancient Chinese character recognition network model includes a lightweight backbone, a neck network, and a head network. The lightweight backbone consists of four layers, with a downsampling layer used before each layer to spatially downsample the feature map. The first two layers of the lightweight backbone are local feature extraction layers. After the downsampling layer, each layer has several FastMix Blocks stacked on top of it. The FastMix Block is an improved module that adds a MixStyle Module after the partial convolution PConv of the FasterNetBlock. The FasterNet Block consists of PConv and two PWConvs. An efficient BatchNorm and ReLU activation function are added between the two PWConvs, and a residual connection is set to reuse the input features. The MixStyle Module is inserted between PConv and PWConv as a feature-level data augmentation module. The last two layers of the lightweight backbone are global feature extraction layers. After the downsampling layer, each layer has several Shift Blocks stacked on top of it. The Shift Blocks consist of a parameterless Partial Shift operation and a Layer... The system consists of Normalization and two PWConv layers. GELU is used as a non-linear activation function between the two PWConv layers, and feature reuse is achieved through residual connections. Finally, an efficient channel attention module (ECA) is inserted as an independent feature interaction layer between the local and global stages. The neck network enhances the feature extraction capabilities of head and tail Chinese characters to improve overall recognition performance. The neck network also uses ResTL Blocks to add two independent branches outside the main branch. The ancient Chinese character recognition network model is optimized. The optimization method includes: employing a weighted loss calculation approach, using a joint loss of fusion loss and branch loss to increase the network's attention to complex head-type characters and data-scarce tail-type characters; both fusion loss and branch loss are calculated using an improved softmax loss (ArcFace); simultaneously, color dithering, Gaussian blur, and GridMask-like advanced data augmentation are combined to improve the recognition performance of the ancient Chinese character recognition network model. The optimized ancient Chinese character recognition network model was trained using ancient Chinese character image data. The trained ancient Chinese character recognition network model is used to complete the recognition of ancient Chinese characters.

2. The lightweight ancient Chinese character recognition method according to claim 1, characterized in that, The head network uses an MLP layer to classify the extracted 1280-dimensional features, thereby completing the construction of the ancient Chinese character recognition network model.

3. The lightweight ancient Chinese character recognition method according to claim 1, characterized in that, The method for training the ancient Chinese character network recognition model includes: First, initialize the ancient Chinese character recognition network model; The collected ancient Chinese character image data is divided into training and testing sets for training and evaluation of the ancient Chinese character recognition network model. When training the ancient Chinese character recognition network model, the hyperparameters are initialized; Finally, the performance of the ancient Chinese character recognition network model was evaluated, and the training was completed.

4. A lightweight ancient Chinese character recognition system, said system being used to implement the lightweight ancient Chinese character recognition method according to any one of claims 1-3, characterized in that, include: The module consists of a construction module, an optimization module, a training module, and a recognition module. The construction module is used to build an ancient Chinese character recognition network model based on the features of ancient Chinese characters; The optimization module is used to optimize the ancient Chinese character recognition network model; The training module is used to train the optimized ancient Chinese character recognition network model using ancient Chinese character image data. The recognition module is used to recognize ancient Chinese characters using the trained ancient Chinese character recognition network model.