A character image restoration method, system and model training method

By introducing a condition tuning unit to modify the degradation restoration conditions and generating tuned restoration conditions, the problem of character content errors in text image restoration under severe degradation scenarios in the prior art is solved, and higher restoration accuracy and stability are achieved.

CN123160385APending Publication Date: 2026-11-24SHANGHAI JIAOTONG UNIV
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202611162491.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-03
Publication Date
2026-11-24

AI Technical Summary

Technical Problem

Existing text image restoration methods tend to produce visually clear but incorrect character content in severely degraded scenarios, lacking a mechanism for constraining and correcting using clear image information.

Method used

By introducing a conditional tuning unit, the degradation restoration conditions are tuned using a pre-trained conditional tuning unit to generate the tuned restoration conditions. Combined with the degradation image representation, image restoration is performed to generate a clear text image.

Benefits of technology

It improves the reliability of conditional information in the process of text image restoration, reduces character miswriting and stroke structure errors, and enhances the restoration accuracy and stability in severely degraded scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123160385A_ABST
    Figure CN123160385A_ABST
Patent Text Reader

Abstract

This application provides a method and system for text image restoration. The method includes: acquiring a degraded text image to be processed; extracting features from the degraded text image to obtain a degraded image representation; generating degraded restoration conditions based on the degraded image representation to represent text content, character layout, and glyph cues; adjusting the degraded restoration conditions through a pre-trained condition tuning unit to obtain tuned restoration conditions; and performing image restoration based on the degraded image representation and the tuned restoration conditions to generate a clear text image corresponding to the degraded text image. This application improves the reliability of conditional information during text image restoration through the process of conditional reference construction, degraded condition generation, condition tuning, and condition-driven restoration.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical fields of computer vision, image restoration, text image enhancement, text image super-resolution, and deep learning. Specifically, it relates to a text image restoration method, system, and model training method. Background Technology

[0002] Text image restoration aims to recover clear and readable text images from low-resolution, blurry, noisy, or compressed inputs. Unlike ordinary image restoration, text images are highly sensitive to character identity and stroke structure. Even a small number of missing, misaligned, joined, or incorrectly closed strokes can alter the meaning of a character.

[0003] Existing text image restoration methods typically extract text-related conditions from degraded input and use them as auxiliary information for the restoration network. However, in severely degraded scenarios, the visible strokes in the input image are incomplete, and the directly extracted conditions often contain incorrect character judgments or unstable glyph information. If these conditions are directly used for image restoration, the restoration network is prone to generating visually clearer results but with incorrect character content.

[0004] The training phase typically yields degraded images and their corresponding sharpened images. Sharpened images contain more complete character content, overall layout, and glyph structure information. Existing methods often use sharpened images as supervision for the final output, failing to fully utilize the reliable textual information within them to constrain and correct the restoration conditions obtained from the degraded input.

[0005] A search revealed a patent application (application number 202410565867.5) that discloses a global text image restoration method. This method constructs a latent causal model by combining a structural causal model with an attention mechanism, and uses an adaptive feature filtering module to control information flow, reconstructing damaged text from a global contextual level. However, the extracted restoration conditions are prone to bias in cases of severe degradation, and lack a mechanism to constrain and correct (adjust) these conditions using a clear image. Directly using biased conditions for decoding easily leads to miswritten characters in the restored result, failing to address the problem of character errors caused by unreliable conditions.

[0006] Therefore, a reference condition tuning method for text image restoration is needed, which enables the model to form condition references using clear sample information during the training phase, generate restoration conditions based solely on degraded images during the inference phase, and tune these conditions before entering the restoration network, thereby reducing the misleading effect of erroneous conditions on the restoration results. Summary of the Invention

[0007] In view of the shortcomings of the prior art, the purpose of this application is to provide a text image restoration method, system, and model training method.

[0008] A first aspect of this application provides a method for restoring text images, comprising: Obtain the degraded text image to be processed; Feature extraction is performed on the degraded text image to obtain a degraded image representation; Degradation restoration conditions are generated based on the described degraded image characterization; The degradation restoration conditions are tuned by a condition tuning unit that is trained in advance based on the restoration conditions reference, and the tuned restoration conditions are obtained. Image restoration is performed based on the degraded image representation and the adjusted restoration conditions to generate a clear text image corresponding to the degraded text image.

[0009] Optionally, the step of tuning the degradation recovery conditions using a pre-trained condition tuning unit to obtain tuned recovery conditions includes employing any of the following tuning methods: The compensation-type tuning method is as follows: the degradation restoration condition is taken as input, the condition adjustment amount is calculated and output by the condition tuning unit, and the condition adjustment amount is combined with the degradation restoration condition to obtain the tuned restoration condition. Alternatively, a mapping-based tuning method can be used, specifically by taking the degradation restoration conditions as input, performing feature mapping processing through the condition tuning unit, and directly outputting the tuned restoration conditions without explicitly outputting the adjustment amount.

