Automatic oracle annotation method, system and equipment for digital literature

By employing character classification and differential recognition strategies, combined with adaptive layout analysis and a lightweight model, the problem of automatic annotation of documents containing mixed oracle bone script and Chinese characters has been solved, achieving efficient and accurate automatic annotation of oracle bone script, suitable for low-computing-power environments.

CN121708595APending Publication Date: 2026-03-20TONGFANG KNOWLEDGE DIGITAL PUBLISHING TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511835848.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-08
Publication Date
2026-03-20

AI Technical Summary

Technical Problem

Existing technologies cannot effectively handle the automatic recognition and annotation of documents with mixed oracle bone script and Chinese characters. General OCR technology is ineffective, and the scarcity of professional data and high computing power costs limit the application of automatic annotation of oracle bone script.

Method used

By employing character classification and differential recognition strategies, combined with adaptive layout direction analysis, multi-level progressive noise reduction, table line filtering, and dynamic parameter adjustment, and using lightweight model design and ONNX inference optimization technology, automatic annotation of Oracle characters is achieved.

Benefits of technology

It significantly improves the recognition accuracy of mixed oracle bone script documents, reduces the dependence on computing resources, ensures the stability and accuracy of annotation, generates structured annotation files, and provides a reliable foundation for academic retrieval.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121708595A_ABST
    Figure CN121708595A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of digital image processing and ancient text information processing, particularly relates to an automatic oracle annotation method, system and equipment for digital literatures, and aims to solve the problem of automatic identification and annotation of oracle and Chinese character mixed literatures. The method comprises the following steps: receiving a document image, and obtaining respective coordinate areas of a plurality of characters in the image; obtaining each character image according to the coordinate area, and classifying the character images into an oracle character type or a non-oracle character type; performing differentiation recognition based on a classification result, determining codes of the oracle characters by adopting an image matching model, and determining texts of the non-oracle characters by adopting a character recognition model; and finally, associating an identification result with the coordinate region to generate a structured annotation file. According to the method, the technical bottlenecks of failure of a general OCR (Optical Character Recognition) technology, poor adaptability of a complex format and high computing power dependence are solved, and high-precision and automatic labeling of the oracle in the mixed literature in a low computing power environment is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of digital image processing and ancient script information processing technology, and specifically relates to an automatic annotation method, system and device for oracle bone script in digital documents. Background Technology

[0002] Oracle bone script, as an early form of Chinese characters and a treasure of Chinese civilization, is crucial for cultural preservation and academic exploration through digital research. With the advancement of the digitization of ancient books, a large number of research documents and rubbings containing oracle bone script have been converted into digital images. However, how to automatically and accurately locate and identify oracle bone script from this massive and complex image data, and generate structured data that can be retrieved by computers, has become a key challenge facing the interdisciplinary field of paleography and artificial intelligence.

[0003] Current technologies face several bottlenecks: First, general-purpose optical character recognition (OCR) technology is completely ineffective. Mainstream OCR engines are designed for modern, standardized Chinese characters, and their models cannot handle the archaic and structurally varied oracle bone script. When processing documents containing a mix of Chinese characters and oracle bone script, this often leads to missed or severely misidentified oracle bone script characters. Second, existing text detection models have poor adaptability. General-purpose row and column detection algorithms struggle to handle the dense vertical layouts common in ancient texts, and the varying sizes and flexible layouts of oracle bone script characters frequently result in location failures. Finally, the scarcity of specialized data and the high computational costs create a contradiction. Training high-precision oracle bone script-specific models requires large-scale labeled data, but acquiring such data is extremely costly; while existing large-scale models, though powerful, are limited in their application in ordinary research environments due to their high training and deployment costs.

[0004] Therefore, there is an urgent need in this field for an innovative solution that can efficiently and accurately complete the automatic annotation of oracle bone script in digital documents under low computing power conditions. Summary of the Invention

[0005] To address the aforementioned problems in existing technologies, namely the challenge of automatic identification and annotation of documents containing a mixture of oracle bone script and Chinese characters, this invention provides a method, system, and device for automatic annotation of oracle bone script in digital documents.

[0006] In a first aspect, this invention proposes an automatic annotation method for oracle bone inscriptions in digital documents, the method comprising:

[0007] Receive a document image containing oracle bone script characters and non-oracle bone script characters, perform character detection on the document image to obtain the coordinate regions of each of the multiple characters in the image;

[0008] Based on the coordinate region, each character image is obtained from the document image, and the character images are classified to determine whether the character type of each character image is oracle bone script or non-oracle bone script.

[0009] Differential recognition is performed on the character image based on the character type: if the character type is oracle bone script, the corresponding character image is input into a preset image matching model to determine its oracle bone script encoding in the target character library; if the character type is not oracle bone script, the corresponding character image is input into a preset character recognition model to determine its corresponding text character.

[0010] The identified oracle bone script codes and text characters are associated with their coordinate regions in the document image to generate a structured annotation file.

[0011] Furthermore, prior to the character detection, the method further includes:

[0012] The document image is preprocessed, including: determining the text layout direction of the document based on morphological operations and contour analysis; and performing progressive noise suppression using a hierarchical cascaded processing mode, wherein the progressive noise suppression includes using median filtering to process impulse interference, using morphological opening operations to process discrete noise, and using connected component analysis to process non-character regions.

[0013] Furthermore, the preprocessing also includes table line filtering, which includes:

[0014] Construct probe-shaped rectangular structural elements to perform linear feature detection in the horizontal and vertical directions;

[0015] The detection results in the horizontal and vertical directions are subjected to pixel-level logical OR operations to be integrated into a table line binary mask.

[0016] And perform a difference operation on the binary image of the document image and the binary mask of the table lines to remove the table line region.

