An ancient book and handwriting character intelligent recognition method and system

By using the DBNet text detection model and sliding window technology, combined with unified character processing and dynamic resolution OCR, the problem of unstable correspondence between text regions and character blocks in intelligent recognition of ancient books and handwritten texts has been solved, achieving continuous correspondence and stable processing between recognition blocks and recognition results.

CN122369017APending Publication Date: 2026-07-10

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Filing Date
2026-05-11
Publication Date
2026-07-10

AI Technical Summary

Technical Problem

In the intelligent recognition of ancient books and handwritten text, the existing technology has an unstable correspondence between text regions and character blocks, the projection blocks are not closely connected with the subsequent recognition objects, and the recognition results are separated from the subsequent proofreading process. It is difficult to form a continuous correspondence between the overall detection and recognition results and the recognition blocks, especially under complex page structures and mixed handwritten and printed text, which makes it difficult to process continuously and stably.

Method used

The DBNet text detection model is used for text region segmentation and differentiable binarization to generate text box coordinates. The text blocks are classified into handwritten and printed characters. By generating projection blocks, calculating sliding window parameters, and adjusting the recognition block boundaries, combined with unified character processing and dynamic resolution OCR, a closed-loop generation link between recognition blocks and recognition results is formed.

Benefits of technology

It achieves a continuous correspondence between recognition blocks and text regions, position results, and classification results. The recognition results directly enter the result evaluation link after output, forming a correspondence between the previous and subsequent steps. The page numbering relationship after the whole page image is processed remains consistent in subsequent processing, solving the problem of continuous processing of recognition results under complex page structures.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122369017A_ABST
    Figure CN122369017A_ABST
Patent Text Reader

Abstract

The present application relates to the field of character recognition and image processing, and particularly relates to an ancient book and handwritten character intelligent recognition method and system. The method comprises: obtaining a whole page image by scanning an original page of an ancient book document, sequentially performing correction, enhancement, denoising and standardization processing to obtain an input image and a text label; using a character detection model to segment a character region and generate a text box coordinate, classifying a handwritten and printed character block, and establishing a corresponding relationship between a region, a coordinate, a category and a text label; performing horizontal and vertical projection to generate a projection block, calculating a sliding window parameter through a connected domain and a reference height, and adjusting a boundary to generate a recognition block; performing unified character processing and character recognition to obtain a result, triggering dynamic resolution optical character recognition and boundary adjustment through joint judgment, and outputting an overall detection and recognition result and a returnable recognition block. The present application improves the recognition accuracy and adaptability through closed-loop reprocessing and dynamic adjustment of the recognition block.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of character recognition and image processing, and in particular to an intelligent recognition method and system for ancient books and handwritten characters. Background Technology

[0002] In the field of character recognition and image processing, existing solutions typically revolve around whole-page image processing, text region detection and localization, text box coordinate generation, character block classification, projection block generation, and character recognition result output. These solutions suffer from limitations such as unstable correspondence between text regions and character blocks, poor connection between projection blocks and subsequent recognition objects, and separation of recognition results from subsequent verification processing. Existing methods often preprocess the whole-page image and directly proceed to text region detection and localization, then output character recognition results according to a fixed path. In scenarios involving ancient texts and handwritten characters, this approach is prone to inconsistencies between text box coordinates and character block boundaries, and mismatches between recognition blocks and actual text structures, making it difficult to achieve stable overall detection and recognition results and closed-loop generation of recognition blocks.

[0003] Existing technologies generally suffer from shortcomings in the joint processing of projection block and sliding window parameters, recognition block boundary adjustment, dynamic resolution optical character recognition, and joint judgment. These shortcomings include a lack of continuous feedback between the front-end segmentation results and the back-end recognition results, result evaluation remaining at the post-hoc verification level, and a lack of sequential switching mechanism between recognition block boundary adjustment and dynamic resolution optical character recognition. As a result, it is difficult to form a consistent process for whole-page image processing, text region detection and localization, recognition block generation, recognition result output, result evaluation, and joint judgment in the application scenario of intelligent recognition of ancient books and handwritten text. This makes it difficult to maintain a continuous correspondence between the overall detection and recognition results and the recognition blocks, and the recognition results are difficult to process stably and continuously under complex page structures, mixed handwritten and printed text, and local boundary offset conditions. Summary of the Invention

[0004] To address the aforementioned technical problems, this invention provides an intelligent recognition method for ancient books and handwritten characters, comprising:

[0005] S100: Scan the original pages of ancient books and documents to obtain full-page images, and perform rotation correction, data enhancement, noise reduction and standardization processing in sequence. Mark the positions of text areas, enter text and add numbers to obtain input images and text labels.

[0006] S200. Based on the input image and text labels, the DBNet text detection model is used to perform text region segmentation and differentiable binarization processing to generate text box coordinates. The text blocks are classified as handwritten or printed. The correspondence between text regions, coordinates, categories and text labels is established to obtain text region, position results and classification results.

[0007] S300. Based on the text region, position result and classification result, perform horizontal and vertical projection to generate projection blocks, perform connected component calculation and reference height calculation on the projection blocks to obtain sliding window parameters, slide the window according to the sliding window parameters and adjust the boundary to generate recognition blocks.

[0008] S400. Based on the recognition block, the recognition result is obtained through unified character processing and SVTR text recognition. The result is evaluated by checking against the dictionary database and full-text database. Dynamic resolution OCR and recognition block boundary adjustment are triggered by joint judgment. The overall detection and recognition result and the recognition block that can be sent back are output.

[0009] Further, the process of performing rotation correction, data augmentation, denoising, and standardization, as well as marking the text regions, entering the text, and adding numbers to obtain the input image and text labels includes:

[0010] The rotation correction process includes: reading the text line direction and page edge direction in the whole page image, and performing angle adjustment on the whole page image that is tilted;

[0011] The data enhancement process includes adjusting image contrast, brightness, and sharpness;

[0012] The denoising process includes: identifying and removing isolated noise points, edge artifacts, and non-text blocks from the input image;

[0013] The standardization process includes: uniform image size, uniform page orientation, and uniform page storage format;

[0014] The location annotation process includes: selecting text regions one by one on the preprocessed image and generating location annotation information corresponding to the page position;

[0015] The text input processing includes: writing the selected text content into a text record item according to the position label, ensuring that the position label and the text content correspond to each item;

[0016] The numbering process includes adding the same number to each location marker and corresponding text content, with the numbers set in the order within the page to ensure that the selected content matches the entered text.

[0017] Furthermore, the process of using the DBNet text detection model for text region segmentation and differentiable binarization to generate text box coordinates includes:

[0018] The image input part receives the entire page image, the feature extraction part reads the text texture, character block edges and line region distribution, and the segmentation output part outputs the segmentation result corresponding to the text region;

[0019] Based on the grayscale and boundary distribution of the candidate regions, text and background separation is performed block by block in the candidate regions, preserving continuous areas of text blocks and compressing isolated noise areas.

[0020] Extract the start and end positions, block range, and line range of the text region within the page to form text box coordinates that correspond to each item of the text region.

[0021] Furthermore, the process of classifying character blocks into handwritten and printed styles, and establishing the correspondence between character regions, coordinates, categories, and text labels includes:

[0022] The convolution operation is performed on the character blocks, the convolution output is normalized, and then two rounds of normalization, ReLU function processing and deconvolution operation are performed to distinguish the edges of handwritten characters from the edges of printed characters.

[0023] Read the location annotations, text box coordinates, character block categories, and entered text item by item according to the added number, and organize the text area, location results, and classification results under the same number into a unified record.

[0024] Furthermore, the process of generating projection blocks by performing horizontal and vertical projections includes:

[0025] Perform a horizontal projection on the text region to obtain the row region boundary, then perform a vertical projection on each row region to obtain the column region boundary, and combine the row region boundary and the column region boundary to generate a projection block.