[0010] Optionally, the step of performing image restoration based on the degraded image representation and the adjusted restoration conditions to generate a clear text image corresponding to the degraded text image includes: The adjusted restoration conditions are subjected to condition embedding processing to obtain embedded features; The degraded image representation is fused with the embedded features and input into a pre-trained image restoration unit; The clear text image is generated by the image restoration unit; The conditional embedding processing method includes at least one of feature splicing, attention modulation, conditional normalization, gating fusion, channel modulation, or spatial modulation.

[0011] Optionally, the condition tuning unit can be executed in a single-step forward calculation tuning or a multi-step iterative update tuning. The network that generates the degradation restoration conditions, the condition tuning unit, and the network that performs the image restoration can be implemented independently or in combination using convolutional networks, Transformer networks, attention networks, generative networks, or diffusion networks.

[0012] A second aspect of this application provides a training method for a text image restoration model, the model comprising a conditional tuning unit and an image restoration unit, the training method comprising: Obtain training sample pairs, which include degraded text images and corresponding clear text images; Feature extraction is performed on the degraded text image and the clear text image to obtain the degraded image representation and the clear image representation, respectively; A restoration condition reference is constructed based on the degraded image representation and the clear image representation; Degradation restoration conditions are generated based on the described degraded image characterization; The condition tuning unit is trained using the restoration condition reference, so that the condition tuning unit learns the difference between the degradation restoration condition and the restoration condition reference, and outputs the tuned restoration condition. The image restoration unit is trained using the clear text image, so that the image restoration unit generates clear text images under the guidance of the adjusted restoration conditions.

[0013] Optionally, constructing a restoration condition reference based on the degraded image representation and the clear image representation includes: The degraded image representation and the clear image representation are fused by stitching, weighted fusion, attention fusion, convolutional mapping or linear mapping to generate a fused representation; The restoration condition reference is generated based on the fusion representation and is used to express character content, character arrangement, coarse-grained glyph structure and overall text direction information.

[0014] Optionally, training the condition tuning unit using the restoration condition reference includes: The degradation restoration conditions and the restoration conditions are mapped to the same feature space; The adjusted restoration conditions are constrained by taking the restoration conditions as the direct monitoring target. The image restoration quality output by the image restoration unit is used as an indirect supervision target to constrain the condition tuning unit.

[0015] A third aspect of this application provides a text-image restoration system, comprising: The feature extraction module is used to extract features from the acquired degraded text image to obtain a degraded image representation; The degradation condition generation module is used to generate degradation restoration conditions for characterizing text content, character layout and glyph cues based on the degradation image representation; The condition tuning module is used to tune the degradation restoration conditions by using a condition tuning unit that has been pre-trained based on the restoration condition reference, so as to obtain the tuned restoration conditions. The image restoration module is used to restore the image based on the degraded image representation and the adjusted restoration conditions, and generate a clear text image corresponding to the degraded text image.

[0016] A fourth aspect of this application provides a terminal including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, can be used to perform any of the methods described above.

[0017] A fifth aspect of this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, can be used to perform any of the methods described above.

[0018] The text image restoration method provided in this application improves the reliability of conditional information during the text image restoration process through the process of conditional reference construction, degradation condition generation, condition tuning, and condition-driven restoration.

[0019] Other technical effects resulting from the additional features will be further illustrated in the corresponding embodiments. Attached Figure Description

[0020] Other features, objects, and advantages of this application will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings: Figure 1 This is a flowchart illustrating a text image restoration method according to an exemplary embodiment; Figure 2 This is a framework diagram illustrating a text image restoration method according to an exemplary embodiment; Figure 3 This is a flowchart illustrating a method for training a text image restoration model according to an exemplary embodiment. Detailed Implementation

[0021] The present application will now be described in detail with reference to specific embodiments. These embodiments will help those skilled in the art to further understand the present application, but do not limit the present application in any way. It should be noted that those skilled in the art can make several modifications and improvements without departing from the concept of the present application, and these all fall within the protection scope of the present application. Parts not described in detail in the following embodiments can be implemented using existing technology.

[0022] In existing text image restoration techniques, when the input image suffers from severe degradation (such as blurriness, low resolution, or noise contamination), the restoration conditions extracted directly from it often contain incorrect character judgments or incomplete glyph information. This makes it highly susceptible to being misled by erroneous conditions during the inference stage, resulting in visually clear images but with incorrect character content (i.e., "misspelled characters"). Based on the aforementioned problem of unreliable restoration conditions leading to errors in restored text content, this application provides a text image restoration method to solve the aforementioned problems.