[0017] Furthermore, the character detection includes:

[0018] Based on the quality assessment results of the document image and the text layout direction, the hyperparameters of the Gaussian smoothing kernel and morphological structural element size required for character detection are dynamically calibrated.

[0019] Based on the text layout direction, a morphological processing strategy is configured to perform a directional morphological closing operation on the binary image after adaptive thresholding to construct row-level or column-level candidate regions.

[0020] Furthermore, within each candidate region, the precise boundary of a single character is located by analyzing the pixel density projection curve perpendicular to the layout direction, in order to obtain the initial character coordinate region.

[0021] Furthermore, after obtaining the coordinate region, the method further includes:

[0022] The initial character coordinate region is serialized, and the process includes: establishing an initial sequence using a two-level sorting strategy; reconstructing the sorted coordinate region into text lines or text columns through spatial location clustering; and performing a merging process on the coordinate region to merge multiple fragmented coordinate regions belonging to the same character to generate a normalized character sequence.

[0023] Furthermore, the merging process includes:

[0024] In the subject recognition stage, potential fragmented characters are locked based on width thresholds and height constraints, and edge noise is eliminated by combining vertical boundary detection; and in the neighborhood evaluation stage, the candidate boxes of the potential fragmented characters are bidirectionally measured. The measurement comprehensively considers spatial distance, size matching and position verification. When the measurement result meets the preset merging conditions, the candidate boxes are merged.

[0025] Furthermore, the process of establishing the initial sequence using the secondary sorting strategy also includes:

[0026] An adaptive threshold based on the dynamic average value of the text box size is constructed to group text lines or text columns; and during the grouping process, punctuation marks are identified based on multi-dimensional features, and when updating the center position of the group using the weighted average method, the calculation is performed only based on the coordinate region of non-punctuation marks.

[0027] Furthermore, the classification of character images includes:

[0028] A trained deep learning classification model is converted into an ONNX inference model optimized for dynamic batch input; and operator fusion is performed on the continuous computation operations in the inference model based on the ONNX Runtime optimization tool to generate a lightweight classifier; finally, the lightweight classifier is used to classify the character images acquired in batches according to the coordinate region.

[0029] In a second aspect, this invention proposes an automatic annotation system for oracle bone inscriptions in digital documents, comprising:

[0030] The character region acquisition module is configured to receive a document image containing oracle bone script characters and non-oracle bone script characters, perform character detection on the document image, and obtain the coordinate regions of each of the multiple characters in the image.

[0031] The classification module is configured to acquire each character image from the document image according to the coordinate region, and classify the character images to determine whether the character type of each character image is oracle bone script or non-oracle bone script.

[0032] The recognition module is configured to perform differential recognition on the character image based on the character type: if the character type is oracle bone script, the corresponding character image is input into a preset image matching model to determine its oracle bone script encoding in the target character library; if the character type is not oracle bone script, the corresponding character image is input into a preset character recognition model to determine its corresponding text character.

[0033] The annotation module is configured to associate the identified oracle bone script codes and text characters with their coordinate regions in the document image to generate a structured annotation file.

[0034] In a third aspect, the present invention provides an electronic device comprising a processor and a memory, wherein the memory stores a computer program, and the processor, when executing the computer program, implements the method described in the first aspect.

[0035] The beneficial effects of this invention are:

[0036] This invention effectively solves the fundamental problem that general OCR technology cannot handle oracle bone script and causes serious misrecognition in mixed texts by introducing character classification and differentiated recognition strategies. This solution can simultaneously handle two completely different character systems, significantly improving the overall recognition accuracy of documents containing mixed Chinese characters and oracle bone script, and expanding the application boundaries of automated annotation technology.

[0037] This invention employs a series of preprocessing steps, including adaptive layout direction analysis, multi-level progressive noise reduction, table line filtering, and dynamic parameter adjustment, to effectively address complex issues commonly found in ancient texts, such as vertical layout, character overlap, background noise, stains, and image degradation. This ensures that subsequent character detection and recognition modules receive higher-quality input, thereby guaranteeing high stability and accuracy throughout the entire process when handling real and diverse digital documents.

[0038] This invention significantly reduces the system's dependence on computing resources by employing a lightweight model design and combining inference optimization technologies such as ONNX. This enables high-precision automatic Oracle character annotation technology to be efficiently deployed and run in low-computing-power environments such as ordinary servers or personal computers, solving the pain point of high computing costs and difficulty in widespread application of large models, and greatly improving the economics of the technology and its practical application value in scientific research and teaching institutions.

[0039] This invention, through intelligent merging and secondary sorting post-processing mechanisms, effectively repairs character fragmentation caused by image degradation or scanning problems, and ensures that the output character sequence strictly conforms to the reading order of the original document (whether horizontal or vertical). The final generated structured annotation file not only contains accurate recognition results but also precisely associates the coordinate information of each character, resulting in high data integrity and providing a reliable and convenient foundation for subsequent academic retrieval, corpus construction, and data analysis. Attached Figure Description

[0040] Other features, objects, and advantages of this application will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings:

[0041] Figure 1 This is a flowchart illustrating an automatic annotation method for oracle bone script in digital documents according to the present invention.

[0042] Figure 2 This is a schematic diagram of the character detection process of an automatic annotation method for oracle bone script in digital documents according to the present invention;

[0043] Figure 3 This is a schematic diagram of the serialization process of an automatic annotation method for oracle bone script in digital documents according to the present invention.

[0044] Figure 4 This is a schematic diagram of the structure of an automatic annotation system for oracle bone script in digital documents according to the present invention;

[0045] Figure 5 This is a schematic diagram of the structure of a computer system used to implement the methods, systems, and electronic devices of this application. Detailed Implementation