[0026] Furthermore, the process of calculating the connected component and reference height of the projected block to obtain the sliding window parameters includes:

[0027] The text pixels and background pixels in the projection block are read adjacently, and the connected pixel regions are merged into connected component blocks. According to the classification results, the connection reading range is widened for handwritten projection blocks and the connection reading range is kept tighter for printed projection blocks.

[0028] Read the block height of all connected components within the same projection block or the same row region, and take the median as the reference height;

[0029] The aspect ratio and overlap width are generated based on the reference height and the image size of the projected block.

[0030] Furthermore, the process of sliding the window according to the sliding window parameters and adjusting the boundaries to generate the recognition block includes:

[0031] Within the projection block, advance the sliding window according to the aspect ratio and overlap width, moving it along the page layout direction. When arranging horizontally, advance it horizontally; when arranging vertically, advance it vertically. After each advance, read the distribution of character block edges, background blanks, and connected component blocks within the currently covered area of ​​the sliding window.

[0032] Based on the reference height, text box coordinate range, and classification results, the sliding window boundary is shrunk or expanded. For printed characters, the projection block is adjusted according to the regular boundary of the character block, and for handwritten characters, the projection block is adjusted according to the continuous boundary of the strokes. One or more adjusted sliding window areas are merged to form a recognition block. Each recognition block retains the corresponding projection block source, sliding window parameter source, page number, and classification result.

[0033] Furthermore, the process of obtaining recognition results through unified character processing and SVTR character recognition, and then evaluating the results by comparing them against dictionary databases and full-text databases, includes:

[0034] The unified character processing includes: an image encoder reading image features of stroke shapes, character block boundaries and local background in the recognition block, and a language decoder outputting candidate character sequences based on the image features;

[0035] The SVTR text recognition processing includes: calling the SVTR text recognition algorithm model on the printed text recognition block, reading local features and long-distance global dependencies, and then outputting the text sequence;

[0036] The processing of the recognition results includes: writing the page number, classification result, position result and current text sequence corresponding to each recognition block into the recognition result record;

[0037] The evaluation process for the results obtained from the dictionary database and full-text database verification includes: first, evaluating the results of a single recognition block using the dictionary database to check whether the candidate text sequence belongs to a character, word, or common text combination already existing in the dictionary database; then, evaluating the results of a text sequence formed by multiple recognition blocks on the same page using the full-text database to check whether the context position of the current candidate text sequence in the full-text database is consistent with the page numbering order; and finally, merging the results of the two types of processing into the result evaluation of the current recognition block.

[0038] Furthermore, the process of jointly determining and triggering dynamic resolution OCR and adjusting the recognition block boundaries includes:

[0039] After the joint judgment unit reads and evaluates the results, if the evaluation is stable, it directly writes the entire page output sequence. If the joint judgment determines that there are numbering conflicts, insufficient dictionary database correspondence, discontinuous full-text database order, or abnormal text sequence connection between adjacent blocks on the same page, it enters the reprocessing path: If the current recognition block boundary range is significantly too large or too small, or simultaneously covers adjacent character blocks, the recognition block boundary adjustment processing is performed first, and then the dynamic resolution OCR is called; If the current recognition block boundary range is basically stable, but the text sequence still has conflicts, the dynamic resolution OCR is called first, and then the boundary is locally reverted according to the new recognition result; The dynamic resolution OCR is only called for recognition blocks that enter the reprocessing path, and the input resolution is switched according to the character block density state, stroke thickness state, and boundary blur state of the recognition block before re-outputting the recognition result candidate.

[0040] Furthermore, an intelligent recognition system for ancient books and handwritten characters includes: an image acquisition and preprocessing module, a character detection and classification module, a projection and sliding window module, and a recognition and proofreading module; the modules are connected in sequence to implement the method described in any of the above-mentioned embodiments.

[0041] The key innovations of this invention include:

[0042] (1) Based on the text region, position result and classification result, perform projection block generation, reference height calculation, sliding window parameter calculation, sliding window sliding, recognition block boundary adjustment and recognition block generation processing, distinguish the projection block and recognition block as two connected processing objects, and make the recognition block boundary adjustment simultaneously constrained by reference height, text box coordinate generation and classification result.

[0043] (2) Based on the recognition block, perform unified character processing of image encoder and language decoder, recognition result output, recognition proof module processing, dictionary database result evaluation processing and full-text database result evaluation processing, and organize the recognition block, recognition result and result evaluation into a continuously transmitted data link.

[0044] (3) Based on the result evaluation, joint judgment, dynamic resolution OCR and recognition block boundary adjustment processing are performed. The result evaluation is used as the reprocessing trigger condition, and the recognition block is sent back to the image encoder and language decoder for unified character processing and recognition result output processing, forming a closed-loop generation link of overall detection and recognition results and recognition blocks.

[0045] The following are its main beneficial effects:

[0046] (1) In response to the problems of poor connection between the projection block and the subsequent recognition object in the existing scheme and the inconsistency between the text box coordinates and the character block boundary, the continuous processing of projection block generation, sliding window parameter calculation, sliding window sliding and recognition block boundary adjustment is used to organize the object entering the recognition stage from the projection block into the recognition block. The recognition block maintains a corresponding relationship with the text area, position result and classification result. In the scenario of intelligent recognition of ancient books and handwritten characters, the recognition block generation link remains continuous.

[0047] (2) To address the problem of separation between recognition results and subsequent verification processing in existing solutions, the sequence of character processing, recognition result output, recognition verification module processing, dictionary database result evaluation processing and full-text database result evaluation processing is unified by image encoder and language decoder. This allows the recognition result to directly enter the result evaluation link after output. A corresponding relationship is formed between the recognition block, recognition result and result evaluation. The page numbering relationship after the whole page image processing remains consistent in subsequent processing.

[0048] (3) In response to the problem that the result evaluation in the existing scheme is limited to the post-verification level and there is no continuous feedback relationship between the front-end segmentation result and the back-end recognition result, the result evaluation is no longer limited to static processing after a single output, but enters the recognition block feedback link. The overall detection and recognition result and the recognition block maintain a closed-loop generation relationship in the same processing flow.

[0049] (4) By organizing the text region detection and positioning, text box coordinate generation, character block classification, projection block generation, recognition block generation, recognition result output and result evaluation into continuous steps, the link breakpoints formed by directly entering the fixed recognition path after the whole page image is processed in the existing scheme are sorted out, and a continuous transmission relationship is formed between the whole page image, text region, recognition block and overall detection and recognition result in the intelligent recognition of ancient books and handwritten characters.

[0050] (5) By placing dynamic resolution OCR and recognition block boundary adjustment into the reprocessing link after joint judgment, the problem that recognition results are difficult to continuously process under complex page structure, mixed handwriting and printed text and local boundary offset conditions in the existing scheme is addressed. The recognition block maintains the correspondence between the page number and the processing order before and after reprocessing. The overall detection and recognition result generation process has the link basis for continuous feedback and repeated processing. Attached Figure Description

[0051] Figure 1 A flowchart illustrating an intelligent recognition method for ancient books and handwritten characters provided in an embodiment of this application;

[0052] Figure 2This is a structural block diagram of an intelligent recognition system for ancient books and handwritten characters provided in an embodiment of this application. Detailed Implementation

[0053] Example 1: Refer to Figure 1 This is a flowchart illustrating an intelligent recognition method for ancient books and handwritten characters provided in an embodiment of the present invention. The process may include at least steps S100-S400:

[0054] S100: Scan the original pages of ancient books and documents to obtain full-page images, and perform rotation correction, data enhancement, noise reduction and standardization processing in sequence. Mark the positions of text areas, enter text and add numbers to obtain input images and text labels.

[0055] S200. Based on the input image and text labels, the DBNet text detection model is used to perform text region segmentation and differentiable binarization processing to generate text box coordinates. The text blocks are classified as handwritten or printed. The correspondence between text regions, coordinates, categories and text labels is established to obtain text region, position results and classification results.