[0023] Reference Figure 1 and Figure 2 As shown in one embodiment of this application, a method for restoring text images is provided, which can be implemented by the following steps: S100, Obtain the degraded text image to be processed; S200, feature extraction is performed on the degraded text image to obtain the degraded image representation; S300, Generate degradation restoration conditions based on the degradation image representation, wherein the degradation restoration conditions are feature vectors or feature maps used to represent text content, character layout and glyph cues; S400 tunes the degradation restoration conditions by using a condition tuning unit trained in advance based on restoration condition references, and obtains the tuned restoration conditions; wherein tuning is to modify the degradation restoration conditions to make them more suitable for image restoration.

[0024] S500 performs image restoration based on the degraded image characterization and the adjusted restoration conditions, generating a clear text image corresponding to the degraded text image.

[0025] In the above embodiment, step S400 introduces a pre-trained conditional tuning unit. Since this conditional tuning unit has fully learned and internalized reliable textual information (i.e., conditional references) from the clear image during the training phase, it can effectively compensate or map and correct the initially generated, biased degradation restoration conditions during actual inference, even if only a degraded image is input without relying on a clear reference image. This step fundamentally prevents erroneous conditions (such as incorrect strokes or missing structures) from misleading the subsequent restoration network, providing accurate character content and glyph guidance for image restoration in step S500. The resulting clear text image not only improves visual resolution but also significantly reduces phenomena such as character miswriting, stroke adhesion, breaks, and overall glyph drift, greatly improving the accuracy and stability of text image restoration in severely degraded scenarios.

[0026] In one specific embodiment of this application, S100, a degraded text image to be processed is obtained, specifically, a text image with degraded image quality is obtained as a degraded text image.

[0027] Degraded text images can originate from: low-quality text images captured directly in real-world scenes using photographic or scanning devices; or low-quality text images generated by applying degradation operations to clear text images.

[0028] The application scenarios for text images include documents, tickets, license plates, or natural scenes, and the text content includes Chinese, English, numbers, or symbols; image quality degradation is caused by at least one of the following factors: downsampling, blurring, noise, compression distortion, motion jitter, lighting disturbance, or background interference.

[0029] The degraded text images obtained in the above embodiments provide a carrier basis for subsequent image processing.

[0030] In one specific embodiment of this application, S200, feature extraction is performed on the degraded text image to obtain a degraded image representation, which can be achieved through the following steps: S201 performs preprocessing operations on the acquired degraded text image, such as size regularization, normalization, cropping, padding, or text region alignment, to adapt its size and data format to the input requirements of the subsequent neural network.

[0031] In step S202, the degraded text image preprocessed in step S201 is input into a pre-trained image representation extraction unit (or network). The image representation extraction unit extracts feature vectors or feature maps containing observable text information, local texture, and degradation interference features from the degraded text image through forward computation, serving as the degraded image representation.

[0032] Specifically, the image representation extraction unit here can independently adopt one of the following: convolutional network, Transformer network, attention network, generative restoration network, and diffusion restoration network, or it can adopt a combination of the above networks. This application does not make any specific limitations on this.

[0033] The above embodiments adapt the degraded text image to subsequent network processing in terms of size, data range, and text region location through input preprocessing, and obtain a degraded image representation containing observable text information, local texture, and degradation interference features through image representation extraction. This provides stable and uniform feature input for the generation of degradation restoration conditions and subsequent condition tuning, reducing the risk of unstable condition generation due to inconsistent input size, text region offset, or noise interference.

[0034] In order to infer preliminary textual structural information from the degraded image representation to guide subsequent image restoration, in a specific embodiment of this application, S300, degradation restoration conditions are generated based on the degraded image representation, which may specifically employ the following steps: S301, input the degraded image representation obtained in S200 into the pre-trained degradation condition generation unit to generate degradation restoration conditions.

[0035] Specifically, the degradation condition generation unit can be implemented by convolutional networks, Transformer networks, attention networks, generative restoration networks, diffusion restoration networks, or combinations thereof, without any specific limitation.

[0036] It should be noted that the degradation restoration condition includes the text content, character layout, and glyph cues inferred from the low-quality input. Since this condition is generated solely from the degraded text image and does not rely on any external clear reference images or human-generated text cues, it can be obtained directly during the inference stage. However, because it originates from a degraded image, this condition may be affected by blurring, noise, compression artifacts, missing strokes, or local deformations, leading to character identification errors or glyph instability. Therefore, subsequent steps are required for tuning and correction.

[0037] S302, in order to facilitate subsequent input to the condition tuning unit for processing, the degradation restoration conditions obtained in S301 are mapped to a preset feature space.

[0038] Specifically, if the feature dimension output by the degradation condition generation unit is different from the input dimension required by the condition tuning unit, then one or more of the projection layer, convolutional layer, pooling layer or upsampling layer are selected for dimension alignment based on the differences between the two in the number of channels, spatial size or sequence length, so that the degradation restoration conditions meet the input requirements of the condition tuning unit.