[0046] The present application will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the invention. Furthermore, it should be noted that, for ease of description, only the parts relevant to the invention are shown in the accompanying drawings.

[0047] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.

[0048] The first embodiment of this invention proposes an automatic annotation method for oracle bone inscriptions in digital documents, the method comprising:

[0049] Step S10: Receive a document image containing oracle bone script characters and non-oracle bone script characters, perform character detection on the document image to obtain the coordinate regions of each of the multiple characters in the image;

[0050] Step S20: Obtain each character image from the document image according to the coordinate region, and classify the character images to determine whether the character type of each character image is oracle bone script or non-oracle bone script.

[0051] Step S30: Perform differential recognition on the character image based on the character type: if the character type is oracle bone script, input the corresponding character image into a preset image matching model to determine its oracle bone script encoding in the target character library; if the character type is not oracle bone script, input the corresponding character image into a preset character recognition model to determine its corresponding text character.

[0052] Step S40: Associate the identified oracle bone script codes and text characters with their coordinate regions in the document image to generate a structured annotation file.

[0053] To more clearly explain an automatic annotation method for oracle bone inscriptions in digital documents, the following section will combine... Figure 1 The steps in the embodiments of the present invention are described in detail below:

[0054] Step S10: Receive a document image containing oracle bone script characters and non-oracle bone script characters, perform character detection on the document image to obtain the coordinate regions of each of the multiple characters in the image;

[0055] In this embodiment, before the character detection, the method further includes:

[0056] The document image is preprocessed, including: determining the text layout direction of the document based on morphological operations and contour analysis; and performing progressive noise suppression using a hierarchical cascaded processing mode, wherein the progressive noise suppression includes using median filtering to process impulse interference, using morphological opening operations to process discrete noise, and using connected component analysis to process non-character regions.

[0057] The preprocessing also includes table line filtering, which includes:

[0058] Construct probe-shaped rectangular structural elements to perform linear feature detection in the horizontal and vertical directions;

[0059] The detection results in the horizontal and vertical directions are subjected to pixel-level logical OR operations to be integrated into a table line binary mask.

[0060] And perform a difference operation on the binary image of the document image and the binary mask of the table lines to remove the table line region.

[0061] In practical implementation, this method first analyzes the layout orientation of the document image. The purpose of this step is to accurately determine the main layout orientation of the text in the document, i.e., horizontal or vertical layout. To achieve this, the system can first use, for example, the OTSU adaptive thresholding segmentation algorithm, combined with Gaussian filtering, to convert the original grayscale document image into a binary image.

[0062] Based on binary images, a method combining morphological operations and contour analysis is used to extract multi-scale structural features from the images. Furthermore, the system quantifies the spatial distribution characteristics of the extracted contour features, constructing an index system for evaluating the connectivity of text regions. By analyzing this index system, such as evaluating the differences in the horizontal and vertical extensibility of connected text regions, the main layout orientation of the text can be scientifically and accurately determined. This morphological and topological feature-based analysis method can effectively adapt to documents from different periods and with different writing styles, and can cope with image degradation caused by age or poor scanning quality, ensuring the accuracy and robustness of layout orientation recognition.

[0063] After determining the layout orientation, or in parallel with it, this method performs progressive noise suppression on the document image to obtain a clean image background. This process employs a hierarchical cascaded processing mode, with dedicated cleanup stages designed for different types and dimensions of noise. While efficiently removing interference, it maximizes the preservation of the morphological integrity and topological structure of the text region. Specifically, this three-level processing mechanism progresses step by step. In the first level, the non-linear smoothing characteristics of median filtering are utilized to effectively suppress the widespread salt-and-pepper noise and impulse interference in the image. In the intermediate level, morphological opening operations are used to eliminate discrete noise points smaller than the width of character strokes, such as the fibrous texture patterns or isolated non-character ink dots commonly found in old document backgrounds. In the final level, the system uses connected component analysis to accurately identify and filter candidate regions by evaluating the area, aspect ratio, and other topological properties of each connected region, thereby effectively filtering out non-character regions such as large areas of dirt. Through this three-level processing, various types of noise can be systematically suppressed, resulting in a clear text image.

[0064] Furthermore, to address potential table line interference in document images, the preprocessing step includes an optional morphological topology-aware table line filtering step. This method first constructs probe-shaped rectangular structural elements with a large aspect ratio, designed to perform linear feature detection in both the horizontal and vertical directions, enabling sensitive capture of straight lines in the image. After completing the horizontal and vertical detections, the detection results in both directions are subjected to a pixel-level logical OR operation, integrating all detected horizontal and vertical lines into a complete binary table line mask. Finally, the original binary image and the generated table line mask are subtracted, i.e., the pixel area covered by the mask is subtracted from the original binary image. This operation accurately removes table line regions from document images, and because it is based on linear feature detection, it effectively avoids damaging text strokes adjacent to or intersecting with table lines, providing a clean and interference-free background environment for subsequent character segmentation.

[0065] See Figure 2 In this embodiment, the character detection includes:

[0066] Step S11: Based on the quality assessment results of the document image and the text layout direction, dynamically calibrate the hyperparameters of the Gaussian smoothing kernel and morphological structural element size required for character detection;

[0067] Step S12: Configure morphological processing strategy according to the text layout direction, perform directional morphological closing operation on the binary image after adaptive thresholding, and construct row-level or column-level candidate regions.

[0068] Step S13 involves locating the precise boundary of a single character within each candidate region by analyzing the pixel density projection curve perpendicular to the layout direction, thereby obtaining the initial character coordinate region.