[0056] S300. Based on the text region, position result and classification result, perform horizontal and vertical projection to generate projection blocks, perform connected component calculation and reference height calculation on the projection blocks to obtain sliding window parameters, slide the window according to the sliding window parameters and adjust the boundary to generate recognition blocks.

[0057] S400. Based on the recognition block, the recognition result is obtained through unified character processing and SVTR text recognition. The result is evaluated by checking against the dictionary database and full-text database. Dynamic resolution OCR and recognition block boundary adjustment are triggered by joint judgment. The overall detection and recognition result and the recognition block that can be sent back are output.

[0058] Step S100 includes at least steps S110-S130:

[0059] S110. Obtain the entire page image, perform scanning, rotation correction, and data enhancement processing to obtain the input image.

[0060] Specifically, the input source for this step is the original page of the ancient book document. The full-page image refers to the page image formed in a single scan of the same page of the ancient book document. The page image simultaneously preserves the text area, blank area, page margin area, and smudged area. The scanning is performed by the acquisition device, which reads the ancient book document page by page and forms a full-page image of each page's content. During scanning, the text lines, page margin outlines, and blank areas within the page are kept synchronously in the same image file to avoid losing the overall page positional relationship by only retaining local character blocks in the subsequent text area detection and positioning stage. Rotation correction is the page orientation processing performed on the scanned full-page image. Specifically, the text line direction and page margin direction in the full-page image are read, and the angle is adjusted for any tilted full-page images to bring vertically written pages, horizontally written pages, and pages with slight tilt back to a unified orientation.

[0061] Data enhancement is an image adjustment process performed continuously on the entire page image after rotation correction. The data enhancement includes adjusting the image contrast, brightness, and sharpness. The processing object is still the entire page image rather than individual character blocks. Among them, contrast adjustment is used to widen the grayscale difference between the text and the background area, brightness adjustment is used to correct the page being too dark or too bright during scanning, and sharpness adjustment is used to improve the recognizability of character edges and stroke edges.

[0062] Understandably, when the same page of an ancient document has yellowed paper, faded ink, localized stains, or shadows, the acquisition device first outputs the original full-page image, then performs rotation correction and data enhancement sequentially. If the processed page still shows significant skewness or localized blurring, the original full-page image of that page is retrieved again for scanning or rotation correction and data enhancement are performed again. The page images before and after reprocessing are stored in the local storage of the acquisition device for subsequent steps. After this step, the resulting page image is recorded as the output field name "Input Image." The "Input Image" is directly sent to S120 as input to the "Input Image," and continues to be passed along with subsequent main steps. In S130, it participates in position labeling, text entry, and numbering, and in S210, it is retrieved as the image source for "Input Image and Text Labels."

[0063] S120. Based on the input image, perform denoising, standardization, and local storage processing to obtain a preprocessed image.

[0064] Specifically, the input source for this step is the "input image" output by S110. The denoising process is an image cleaning process targeting background noise, scanning noise, and page blemishes in the input image; the processing object remains the entire page image. In practice, isolated noise points, edge noise, and non-text blocks in the input image are first identified, and then these isolated noise points, edge noise, and non-text blocks are removed, ensuring a stable distribution of text areas, blank areas, and page margins within the same page. The standardization process is a unified process performed on the denoised input image, specifically including image size standardization, page orientation standardization, and page storage format standardization. Image size standardization involves organizing full-page images from different scanning sources, different paper sizes, and different trimming states into the same processing scale. Page orientation standardization aligns with the rotation correction in S110, and page storage format standardization ensures that subsequent position annotations, text entry, and numbering use the same format of page image. The local storage processing involves writing the denoised and standardized full-page image into the local storage space of the acquisition or processing device. The local storage processing also preserves the correspondence between the input image and the processed page image, so that the page-level correspondence of the same page of ancient literature is maintained in the preceding and following steps.

[0065] Furthermore, in an engineering embodiment, if the acquisition device continuously reads multiple pages of ancient texts, each page first forms an "input image," then performs denoising and standardization processing page by page, and writes the processing results to local storage in page order. When a page has excessive background noise, abnormal page size, or incomplete orientation rotation, the "input image" of the same page is called again to perform denoising or standardization processing, without changing the page order of that page in the entire batch of ancient texts. After this processing, subsequent position annotations read the entire page image of the same page, rather than fragmented image files out of page order. After this step, the processed page image is recorded as the output field name "preprocessed image." The "preprocessed image" is directly sent to S130 as the input of the "preprocessed image," and in the subsequent main step S200, it continues to participate in the DBNet (Differentiable Binarization Network) text detection algorithm model for text region segmentation, differentiable binarization processing, and text box coordinate generation processing via the "input image and text label."

[0066] S130. Based on the preprocessed image, perform position labeling, text input, and numbering to obtain the input image and text label.

[0067] Specifically, the input source for this step is the "preprocessed image" output by S120. The location annotation is a page-based annotation process for locating text regions in the preprocessed image. The annotation objects include character blocks, line regions, and corresponding text regions within the entire page image. During processing, annotators or annotation tools select text regions one by one on the preprocessed image and generate location annotation information corresponding to the page position. The text input involves writing the selected text content from the ancient text document page into text record items based on the location annotation information. During text input, the location annotations and text content are kept to correspond item by item, avoiding overlap between upper and lower line text, or left and right column text on the same page. The addition of numbers involves adding the same number to each location annotation and corresponding text content after text input is completed. The numbers are set according to the page order, ensuring consistency between the selected content and the input text. When multiple character blocks, line regions, or text regions exist on the same page, each selected content corresponds to a number, and each number corresponds to only one input text, thus establishing a one-to-one correspondence between location annotations, input text, and numbers within the same preprocessed image.

[0068] Furthermore, in a real-world scenario, the operator first opens a page of "preprocessed images," then sequentially selects text regions from top to bottom or right to left, marking the locations. Immediately after marking the locations, text is entered into each location, and numbers are added to both the location markings and the entered text. If the selected area doesn't match the entered text, the operator returns to the current location marking, re-selects, and re-adds numbers using the original page order, without altering the correspondence of other completed numbers. Through this process, each text block region on the same page has traceable location marking information and corresponding text content. Subsequently, when S210 reads the "input image and text labels," it can directly call the corresponding text region based on the location marking information, and then execute the DBNet text detection algorithm model to segment the text region, perform differentiable binarization processing, and generate text box coordinates. Simultaneously, the subsequent character block classification in S220, the text box coordinate correspondence and text label correspondence in S230, and the processing of recognition blocks and results in S300 and S400 are all based on the intra-page correspondence formed in this step. After processing in this step, the preprocessed image, together with the location annotation, entered text, and number, constitutes the output field name "Input Image and Text Label". This "Input Image and Text Label" is first sent to S210 as the input of "Input Image and Text Label", and then serves as the starting input of the main step S200 to continue providing the page source and text label source to the "Text Region, Location Result and Classification Result" of the main step S300, as well as the "Recognition Result" and "Result Evaluation" of the main step S400.

[0069] In summary, this step integrates full-page image processing with location annotation, text entry, and numbering into a continuous processing chain within the same page. This ensures that subsequent text region detection and localization reads not isolated images, but input images and text labels with corresponding relationships within the page. Compared to processing methods that only retain image files or only retain text records, this step synchronously fixes the page order, location annotation, and text entry, allowing for direct calling relationships between subsequent text box coordinates, character block correspondences, and text label correspondences.

[0070] Step S200 includes at least steps S210-S230:

[0071] S210. Based on the input image and text label, the DBNet text detection algorithm model is used to segment the text region, perform differentiable binarization processing and text box coordinate generation processing to obtain the text region and position results.

[0072] Specifically, the input source for this step is the "input image and text labels" output by S130. The input image and text labels include a preprocessed image, location annotations, entered text, and added numbering results. The preprocessed image is a full-page image after noise reduction, standardization, and local storage processing. The location annotations are selected records of text regions within the full-page image. The entered text is the text content corresponding to each location annotation. The added numbering is a numbering record that establishes an in-page correspondence between the location annotations and the entered text.

