Lightweight YOLO detector and detection method for ancient characters
By introducing high-frequency channel attention and context space attention modules into the YOLOv8 model, the problem of low recognition accuracy during complex background and damaged objects detection in ancient text detection is solved, and higher detection accuracy and recall rate are achieved.
Patent Information
- Application Number
- CN202510280426.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-11
- Publication Date
- 2025-06-10
AI Technical Summary
The existing YOLO series models have performance bottlenecks in ancient text detection, especially when detecting objects with complex backgrounds, damaged or severe erosion, with low recognition accuracy and difficult to effectively extract the characteristics of ancient text.
The high-frequency channel attention (HFCA) module and the context spatial attention (CASA) module are introduced, combined with the YOLOv8 backbone network, and by extracting high-frequency features and integrating multi-scale context information, the model's ability to extract ancient characters' features and suppress background noise is enhanced.
It significantly improves the accuracy and recall of ancient characters detection, enhances the robustness of the model to complex backgrounds and damaged ancient characters, and can more accurately extract the characteristics of ancient characters and reduce the interference of background noise.
Smart Images

Figure CN120126159A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of computer vision, and particularly relates to a lightweight YOLO detector for ancient characters and a detection method thereof. Background Technique
[0002] YOLO (You Only Look Once) is a typical single-stage object detection algorithm, which is characterized by simultaneously predicting the class and the bounding box position in a single neural network and can perform real-time object detection quickly. The YOLO series (including YOLOv4, YOLOv5, YOLOv8, etc.) has been iterated many times, gradually improving the detection accuracy and efficiency, and becoming one of the current popular object detection methods.
[0003] The success of the YOLO algorithm lies in its high efficiency and real-time performance, especially in detecting simple objects, standard texts or high-contrast backgrounds, where it performs excellently. YOLO extracts features through a convolutional neural network (CNN) and uses a regression model for the bounding box localization and classification of objects. However, these traditional YOLO structures have significant performance bottlenecks in detecting objects in complex backgrounds, damaged or severely eroded objects (such as the detection of ancient characters).
[0004] Ancient character detection is of great significance in ancient book and archaeological research. The purpose is to locate and identify ancient characters from images with complex backgrounds such as stone inscriptions and bamboo slips through artificial intelligence technology. However, due to the passage of time, the glyphs and strokes of many ancient characters are incomplete, and even problems such as erasure and damage have occurred, greatly increasing the difficulty of character detection. Different from modern object detection, ancient characters such as oracle bone inscriptions and pictographs have complex and variable character forms, usually accompanied by severe wear, blur or missing, which makes the standard YOLO model unable to be directly applied.
[0005] The existing technical solutions closest to the present invention are mainly research works on ancient character detection based on YOLO and its variants. The following are several technical solutions closest to the present invention:
[0006] (1) Patent CN117095401A discloses a method for collecting, detecting, and recognizing ancient Chinese character samples based on an optimized deep network. This patent proposes a method for recognizing ancient Chinese characters based on a deep network. By collecting and annotating ancient Chinese character images and performing data augmentation, combined with style transfer technology (CycleGAN) to enhance the dataset. Then, the YOLOv7-Tiny model is used for object detection, and the ancient Chinese characters in the image are recognized through deep neural networks (such as AlexNet, ResNet, etc.). The advantage of this method is that by combining data augmentation and multiple deep network models, the recognition accuracy is improved. This patent mainly uses YOLOv7-Tiny for ancient Chinese character detection. When facing complex backgrounds or partial character missing, the recognition accuracy may decrease, especially in the case of noise or character breakage in the image.
[0007] (2) Patent CN114092700A discloses a method for recognizing ancient Chinese characters based on object detection and knowledge graph. This patent improves the accuracy of ancient Chinese character recognition by combining object detection and knowledge graph reasoning. First, annotate and preprocess ancient Chinese character images to expand the dataset. Then, use the YOLOv4 algorithm to recognize the components in ancient Chinese characters, and further judge the structure of the characters by reasoning the positional relationship of the components. Finally, based on knowledge graph reasoning to improve the accuracy of character classification. This patent relies on complex component position reasoning and knowledge graph construction, which makes its method may not be stable enough when dealing with damaged or missing characters.
[0008] In summary, in the field of ancient Chinese character detection, most of the existing deep learning detection models adopt general object detection methods, such as the YOLO series (including YOLOv5, YOLOv8, etc.) or Faster R-CNN, etc. Although these methods perform well in modern object detection tasks, there are still significant technical defects in the detection of ancient Chinese characters. For example:
[0009] (1) Lack of targeted optimization: As Figure 1 shown, ancient Chinese characters (such as oracle bone inscriptions, pictographs, etc.) are very different from modern texts, and usually have the characteristics of irregularity, damage, and incompleteness. Traditional object detection models (such as YOLO, FasterR-CNN) are not optimized for these characteristics, and they often encounter the following problems when dealing with these special characters:
[0010] ① Blurred character outline: Due to the damage or erosion of the characters themselves, the outlines of many characters are blurred or partially missing. Existing models are difficult to extract effective features of these characters, resulting in low recognition accuracy.
[0011] ②Complex background interference: Ancient characters usually appear in complex backgrounds, such as stone inscriptions, bamboo slips, or pottery. The background noise in archaeological images is relatively large, and the interference of background noise makes character detection more difficult. Existing general object detection algorithms fail to effectively distinguish character regions from the background, resulting in poor detection effects.
[0012] (2) Difficult feature extraction: Ancient characters usually have problems such as missing strokes and irregular glyphs. Due to their diverse forms and high variability, it is often impossible to effectively detect them through the preset feature extraction methods (such as low-frequency features extracted by convolutional neural networks (CNNs)) in traditional deep learning models. Especially in the case of a small sample size, existing models cannot effectively learn the effective shape features of ancient characters, resulting in a decline in detection performance. Summary of the Invention
[0013] The purpose of the present invention is to provide a lightweight YOLO detector and detection method for ancient characters. By introducing a high-frequency channel attention (HFCA), context-based spatial attention (CASA) module, and confidence optimization algorithm (SC-Score), it effectively solves the problems of fragmentation, background noise, and data scarcity in ancient character images, and improves the accuracy and recall rate of ancient character detection.
[0014] Among them, aiming at the problem of decreased recognition accuracy when using YOLOv7-Tiny for ancient character detection in the face of complex backgrounds or missing character parts, the present invention uses YOLOv8 and introduces the HFCA module and CASA module on this basis, which can better capture character features, especially in the cases of character defects and complex backgrounds, and improves the robustness of object detection.
[0015] Among them, aiming at the problem of instability when existing detection methods rely on complex component position reasoning and knowledge graph construction to process damaged or missing characters, the present invention can achieve accurate object detection and character restoration without constructing a knowledge graph, especially suitable for cases where the image is severely damaged. In contrast, through the CASA module and multi-level fusion strategy, the present invention can process complex and damaged images more stably and efficiently, avoiding the complexity of knowledge graph reasoning.
[0016] The technical solutions adopted by the present invention to solve the technical problems are as follows:
[0017] A lightweight YOLO detector for ancient characters provided by the present invention includes the following modules:
[0018] YOLO backbone network: used to extract multi-scale features in ancient character images;
[0019] HFCA module: used to extract high-frequency features in ancient character images and obtain high-frequency representations that focus on the stroke features of ancient characters;
[0020] CASA module: used to integrate multi-scale context information and apply a spatial attention mechanism to highlight regions of interest related to ancient characters, and refine neck features.
[0021] As a preferred implementation, the YOLO backbone network adopts a C2f-Darknet backbone network.
[0022] An ancient character detection method provided by the present invention is implemented by using the described lightweight YOLO detector for ancient characters, and specifically includes the following steps:
[0023] Step S1, construct a lightweight YOLO detector for ancient characters;
[0024] Step S2, use the YOLO backbone network to extract multi-scale features in the input ancient character image;
[0025] Step S3, use the HFCA module to extract high-frequency features in the input ancient character image and obtain a high-frequency representation focusing on the stroke features of ancient characters;
[0026] S3.1: Apply a 3×3 convolutional layer to the input single-channel grayscale image to extract high-frequency features;
[0027] S3.2: Subsequently, splice the extracted high-frequency features with the original image to obtain a spliced high-frequency representation;
[0028] S3.3: Process the spliced high-frequency representation through 1×1 convolution and resizing operations to obtain the final high-frequency representation;
[0029] S3.4: Apply a non-local cross-attention mechanism to calculate the similarity matrix between the features at different stages of the YOLO backbone network and the final high-frequency representation, and obtain a fused feature map through layer normalization processing;
[0030] S3.5: Apply a channel attention mechanism to process the fused feature map to obtain a high-frequency representation focusing on the stroke features of ancient characters;
[0031] Step S4, use the CASA module to highlight regions of interest related to ancient characters by integrating multi-scale context information and applying a spatial attention mechanism;
[0032] S4.1: Fuse feature maps at different scales to generate context information;
[0033] S4.2: Apply global pooling and convolution operations to the context information to obtain context features;
[0034] S4.3: Weight the obtained feature map through a spatial attention mechanism to obtain a weighted feature map;
[0035] S4.4: Output the weighted feature map optimized by the confidence optimization algorithm.
[0036] As a preferred implementation, the mathematical expression of the spliced high-frequency representation is:
[0037] I hf = concat(Conv 3×3 (I), ζ(I)) (1)
[0038] where I hf represents the spliced high-frequency representation, I represents the original image, ζ represents downsampling using an average pooling layer, Conv 3×3 represents a 3×3 convolutional layer, and concat represents the splicing operation.
[0039] As a preferred implementation, the mathematical expression of the final high-frequency representation is:
[0040]
[0041] where represents the final high-frequency representation, bilinear represents the bilinear interpolation operation, and φ represents a 1×1 convolutional layer.
[0042] As a preferred implementation, the calculation process of the non-local cross-attention mechanism is:
[0043]
[0044] where X' represents the fused feature map, LN represents layer normalization, X i represents the feature of the i-th stage of the YOLO backbone network, and g, θ, φ, and μ are all 1×1 convolutional layers; N represents the normalization factor, and its shape is H i ×W i where H i is the height and W i is the width; d i represents the similarity matrix between the feature X i of the i-th stage of the YOLO backbone network and the high-frequency representation ; the superscript T represents the transpose operation.
[0045] As a preferred implementation, the mathematical expression of the high-frequency representation focusing on the stroke features of ancient Chinese characters is:
[0046] X = X' + CA(X') (4)
[0047] Among them, CA represents the non-local cross-attention mechanism, and X represents the high-frequency representation of the output that focuses on the stroke features of ancient characters.
[0048] As a preferred implementation, for the multi-scale feature F at each level i , first aggregate the multi-scale features F from other levels through context awareness j and F k ; through global pooling and convolutional layer fusion processing, generate context-aware features
[0049]
[0050] Among them, ρ represents the global pooling operation, and ConvLayers represents a series of convolutional layers with activation functions.
[0051] As a preferred implementation, the mathematical expression of the context feature is:
[0052]
[0053] Among them, sigmoid represents the S-shaped activation function, ζ represents downsampling using the average pooling layer, Conv represents the convolutional operation, ρ represents the global pooling operation, and F i is the multi-scale feature.
[0054] As a preferred implementation, the mathematical expression of the weighted feature map is:
[0055]
[0056] Among them, represents the context-aware feature, represents the context feature.
[0057] The beneficial effects of the present invention are:
[0058] (1) Improve the detection accuracy of ancient characters: The present invention effectively improves the feature extraction ability of the YOLO-ACD model for ancient characters by introducing the High-Frequency Channel Attention (HFCA) module and the Context-Aware Spatial Attention (CASA) module. The HFCA module uses high-frequency channel information to enhance the performance of the network in processing fragmented and missing-stroke ancient characters, enabling the YOLO-ACD model to more accurately extract the key features of characters. The CASA module further enhances the attention to the target area by focusing on the areas irrelevant to background noise, thereby improving the detection accuracy.
[0059] Among them, the HFCA module enhances the saliency of ancient Chinese characters' strokes by extracting and utilizing high-frequency features, helping the network to more accurately extract and focus on fragmented and blurred character regions. The design of this module not only improves the feature extraction ability but also ensures that missing or damaged character parts can be effectively recognized in low-quality scanned images.
[0060] (2) Ability to cope with background noise interference: Ancient Chinese character images usually have complex and variable backgrounds, and it is difficult for traditional object detection models to effectively distinguish characters from the background. By introducing the CASA module, the present invention can significantly reduce the interference of background noise, improve the focusing ability on character regions during the detection process, and thus improve the robustness in complex backgrounds.
[0061] Among them, the CASA module can dynamically enhance the network's attention to character regions by aggregating multi-scale context information while suppressing the interference of background noise on the model. The CASA module further improves the network's character recognition ability in complex backgrounds through a weighted spatial attention mechanism, ensuring the precise focusing of the model on ancient Chinese character regions.
[0062] (3) Adaptation to the complex and diverse forms of ancient Chinese characters: Ancient Chinese characters have extremely high morphological variability. The present invention effectively solves problems such as irregular shapes and missing strokes of ancient Chinese characters through a specially designed YOLO-ACD model structure and attention mechanism, improving the adaptability and robustness of the YOLO-ACD model on diverse data. Whether in image data such as oracle bone inscriptions and bronze inscriptions, or in highly fragmented character forms such as pictographs, the YOLO-ACD model can effectively perform detection, demonstrating strong cross-dataset generalization ability. Brief Description of the Drawings
[0063] Figure 1 is an ancient Chinese character image, with oracle bone inscriptions above and ancient Egyptian characters below.
[0064] Figure 2 is a flowchart of a method for detecting ancient Chinese characters implemented by a lightweight YOLO detector for ancient Chinese characters provided by the present invention.
[0065] Figure 3 is a specific flowchart of step S3 for extracting high-frequency features from the input ancient Chinese character image using the HFCA module to obtain a high-frequency representation focusing on the stroke features of ancient Chinese characters.
[0066] Figure 4 is a specific flowchart of step S4 for highlighting the region of interest related to ancient Chinese characters by using the CASA module to integrate multi-scale context information and apply a spatial attention mechanism.
[0067] Figure 5It is the attention map of the middle neck layer of the YOLO-ACD model.
[0068] Figure 6 It is the object detection result of the YOLO-ACD model for ancient characters. Specific implementation manners
[0069] The present invention will be further described in detail below with reference to the accompanying drawings.
[0070] In a first aspect, the present invention provides a lightweight YOLO detector for ancient characters.
[0071] A lightweight YOLO detector for ancient characters (YOLO Ancient Character Detection, YOLO-ACD) of the present invention designs multiple innovative modules for the special requirements of the ancient character detection task to improve the detection accuracy and efficiency of ancient characters in complex backgrounds and enhance the detection performance for ancient characters. The YOLO-ACD model selects YOLOv8s (a lightweight version of the YOLO series) as the basic framework because the YOLO series has significant advantages in terms of efficiency and real-time performance, and is particularly suitable for real-time ancient character detection on resource-constrained devices, solving specific problems in ancient character detection, such as stroke adhesion and background noise interference. By adding modules such as High-Frequency Channel Attention (HFCA) and Context-Aware Spatial Attention (CASA), the feature extraction ability and background noise suppression effect are enhanced. At the same time, considering the challenge of fewer data samples, the present invention introduces a confidence optimization algorithm based on spectral clustering (SC-Score) to improve the recall rate and prediction effect of the YOLO-ACD model.
[0072] The YOLO-ACD model designed by the present invention consists of the following main modules:
[0073] YOLO backbone network: mainly used to extract multi-scale features in ancient character images.
[0074] HFCA module: mainly used to enhance the sensitivity of the YOLO-ACD model to the stroke features of ancient characters. By extracting high-frequency features in the input ancient character image through the HFCA module, a high-frequency representation focusing on the stroke features of ancient characters can be obtained. The introduction of the HFCA module helps to solve the problem of detail loss caused by wear or incompleteness during the scanning of ancient characters. By strengthening the attention to high-frequency features, the YOLO-ACD model can better understand the local structure of ancient characters.
[0075] CASA module: mainly used to help the YOLO-ACD model distinguish background noise unrelated to ancient characters. By integrating multi-scale context information through the CASA module and applying a spatial attention mechanism to highlight regions of interest related to ancient characters, the neck features are refined. By introducing context information, the CASA module can effectively reduce the interference of the background, enabling the YOLO-ACD model to focus its attention on the ancient character regions, thereby improving the accuracy and reliability of ancient character detection.
[0076] As a preferred implementation, in the present invention, the YOLO backbone network specifically adopts an efficient C2f-Darknet backbone network (C2f-DarknetBackbone).
[0077] In a second aspect, the present invention provides an ancient character detection method, which is implemented using an ancient character lightweight YOLO detector provided in the first aspect of the present invention.
[0078] The ancient character detection method provided by the present invention has the following specific implementation process:
[0079] Step S1, construct an ancient character lightweight YOLO detector;
[0080] The ancient character lightweight YOLO detector mainly consists of a YOLO backbone network, an HFCA module, and a CASA module.
[0081] Step S2, multi-scale feature extraction;
[0082] Use the YOLO backbone network to extract multi-scale features from the input ancient character image.
[0083] Step S3, use the HFCA module to extract high-frequency features from the input ancient character image and obtain a high-frequency representation focusing on the stroke features of ancient characters.
[0084] The HFCA module is mainly used to guide the YOLO-ACD model to extract more accurate stroke information from high-frequency features to cope with the incompleteness and adhesion phenomena of ancient characters during scanning or wear.
[0085] The HFCA module extracts high-frequency features through a 3×3 convolutional layer and combines a non-local cross-attention mechanism for feature enhancement, thereby enhancing the YOLO-ACD model's ability to recognize the details of ancient characters.
[0086] As Figure 3 shown, its specific implementation process is as follows:
[0087] Step S3.1: Apply a 3×3 convolutional layer to the input single-channel grayscale image to extract high-frequency features;
[0088] Since most rubbings of ancient characters are single-channel grayscale images, a 3×3 convolutional layer is used to extract their two-channel high-frequency features.
[0089] Step S3.2: The extracted high-frequency features are then concatenated with the original image to obtain the concatenated high-frequency representation. This process can be expressed as:
[0090] I hf =concat(Conv 3×3 (I),ζ(I)) (1)
[0091] where, I hf represents the concatenated high-frequency representation, I represents the original image, ζ represents downsampling using the average pooling layer, Conv 3×3 represents the 3×3 convolutional layer, and concat represents the concatenation operation.
[0092] Step S3.3: To match the dimensions of the features at different stages of the YOLO backbone network, the concatenated high-frequency representation I hf is processed through a 1×1 convolution φ and a resizing operation to obtain the final high-frequency representation. This process can be expressed as:
[0093]
[0094] where, represents the final high-frequency representation, bilinear represents the bilinear interpolation operation, and φ represents the 1×1 convolutional layer.
[0095] Step S3.4: Apply the non-local cross-attention mechanism to calculate the similarity matrix between the features at different stages of the YOLO backbone network and the final high-frequency representation, and obtain the fused feature map through layer normalization processing;
[0096] To utilize the high-frequency information to guide the features extracted by the YOLO backbone network, a non-local cross-attention mechanism is used for calculation. The specific calculation process of the non-local cross-attention mechanism can be expressed as:
[0097]
[0098] where, X' represents the fused feature map, LN represents layer normalization, X i represents the feature at the i-th stage of the YOLO backbone network, and g, θ, φ, and μ are all 1×1 convolutional layers; N represents the normalization factor, whose shape is H i ×W i , H i is the height, W i is the width; d i represents the feature X i at the i-th stage of the YOLO backbone network and the high-frequency representation The similarity matrix between; the superscript T represents the transpose operation.
[0099] Different from the original non-local self-attention mechanism, the HFCA module uses high-frequency information to guide the original image features in a non-local cross-attention manner. And the HFCA module also uses layer normalization LN instead of summation to enhance the stability of the training process.
[0100] Step S3.5: Apply the channel attention mechanism to process the fused feature map to obtain a high-frequency representation that focuses on the stroke features of ancient characters. Therefore, the final output of the HFCA module can be expressed as:
[0101] X = X' + CA(X') (4)
[0102] Where, CA represents the non-local cross-attention mechanism, and X represents the high-frequency representation of the output that focuses on the stroke features of ancient characters.
[0103] The present invention improves the extraction accuracy of the YOLO-ACD model for ancient character features by introducing the HFCA module, which is specifically designed for features such as breaks, blurs, and incompleteness of ancient characters. The HFCA module can effectively capture the outlines and details of ancient characters by adaptively focusing on the high-frequency information of ancient characters, especially those fuzzy or partially damaged parts that are difficult to extract in traditional object detection models. This design enables the YOLO-ACD model to accurately extract effective features from complex backgrounds and damaged ancient characters, greatly improving the detection accuracy and avoiding recognition errors caused by damaged or irregular forms of ancient characters.
[0104] In addition, the present invention utilizes the fusion of local and global information in the process of extracting ancient character features. Through the fusion of features at different levels and the enhancement of high-frequency information, the YOLO backbone network can better capture the subtle differences of ancient characters and improve the adaptability to variant forms. Such a feature extraction method enables the model to not only perform excellently in the detection of clear ancient characters but also maintain a high accuracy in the recognition of damaged or blurred ancient characters.
[0105] Step S4: Use the CASA module to refine the neck features by integrating multi-scale context information and applying the spatial attention mechanism to highlight the regions of interest related to ancient characters.
[0106] The goal of the CASA module is to focus on the regions related to ancient characters by introducing multi-scale context information and effectively suppress background interference. The CASA module first extracts context information through multi-scale feature fusion and combines it with the spatial attention mechanism to further emphasize the regions related to ancient characters, thereby improving the detection accuracy.
[0107] Such asFigure 4 As shown below, its specific implementation process is as follows:
[0108] Step S4.1: Fuse feature maps of different scales to generate context information;
[0109] PAN-FPN (Path Aggregation Network - Feature Pyramid Network) is a feature fusion method for object detection tasks, commonly used to improve the detector's ability to recognize multi-scale objects.
[0110] In YOLO-ACD (a lightweight object detection model for ancient character detection), PAN-FPN is mainly used for feature fusion, that is, to establish connections between features at different levels to enhance the model's understanding ability of objects.
[0111] FPN (Feature Pyramid Network) is a multi-scale feature extraction method widely used in object detection. Through its top-down structure, it combines high-level semantic features with low-level spatial information to improve the detection performance of small objects. However, relying solely on FPN still has the problem of limited information transmission. Therefore, YOLO-ACD further introduces PAN (Path Aggregation Network), adding a bottom-up path on the basis of FPN, enabling bottom-level detailed information to effectively flow to high-level features and enhancing the overall feature expression ability.
[0112] In YOLO-ACD, PAN-FPN adopts a three-level architecture and adds an SE-block (Squeeze-and-Excitation module) to the lateral connections to strengthen the attention to key features of ancient characters. Since ancient characters often have problems such as damage, adhesion, and large background noise, simple multi-scale feature fusion may not be able to distinguish the target area well. Therefore, PAN-FPN combines HFCA (High-Frequency Channel Attention) and CASA (Contextual Spatial Attention) modules, enabling the model to more accurately focus on the character area while suppressing background interference and enhancing the robustness of detection.
[0113] This improvement makes the detection performance of YOLO-ACD on the ancient character dataset superior to mainstream object detection models, especially showing significant improvements in recall rate and small object detection ability. Compared with the traditional FPN, PAN-FPN not only enhances the feature extraction ability through a two-way information flow mechanism but also reduces the computational cost, enabling the lightweight model to still achieve high detection accuracy with limited computational resources. In addition, due to PAN-FPN providing richer feature expressions, it can also more effectively utilize existing data in the case of few-shot learning, thus enhancing the generalization ability of the model.
[0114] Specifically, the CASA module mainly consists of two parts, one is context awareness and spatial attention. For each level of multi-scale feature F in PAN-FPN i , its shape is H i ×W i ×C i , where H i is the height, W i is the width, and C i is the number of channels. Context awareness aggregates multi-scale features F j from other levels and F k . These multi-scale features are fused through global pooling and convolutional layers to generate context-aware features This process can be expressed as:
[0115]
[0116] where ρ represents the global pooling operation, and ConvLayers represents a series of convolutional layers with activation functions.
[0117] Step S4.2: Apply global pooling and convolutional operations to the context information to obtain context features; this process can be expressed as:
[0118]
[0119] where sigmoid represents the sigmoid activation function, ζ represents downsampling using an average pooling layer, and Conv represents the convolutional operation.
[0120] Step S4.3: Weight the obtained feature map through the spatial attention mechanism to obtain a weighted feature map, strengthening the regions related to ancient characters. Therefore, the final output of the CASA module can be expressed as:
[0121]
[0122] Step S4.4: Output the weighted feature map optimized by the confidence optimization algorithm (SC-Score) for subsequent detection processes.
[0123] Among them, SC-Score (Spectral Clustering Score) is a confidence optimization algorithm in YOLO-ACD, which mainly optimizes the detection results in the post-processing stage to improve the recall rate. Since the ancient character detection task faces high risks of false detection and missed detection, SC-Score analyzes the similarity between the detection boxes and the ancient character features in the training data through the spectral clustering method, thereby adjusting the confidence to make the detection results more in line with the feature distribution of ancient characters.
[0124] In terms of specific implementation, SC-Score first uses VGG-16 to extract the features of character targets in the training set and calculates their clustering centers to establish a standard feature distribution. In the inference stage, the detected targets will also go through the same feature extraction process and be compared with the clustering centers of the training data. SC-Score divides the detection boxes into two categories, relevant (correct characters) and irrelevant (false detection boxes), through the spectral clustering algorithm, and boosts the confidence of the detection boxes in the relevant category, so that the originally low-confidence but correct detection boxes are not misfiltered, improving the overall recall rate.
[0125] In ancient character detection, ancient character characters often appear in complex backgrounds, such as stone carvings, pottery, the surfaces of ancient cultural relics, etc. These backgrounds often have complex textures, colors, and other noises, bringing great interference to ancient character detection. To solve this problem, the present invention proposes a CASA module, which can combine multi-scale context information to help the YOLO-ACD model focus on the ancient character area when processing features, thereby effectively suppressing the interference of background noise.
[0126] The CASA module can make the model better identify the difference between ancient characters and complex backgrounds by enhancing the attention to the target area, especially in the boundary area between ancient characters and the background. This module combines multi-level attention mechanisms in space and channels, which not only helps to enhance the saliency of the character area, but also can ignore the interference information in the background and enhance the prominence of the ancient character area. Through this innovative design, the ancient character detection ability of the present invention has been significantly improved, and it can maintain high accuracy and stability in the case of more background noise.
[0127] To verify the effect of the present invention, the following experiments were carried out.
[0128] 1. The detection accuracy of the YOLO-ACD model;
[0129] In this experiment, two datasets were used to evaluate the YOLO-ACD model, namely the oracle bone dataset and the pictograph dataset. Through comparison, the YOLO-ACD model showed excellent performance in the average precision (AP) on both datasets.
[0130] On the oracle bone dataset, the average precision (AP) of the YOLO-ACD model reached 46.4%, while on the pictograph dataset, the average precision (AP) was 21.8%. Compared with other mainstream models, the AP of the YOLO-ACD model on the oracle bone dataset was 9.8% higher than that of YOLOv5s, and on the pictograph dataset, the AP was 6.2% higher than that of YOLOv10, demonstrating its efficiency and accuracy in ancient character detection.
[0131] 2. Model Efficiency Analysis;
[0132] The YOLO-ACD model also shows excellent performance in terms of floating-point operations (FLOPs) and the number of parameters (Params). Specifically, the floating-point operation amount of the YOLO-ACD model is 21.5G, and the number of parameters is 12.1M. Compared with other models with the same computational overhead (such as YOLOv10), it can still achieve higher detection accuracy (AP) and recall rate (Recall).
[0133] For example, compared with YOLOv10, the YOLO-ACD model improves the AP by 9.5% and 6.2% on the oracle dataset and the hieroglyph dataset respectively, while only increasing a small amount of computational volume.
[0134] 3. Average Recall Rate (AR);
[0135] The YOLO-ACD model has also achieved a significant improvement in the recall rate (AR). Especially in the case of limited training samples, the SC-Score effectively improves the recall rate of the prediction boxes. For example, the recall rate (AR) of the YOLO-ACD model on the hieroglyph dataset is 4.7% higher than that of the baseline model, proving the effectiveness of the SC-Score in improving the model recall in a limited data scenario.
[0136] The experimental results show that the SC-Score is particularly effective in the case of limited data. Especially on the Egyptian hieroglyph dataset, it significantly improves the recall rate (AR) of the model, making up for the loss of target information that may be caused by traditional NMS. The ablation experiment further verifies the effectiveness of the SC-Score. Compared with the model only containing HFCA and CASA, the YOLO-ACD model with SC-Score added has better detection performance and can more accurately identify damaged or adhered ancient characters. This method improves the confidence reliability of the detection boxes, enabling the YOLO-ACD model to maintain a high detection accuracy even in a low-quality image environment.
[0137] 4. Qualitative Experimental Results of the YOLO-ACD Model;
[0138] The visualization analysis of the results is mainly presented from two aspects: the attention map and the detection results. As Figure 5 shown, the attention map of the middle neck layer of the YOLO-ACD model is displayed. For each group of images, Figure 5The first row shows the original image, the second row presents the attention map of the baseline model (YOLOv8s), and the third row is the attention map of the YOLO-ACD model. It can be observed that the HFCA module and the CASA module effectively guide the YOLO-ACD model to focus on the character regions, enhancing the feature representation ability of the YOLO backbone network. As Figure 6 shown, the detection results of the YOLO-ACD model are presented. Compared with the baseline model, the YOLO-ACD model shows more robust performance in detecting ancient characters, successfully improving the accuracy and robustness of ancient character detection.
[0139] The above are only the preferred embodiments of the present invention. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present invention, several improvements and refinements can be made, and these improvements and refinements should also be regarded as the protection scope of the present invention.
Claims
1. A lightweight YOLO detector for ancient characters, characterized in that: include: YOLO backbone network: used to extract multi-scale features in ancient text images; HFCA module: used to extract high-frequency features in ancient character images and obtain high-frequency representations of ancient character stroke features; CASA module: used to integrate multi-scale contextual information and apply spatial attention mechanism to highlight the regions of interest related to ancient characters and refine the neck features.
2. The ancient character lightweight YOLO detector according to claim 1, characterized in that: The YOLO backbone network adopts the C2f-Darknet backbone network.
3. A method for detecting ancient characters, implemented by using a lightweight YOLO detector for ancient characters as claimed in claim 1 or 2, characterized in that: The following steps are involved: Step S1, constructing a lightweight YOLO detector for ancient characters; Step S2, using the YOLO backbone network to extract multi-scale features in the input ancient text image; Step S3, using the HFCA module to extract high-frequency features in the input ancient character image, and obtain high-frequency representations of the stroke features of the ancient character of interest; S3.1: Apply a 3×3 convolutional layer to the input single-channel grayscale image to extract high-frequency features; S3.2: The extracted high-frequency features are then concatenated with the original image to obtain a concatenated high-frequency representation; S3.3: Process the concatenated high-frequency representation through 1×1 convolution and resizing operations to obtain the final high-frequency representation; S3.4: Apply the non-local cross-attention mechanism to calculate the similarity matrix between the features of different stages of the YOLO backbone network and the final high-frequency representation, and obtain the fused feature map through layer normalization; S3.5: Apply the channel attention mechanism to process the fused feature map to obtain the high-frequency representation of the ancient character stroke features; Step S4, using the CASA module to highlight the regions of interest related to ancient characters by integrating multi-scale contextual information and applying a spatial attention mechanism; S4.1: Fuse feature maps of different scales to generate context information; S4.2: Apply global pooling and convolution operations to the context information to obtain context features; S4.3: weighting the feature map obtained above through the spatial attention mechanism to obtain a weighted feature map; S4.4: Output the weighted feature map optimized by the confidence optimization algorithm.
4. The ancient character detection method according to claim 3, characterized in that: In step S3.2, the mathematical expression of the spliced high frequency representation is: I hf =concatConv 3×3 I,ζI(1) Among them, I hf represents the high-frequency representation after splicing, I represents the original image, ζ represents downsampling using the average pooling layer, Conv 3×3 represents a 3×3 convolutional layer, and concat represents a concatenation operation.
5. The ancient character detection method according to claim 3, characterized in that: In step S3.3, the mathematical expression of the final high-frequency representation is: in, represents the final high-frequency representation, bilinear represents the bilinear interpolation operation, and φ represents a 1×1 convolutional layer.
6. The ancient character detection method according to claim 3, characterized in that: In step S3.4, the calculation process of the non-local cross attention mechanism is: Among them, X' represents the fused feature map, LN represents layer normalization, and X i represents the features of the YOLO backbone network at stage i, g, θ, φ, and μ are all 1×1 convolutional layers; N represents the normalization factor, and its shape is H i ×W i , H i is the height, W i is the width; d i Represents the feature X of the YOLO backbone network at stage i i and high frequency representation The similarity matrix between ; the superscript T indicates the transpose operation.
7. The ancient character detection method according to claim 3, characterized in that: In step S3.5, the mathematical expression of the high frequency representation of the ancient character stroke feature of interest is: X=X'+CAX'(4) Among them, CA represents the non-local cross attention mechanism, and X represents the high-frequency representation of the output attention ancient character stroke features.
8. The ancient character detection method according to claim 3, characterized in that: In step S4.1, for each level of multi-scale feature F i , first aggregate multi-scale features F from other levels through context awareness j and F k ; Generate context-aware features through global pooling and convolutional layer fusion processing Among them, ρ represents the global pooling operation, and ConvLayers represents a series of convolutional layers with activation functions.
9. The ancient character detection method according to claim 3, characterized in that: In step S4.2, the mathematical expression of the context feature is: Among them, sigmoid represents the S-type activation function, ζ represents downsampling using the average pooling layer, Conv represents the convolution operation, ρ represents the global pooling operation, and F i It is a multi-scale feature.
10. The ancient character detection method according to claim 3, characterized in that: In step S4.3, the mathematical expression of the weighted feature map is: in, represents context-aware features, Represents contextual features.
Citation Information
Patent Citations
Ancient character sample collection, detection and identification method based on optimized deep network
CN117095401A