[0069] In one specific embodiment of this application, immediately following the image preprocessing step, the method performs a character detection process, namely step S10. Its core objective is to accurately locate each individual character, including both oracle bone script characters and non-oracle bone script characters, from the preprocessed document image and obtain their respective coordinate regions. This character detection process does not employ a fixed set of parameters and strategies, but rather uses a series of dynamically adaptive steps to ensure high accuracy and robustness when processing document images of different qualities and formats, as detailed below.

[0070] The first step in this process, step S11, is dynamic parameter calibration. Instead of blindly processing the image, the system first performs a quality assessment of the pre-processed document image. This assessment comprehensively considers key factors such as image resolution, the average thickness of character strokes after preprocessing, and the statistical size characteristics of the character set. Based on these assessment results, and combined with the document text layout direction (horizontal or vertical) identified in the preprocessing stage, the system can establish a mapping relationship between image features and morphological processing effects. Accordingly, the system dynamically calibrates key hyperparameters in the character detection algorithm. Specifically, this includes, but is not limited to, the kernel function size and variance parameters used for subsequent Gaussian smoothing operations, and the specific size of the morphological structural elements used to construct text rows / columns. For example, for images with large character sizes and high resolution, the system will adapt a relatively large morphological structural element to ensure effective connection of character components; conversely, for images with dense characters and small sizes, a smaller structural element will be selected to avoid erroneous adhesion between different characters. This dynamic calibration step ensures that the parameters used in subsequent processing are optimal for the specific image, thereby significantly improving the adaptability of the detection.

[0071] After obtaining the hyperparameters tailored to the current image, the process proceeds to the second step, S12, which involves constructing row-level or column-level candidate regions. The goal of this step is to organize discrete individual characters in the image into text rows or columns that conform to reading logic. The system first applies an adaptive thresholding method, such as OTSU or local adaptive thresholding, to the grayscale image, and combines this with the Gaussian smoothing parameters calibrated in the previous step to generate a binary image that clearly preserves the character edge structure. Crucially, the system dynamically configures subsequent morphological processing strategies based on the known text layout direction. If the text layout direction is vertical, the system uses a vertically oriented (i.e., height greater than width) morphological structuring element to perform a directional morphological closing operation on the binary image. This operation effectively connects discrete characters within the same text column vertically, forming one or more continuous column-level connected components, i.e., column-level candidate regions. Similarly, if the text layout direction is horizontal, a horizontally oriented (i.e., width greater than height) structuring element is used to perform a closing operation, thereby connecting characters within the same row into row-level candidate regions. Through this directional adaptive strategy, the system can accurately aggregate loose characters into structured text lines or text columns.

[0072] The third step in the process, step S13, involves precisely locating individual characters within the constructed row / column-level candidate regions. For each candidate region, whether row or column, the system analyzes its pixel density projection perpendicular to the layout direction. Specifically, for a vertical column-level candidate region, the system accumulates and projects its pixel values ​​horizontally, generating a one-dimensional pixel density projection curve. On this curve, the character entity corresponds to a peak, while the natural gaps between characters correspond to troughs. By detecting and locating these obvious trough positions, the horizontal separation boundaries between adjacent characters can be determined. Similarly, for a horizontal row-level candidate region, the system projects pixels vertically, locating the vertical separation boundaries of characters by finding the troughs of the projection curve. Combining the boundary information of the candidate regions themselves, the system can calculate the precise bounding rectangle for each character, thus obtaining an initial set of coordinate regions containing all individual characters in the image. This provides the most basic and accurate location data for subsequent recognition and annotation work.

[0073] See Figure 3 In this embodiment, after obtaining the coordinate region, the method further includes:

[0074] The initial character coordinate region is serialized, and the process includes: establishing an initial sequence using a two-level sorting strategy; reconstructing the sorted coordinate region into text lines or text columns through spatial location clustering; and performing a merging process on the coordinate region to merge multiple fragmented coordinate regions belonging to the same character to generate a normalized character sequence.

[0075] In a preferred embodiment, after obtaining the initial set of coordinate regions containing all possible characters in the image through step S13, the coordinate regions in this set are still in a disordered and potentially fragmented state. To establish an accurate character sequence that conforms to the original document format and human reading habits, the method further includes performing serialization processing on these initial character coordinate regions. This processing aims to reconstruct discrete, potentially incomplete character boxes into ordered, complete, and structured text lines or text columns, specifically including the following steps:

[0076] A preliminary sorting based on a two-level sorting strategy is performed on all initial character coordinate regions to establish an initial linear sequence. This sorting strategy is not simply based on a single coordinate axis, but is closely integrated with the previously determined text layout orientation. Specifically, if the layout orientation is vertical, the system uses the X-coordinate of the center point of all coordinate regions as the primary sorting key for ascending (or descending according to the specific right-to-left convention), and the Y-coordinate as the secondary sorting key for ascending. This ensures that the algorithm starts processing from the first column and proceeds from top to bottom within each column. Conversely, if the layout orientation is horizontal, the Y-coordinate is used as the primary sorting key (ascending), and the X-coordinate as the secondary sorting key (ascending), conforming to the reading order from top to bottom and from left to right. Through this two-level sorting, the originally chaotic character coordinate regions are arranged into an initial sequence that roughly conforms to the reading flow.

[0077] By clustering based on spatial location, the linearly ordered coordinate regions described above are reconstructed into structured text lines or columns. This step aims to address sorting biases caused by slight character misalignment and uneven row / column spacing. The system traverses the sorted coordinate region sequence and checks the coordinate differences between adjacent characters in the main sorting direction based on the typesetting orientation. For example, in vertical typesetting, the system checks the difference in the X-coordinates of the center points of two adjacent characters in the sequence. If this difference is less than a predetermined threshold dynamically set based on the average character width, the two characters are considered to belong to the same text column; if the difference exceeds the threshold, it marks the beginning of a new text column. In this way, the system can segment and recombine the initial one-dimensional sequence into multiple groups, each corresponding to an actual text line or column in the document. This not only makes the structure of the character sequence clearer but also limits the scope of the subsequent merging process.