[0073] During execution, the system first reads the input image and the preprocessed image from the text labels, then calls the DBNet (Differentiable Binarization Network) text detection algorithm model to perform text region segmentation on the entire page image. The DBNet text detection algorithm model is a segmentation model, which internally includes at least an image input part, a feature extraction part, and a segmentation output part. The image input part receives the entire page image, the feature extraction part reads the text texture, character block edges, and line region distribution in the image, and the segmentation output part outputs the segmentation results corresponding to the text regions. The differentiable binarization processing is a thresholding process performed based on the segmentation model output. The processing objects are candidate text regions and background regions in the entire page image. The processing procedure involves separating the text from the background block by block based on the grayscale and boundary distribution of the candidate regions, preserving continuous character block regions, and compressing isolated noise regions, so that the subsequent text box coordinate generation process has stable input.

[0074] Furthermore, the text box coordinate generation process extracts coordinates from the text region after differentiable binarization. This process includes determining the start and end positions, character block ranges, and line ranges within the page, resulting in text box coordinates that correspond to each text region. Understandably, when there are smudged areas, margins, or blank areas in the entire image, the DBNet text detection algorithm model prioritizes reading the page areas covered by the position markers and the entered text. If the candidate text regions output by the model deviate from the position markers, the corresponding page position is retrieved according to the added number, and the text region segmentation and differentiable binarization process are re-executed. The reprocessing record is written to local storage to ensure that the text regions and text box coordinates within the same page remain consistent.

[0075] After this step, the system organizes the segmentation results and text box coordinates into an output field name "Text Region and Position Result", and sends the "Text Region and Position Result" to S220 as input to the "Text Region and Position Result". At the same time, the "Text Region and Position Result" continues to participate in the text box coordinate correspondence in S230, and continues to participate in the horizontal projection, vertical projection and projection block generation processing in S300, thereby establishing an intra-page correspondence with the subsequent recognition block generation process.

[0076] S220. Based on the text region and position results, perform character block category division, convolution operation and normalization processing to obtain the classification result.

[0077] Specifically, the input source for this step is the "text region and position result" output by S210. The text region is a set of text regions obtained after processing by the DBNet text detection algorithm model and differentiable binarization. The position result is the text box coordinates corresponding to each text region. During execution, character blocks are first extracted one by one from the entire page image based on the text box coordinates. Each character block refers to a local image region located within the coordinates of a single text box, which retains the character strokes, local background, and in-page orientation information. Subsequently, character block classification is performed on the character blocks.

[0078] The character block classification determines whether a character block belongs to handwritten or printed text, based on the continuity of strokes, the regularity of character shape, and the distribution of edges within the character block. In practice, the classification module first performs a convolution operation on the character block, continuously reading local textures and strokes to output local features. After the convolution operation, normalization is performed, including scaling and distribution adjustments to the convolution output to ensure consistent input for character blocks of different sizes, resolutions, and on different pages within the same classification path. Further, in one feasible implementation, the character block classification is performed by a classification network. After the convolution operation, the network performs two rounds of normalization, ReLU function processing, and deconvolution, first shrinking local features and then restoring the character block category boundaries to clearly distinguish between handwritten and printed edges. When connected strokes, broken strokes, and printed borders appear simultaneously within the same text box coordinates, the classification network determines the current character block's category based on the correspondence between the convolution output and the normalization output. If the output of the classification network is unstable, the coordinates of the text box formed by S210 are retrieved to re-extract the text blocks, and the convolution operation and normalization process are performed again. The reclassification record is then written under the corresponding number for subsequent text label processing.

[0079] After this step, the system will output the character block category classification record as the output field name "Classification Result" and send the "Classification Result" to S230 as the input of "Classification Result". At the same time, the "Classification Result" continues to enter S300 together with the "Text Region and Position Result" of S210 to participate in the generation of projection blocks, the calculation of sliding window parameters and the adjustment of recognition block boundaries, so that the subsequent recognition block generation process has the preliminary classification basis of handwritten and printed characters.

[0080] S230. Based on the text region and classification results, perform text box coordinate correspondence, character block correspondence and text label correspondence processing to obtain text region, position results and classification results.

[0081] Specifically, the input sources for this step include the "text region and position results" output by S210 and the "classification results" output by S220. The text box coordinate mapping involves mapping each text region to the coordinates of a text box within the same page. During processing, the position annotation, text box coordinates, and character block category information are read item by item according to the added number. First, it is checked whether the text region and text box coordinates belong to the same page and the same region. Then, it is checked whether the character block category is consistent with the character block extracted within the text box coordinates. The character block mapping, after the text box coordinate mapping is completed, establishes a fixed relationship between each character block and its corresponding text region, text box coordinates, and page number. The text label mapping, after the character block mapping is completed, maps the entered text item by item to the corresponding character block, and organizes the position annotation, text box coordinates, character block category, and entered text under the same number into a set of corresponding records within the page.

[0082] Specifically, the system reads the addition numbers on the same page, first pairs the text area corresponding to the number with the text box coordinates, then pairs the character blocks within the text box coordinates with the classification results generated in S220, and finally pairs the pairing results with the entered text, thereby forming a unified record containing text areas, position results, and classification results. If a missing text area, offset text box coordinates, conflicting character block categories, or misplaced entered text is found under a certain number, the corresponding number is returned, and the text box coordinate generation process in S210 or the character block category classification process in S220 is called again, and the corresponding processing in the current step is executed again until the correspondence within the page under that number is closed. Furthermore, in the engineering embodiment, when a page of an ancient text contains both handwritten annotations and printed text, the system first locates the text area and annotation area based on the text box coordinates, then distinguishes between handwritten and printed character blocks based on the classification results, and subsequently maps the two types of character blocks to the input text numbers on the same page. After this processing, when S310 reads the "text area, position result, and classification result" laterally, it can directly perform horizontal projection, vertical projection, and projection block generation according to the page number, without having to re-check the entire page position. After this step, the system uniformly records the completed correspondence as the output field name "text area, position result, and classification result," and sends this field to S310 as the input for "text area, position result, and classification result." At the same time, this field continues to be passed to S320 and S330, participating in connected component calculation, reference height calculation, sliding window parameter calculation, sliding window sliding, and recognition block boundary adjustment, and indirectly providing the preceding character block boundary basis for the unified character processing and text recognition algorithm model processing of S410.

[0083] In summary, this step organizes text regions, text box coordinates, character block categories, and text labels into a single page numbering chain, improving the connection between preceding detection results and subsequent projection block generation. Compared to processing paths that only output segmentation or classification results, this step creates a unified record that can directly enter the S300, ensuring clear intra-page correspondence for subsequent recognition block boundary adjustments. Handwritten and printed regions within the entire page image can be continuously transmitted using the same numbering system.

[0084] Step S300 includes at least steps S310-S330:

[0085] S310. Based on the text region, position result, and classification result, perform horizontal projection, vertical projection, and projection block generation processes to obtain the projection block.

[0086] Specifically, the input source for this step is the "text region, position result, and classification result" output by S230. The text region is the effective text region within the page after text box coordinate correspondence, character block correspondence, and text label correspondence. The position result is the text box coordinate corresponding to each item of the text region, and the classification result is the handwritten and printed font category record corresponding to each item of the text region. During execution, the text region, position result, and classification result under the same number are read page by page first, and then the segmentation processing unit performs horizontal projection on the text region. The horizontal projection is to accumulate and read the pixel distribution in the text region along the horizontal direction of the page to obtain the continuous distribution state of each line of text in the horizontal direction; when there are multiple lines of character blocks arranged vertically on the page, the horizontal projection first distinguishes the blank areas between lines from the dense text areas, and then outputs the line area boundary.