[0039] The above embodiments, by employing degradation condition generation technology, can obtain restoration conditions solely based on degraded text images during the inference stage, thus solving the problem of not being able to obtain clear reference images, manual text input, or fixed character templates in actual deployments.

[0040] Since the degradation restoration conditions are derived from the degraded text image, these conditions may be affected by blurring, noise, compression artifacts, missing strokes, or local deformation, resulting in character judgment bias, unstable character layout, or incomplete character structure clues. Therefore, directly inputting the degradation restoration conditions into the image restoration unit may mislead the restoration network with incorrect conditions, generating visually clear text images but with incorrect character content or stroke structure. Based on this, this application sets up a condition tuning unit to tune and correct the degradation restoration conditions.

[0041] In one specific embodiment of this application, in step S400, the degradation recovery conditions are tuned using a pre-trained condition tuning unit to obtain the tuned recovery conditions. The specific implementation process is as follows: The degradation restoration conditions are input into a pre-trained conditional tuning unit. It's important to note that during model training, the conditional tuning unit simultaneously receives both the "degradation restoration conditions" extracted from the degraded image and the "restoration condition reference" (i.e., complete and accurate textual structural information) constructed with the aid of a clear image. By comparing the two, the conditional tuning unit learns and masters the mapping rules of "how to correct biased degradation conditions into accurate conditions," and embeds these correction rules into its own network parameters.

[0042] Therefore, during the actual inference stage, even without inputting clear text images to provide reference for restoration conditions, the condition tuning unit can utilize the correction rules internalized into the network parameters to perform forward computation solely based on the input degenerate restoration conditions, automatically compensating for or mapping structural deviations. This allows the output tuned restoration conditions to accurately represent the true text content and glyph structure, effectively preventing subsequent image restoration networks from generating visually clear but incorrectly formatted images due to misleading conditions.

[0043] To specifically implement the above compensation or mapping operations, the condition tuning unit can use one of the following two tuning methods through its internal network when modifying the degradation restoration conditions: The compensatory tuning process is as follows: the condition tuning unit calculates and outputs a condition adjustment amount, such as residual features, based on the input degradation restoration conditions; then, this condition adjustment amount is combined with the input degradation restoration conditions, such as through element-wise addition, feature concatenation, or gated fusion, to obtain the tuned restoration conditions. This method can retain relatively reliable textual information in the degradation restoration conditions while specifically compensating for missing or unstable parts.

[0044] The mapping tuning process is as follows: the condition tuning unit performs feature mapping on the degradation restoration conditions through its internal network structure, without explicitly outputting intermediate condition adjustment amounts, but directly outputting the tuned restoration conditions. This method is suitable for scenarios with severe image degradation and significant differences between the degradation restoration conditions and the restoration condition reference, and can generate condition information more suitable for subsequent image restoration through feature mapping.

[0045] Furthermore, when performing the above tuning process, the execution strategy of condition tuning can be divided into two types: single-step tuning and multi-step tuning, depending on the computing power and real-time requirements of the actual application scenario.

[0046] Single-step tuning specifically involves completing conditional tuning through a single forward computation. This method has low computational overhead and low inference latency, making it suitable for online deployment scenarios with high real-time requirements, such as real-time video stream text enhancement.

[0047] Multi-step tuning specifically involves gradually optimizing degradation restoration conditions through small iterative updates, such as multiple forward computations or recurrent network structures. This method can further improve the stability of the restored conditions after tuning and is suitable for offline processing scenarios with high image quality requirements and sufficient computing power, such as high-precision digitization of historical documents.

[0048] It is important to emphasize that the condition tuning process in this application does not perform ordinary visual enhancement on the degraded text image itself, but rather corrects the intermediate condition information before image restoration. Ordinary image restoration typically focuses on texture, edges, color, or overall visual quality, while text image restoration also needs to maintain the consistency of character identity, stroke connections, closed structures, and character arrangement. For text images, even minor missing, misconnected, or misplaced strokes can alter the meaning of the characters. Therefore, this application first corrects the degradation restoration conditions through a condition tuning unit, and then applies the tuned restoration conditions to image restoration, thus demonstrating the technical characteristics that distinguish text image restoration from ordinary image processing.

[0049] Based on the above technical characteristics, it is worth noting that the design challenges of the conditional tuning unit are as follows: First, the degradation restoration conditions are not entirely incorrect conditions. They contain both valid textual cues that can still be observed from the degradation image and unreliable information introduced by blurring, noise, or compression artifacts. Therefore, they cannot be simply discarded or directly replaced. Second, clear textual images and restoration condition references cannot be obtained during the inference stage. The conditional tuning unit needs to complete the correction with only the degradation restoration conditions as input. Third, the degradation restoration conditions and restoration condition references may differ in the number of channels, spatial size, or sequence length. The differences between the two need to be learned in the same or mappable feature space. Fourth, the conditional tuning results must retain the valid information related to the original characters in the degradation input while suppressing the influence of incorrect character judgments, incorrect layouts, and unstable glyph cues on the restoration network.