[0078] Finally, the system performs a merging process on the coordinate regions within each constructed text line or column. This step is specifically designed to address the problem of single complex Chinese characters (especially loosely structured oracle bone script characters) being incorrectly segmented into multiple independent coordinate regions (i.e., fragmented coordinate regions) during initial detection. For adjacent coordinate regions within each text line / column, the system determines whether they belong to the same character based on a series of geometric constraints. These constraints may include: 1) whether the overlap or proximity of the two regions in the secondary sorting direction is sufficiently high; 2) whether the two regions are closely aligned in the primary sorting direction; and 3) whether the size (especially the aspect ratio) of the new bounding rectangle formed after merging them is within a reasonable character size range.

[0079] When all preset conditions are met, the system merges the two or more fragmented coordinate regions into a single, complete bounding rectangle. For example, two small coordinate regions representing the left radical and right body of a character are merged into a large coordinate region that completely encloses the character. Through this merging process, a normalized character sequence is ultimately generated, in which each sequence element (coordinate region) accurately corresponds to a complete character, and all characters are organized according to their row and column structure in the original text, laying a solid foundation for subsequent advanced processing such as character recognition.

[0080] In this embodiment, the merging process includes:

[0081] In the subject recognition stage, potential fragmented characters are locked based on width thresholds and height constraints, and edge noise is eliminated by combining vertical boundary detection; and in the neighborhood evaluation stage, the candidate boxes of the potential fragmented characters are bidirectionally measured. The measurement comprehensively considers spatial distance, size matching and position verification. When the measurement result meets the preset merging conditions, the candidate boxes are merged.

[0082] This step aims to correct individual characters that were incorrectly segmented into multiple independent regions during the initial detection phase due to broken strokes or complex character structures. This merging process is implemented through a two-stage, refined decision-making process, ensuring the integrity of the final generated character sequence.

[0083] In this embodiment, the first stage of the process is the subject recognition stage, the core task of which is to quickly and accurately filter out candidate boxes that are highly likely to be part of a split character from the initially ordered sequence of character coordinate regions. The system first dynamically sets a width threshold based on the size statistics of all characters in the current text line or column; for example, this threshold can be set as a percentage of the median character width. The system traverses each coordinate region in the sequence. If it finds that the width is significantly smaller than this dynamic width threshold, while its height is still within a reasonable range of normal character heights, i.e., it meets the preset height constraint, then the coordinate region will be locked by the system and marked as a potential split character. This height constraint effectively avoids misjudging very narrow punctuation marks such as dashes as split characters. Furthermore, to further improve the accuracy of recognition and eliminate interference from document edge artifacts or residual noise, this stage also incorporates a vertical boundary detection mechanism. The system will determine whether the locked narrow box is close to the left and right boundaries of the entire text block. If its position is in the edge area, it is likely to be noise rather than a character component. The system will therefore reduce its confidence as a candidate box or exclude it directly, thus effectively avoiding the incorrect handling of edge noise.

[0084] After completing subject identification and locking all potential fragmented character candidate boxes, the process enters the neighborhood evaluation phase. The goal of this phase is to find the correct belonging for each candidate box, i.e., to determine whether it should be merged with its immediate neighbors in the sequence. To this end, the system performs a bidirectional metric for each candidate box, meaning it evaluates the merging probability of the candidate box with both its previous and next neighbors. This metric is a comprehensive evaluation process that considers three core dimensions: spatial distance, size matching, and position verification. Regarding spatial distance, the system calculates the gap between the candidate box and its neighbors; only when this distance is less than a preset threshold for close proximity (significantly smaller than normal character spacing) is the candidate considered potentially merging.

[0085] Regarding size matching, the system compares the heights of two regions; two parts belonging to the same character should have similar heights. For position verification, the system focuses on evaluating the alignment of the two regions based on the known text layout direction. For example, for characters split horizontally, the system checks whether their vertical center lines are basically aligned. When the results of these multi-dimensional measurements collectively meet a preset merging condition—such as spatial distance, size difference, and positional deviation all being less than their respective thresholds—the system ultimately determines that the two candidate boxes do indeed belong to the same split character. At this point, the system performs a merging operation on these two candidate boxes. Specifically, it calculates the smallest bounding rectangle that can completely enclose both regions simultaneously and replaces the two original, fragmented regions in the data sequence with this newly generated, complete coordinate region, thus completing a successful character repair.

[0086] In this embodiment, the process of establishing the initial sequence using the secondary sorting strategy also includes:

[0087] An adaptive threshold based on the dynamic average value of the text box size is constructed to group text lines or text columns; and during the grouping process, punctuation marks are identified based on multi-dimensional features, and when updating the center position of the group using the weighted average method, the calculation is performed only based on the coordinate region of non-punctuation marks.

[0088] In this embodiment, the secondary sorting strategy integrates an adaptive threshold and group center update mechanism during the initial sequence establishment process to achieve robust and accurate dynamic grouping of character coordinate regions. The core of this mechanism lies in its ability to effectively handle complex situations such as varying character sizes, changes in line or column spacing, and punctuation interference in documents, thereby accurately aggregating discrete character coordinate regions into text lines or columns that conform to reading logic.

[0089] Specifically, to achieve effective grouping of text lines or columns, the system first constructs an adaptive threshold based on the dynamic average of the text box sizes. When processing a sequence of text boxes, the system does not use a globally fixed distance threshold to determine whether a character belongs to the row or column of the previous character. Instead, as grouping progresses, it dynamically calculates the average size of all characters already included in the current group. This dynamic average, particularly the average character height for horizontal layouts or the average character width for vertical layouts, is used as a benchmark to generate an adaptive distance threshold.