[0087] Subsequently, vertical projection is performed on each row region within the same page. Vertical projection involves accumulating the pixel distribution within the row region along the page's vertical axis to obtain the continuous vertical distribution of each column of characters. When connected strokes, adjacent characters, or localized damage exist within the same row, vertical projection, combined with previous positional results, limits the projection range, performing vertical accumulation only within the area covered by the corresponding text box coordinates to prevent page margin noise and blank areas from entering subsequent processing. Further, the projection block generation process involves combining the row region boundaries obtained from horizontal projection with the column region boundaries obtained from vertical projection to generate projection blocks for subsequent connected component calculations. Each projection block refers to a local image block located within the same page, with the same number, and within the same text region. Each projection block retains the character edges, local background, and in-page orientation relationships within the original text region, and records its corresponding positional and classification results. Understandably, when the input page contains printed text, handwritten annotations, and small margin text simultaneously, the segmentation processing unit first reads the printed and handwritten regions according to the classification results, and then performs horizontal and vertical projections respectively. For the printed region, the projection range expands along the rectangular area of ​​the text box coordinates; for the handwritten region, the projection range expands along the local boundary corresponding to the position result. If a projection result shows too many consecutive blank segments, broken row areas, or overlapping column areas, the text area and position result under the corresponding number are checked back, the horizontal or vertical projection of that page is re-executed, and the reprocessing record is written to local storage.

[0088] Through the above processing, the system uniformly records the generated local image blocks as the output field name "projection block" and sends the "projection block" to S320 as the input of the "projection block". At the same time, the "projection block" continues to participate in the sliding window sliding, recognition block boundary adjustment and recognition block generation processing in S330, and maintains the same page number as the recognition block input in the subsequent S410.

[0089] S320. Based on the projection block, perform connected component calculation, reference height calculation, and sliding window parameter calculation to obtain the sliding window parameters.

[0090] Specifically, the input source for this step is the "projection block" output by S310. The projection block is a local image block formed after horizontal projection, vertical projection, and projection block generation processing. Each projection block has a corresponding page number, position result, and classification result. During execution, the computational processing unit first performs connected component calculation on each projection block. The connected component refers to the region formed by the continuous connection of pixels within the projection block. The connected component calculation process involves reading the adjacency of text pixels and background pixels in the projection block, merging the connected pixel regions into a connected component block, and then recording the position range and block height of each connected component block.

[0091] For projection blocks with broken strokes, adhesion, or localized smudges, the processing unit first identifies whether it is a handwritten or printed projection block based on the classification results. Then, for handwritten projection blocks, the connection reading range of the connected component blocks is widened, while for printed projection blocks, a tighter connection reading range is maintained, thus making the connected component blocks closer to the actual character block boundaries. Subsequently, a reference height is calculated based on the connected component calculation results. This reference height is a page height benchmark formed by the combined heights of multiple connected component blocks. During processing, the block heights of all connected component blocks within the same projection block or the same line area are read, and the median is taken as the reference height. This reference height does not directly represent the fixed height of a particular character block, but rather serves as the scale basis when the current projection block enters the sliding window processing.

[0092] Furthermore, the sliding window parameter calculation process generates sliding window parameters based on the reference height and the image size of the projection block. These sliding window parameters include at least an aspect ratio and an overlap width, where the aspect ratio defines the horizontal and vertical proportions of the sliding window within the projection block, and the overlap width defines the overlap area between adjacent sliding windows. In specific operation, the calculation unit first reads the projection block height and then combines it with the reference height to generate the aspect ratio of the current projection block; subsequently, it generates the overlap width based on the reference height, ensuring that adjacent sliding windows retain a common coverage area when crossing connected strokes, broken strokes, and blurred edge areas. Understandably, in engineering embodiments, when a page of an ancient book contains dense text, sparse annotations, and inconsistent character block sizes, the system performs connected component calculations on the projection blocks corresponding to the text and annotations respectively, and then calculates the reference height and sliding window parameters separately. For printed projection blocks with relatively small fluctuations in reference height, a uniform aspect ratio and a stable overlap width are used; for handwritten projection blocks with large fluctuations in reference height, the sliding window parameters are recalculated between adjacent projection blocks according to their numbers. If the number of connected component blocks is too small, or the reference height is abnormally large or small, the projection block generation process of S310 will be called again, and the connected component calculation and reference height calculation process will be entered again.

[0093] After this step, the system records the parameter results corresponding to the current projection block as the output field name "sliding window parameter" and sends the "sliding window parameter" to S330 as the input of the "sliding window parameter". At the same time, the "sliding window parameter" and the "projection block" together constitute the pre-order input for subsequent sliding window sliding and recognition block boundary adjustment, and continue to provide the boundary scale basis to the recognition block input chain of S400.

[0094] S330. Based on the projection block and sliding window parameters, perform sliding window sliding, recognition block boundary adjustment and recognition block generation processes to obtain the recognition block.

[0095] Specifically, the input sources for this step are the "projection block" output by S310 and the "sliding window parameters" output by S320. The sliding window movement refers to the process of sequentially moving and reading a local image region within the projection block according to the aspect ratio and overlap width defined by the sliding window parameters. During execution, the window processing unit first places the first sliding window at the starting boundary of the projection block, and then moves it along the text arrangement direction of the projection block; when the page is horizontally arranged, the sliding window moves horizontally, and when the page is vertically arranged, the sliding window moves vertically. After each movement, the window processing unit reads the distribution of character block edges, background blanks, and connected component blocks within the current sliding window's coverage area and compares it with the overlapping area of ​​the previous sliding window. The identification block boundary adjustment is a boundary correction process performed during the sliding window movement, and the processing object is the boundary position between the current sliding window's coverage area and the overlapping area of ​​the adjacent sliding window. Specifically, if the same connected component block within the overlapping area is simultaneously covered by two sliding windows, the window processing unit shrinks or expands the current sliding window boundary based on the reference height, text box coordinate range, and classification result; for printed projection blocks, boundary adjustment is prioritized according to the regular boundaries of the character blocks, and for handwritten projection blocks, boundary adjustment is prioritized according to the continuous boundaries of the strokes.

[0096] Furthermore, the recognition block generation process involves solidifying the effective area corresponding to the current sliding window after the recognition block boundary adjustment is completed, generating a local image block that can be directly called by the subsequent unified character processing and text recognition algorithm model. The recognition block refers to an image region with stable boundaries, retaining the page number and corresponding classification result. Each recognition block is formed by merging one or more sliding window regions with adjusted boundaries, and its corresponding projection block source and sliding window parameter source are recorded. Understandably, in a practical scenario embodiment, when a handwritten annotation on a page of ancient literature is located at the edge of the printed text, and the annotation strokes cross two adjacent projection blocks, the window processing unit first performs sliding window sliding on the two projection blocks according to the sliding window parameters, and then performs recognition block boundary adjustment based on the stroke continuity state within the overlapping area, merging the local areas belonging to the same annotation block into one recognition block; if the adjusted recognition block still contains a large blank area or simultaneously covers two independent blocks, the projection block and sliding window parameters are reread according to the same number, the sliding window sliding and recognition block boundary adjustment are re-executed, and the duplicate processing record is written to local storage. Through the above processing, the system uniformly records the formed local image blocks as the output field name "identification block" and sends the "identification block" to S410 as the input of the "identification block". At the same time, the "identification block" continues to be called in the recognition and correction module processing of S420 and the joint judgment, dynamic resolution OCR and identification block boundary adjustment processing of S430, forming a continuous processing chain from projection block to identification block to overall detection and recognition result and identification block.

[0097] In summary, this step improves upon conventional methods that rely on direct recognition after segmentation by processing the projected blocks and sliding window parameters within the same page's numbering chain. Through continuous coordination between the sliding window's movement and the adjustment of the recognition block boundaries, the generated recognition blocks maintain a stable correspondence with the preceding text regions, positional results, and classification results. Subsequent unified character processing and text recognition algorithm models then read locally image blocks with well-defined boundaries, rather than the loosely bounded original projected blocks.