[0050] Conversely, without a condition tuning stage, the degradation restoration conditions obtained by the degradation condition generation unit will directly participate in image restoration. When the degraded text image suffers from severe blurring, low resolution, compression artifacts, or missing strokes, erroneous character judgments, unstable layouts, or incorrect glyph clues in the degradation restoration conditions may be amplified by the image restoration unit, leading to problems such as miswritten characters, overlapping adjacent strokes, broken strokes, incorrect closed structures, or overall glyph drift in the restoration result. Conversely, by compensating for or mapping the degradation restoration conditions through the condition tuning unit, the misleading influence of unreliable conditions on the image restoration unit can be reduced, improving the readability and character structure stability of the restored text image.

[0051] To verify the effectiveness of the above design, a control scheme without the condition tuning unit can be set up in actual verification. The untuned degradation restoration conditions are directly input into the image restoration unit, and compared with the scheme including the condition tuning unit. Comparison metrics may include OCR recognition accuracy, normalized edit distance, perceptual similarity index, or structural similarity index. For example, in the RealCE test set's four-fold text image super-resolution verification, the scheme without the condition tuning unit but using only degradation conditions for direct restoration achieved an OCR recognition accuracy of 62.27% and a normalized edit distance of 0.8280. The scheme with the condition tuning unit improved the OCR recognition accuracy to 64.67%, the normalized edit distance to 0.8461, and the perceptual similarity index decreased from 0.2132 to 0.2028. The experimental data show that the condition tuning unit can improve the reliability of text restoration conditions and plays a role in reducing character errors, reducing stroke structure errors, and improving the stability of text restoration.

[0052] In summary, the above embodiments employ condition tuning techniques, which can compensate for or correct unreliable information caused by blurring, compression, noise, missing strokes, or local deformation in the degradation restoration conditions, reducing the risk of erroneous conditions misleading the restoration network. At the same time, this technique addresses the highly sensitive characteristics of character identity and stroke structure in text images by tuning text-related condition information before image restoration, thus distinguishing it from ordinary image processing methods that only focus on visual clarity.

[0053] In one specific embodiment of this application, in step S500, image restoration is performed based on the degraded image characterization and the adjusted restoration conditions to generate a clear text image corresponding to the degraded text image. This can be achieved through the following steps: S501, the adjusted restoration conditions are input into the condition embedding unit, and the adjusted restoration conditions are combined with the degraded image representation by using condition embedding methods such as feature splicing, attention modulation, condition normalization, gated fusion, channel modulation or spatial modulation, and then sent to the image restoration unit.

[0054] S502, the image restoration unit generates a restored image or restored features based on the input degraded image representation and the adjusted restoration conditions; wherein, the image restoration unit may adopt a convolutional structure, a Transformer structure, a generative structure or a diffusion structure.

[0055] S503 maps the restored features generated in S502 to pixel images to obtain clear text images.

[0056] Specifically, in the final output, for text line images, the restored result is output directly; for natural scene images, the restored text area is filled back into the original image for output.

[0057] The above embodiments, by employing conditionally embedded image restoration technology, can introduce more stable text content and coarse-grained glyph guidance during the restoration process, thereby reducing problems such as character miswriting, overall glyph drift, and inconsistent text structure. By combining restoration condition reference construction, degradation condition generation, condition tuning, and conditionally embedded restoration, the reliability of conditions in degenerate text image restoration is improved, overcoming the problem of unstable restoration results caused by directly using degradation conditions in existing methods.

[0058] Existing methods typically use only the corresponding clear image as pixel-level supervision for the final output during the model training phase, failing to fully utilize the complete and reliable textual structural information in the clear image to constrain and correct erroneous conditions obtained from degraded input. To address the aforementioned problem of insufficient information utilization during the training phase and enable the model to learn and master conditional tuning capabilities (to support the error correction process in the aforementioned inference phase), based on the same technical concept, another embodiment of this application provides a training method for a text image restoration model.