[0090] For example, in a horizontally formatted scenario, suppose the system has identified the first character in a line with a height of 50 pixels and a center Y-coordinate of 100. At this point, the average character height within the group is 50 pixels. If the preset threshold generation coefficient is 0.5, the adaptive threshold is calculated as 50 pixels multiplied by 0.5, which is 25 pixels. This threshold determines how far the center coordinate of the next character to be processed can deviate from the current group center. When the system evaluates the next character, if its center Y-coordinate is 105, its vertical distance from the current group center of 100 is 5 pixels, far less than the adaptive threshold of 25 pixels. Therefore, this character is successfully placed in the current line. Subsequently, the average character height of the group is updated to the average of the two characters, i.e., the average of 50 pixels and the new character height. The group's center Y-coordinate is also updated to the average of 100 and 105, i.e., 102.5. The system will use these updated values ​​to calculate a new adaptive threshold and use it to determine subsequent characters. This adaptive strategy allows the grouping process to tolerate slight bends in rows or columns and uneven spacing, greatly improving the accuracy and robustness of the grouping.

[0091] During the grouping process, a special processing logic for punctuation marks was invented to prevent them from interfering with the group's main axis. The system identifies punctuation marks in real time based on multi-dimensional features, including but not limited to the fact that the size of the coordinate region is much smaller than the average size of the characters in the current group, as well as their unique aspect ratio and relative position. This identification result plays a crucial role when updating the center position of the group using a weighted average method. When a new character is determined to belong to the current group, the system needs to update the center coordinates of that group as the basis for subsequent judgments. At this time, if the newly added character is identified as a punctuation mark, the system will calculate the weighted average only based on the coordinate regions of all non-punctuation marks within the group. In this way, although the punctuation mark is correctly assigned to its corresponding text line or column, its coordinates deviating from the main axis do not affect the update of the group's center position, thus ensuring that the group's center line is always determined by the main text and avoiding incorrect grouping of subsequent characters due to punctuation mark position disturbances.

[0092] Step S20: Obtain each character image from the document image according to the coordinate region, and classify the character images to determine whether the character type of each character image is oracle bone script or non-oracle bone script.

[0093] Specifically, the classification of character images includes:

[0094] Step S21: Convert a trained deep learning classification model into an ONNX inference model optimized for dynamic batch input.

[0095] Step S22: Based on the ONNX Runtime optimization tool, perform operator fusion on the continuous computation operations in the inference model to generate a lightweight classifier;

[0096] Step S23: Use the lightweight classifier to classify the character images acquired in batches according to the coordinate region.

[0097] In one embodiment of this application, after the system completes the coordinate localization and serialization of all characters in the document image, the process proceeds to step S20. In this step, the system first accurately obtains the image of each character from the original document image based on the coordinate region output in the previous stage, and then classifies these character images to determine whether each character is of the oracle bone script type or a non-oracle bone script type. This classification result is a key prerequisite for achieving subsequent differentiated and high-precision semantic annotation.

[0098] In this embodiment, the system uses a pre-trained deep learning classification model as its foundation, trained using mainstream frameworks such as PyTorch. To achieve efficient and flexible deployment in computationally limited environments, the trained model first needs to be converted. The system exports this model to the Open Neural Network Exchange (ONNX) format. A key optimization during the conversion process is the specific configuration for dynamic batch input. Specifically, the system sets the batch dimension of the model input tensor to be dynamic. This configuration allows the final generated ONNX inference model to no longer be limited to a fixed batch size, but to flexibly accept and process any number of character image batches, thus perfectly adapting to real-world application scenarios with varying character counts in different documents.

[0099] After obtaining an ONNX model that supports dynamic batch processing, the system utilizes the ONNXRuntime optimization tool to perform deep optimization on the model to further improve inference performance. The core optimization method is operator fusion. This process analyzes the structure of the model's computation graph and automatically identifies consecutive computational operations that can be merged. For example, a consecutive computational sequence in the original model consisting of operations such as convolution, batch normalization, and activation functions can be merged into a single, highly optimized composite operator after operator fusion. This significantly reduces the number of times the computational core is launched and the memory read / write overhead of intermediate data during model inference. After this step, the original ONNX model is transformed into a more computationally efficient version, namely the lightweight classifier described in this invention. Here, lightweight primarily refers to its lower latency and less resource consumption during inference.

[0100] Finally, the system performs the actual classification task. First, based on the character coordinates obtained in the initial stage of step S20, the system batch-crops all character images from the original document image and constructs them into a batch of data. Then, the system calls the ONNX Runtime inference engine to load and execute the lightweight classifier generated in step S22. Since the model has been optimized for dynamic batches, all character images in the batch can be processed at once. The classifier performs forward propagation calculations on each input character image and outputs the prediction result of whether it belongs to the Oracle Bone Script character type or a non-Oracle Bone Script character type. The entire process benefits from the performance improvement brought by model transformation and operator fusion, enabling fast and accurate classification of all characters in the entire document even on ordinary computing devices without high-performance graphics processing units.

[0101] Step S30: Perform differential recognition on the character image based on the character type: if the character type is oracle bone script, input the corresponding character image into a preset image matching model to determine its oracle bone script encoding in the target character library; if the character type is not oracle bone script, input the corresponding character image into a preset character recognition model to determine its corresponding text character.

[0102] In one embodiment of this application, after all character images have been classified, the process proceeds to step S30, which involves performing differential recognition on the character images based on the character type. This step is the core of the entire annotation process; it employs the optimal recognition path for different types of text to ensure the accuracy of the final annotation result.

[0103] Specifically, this differential recognition process splits the character image into two different processing channels based on the classification results output from the previous stage:

[0104] If the character type of a character image is determined to be oracle bone script, the system inputs the character image into a pre-defined image matching model. In this embodiment, this model is not a simple classifier, but a specialized model built based on deep metric learning. It can map the input oracle bone script character image into a high-dimensional feature space and calculate the similarity between its feature vector and the pre-extracted feature vectors of all standard oracle bone script characters in the target character set. By finding the match with the highest similarity, the model can ultimately determine the unique oracle bone script encoding corresponding to the character image in the target character set. This image matching-based method is highly robust to the unique glyph variations and stroke incompleteness inherent in oracle bone script.

[0105] Correspondingly, if the character type of a character image is determined to be non-oracle bone script, the system adopts a different strategy. It first checks whether the adjacent characters in the original text are also non-oracle bone script, based on the text detection sequence generated in the previous steps. If so, the system merges these consecutive non-oracle bone script character images in the reading order to form an image fragment containing words or longer text. This merged image fragment is then input into a pre-trained OCR recognition model. The model performs overall recognition of the entire image fragment and finally outputs its corresponding text character sequence. By merging before recognition, the powerful contextual association capabilities of the OCR model can be fully utilized, significantly improving the recognition speed and accuracy of regular text and effectively avoiding recognition errors caused by blurry or similar individual characters.

[0106] Step S40: Associate the identified oracle bone script codes and text characters with their coordinate regions in the document image to generate a structured annotation file.

[0107] After the differentiation identification process is completed, the method of this application embodiment enters the final result integration and structured output stage. In this stage, the system accurately associates the oracle bone script codes and non-oracle bone script text characters obtained after parallel processing in the previous steps with their corresponding coordinate region information in the original document image, and finally generates a machine-readable structured annotation file.

[0108] Specifically, the result integration module in this embodiment is responsible for performing this task. This module processes each recognition unit one by one according to the character appearance order established in the text detection and serialization stage, which conforms to human reading habits. For each unit, the system creates a data record that aggregates information from different processing stages. A complete record not only contains the final recognized content, i.e., the oracle bone script code or text character, but also necessarily the precise bounding box coordinates of the character in the original image, such as its x and y coordinates, width and height, the character type it was judged to be, i.e., oracle bone script or non-oracle bone script, and its appearance order in the entire document.

[0109] The final annotated file preferably uses a standardized data format, such as JSON or XML, to ensure good machine readability and cross-platform compatibility. This structured output format makes each recognized character a data node containing complete metadata. Researchers or downstream applications can easily parse this file. For example, they can quickly locate and highlight any character in the original image based on coordinate information to verify the accuracy of the recognition results; or they can perform statistical analysis and retrieval on all recognized oracle bone script codes, greatly facilitating subsequent academic research, data analysis, and the development of digital applications, thus providing reliable and structured data support for the in-depth utilization of ancient books.

[0110] See Figure 4 A second embodiment of the present invention provides an automatic annotation system for oracle bone inscriptions in digital documents, used to implement the method described in the first embodiment, comprising:

[0111] The character region acquisition module is configured to receive a document image containing oracle bone script characters and non-oracle bone script characters, perform character detection on the document image, and obtain the coordinate regions of each of the multiple characters in the image.

[0112] The classification module is configured to acquire each character image from the document image according to the coordinate region, and classify the character images to determine whether the character type of each character image is oracle bone script or non-oracle bone script.

[0113] The recognition module is configured to perform differential recognition on the character image based on the character type: if the character type is oracle bone script, the corresponding character image is input into a preset image matching model to determine its oracle bone script encoding in the target character library; if the character type is not oracle bone script, the corresponding character image is input into a preset character recognition model to determine its corresponding text character.

[0114] The annotation module is configured to associate the identified oracle bone script codes and text characters with their coordinate regions in the document image to generate a structured annotation file.

[0115] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working process and related explanations of the methods described above can be found in the corresponding processes in the foregoing system embodiments, and will not be repeated here.

[0116] It should be noted that the above-described embodiment of an automatic oracle bone script annotation system for digital documents is merely an example of the division of functional modules. In practical applications, the functions can be assigned to different functional modules as needed, that is, the modules or steps in the embodiments of the present invention can be further decomposed or combined. For example, the modules in the above embodiments can be merged into one module, or further divided into multiple sub-modules to complete all or part of the functions described above. The names of the modules and steps involved in the embodiments of the present invention are merely for distinguishing the various modules or steps and are not considered as an improper limitation of the present invention.

[0117] A device according to a third embodiment of the present invention includes:

[0118] At least one processor;

[0119] and a memory communicatively connected to at least one of the processors;

[0120] The memory stores instructions that can be executed by the processor to implement the above-described method for automatic annotation of oracle bone inscriptions for digital documents.

[0121] A fourth embodiment of the present invention provides a computer-readable storage medium storing computer instructions, which are executed by the computer to implement the above-described method for automatic annotation of oracle bone inscriptions for digital documents.

[0122] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working process and related descriptions of the storage device and processing device described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0123] The following is for reference. Figure 5 It shows a schematic diagram of the structure of a computer system for implementing embodiments of the systems, methods, and electronic devices of this application. Figure 5 The server shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.

[0124] likeFigure 5 As shown, the computer system includes a Central Processing Unit (CPU) 501, which can perform various appropriate actions and processes based on programs stored in Read Only Memory (ROM) 502 or programs loaded from storage section 508 into Random Access Memory (RAM) 503. The RAM 503 also stores various programs and data required for system operation. The CPU 501, ROM 502, and RAM 503 are interconnected via a bus 504. An Input / Output (I / O) interface 505 is also connected to the bus 504.