[0098] Step S400 includes at least steps S410-S430:

[0099] S410. Based on the recognition block, perform unified character processing of the image encoder and language decoder, SVTR text recognition algorithm model processing, and recognition result output processing to obtain the recognition result.

[0100] Specifically, the input source for this step is the "recognition block" output by S330. The recognition block is a local image region formed after sliding the window and adjusting the block boundaries. Each recognition block retains its corresponding page number, classification result, and position result. During execution, the recognition processing unit first reads the recognition block, and then distinguishes between handwritten and printed recognition blocks according to the classification results. The image encoder is the processing part that receives the recognition block image and extracts image features, and the language decoder is the processing part that receives image features and outputs text sequences. Together, they constitute a unified character processing link. The unified character processing is a process of uniformly organizing input, uniformly reading features, and uniformly outputting characters for recognition blocks from different historical periods, different writing styles, and different categories. Specifically, the image encoder first reads the image features of the stroke shapes, character boundaries, and local background in the recognition block, and then sends the image features to the language decoder; the language decoder outputs the candidate text sequence corresponding to the recognition block and the text recognition result under the current recognition order based on the image features corresponding to the recognition block.

[0101] For printed text recognition blocks, after unified character processing, the SVTR (Scene Text Recognition with a Single Visual Model) text recognition algorithm model is called for further processing. The SVTR text recognition algorithm model continuously reads the local features and long-distance global dependencies within the character block, and then organizes the reading results into a text sequence for output. For handwritten text recognition blocks, the candidate text sequences output by the image encoder and speech decoder are preferentially retained, and then the recognition results are output based on the page number and previous position results.

[0102] Furthermore, the output processing of the recognition results is not simply writing out the characters, but rather writing the page number, classification result, position result, and current text sequence corresponding to each recognition block into the recognition result record, so that the subsequent recognition and verification module can continue processing by page, by block, and by category. Understandably, in the engineering embodiment, when both printed text and handwritten annotations exist on the same page of an ancient book document, the recognition processing unit first calls the SVTR character recognition algorithm model to process the printed recognition block, and then calls the image encoder and language decoder to process the handwritten recognition block in a unified character manner; if a certain handwritten recognition block has broken strokes, blurred character block boundaries, or local background residue, the recognition processing unit still outputs the candidate text sequence of the recognition block and records the candidate text sequence together with the page number for use in the "recognition result" of S420.

[0103] After this step, the system organizes the text sequence, page number, classification result, and position result into an output field name "Recognition Result," and sends this "Recognition Result" to S420 as input to the "Recognition Result." Simultaneously, the "Recognition Result" continues to participate in joint judgment, dynamic resolution OCR (Optical Character Recognition), and recognition block boundary adjustment processing in S430, thereby maintaining a correspondence with the overall detection and recognition result and the feedback link of the recognition block.

[0104] S420. Based on the recognition result, perform recognition verification module processing, dictionary database result evaluation processing, and full-text database result evaluation processing to obtain the result evaluation.

[0105] Specifically, the input source for this step is the "recognition result" output by S410. The recognition result is a record of text sequences formed in units of recognition blocks, which includes page numbers, classification results, position results, and candidate text sequences. During execution, the recognition verification module first reads the recognition result. The recognition verification module is an intermediate processing part connecting the recognition result, the dictionary database, and the full-text database. It includes at least a result access part, a corresponding verification part, and a result output part. The result access part receives the recognition result, the corresponding verification part checks the recognition result item by item according to the page number and position result, and the result output part outputs the result evaluation. The dictionary database result evaluation process reads the candidate text sequences in the recognition result and matches them with the text entries in the dictionary database, checking whether the current candidate text sequence belongs to a character, word, or common text combination already existing in the dictionary database. The full-text database result evaluation process reads the candidate text sequence continuously in the text entered on the same page and adjacent text sequences, checking whether the context position of the current candidate text sequence in the full-text database is consistent with the page number order.

[0106] Furthermore, the recognition and verification module adopts a block-first, page-later processing approach. First, it evaluates the dictionary database results for individual recognition blocks, then evaluates the full-text database results for text sequences formed by multiple recognition blocks on the same page, and finally merges the two sets of results into the current recognition block's evaluation result. For printed recognition blocks, the module prioritizes verifying the correspondence between the text sequence and the dictionary database; for handwritten recognition blocks, it prioritizes verifying the full-text database records near the page number, then checks the corresponding entries in the dictionary database. If a conflict arises between the dictionary database evaluation and the full-text database evaluation, the module retains both evaluation records for that recognition block according to its page number and marks it as a target for joint judgment, rather than directly deleting the current recognition result.

[0107] Understandably, in a practical scenario, after the printed text block in a page of ancient text outputs a text sequence, the recognition and verification module first sends the text sequence to the dictionary database for result evaluation processing. If the text sequence has a corresponding entry in the dictionary database, it continues to enter the full-text database for result evaluation processing to verify the order of the entry in the entire page's text sequence. For handwritten annotations on the edge of the same page, the recognition and verification module first calls the full-text database for result evaluation processing to read the text sequence of its adjacent character blocks, and then returns to the dictionary database for result evaluation processing to verify the corresponding character entries. After this step, the system unifies the single-block evaluation result, the page-wide evaluation result, and the corresponding numbered record into an output field name "Result Evaluation," and sends this "Result Evaluation" to S430 as input for "Result Evaluation." At the same time, the "Result Evaluation" continues to serve as the triggering basis for joint judgment and dynamic resolution OCR in S430, and maintains the same page-wide numbering relationship with the preceding "Recognition Result" and the subsequent "Overall Detection Recognition Result and Recognition Block."

[0108] S430. Based on the evaluation of the results, perform joint judgment, dynamic resolution OCR and recognition block boundary adjustment processing to obtain the overall detection and recognition results and recognition blocks.

[0109] Specifically, the input source for this step is the "result evaluation" output by S420. The result evaluation includes the dictionary database evaluation record, the full-text database evaluation record, and the corresponding page number after processing by the recognition and verification module. During execution, the joint judgment unit first reads the result evaluation. The joint judgment is a process of merging and determining the recognition result, dictionary database evaluation record, and full-text database evaluation record corresponding to the same recognition block. During processing, the single-block evaluation is first read according to the page number, then the evaluation records of the preceding and following recognition blocks are read in the order of the same page, and finally, the judgment result of whether the current recognition block enters the reprocessing path is output. If the joint judgment determines that the result evaluation of the current recognition block is in a stable state, the text sequence of the recognition block is directly written into the full-page output sequence; if the joint judgment determines that the current recognition block has number conflicts, insufficient dictionary database correspondence, discontinuous full-text database order, or abnormal text sequence connection between adjacent blocks on the same page, dynamic resolution OCR processing is triggered. The dynamic resolution OCR is a process of resetting the input resolution of the current recognition block and re-performing optical character recognition. The processing object is the recognition block that enters the reprocessing path after joint judgment. During processing, the original recognition block image is first read according to the boundary range of the current recognition block. Then, the input resolution is switched based on the character block density, stroke thickness, and boundary blurring state of the recognition block. Subsequently, new recognition result candidates are output. The recognition block boundary adjustment process can be performed before or after the dynamic resolution OCR. Specifically, if the current recognition block boundary range is significantly too large, significantly too small, or simultaneously covers adjacent character blocks, the recognition block boundary adjustment process is performed first, followed by the dynamic resolution OCR. If the current recognition block boundary range is basically stable but the text sequence still has conflicts, the dynamic resolution OCR is performed first, and then a local callback is performed on the boundary based on the new recognition result.

[0110] Furthermore, the identification block boundary adjustment process in this step directly calls the number, position result and projection block source record in the previous page to shrink, expand or re-segment the current identification block, and sends the adjusted identification block back to S410 as the input of "identification block", thus forming a closed-loop processing chain of "identification block - identification result - result evaluation - overall detection identification result and identification block".