[0059] It should be clarified that the "text image restoration model" described in this application is the model used in the aforementioned inference stage, and its core structure includes: an image representation extraction unit, a degradation condition generation unit, a condition tuning unit, and an image restoration unit. Furthermore, during the training phase, a conditional reference construction unit is introduced to construct reliable supervision signals (this unit is only used during the training phase and is not relied upon during the inference phase). Figure 3 As shown, the training method includes the following steps: S1, Obtain training sample pairs, wherein the training sample pairs include degraded text images and corresponding clear text images; S2, feature extraction is performed on the degraded text image and the clear text image to obtain the degraded image representation and the clear image representation, respectively; S3, construct a restoration condition reference based on the degraded image representation and the clear image representation; S4, Generate degradation restoration conditions based on the degradation image characterization; S5, the condition tuning unit is trained using the restoration condition reference, so that the condition tuning unit learns the difference between the degradation restoration condition and the restoration condition reference, and outputs the tuned restoration condition. S6, the image restoration unit is trained using the clear text image, so that the image restoration unit generates a clear text image under the guidance of the adjusted restoration conditions.

[0060] By performing the training steps S1 to S6 described above, this application achieves the following beneficial effects: This application addresses the problem of unreliable restoration conditions generated from degraded input. Severe degradation leads to missing, broken, or overlapping character strokes, causing bias in restoration conditions extracted directly from degraded images. This invention corrects degradation conditions through a condition tuning mechanism, reducing the impact of erroneous conditions on the restoration results. It also addresses the problem of insufficient utilization of clear image information. Clear text images during the training phase contain more complete character content and glyph structure. This invention transforms this information into conditional references, using it not only for output supervision but also to guide the learning and tuning of degradation conditions. Furthermore, it addresses the problem of not being able to rely on clear reference images during the inference phase. This invention only inputs degraded text images during the inference phase, obtaining restoration conditions through degradation condition generation and condition tuning, without requiring manual text, fixed character templates, or clear reference images. Finally, it improves the restoration stability of severely degraded text images. By guiding the image restoration network with tuned restoration conditions, this invention reduces problems such as character miswriting, overall glyph drift, and inconsistent text structure.

[0061] It should be noted that the data preprocessing, degraded image feature extraction (the degraded part in S2), and the forward computation process of degradation restoration condition generation (S4) involved in the above training method are basically consistent with the corresponding steps and network structure in the aforementioned inference stage implementation (S100-S300). To avoid redundancy, the same parts will not be repeated here; only the steps specific to the training stage will be further described below.

[0062] In one specific embodiment of this application, S1 and S2 involve acquiring training sample pairs and performing dual-source feature extraction. Specifically, this means acquiring pairs of "degraded text images" and "clear text images" as training sample pairs. These are then input into the image representation extraction unit, whereby, in addition to obtaining the aforementioned degraded image representation, a clear image representation containing complete character content and glyph structure information is extracted.

[0063] In one specific embodiment of this application, S3, a restoration condition reference is constructed based on the degraded image representation and the clear image representation, which may specifically take the following steps: Degraded image representations and clear image representations are input condition reference construction units, and feature fusion is performed through methods such as stitching, weighted fusion, attention fusion, convolutional mapping or linear mapping to generate fused representations; The restoration condition reference is generated based on the fusion representation. This restoration condition reference expresses relatively reliable text restoration information (including accurate character content, arrangement, and coarse-grained glyph structure) that can be obtained during the training phase.

[0064] It is important to emphasize that the conditional reference construct unit only works during the training phase, serving as a "standard answer" to guide the learning of the conditional tuning unit. It is neither generated nor dependent on this reference during the actual reasoning phase.

[0065] In one specific embodiment of this application, S5 and S6 involve training the model using restored conditional references and clear text images, which can be achieved through the following steps: During training, restoration condition references can be used to constrain the tuned restoration conditions, and the final image restoration quality can be used to indirectly constrain the conditional tuning units. These two types of supervision can be used individually or in combination.

[0066] Specifically, the condition tuning unit is trained to compensate for or map the degradation restoration conditions using restoration condition references and image restoration targets as supervision. At the same time, clear text images are used to supervise the image restoration results, enabling the image restoration unit to generate clear text images under the guidance of the tuned conditions.

[0067] In one specific embodiment of this application, the training process and strategy for the model can be implemented in the following manner: Training the image representation extraction unit and the degradation condition generation unit: enables the image representation extraction unit to extract high-quality dual-source representations, and enables the degradation condition generation unit to generate adjustable degradation restoration conditions based solely on the degradation image representations.

[0068] Training Conditional Reference Constructor: Using paired training samples, the conditional reference constructor is able to generate reliable restoration conditional references from degraded image representations and sharp image representations.

[0069] Training Condition Tuning Unit: Using restoration condition reference and image restoration target as supervision, the training condition tuning unit compensates for or maps the degradation restoration conditions.

[0070] Training the image restoration unit: Supervise the image restoration results using clear text images, so that the image restoration unit can generate clear text images under the guidance of tuned conditions.

[0071] The aforementioned units can be trained in stages or jointly optimized after pre-training. Staged training helps stabilize the functions of each module, while joint optimization improves the overall restoration effect. Through the above training process, the conditional tuning unit acquires the ability to automatically correct errors even when separated from a clear image during the inference stage.