[0125] The following components are connected to I / O interface 505: an input section 506 including a keyboard, mouse, etc.; an output section 507 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN (Local Area Network) card, modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to I / O interface 505 as needed. Removable media 511, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., are installed on drive 510 as needed so that computer programs read from them can be installed into storage section 508 as needed.

[0126] Specifically, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 509, and / or installed from removable medium 511. When the computer program is executed by central processing unit (CPU) 501, it performs the functions defined in the methods of this application. It should be noted that the computer-readable medium described above in this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on a computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.

[0127] Computer program code for performing the operations of this application can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, and C++, and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0128] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0129] The terms “first”, “second”, etc., are used to distinguish similar objects, not to describe or indicate a specific order or sequence.

[0130] The term "comprising" or any other similar term is intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus / device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent in such process, method, article, or apparatus / device.

[0131] The technical solution of the present invention has been described above with reference to the preferred embodiments shown in the accompanying drawings. However, it will be readily understood by those skilled in the art that the scope of protection of the present invention is obviously not limited to these specific embodiments. Without departing from the principles of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will all fall within the scope of protection of the present invention.

Claims

1. A method for automatic annotation of oracle bone inscriptions in digital documents, characterized in that, The method includes: Receive a document image containing oracle bone script characters and non-oracle bone script characters, perform character detection on the document image to obtain the coordinate regions of each of the multiple characters in the image; Based on the coordinate region, each character image is obtained from the document image, and the character images are classified to determine whether the character type of each character image is oracle bone script or non-oracle bone script. Differential recognition is performed on the character image based on the character type: if the character type is oracle bone script, the corresponding character image is input into a preset image matching model to determine its oracle bone script encoding in the target character library; if the character type is not oracle bone script, the corresponding character image is input into a preset character recognition model to determine its corresponding text character. The identified oracle bone script codes and text characters are associated with their coordinate regions in the document image to generate a structured annotation file.

2. The method according to claim 1, characterized in that, Prior to the character detection, the method further includes: The document image is preprocessed, including: determining the text layout direction of the document based on morphological operations and contour analysis; and performing progressive noise suppression using a hierarchical cascaded processing mode, wherein the progressive noise suppression includes using median filtering to process impulse interference, using morphological opening operations to process discrete noise, and using connected component analysis to process non-character regions.

3. The method according to claim 2, characterized in that, The preprocessing also includes table line filtering, which includes: Construct probe-shaped rectangular structural elements to perform linear feature detection in the horizontal and vertical directions; The detection results in the horizontal and vertical directions are subjected to pixel-level logical OR operations to be integrated into a table line binary mask. And perform a difference operation on the binary image of the document image and the binary mask of the table lines to remove the table line region.

4. The method according to claim 2, characterized in that, The character detection includes: Based on the quality assessment results of the document image and the text layout direction, the hyperparameters of the Gaussian smoothing kernel and morphological structural element size required for character detection are dynamically calibrated. Based on the text layout direction, a morphological processing strategy is configured to perform a directional morphological closing operation on the binary image after adaptive thresholding to construct row-level or column-level candidate regions. Furthermore, within each candidate region, the precise boundary of a single character is located by analyzing the pixel density projection curve perpendicular to the layout direction, in order to obtain the initial character coordinate region.

5. The method according to claim 4, characterized in that, After obtaining the coordinate region, the method further includes: The initial character coordinate region is serialized, and the process includes: establishing an initial sequence using a two-level sorting strategy; reconstructing the sorted coordinate region into text lines or text columns through spatial location clustering; and performing a merging process on the coordinate region to merge multiple fragmented coordinate regions belonging to the same character to generate a normalized character sequence.

6. The method according to claim 5, characterized in that, The merging process includes: In the subject recognition stage, potential fragmented characters are locked based on width thresholds and height constraints, and edge noise is eliminated by combining vertical boundary detection; and in the neighborhood evaluation stage, the candidate boxes of the potential fragmented characters are bidirectionally measured. The measurement comprehensively considers spatial distance, size matching and position verification. When the measurement result meets the preset merging conditions, the candidate boxes are merged.

7. The method according to claim 5, characterized in that, The process of establishing the initial sequence using the secondary sorting strategy also includes: An adaptive threshold based on the dynamic average value of the text box size is constructed to group text lines or text columns; and during the grouping process, punctuation marks are identified based on multi-dimensional features, and when updating the center position of the group using the weighted average method, the calculation is performed only based on the coordinate region of non-punctuation marks.

8. The method according to claim 1, characterized in that, Classifying character images includes: A trained deep learning classification model is converted into an ONNX inference model optimized for dynamic batch input; and operator fusion is performed on the continuous computation operations in the inference model based on the ONNX Runtime optimization tool to generate a lightweight classifier; finally, the lightweight classifier is used to classify the character images acquired in batches according to the coordinate region.

9. An automatic annotation system for oracle bone inscriptions in digital documents, used to implement the method as described in any one of claims 1-8, characterized in that, include: The character region acquisition module is configured to receive a document image containing oracle bone script characters and non-oracle bone script characters, perform character detection on the document image, and obtain the coordinate regions of each of the multiple characters in the image. The classification module is configured to acquire each character image from the document image according to the coordinate region, and classify the character images to determine whether the character type of each character image is oracle bone script or non-oracle bone script. The recognition module is configured to perform differential recognition on the character image based on the character type: if the character type is oracle bone script, the corresponding character image is input into a preset image matching model to determine its oracle bone script encoding in the target character library; If the character type is not oracle bone script, the corresponding character image is input into the preset character recognition model to determine its corresponding text character; The annotation module is configured to associate the identified oracle bone script codes and text characters with their coordinate regions in the document image to generate a structured annotation file.

10. An electronic device comprising a processor and a memory, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the method as described in any one of claims 1-8.