[0111] Understandably, in the engineering implementation, when a candidate text sequence is output by S410 after the handwritten annotations on a certain page of an ancient book document, if there is insufficient evaluation record in the dictionary database and the order of the full-text database is not continuous in S420, the joint judgment unit will first mark the recognition block as a reprocessing object, and then call the dynamic resolution OCR to read the original image of the recognition block; if the new text sequence output by the dynamic resolution OCR is still inconsistent with the context of the same page, the recognition block boundary adjustment processing will continue to be performed, splitting the original recognition block into two new recognition blocks or merging adjacent recognition blocks, and then sending the adjusted recognition block back to S410 to re-execute the unified character processing and text recognition algorithm model processing.

[0112] Through the above continuous processing, the system finally organizes the stable whole-page text sequence and the recognition blocks that need to be sent back into the output field name "overall detection and recognition result and recognition block". The "overall detection and recognition result" is used for the output of the whole page of ancient documents, and the "recognition block" is sent back to S410 as the input of the "recognition block" and continues to participate in the "recognition result" processing of S420 and the "result evaluation" processing of S430.

[0113] In summary, this step integrates joint judgment, dynamic resolution OCR, and recognition block boundary adjustment into a single reprocessing chain, improving upon the direct output method after recognition. For recognition blocks entering the reprocessing path, the system does not remain on the single recognition result but instead calls back the recognition block boundaries and input resolution according to the page number, then re-sends the adjusted recognition blocks back to the unified character processing and text recognition algorithm model, thus maintaining a continuous correspondence between the overall detection and recognition results and the recognition blocks.

[0114] Example 2: Figure 2 This diagram illustrates a structural block diagram of an intelligent recognition system for ancient books and handwritten characters according to an embodiment of the present invention. Figure 2 As shown, the structure may include:

[0115] The image acquisition and preprocessing module 01 is used to scan the original pages of ancient books and documents to obtain full-page images, perform rotation correction, data enhancement, denoising, and standardization processing, mark the positions of text areas, input text and add numbers, and obtain the input image and text labels. Specifically, this module receives the original pages of ancient books and documents from the scanning device and converts the original pages into full-page images. This module sequentially performs rotation correction, data enhancement, denoising, and standardization processing; during rotation correction, it reads the text line direction and page edge direction in the full-page image and adjusts the angle; during data enhancement, it adjusts the contrast, brightness, and sharpness of the full-page image; during denoising, it identifies and removes isolated noise points, edge noise, and non-text blocks in the full-page image; during standardization, it unifies the image size, page orientation, and storage format. After processing, this module selects text areas one by one on the full-page image to generate position annotation information, writes the text content into text record items according to the position annotations, and adds a number set according to the page order to each position annotation and corresponding text content. This module records the processed page image, along with the position annotations, input text, and numbers, as the input image and text labels. This module passes the input image and text labels to the text detection and classification module.

[0116] The text detection and classification module 02, connected to the image acquisition and preprocessing module, is used to perform text region segmentation and differentiable binarization processing based on the input image and text labels using the DBNet text detection model. It generates text box coordinates, classifies character blocks into handwritten and printed styles, establishes the correspondence between text regions, coordinates, categories, and text labels, and obtains text region, position, and classification results. Specifically, this module receives the input image and text labels from the image acquisition and preprocessing module. It calls the DBNet text detection model to perform text region segmentation on the entire page image. The model reads the text texture, character block edges, and line region distribution before outputting the segmentation results. The module performs differentiable binarization processing on the segmentation results, separating the text from the background block by block based on the grayscale and boundary distribution of the candidate regions, preserving continuous character block regions and compressing isolated noise regions. The module then extracts the start and end positions, character block ranges, and line region ranges of the text regions within the page, generating text box coordinates corresponding to each item of the text region. This module extracts character blocks from the entire page image based on text box coordinates. It then performs convolution, normalization, two rounds of normalization, ReLU function processing, and deconvolution on these blocks to distinguish between handwritten and printed edges, resulting in a handwritten or printed character classification. The module reads the location annotations, text box coordinates, character block category, and entered text item by item according to the added number. It then organizes the text region, location result, and classification result under the same number into a unified record, denoted as Text Region, Location Result, and Classification Result. This module then passes the text region, location result, and classification result to the projection and sliding window module.

[0117] The projection and sliding window module 03, connected to the text detection and classification module, is used to generate projection blocks by performing horizontal and vertical projection based on the text region, position result, and classification result. It then performs connected component calculation and reference height calculation on the projection blocks to obtain sliding window parameters, slides the window according to the sliding window parameters, and adjusts the boundaries to generate recognition blocks. Specifically, this module receives text regions, position results, and classification results from the text detection and classification module. It reads the text regions, position results, and classification results for the same page number, performs horizontal projection on the text regions to obtain row region boundaries, and then performs vertical projection on each row region to obtain column region boundaries. The row region boundaries and column region boundaries are then combined to generate projection blocks. This module performs connected component calculation on each projection block, reads the adjacency of text pixels and background pixels in the projection block, merges connected pixel regions into connected component blocks, and, based on the classification result, widens the connection reading range for handwritten projection blocks and maintains a tighter connection reading range for printed projection blocks. This module reads the block height of all connected component blocks within the same projection block or the same row region and takes the median as the reference height. This module generates sliding window parameters based on the reference height and the image size of the projection block. These parameters include aspect ratio and overlap width. Within the projection block, the module advances the sliding window along the page layout direction according to the aspect ratio and overlap width. For horizontal layouts, it advances horizontally; for vertical layouts, it advances vertically. After each advancement, it reads the distribution of character edges, background blank space, and connected component blocks within the currently covered area of ​​the sliding window. The module shrinks or expands the sliding window boundary based on the reference height, text box coordinate range, and classification results. For printed projection blocks, it prioritizes adjustment according to the regular boundaries of the character blocks; for handwritten projection blocks, it prioritizes adjustment according to the continuous boundaries of the strokes. One or more adjusted sliding window regions are merged to form a recognition block. Each recognition block retains its corresponding projection block source, sliding window parameter source, page number, and classification result. This module then passes the recognition block to the recognition and verification module.

[0118] The recognition and verification module 04, connected to the projection and sliding window module, is used to obtain recognition results based on the recognition blocks through unified character processing and SVTR text recognition. The results are then verified using a dictionary database and a full-text database for evaluation. A joint judgment triggers dynamic resolution OCR and recognition block boundary adjustment, outputting the overall detection and recognition results and the retrievable recognition blocks. Specifically, this module receives recognition blocks from the projection and sliding window module. It performs unified character processing on the recognition blocks: the image encoder reads the stroke shapes, character boundaries, and local background of the recognition blocks, and the language decoder outputs candidate text sequences based on image features. For printed text recognition blocks, this module calls the SVTR text recognition algorithm model, reads local features and long-distance global dependencies, and outputs the text sequence. This module writes the page number, classification result, position result, and current text sequence corresponding to each recognition block into the recognition result record. This module performs verification on the recognition results: first, it evaluates the results of a single recognition block using a dictionary database, checking whether the candidate text sequence belongs to characters, words, or common text combinations already existing in the dictionary database; then, it evaluates the results of a full-text database for text sequences formed by multiple recognition blocks on the same page, checking whether the contextual position of the current candidate text sequence in the full-text database is consistent with the page numbering order; the two types of processing results are merged into the result evaluation of the current recognition block. The joint judgment unit of this module reads the result evaluation: if the result evaluation is stable, it directly writes the entire page output sequence; if the joint judgment determines that there is a numbering conflict, insufficient dictionary database correspondence, inconsistent full-text database order, or abnormal connection of text sequences between adjacent blocks on the same page, it enters the reprocessing path. In the reprocessing path, if the current recognition block boundary is significantly too large or too small, or simultaneously covers adjacent character blocks, the recognition block boundary adjustment is performed first, and then the dynamic resolution OCR is invoked. If the current recognition block boundary is basically stable but the text sequence still has conflicts, the dynamic resolution OCR is invoked first, and then the boundary is locally reverted based on the new recognition result. The dynamic resolution OCR is only invoked for recognition blocks entering the reprocessing path. The input resolution is switched according to the character block density, stroke thickness, and boundary blurring state of the recognition block, and then the candidate recognition result is re-output. This module outputs a stable whole-page text sequence as the overall detection and recognition result, and sends back the recognition blocks that still need further adjustment after reprocessing as the input of the recognition blocks, forming a closed-loop processing chain from recognition block to recognition result to result evaluation to overall detection and recognition result and recognition block.