[0072] Based on the same technical concept, other embodiments of this application provide a text image restoration system, including: The characterization extraction module acquires the degraded text image to be processed; it performs feature extraction on the degraded text image to obtain the degraded image characterization. The degradation condition generation module generates degradation restoration conditions based on the degradation image representation; The condition tuning module tunes the degradation recovery conditions through a pre-trained condition tuning unit to obtain the tuned recovery conditions. The image restoration module restores the image based on the degraded image representation and the adjusted restoration conditions, generating a clear text image corresponding to the degraded text image.

[0073] The specific implementation techniques of each module / unit in the above examples of this application can be referred to the steps of the text image restoration method in the above embodiments, and will not be repeated here.

[0074] The preferred features in the above embodiments can be used individually in any embodiment, or in any combination thereof, provided they do not conflict with each other. Furthermore, parts not described in detail in the embodiments can be implemented using existing technologies.

[0075] The following examples and comparative examples will be used to further illustrate this application in order to better understand the above-mentioned technical solutions. It should be understood that the following are only some examples and are not intended to limit this application.

[0076] Example 1: Conditional tuning in text line image restoration First, prepare paired training samples. The training samples include degraded text line images and corresponding sharp text line images. Degraded text line images can be obtained from sharp text line images through degradation operations such as downsampling, blurring, noise reduction, and compression distortion, or they can come from real shooting or scanning scenes.

[0077] Then, feature extraction is performed on the degraded text line images and the clear text line images respectively to obtain degraded image representations and clear image representations. A restoration conditional reference is constructed based on the degraded image representations and the clear image representations. This reference is used to represent the more reliable text content, character layout, and coarse-grained glyph structure during the training phase.

[0078] Simultaneously, degradation restoration conditions are generated solely based on the degraded image representation. These conditions are then tuned using a condition tuning unit pre-trained based on restoration condition references, resulting in the tuned restoration conditions.

[0079] Finally, image restoration is performed based on the degraded image representation and the adjusted restoration conditions, outputting a clear text line image. During training, the restoration results can be supervised using the clear text line image, or the restoration conditions can be used to constrain the adjusted conditions.

[0080] During inference, only a degraded text line image is input, without a clear reference image. Feature extraction, degradation restoration condition generation, condition tuning, and image restoration are performed sequentially, ultimately outputting a clear text line image.

[0081] Example 2: Application in natural scenes or document text and images For natural scene images, text regions can be obtained first using text detection algorithms, and then cropped into image blocks to be restored. For document, invoice, or certificate images, page correction and text line segmentation can be performed first, and then each text block can be used as a degraded text image to be processed.

[0082] During the training phase, if a corresponding clear text image exists, the restoration condition reference is constructed according to Example 1, and the model is trained. During the inference phase, only low-quality text regions or text lines are received. Degradation restoration conditions are generated and condition tuning is performed to obtain the tuned restoration conditions. Then, image restoration is performed to output a clear text image.

[0083] This method does not require users to provide manually written text, does not require clear reference images to be input during the inference stage, and does not rely on fixed character templates. Therefore, the method provided in this application embodiment can be used as an independent text image enhancement step, or as a preprocessing step for OCR (Optical Character Recognition), document scanning, or natural scene text recognition.

[0084] Based on the same technical concept, in other embodiments of this application, a terminal is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it can be used to perform the above-described method or to run the above-described system.

[0085] Based on the same technical concept, in other embodiments of this application, a computer-readable storage medium is provided, on which a computer program is stored, which, when executed by a processor, can be used to perform the above-described method or to run the above-described system.

[0086] Optionally, the memory is used to store programs; the memory may include volatile memory, such as random-access memory (RAM), such as static random-access memory (SRAM), double data rate synchronous dynamic random-access memory (DDR SDRAM), etc.; the memory may also include non-volatile memory, such as flash memory. The memory is used to store computer programs (such as application programs and functional modules that implement the above methods), computer instructions, etc., and the aforementioned computer programs and computer instructions can be partitioned and stored in one or more memories. Furthermore, the aforementioned computer programs, computer instructions, data, etc., can be accessed by the processor.

[0087] The aforementioned computer programs, computer instructions, etc., can be stored in partitions within one or more memory locations. Furthermore, the aforementioned computer programs, computer instructions, data, etc., can be accessed by a processor.

[0088] A processor is used to execute a computer program stored in memory to implement the various steps of the methods involved in the above embodiments. For details, please refer to the relevant descriptions in the preceding method embodiments.

[0089] The processor and memory can be separate structures or integrated structures. When the processor and memory are separate structures, they can be coupled together via a bus.