Claims

1. A method for intelligent recognition of ancient books and handwritten characters, characterized in that, include: S100: Scan the original pages of ancient books and documents to obtain full-page images, and perform rotation correction, data enhancement, noise reduction and standardization processing in sequence. Mark the positions of text areas, enter text and add numbers to obtain input images and text labels. S200. Based on the input image and text labels, the DBNet text detection model is used to perform text region segmentation and differentiable binarization processing to generate text box coordinates. The text blocks are classified as handwritten or printed. The correspondence between text regions, coordinates, categories and text labels is established to obtain text region, position results and classification results. S300. Based on the text region, position result and classification result, perform horizontal and vertical projection to generate projection blocks, perform connected component calculation and reference height calculation on the projection blocks to obtain sliding window parameters, slide the window according to the sliding window parameters and adjust the boundary to generate recognition blocks. S400. Based on the recognition block, the recognition result is obtained through unified character processing and SVTR text recognition. The result is evaluated by checking against the dictionary database and full-text database. Dynamic resolution OCR and recognition block boundary adjustment are triggered by joint judgment. The overall detection and recognition result and the recognition block that can be sent back are output.

2. The method according to claim 1, characterized in that, The process of performing rotation correction, data augmentation, noise reduction, and standardization, as well as marking the text regions, entering the text, and adding numbers to obtain the input image and text labels includes: The rotation correction process includes: reading the text line direction and page edge direction in the whole page image, and performing angle adjustment on the whole page image that is tilted; The data enhancement process includes adjusting image contrast, brightness, and sharpness; The denoising process includes: identifying and removing isolated noise points, edge artifacts, and non-text blocks from the input image; The standardization process includes: uniform image size, uniform page orientation, and uniform page storage format; The location annotation process includes: selecting text regions one by one on the preprocessed image and generating location annotation information corresponding to the page position; The text input processing includes: writing the selected text content into text record items according to the position labels, ensuring that the position labels and text content correspond to each item; The numbering process includes adding the same number to each location marker and corresponding text content, with the numbers set in page order to ensure that the selected content matches the entered text.

3. The method according to claim 2, characterized in that, The process of using the DBNet text detection model for text region segmentation and differentiable binarization to generate text box coordinates includes: The image input part receives the entire page image, the feature extraction part reads the text texture, character block edges and line region distribution, and the segmentation output part outputs the segmentation result corresponding to the text region; Based on the grayscale distribution and boundary distribution of the candidate regions, text and background separation is performed block by block in the candidate regions, preserving continuous areas of text blocks and compressing isolated noise areas; Extract the start and end positions, block range, and line range of the text region within the page to form text box coordinates that correspond to each item of the text region.

4. The method according to claim 3, characterized in that, The process of classifying character blocks into handwritten and printed styles, and establishing the correspondence between text regions, coordinates, categories, and text labels includes: The convolution operation is performed on the character blocks, the convolution output is normalized, and then two rounds of normalization, ReLU function processing and deconvolution operation are performed to distinguish the edges of handwritten characters from the edges of printed characters. Read the location annotations, text box coordinates, character block categories, and entered text item by item according to the added number, and organize the text area, location results, and classification results under the same number into a unified record.

5. The method according to claim 4, characterized in that, The process of generating projection blocks by performing horizontal and vertical projections includes: Perform a horizontal projection on the text region to obtain the row region boundary, then perform a vertical projection on each row region to obtain the column region boundary, and combine the row region boundary and the column region boundary to generate a projection block.

6. The method according to claim 5, characterized in that, The process of calculating the connected component and reference height of the projected block to obtain the sliding window parameters includes: The text pixels and background pixels in the projection block are read adjacently, and the connected pixel regions are merged into connected component blocks. According to the classification results, the connection reading range is widened for handwritten projection blocks and the connection reading range is kept tighter for printed projection blocks. Read the block height of all connected components within the same projection block or the same row region, and take the median as the reference height; The aspect ratio and overlap width are generated based on the reference height and the image size of the projected block.

7. The method according to claim 6, characterized in that, The process of sliding the window according to the sliding window parameters and adjusting the boundaries to generate the recognition block includes: Within the projection block, advance the sliding window according to the aspect ratio and overlap width, moving it along the page layout direction. When arranging horizontally, advance it horizontally; when arranging vertically, advance it vertically. After each advance, read the distribution of character block edges, background blanks, and connected component blocks within the currently covered area of ​​the sliding window. Based on the reference height, text box coordinate range, and classification results, the sliding window boundary is shrunk or expanded. For printed characters, the projection block is adjusted according to the regular boundary of the character block, and for handwritten characters, the projection block is adjusted according to the continuous boundary of the strokes. One or more adjusted sliding window areas are merged to form a recognition block. Each recognition block retains the corresponding projection block source, sliding window parameter source, page number, and classification result.

8. The method according to claim 7, characterized in that, The process of obtaining recognition results through Unified Character Processing and SVTR text recognition, and then evaluating the results by comparing them with dictionary databases and full-text databases, includes: The unified character processing includes: an image encoder reading image features of stroke shapes, character block boundaries and local background in the recognition block, and a language decoder outputting candidate character sequences based on the image features; The SVTR text recognition processing includes: calling the SVTR text recognition algorithm model on the printed text recognition block, reading local features and long-distance global dependencies, and then outputting the text sequence; The processing of the recognition results includes: writing the page number, classification result, position result and current text sequence corresponding to each recognition block into the recognition result record; The evaluation process for the results obtained from the dictionary database and full-text database verification includes: first, evaluating the results of a single recognition block using the dictionary database to check whether the candidate text sequence belongs to a character, word, or common text combination already existing in the dictionary database; then, evaluating the results of a text sequence formed by multiple recognition blocks on the same page using the full-text database to check whether the context position of the current candidate text sequence in the full-text database is consistent with the page numbering order; and finally, merging the results of the two types of processing into the result evaluation of the current recognition block.

9. The method according to claim 8, characterized in that, The process of triggering dynamic resolution OCR and adjusting the boundary of the recognition block through joint judgment includes: After the joint judgment unit reads and evaluates the results, if the evaluation is stable, it directly writes the entire page output sequence. If the joint judgment determines that there are numbering conflicts, insufficient dictionary database correspondence, discontinuous full-text database order, or abnormal text sequence connection between adjacent blocks on the same page, it enters the reprocessing path: If the current recognition block boundary range is significantly too large or too small, or simultaneously covers adjacent character blocks, the recognition block boundary adjustment processing is performed first, and then the dynamic resolution OCR is called; If the current recognition block boundary range is basically stable, but the text sequence still has conflicts, the dynamic resolution OCR is called first, and then the boundary is locally reverted according to the new recognition result; The dynamic resolution OCR is only called for recognition blocks that enter the reprocessing path, and the input resolution is switched according to the character block density state, stroke thickness state, and boundary blur state of the recognition block before re-outputting the recognition result candidate.

10. An intelligent recognition system for ancient books and handwritten characters, characterized in that, include: Image acquisition and preprocessing module, text detection and classification module, projection and sliding window module, recognition and proofreading module; The modules are connected in sequence to implement the method as described in any one of claims 1-9.