[0090] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0091] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0092] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0093] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0094] The foregoing has described some specific embodiments of this application. It should be understood that this application is not limited to the specific embodiments described above, and those skilled in the art can make various modifications or variations within the scope of the claims, which do not affect the substantive content of this application. The above-described preferred features can be used in any combination without conflict.

Claims

1. A method for restoring text images, characterized in that, include: Obtain the degraded text image to be processed; Feature extraction is performed on the degraded text image to obtain a degraded image representation; Degradation restoration conditions are generated based on the degraded image representation, wherein the degradation restoration conditions are feature vectors or feature maps used to represent text content, character layout, and glyph cues; The degradation restoration conditions are tuned by a condition tuning unit that is trained in advance based on the restoration conditions reference, and the tuned restoration conditions are obtained. Image restoration is performed based on the degraded image representation and the adjusted restoration conditions to generate a clear text image corresponding to the degraded text image.

2. The method according to claim 1, characterized in that, The degradation restoration conditions are tuned by a condition tuning unit pre-trained based on restoration condition references to obtain the tuned restoration conditions. The following compensation tuning method or mapping tuning method is used: The compensation-type tuning method is as follows: the degradation restoration condition is taken as input, the condition adjustment amount is calculated and output by the condition tuning unit, and the condition adjustment amount is combined with the degradation restoration condition to obtain the tuned restoration condition. The mapping tuning method specifically involves taking the degradation restoration condition as input, performing feature mapping processing through the condition tuning unit, and directly outputting the tuned restoration condition without explicitly outputting the adjustment amount.

3. The method according to claim 1, characterized in that, The step of restoring the image based on the degraded image representation and the adjusted restoration conditions to generate a clear text image corresponding to the degraded text image includes: The adjusted restoration conditions are subjected to condition embedding processing to obtain embedded features; The degraded image representation is fused with the embedded features and input into a pre-trained image restoration unit; The clear text image is generated by the image restoration unit; The conditional embedding processing method includes at least one of feature splicing, attention modulation, conditional normalization, gating fusion, channel modulation, or spatial modulation.

4. The method according to claim 1, characterized in that, The condition tuning unit is executed in either a single-step forward calculation tuning or a multi-step iterative update tuning. The network that generates the degradation restoration conditions, the condition tuning unit, and the network that performs the image restoration can be implemented independently or in combination using convolutional networks, Transformer networks, attention networks, generative networks, or diffusion networks.

5. A training method for a text image restoration model, characterized in that, The text image restoration model is used to implement the method described in claim 1; The text image restoration model includes an image representation extraction unit, a degradation condition generation unit, a condition tuning unit, and an image restoration unit; The training method includes: Obtain training sample pairs, which include degraded text images and corresponding clear text images; Feature extraction is performed on the degraded text image and the clear text image to obtain the degraded image representation and the clear image representation, respectively; A restoration condition reference is constructed based on the degraded image representation and the clear image representation; Based on the degraded image representation, degradation restoration conditions are generated to represent text content, character layout, and glyph cues; The condition tuning unit is trained using the restoration condition reference, so that the condition tuning unit learns the difference between the degradation restoration condition and the restoration condition reference, and outputs the tuned restoration condition. The image restoration unit is trained using the clear text image, so that the image restoration unit generates clear text images under the guidance of the adjusted restoration conditions.

6. The training method according to claim 5, characterized in that, The construction of restoration condition references based on the degraded image representation and the clear image representation includes: The degraded image representation and the clear image representation are fused by stitching, weighted fusion, attention fusion, convolutional mapping or linear mapping to generate a fused representation; The restoration condition reference is generated based on the fusion representation and is used to express character content, character arrangement, coarse-grained glyph structure and overall text direction information.

7. The training method according to claim 5, characterized in that, The step of training the condition tuning unit using the restoration condition reference includes: The degradation restoration conditions and the restoration conditions are mapped to the same feature space; The adjusted restoration conditions are constrained by taking the restoration conditions as the direct monitoring target. The image restoration quality output by the image restoration unit is used as an indirect supervision target to constrain the condition tuning unit.

8. A text-image restoration system, characterized in that, include: The characterization extraction module acquires the degraded text image to be processed; Feature extraction is performed on the degraded text image to obtain a degraded image representation; The degradation condition generation module generates degradation restoration conditions based on the degradation image representation to represent text content, character layout, and glyph cues. The condition tuning module tunes the degradation restoration conditions in advance using a condition tuning unit trained based on restoration condition references, thereby obtaining the tuned restoration conditions. The image restoration module restores the image based on the degraded image representation and the adjusted restoration conditions, generating a clear text image corresponding to the degraded text image.

9. A terminal, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it can be used to perform the method of any one of claims 1-7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the program can be used to perform the method of any one of claims 1-7.

Citation Information

Patent Citations

  • Global character image restoration method and device, and medium

    CN118154476A