A document image shadow removal method based on attention-guided detail restoration

Through attention-oriented detailed repair methods, combined with multi-scale large-core attention mechanism and lightweight space-channel convolution, the problems of loss of details and high computational complexity when removing shadows in document images are solved, and the precise removal of shadows is achieved and the retention of details improves the processing power and readability of document images.

CN118898847BActive Publication Date: 2025-01-17XIAMEN UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411390566.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-08
Publication Date
2025-01-17
Estimated Expiration
2044-10-08

AI Technical Summary

Technical Problem

The prior art tends to cause image details to be lost when removing shadows in document images and has high computational complexity, limiting its potential in practical applications.

Method used

Adopting attention-oriented detailed repair method, shadow attention maps are generated through YCbCr color space transformation, combining multi-scale large-core attention mechanism and lightweight space-channel convolution, dynamically fuse shadow features and detailed information, and use end-to-end Training optimizes network parameters to achieve accurate shadow removal and retention of details.

Benefits of technology

Effectively remove complex shadows from document images, preserve key details, reduce computational complexity, improve shadow removal accuracy and image naturalness and readability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118898847B_ABST
    Figure CN118898847B_ABST
Patent Text Reader

Abstract

The present invention proposes a document image shadow removal method based on attention-guided detail restoration, comprising the following steps: step S1, using YCbCr color space transformation and brightness information to generate a shadow attention map as a label to identify the shadow area; step S2, through the shadow attention generation sub-network, using a multi-scale large-core attention mechanism, extracting shadow features, and obtaining an optimal attention map; step S3, dynamically fusing the optimal attention map and shadow features; step S4, through the detail refinement sub-network, using lightweight spatial channel convolution to calculate and restore image details; step S5, based on the loss function, optimizing network parameters through end-to-end training; step S6, using the trained network to perform shadow removal processing on the document image. The method aims to effectively remove complex shadows in document images while retaining image details, and to achieve this with low computational complexity.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of computer vision and image processing, and in particular to a document image shadow removal method based on attention-oriented detail restoration. Background Art

[0002] With the rapid development of digital informatization, the automatic processing and analysis of document images has become increasingly important. In practical applications, document images are often affected by shadows due to factors such as non-ideal lighting conditions, camera angles, and occlusions. These shadows reduce the readability of the image and hinder subsequent intelligent processing tasks such as document content analysis and optical character recognition. Although a variety of image processing techniques have been proposed to remove shadows from images, most methods still face challenges when processing document images. Existing techniques usually ignore key details in complex shadow areas and are prone to loss of image details while removing shadows. In addition, existing methods often have problems with large model parameters and high computational complexity, which limits their potential in practical applications. Summary of the invention

[0003] In order to solve the problems existing in the above-mentioned prior art, the present invention proposes a document image shadow removal method based on attention-guided detail restoration, corresponding to an attention-guided detail restoration network, which aims to effectively remove complex shadows in document images while retaining image details and achieving it with lower computational complexity.

[0004] The specific technical solutions are as follows:

[0005] A document image shadow removal method based on attention-guided detail restoration aims to remove complex shadows in document images and retain key details. It is used for document image shadow removal tasks and can effectively capture the edge details of non-uniform shadows, solve the problem of text detail loss in document image shadow removal, and remove shadows in a relatively lightweight way, thereby improving the ability of document image shadow removal.

[0006] The steps include:

[0007] Step S1, using YCbCr color space transformation and brightness information to generate a shadow attention map as a label to identify the shadow area;

[0008] Step S2: generate a sub-network through shadow attention, adopt a multi-scale large-core attention mechanism, extract shadow features, and obtain the optimal attention map;

[0009] Step S3, dynamically fusing the optimal attention map and shadow features;

[0010] Step S4, through the detail refinement subnetwork, using lightweight spatial channel convolution to calculate and restore image details; the lightweight spatial channel convolution includes a spatial reconstruction unit and a channel reconstruction unit processed in sequence; firstly, the spatial refinement feature is obtained by operating the spatial reconstruction unit, and then the channel refinement feature is obtained by operating the channel reconstruction unit;

[0011] The spatial reconstruction unit uses a separation-reconstruction operation to separate feature maps with different spatial content information, and uses a scaling factor in a group normalization layer GN to evaluate the information content of different feature maps with corresponding weights to obtain a refined spatial feature map;

[0012] The channel reconstruction unit adopts a split-transform-fusion operation to further reduce the redundancy of the refined spatial feature map along the channel size;

[0013] Step S5: Optimizing network parameters through end-to-end training based on the loss function;

[0014] Step S6: Use the trained network to perform shadow removal on the document image.

[0015] Furthermore, in step S1, the shadow attention map is generated using the YCbCr color space transformation and brightness information as a label. and clear images Convert to YCbCr color space , respectively and Then, the brightness deviation between the two based on the Y channel is calculated to obtain the real attention map , the process is expressed as:

[0016] (1)

[0017] (2).

[0018] Furthermore, in step S2, the shadow attention generation subnetwork is based on residual learning and consists of multiple multi-scale large-core attention mechanism layers MLKA to generate multi-granularity attention maps; the input image passes through several convolutional layers and multi-scale large-core attention modules MAB to obtain the optimal attention map. ;

[0019] The multi-scale large core attention module MAB consists of two multi-scale large core attention mechanism layers MLKA and layer normalization LN, and the process is as follows:

[0020]

[0021]

[0022] in, is an intermediate feature, is the final output feature.

[0023] Further, in step S3, the optimal attention map obtained in step S2 is , introduce dynamic fusion strategy, set parameter λ, and fuse the optimal attention map And the real attention map To get the final M, expressed as:

[0024] (3).

[0025] Furthermore, the spatial reconstruction unit firstly processes the input feature X using the GN layer to normalize it and obtains , then, a trainable affine transformation factor β is used to measure the variance of spatial pixels in each batch and channel; then, the weights are assigned to ,get , and then mapped to the range of (0,1) through the function Sigmoid(·) and the gate Gate(·), thus obtaining two types of weights w1 and w2, which are multiplied by X to obtain X w1 and X w2 ; Use the split operation Splitc(·) to split X w1 and X w2 Combined with the channel size, it is divided into different parts, and then cross-reconstructed to obtain the spatial refinement feature map X sr ;

[0026] The channel reconstruction unit refines the spatial feature map X sr The channel is divided into two parts with different proportions, where the channel is C and the proportion is a Indicates that the corresponding generation and , and then use two convolutional layers to transform and obtain the initial feature X t1 and X t2 ; for X t1 Perform Group-Wise convolution and Point-Wise convolution to extract high-level representative information ; For X t2 A Point-Wise convolution is used in combination with the CONCATENATE function to extract the hidden details of the shallow layer. ; Finally, SKNet adaptive merging is used and To obtain the final output Xcr.

[0027] Further, in step S5, the mean square error loss function l1 is used to represent the optimal attention map The corresponding real attention map The loss between , and add the optimal attention map The corresponding real attention map The gradient loss between , the two losses are expressed as:

[0028] (4)

[0029] (5).

[0030] Furthermore, in step S5, the parameters are set The generated attention map is used to help the model capture the structure of the shadow area and retain more details. The final attention map loss It is expressed as:

[0031] (6).

[0032] Further, in step S5, the reconstruction loss is used Evaluating prediction results and real images The quality between:

[0033] (7)

[0034] (8)

[0035] (9)

[0036] in, is the SSIM loss, λ1 and λ2 are the scale parameters;

[0037] The final optimization function It is expressed as:

[0038] (10).

[0039] An electronic device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the program.

[0040] A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that the computer program implements the steps of the above method when executed by a processor.

[0041] Compared with the prior art, the present invention and its preferred embodiment can accurately identify and remove complex shadows in document images while retaining key details in the image. The method uses color space theory and attention-oriented network structure to dynamically adjust the recognition and processing strategy of shadow areas to achieve fine removal of shadows. By analyzing the multi-scale features of shadows and combining dynamic fusion strategies, the present invention can effectively reduce the ambiguity problems caused by the existence of shadows. In addition, the application of lightweight spatial-channel convolution further optimizes the detail recovery process and reduces the computational complexity. The method not only improves the accuracy of shadow removal, but also maintains the naturalness and readability of document images.

[0042] It has the following design features or beneficial effects:

[0043] (1) The shadow attention map generated by color space conversion and brightness information can accurately identify the shadow area and provide accurate positioning information for shadow removal.

[0044] (2) By adopting the multi-scale large-kernel attention mechanism, this method can capture the shadow features at different scales and generate a more accurate attention map, thereby improving the shadow removal effect.

[0045] (3) The application of dynamic fusion strategy enables the model to adaptively adjust the attention weights during training, reducing the ambiguity caused by incorrect attention map predictions and improving the robustness of the model.

[0046] (4) The introduction of lightweight spatial-channel convolution optimizes the detail recovery process and reduces the consumption of computing resources, so that this method can process high-resolution document images while maintaining high efficiency.

[0047] (5) Through end-to-end training and optimization, this method can automatically learn the optimal strategy for removing shadows from document images without human intervention, thus improving the convenience and practicality of operation. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] The present invention is further described in detail below with reference to the accompanying drawings and specific embodiments:

[0049] Figure 1 It is a schematic diagram of the overall flow of the method of the embodiment of the present invention;

[0050] Figure 2 Schematic diagram of the real attention map generation process according to an embodiment of the present invention;

[0051] Figure 3 is a schematic diagram of the dynamic fusion process of an embodiment of the present invention;

[0052] Figure 4 It is a schematic diagram of the network structure of an embodiment of the present invention.

[0053] Figure 5 It is a schematic diagram of the shadow attention generation subnetwork structure according to an embodiment of the present invention.

[0054] Figure 6 It is a schematic diagram of the detail repair sub-network structure of an embodiment of the present invention. DETAILED DESCRIPTION

[0055] In order to make the features and advantages of this patent more obvious and easy to understand, the following embodiments are specifically described in detail with the accompanying drawings as follows:

[0056] like Figure 1-Figure 4 As shown, an embodiment of the present invention provides a document image shadow removal method based on attention-guided detail restoration, and its implementation process includes the following steps:

[0057] Step S1, using YCbCr color space transformation and brightness information to generate a shadow attention map as a label to identify the shadow area;

[0058] Step S2: generate a sub-network through shadow attention, adopt a multi-scale large-core attention mechanism, extract shadow features, and obtain the optimal attention map;

[0059] Step S3: Implement a dynamic fusion strategy to combine the optimal attention map and shadow features to alleviate the ambiguity problem;

[0060] Step S4, designing a detail refinement subnetwork, using lightweight spatial-channel convolution to reduce redundant calculations and restore image details;

[0061] Step S5: define a loss function and optimize network parameters through end-to-end training;

[0062] Step S6: Finally, use the trained network to perform shadow removal on the new image.

[0063] In step S1, the shadow attention map is generated using the YCbCr color space transformation and brightness information as a label. and clear images Convert to YCbCr color space ( ),get and Then, the present invention calculates the brightness deviation between the two based on the Y channel to obtain the real image of the attention map , this process can be expressed as:

[0064] (1)

[0065] (2)

[0066] In step S2, the shadow attention generation subnetwork is built on the basis of residual learning and consists of multiple multi-scale large core attention mechanism layers. The input image is generated through several convolutional layers and multi-scale large core attention modules. .

[0067] It consists of multiple multi-scale large kernel attention mechanism layers Multi-scale Large Kernel Attention (MLKA) to generate multi-granularity attention maps; the input image X passes through several convolutional layers and Multi-scale Attention Block (MAB) to obtain the optimal attention map ;

[0068] Among them, the multi-scale large core attention module consists of two multi-scale large core attention mechanism layers and layer normalization LayerNorm (LN). The process is as follows Figure 5 As shown, is an intermediate feature, is the final output feature:

[0069] .

[0070] Specifically, the multi-scale large core attention module is built on the basis of residual learning and consists of two multi-scale large core attention mechanism layers and layer normalization. The attention mechanism can make the neural network focus on key information and ignore irrelevant information. However, popular channel attention or spatial attention methods cannot model local information and long-term dependencies at the same time, and they often consider fixed received attention maps. Therefore, the multi-scale large core attention mechanism is introduced. The multi-scale large core attention mechanism can avoid the problem of long-term dependency and generate multi-granularity attention maps, and finally obtain the optimal attention map. .

[0071] Considering that the existing channel attention or spatial attention methods cannot simulate local information and long-range dependencies at the same time, they usually consider the attention map of a fixed receptive field. Therefore, different from the existing conventional Large Kernel Attention (LKA), the preferred LKA design provided by the embodiment of the present invention can be found in Figure 5 , expressed as follows:

[0072]

[0073] The multi-scale large kernel attention mechanism layer MLKA is obtained by introducing a multi-scale mechanism improvement based on the large kernel attention Large Kernel Attention (LKA): Figure 5As shown, for a given input feature X, it first passes through the PWconv layer and is divided into X1-X4 along the channel direction. For each feature group X i, Use LKA to generate uniformly scaled attention maps ; In this way, attention maps at different granularity levels can be better utilized to obtain fused features , and finally perform matrix element multiplication. The operation process of MLKA can be expressed as:

[0074]

[0075] Among them, Split() represents the decomposition operation, and Concat() represents the connection operation.

[0076] The above attention mechanism can achieve better shadow recognition and pay attention to more complex shadow distribution.

[0077] like Figure 3 As shown, in step S3, with the help of the learned attention map , which can effectively model complex distributed shadows. However, the context details in the shadow area are more likely to be destroyed, and the context details in the non-shadow area may be better preserved, so an ideal network should focus on the shadow area. And if the attention map is simply connected with the hidden features of the shadow image, this will lead to insufficient utilization of auxiliary information due to the lack of feature interaction. Finally, since multi-target prediction requires predicting the final clean image output and the optimal attention map , the learning ambiguity will be aggravated. Therefore, a dynamic fusion strategy is introduced here, and the parameter λ is set to fuse and To get the final M, the process can be expressed as:

[0078] (3)

[0079] The preferred implementation process of feature fusion in this scheme is to use a series of stacked residual blocks to extract basic image features f b And combine it with the optimal attention map M to obtain the fusion feature fr. During the training process, it is preferred to use a learnable parameter α to dynamically adjust the weights of different features to avoid learning ambiguity. The process can be expressed as:

[0080] .

[0081] In step S4, some tiny shadows and document image details (such as text and character content) are essentially high-frequency, and they inevitably have similar geometric characteristics. In order to reduce feature redundancy and refine details, the present invention designs a detail refinement subnetwork, in which the core module is a lightweight spatial channel convolutional layer, which is composed of two units, including a spatial reconstruction unit SRU and a channel reconstruction unit CRU, which are placed in sequence, as shown in the following example. Figure 6 As shown in the figure. Given an input feature X, the spatially refined features are first obtained by operating the spatial reconstruction unit, and then the channel-refined features are obtained by operating the channel reconstruction unit. The present invention reduces the spatial and channel redundancy between features in the lightweight spatial channel convolutional layer module. Each unit of this module contributes differently to the feature representation.

[0082] Specifically, in order to reduce the spatial redundancy of features, SRU adopts a "separation-reconstruction" operation: the separation operation aims to distinguish feature maps with large information content from feature maps with small information content corresponding to spatial content, and use the scaling factor in the group normalization layer (GN) to evaluate the information content of different feature maps with corresponding weights. In the specific implementation process, the input feature X is first normalized using the GN layer to obtain Then, a trainable affine transformation factor β is used to measure the variance of spatial pixels in each batch and channel. The richer the spatial information, the larger the value of β. Therefore, this embodiment adopts an adaptive method to assign normalized correlation weights:

[0083]

[0084] Where C is the number of feature map channels.

[0085] Afterwards, the weights are assigned to ,get , and then mapped to the range of (0,1) through the function Sigmoid(·) and the gate Gate(·), the threshold can be set to 0.5. Thus, two types of weights w1 and w2 are obtained, and after multiplying with X, X is obtained. w1 and X w2 These two features have different sensitivities to space. Therefore, the split operation Splitc(·) is used to divide the two combined channel sizes into different parts, and then a cross reconstruction operation is performed to reduce spatial redundancy. Finally, the final spatial refinement feature map X is obtained by combining the cross reconstruction technology. sr Therefore, the entire SRU mechanism is described by the following process:

[0086] .

[0087] In order to reduce the channel redundancy of features, CRU adopts the strategy of "split-transform-fusion" to further reduce the refinement of spatial feature map X sr Redundancy along the channel dimension. First, CRU will X sr The channel is divided into two parts with different proportions, where the channel is C and the proportion is represented by a, corresponding to the generated and , and then use two convolutional layers to transform them respectively to obtain the initial feature X t1 and X t2 . t1 Perform Group-Wise Convolution (GWC) and Point-Wise Convolution (PWC) to extract high-level representative information For X t2 A PWC combined with the CONCATENATE function is used to extract the shallow hidden details without paying extra cost, and the obtained Finally, SKNet adaptive merging is used and To obtain the final output Xcr. This method can use the channel-level descriptors in the pooling operation to generate feature importance vectors, thereby improving the robustness of the features. In general, CRU extracts rich representative features through lightweight convolution operations, while processing redundant features through cheap operations and feature reuse schemes, which can be expressed as:

[0088] .

[0089] Among them, Channel split performs the operation of the split() function.

[0090] The effect of retaining more details in the present invention is mainly produced through the above mechanism, which solves the problem of better removing shadow effects while avoiding detail loss.

[0091] In step S5, the mean square error loss function (l1) is used to represent the optimal attention map The corresponding real attention map Between , and in order to retain more details, we also added and The gradient loss between , the two losses can be expressed as:

[0092] (4)

[0093] (5)

[0094] In step S5, in order to make the generated attention map help the model capture the structure of the shadow area and retain more details, the parameters are set , the final attention map loss It can be expressed as:

[0095] (6)

[0096] In step S5, the present invention uses the reconstruction loss To evaluate the prediction results and real images In addition, in order to improve the output With real image The similarity and contrast of high-frequency regions between the two, the present invention adds SSIM loss , and set the parameters λ1 and λ2 respectively, and finally the complete It can be expressed as follows:

[0097] (7)

[0098] (8)

[0099] (9)

[0100] In step S5, the present invention will and Combined together, the final optimization function of the present invention is formed It can be expressed as:

[0101] (10)

[0102] In step S6, the document image to be de-shadowed is input, the image is processed through the complete network to generate an image after the shadow is removed, and a clear document image after the shadow is removed is output.

[0103] The method of the present invention has been verified in multiple public benchmarks and OCR performance tests. The experimental results show that it has superior performance in removing complex shadows and preserving details of document images, while maintaining the low complexity of the model, which is suitable for practical application scenarios.

[0104] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0105] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0106] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0107] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0108] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0109] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the relevant field should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents. Any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.

[0110] This patent is not limited to the above-mentioned optimal implementation mode. Anyone can derive various other forms of a document image shadow removal method based on attention-guided detail restoration under the inspiration of this patent. All equal changes and modifications made according to the scope of the patent application of the present invention should be covered by this patent.

Claims

1. A document image shadow removal method based on attention-guided detail restoration, characterized in that: The following steps are involved: Step S1, using YCbCr color space transformation and brightness information to generate a real attention map as a label to identify the shadow area; In step S1, the YCbCr color space transformation and brightness information are used to generate the real attention map as the label, where the shadow image is first and real images Convert to YCbCr color space , respectively and Then, the brightness deviation between the two based on the Y channel is calculated to obtain the real attention map , the process is expressed as: (1) (2) Step S2: generate a sub-network through shadow attention, adopt a multi-scale large-core attention mechanism, extract shadow features, and obtain the optimal attention map; In step S2, the input shadow image Obtain the optimal attention map by generating a sub-network through shadow attention ; The shadow attention generation subnetwork is composed of a convolutional layer, three multi-scale large-core attention modules MAB and a convolutional layer in sequence; The multi-scale large core attention module MAB consists of two multi-scale large core attention mechanism layers MLKA and layer normalization LN, and the process is as follows: in, is an intermediate feature, is the final output feature; X is the input feature of the multi-scale large-core attention module MAB; Step S3: The optimal attention map obtained by step S2 , introduce dynamic fusion strategy, set parameter λ, and fuse the optimal attention map And the real attention map To obtain the final optimal attention map M, expressed as: (3) And, based on the shadow image Use stacked residual blocks to extract basic image features f b ; Then, f b Combined with the optimal attention map M, the fusion feature f is obtained r ; During the training process, a learnable parameter α is used to dynamically adjust the weights of different features: ; Step S4: Through the detail refinement sub-network, the lightweight spatial channel convolution in the detail refinement sub-network is used to calculate and restore the image details; The lightweight spatial channel convolution includes a spatial reconstruction unit and a channel reconstruction unit processed sequentially; First, the spatial refinement feature is obtained by the spatial reconstruction unit operation, and then the channel refinement feature is obtained by the channel reconstruction unit operation; The spatial reconstruction unit uses a separation-reconstruction operation to separate feature maps with different spatial content information amounts, and uses a scaling factor in a group normalization layer, i.e., a GN layer, to evaluate the information content of different feature maps with corresponding weights to obtain a refined spatial feature map; The channel reconstruction unit adopts a split-transform-fusion operation to further reduce the redundancy of the refined spatial feature map along the channel size; The spatial reconstruction unit first normalizes the input feature X'' of the spatial reconstruction unit using a group normalization layer, i.e., a GN layer, to obtain ; Then, a trainable affine transformation factor β is used to measure the variance of spatial pixels in each batch and channel. The richer the spatial information, the larger the value of β, and the following adaptive method is used to assign normalized related weights: Where C is the number of feature mapping channels of the spatial reconstruction unit; Afterwards, The weights are assigned to ,get , and then mapped to the range of (0,1) through the function Sigmoid(·) and the gate Gate(·), thus obtaining two types of weights w1 and w2, which are multiplied by X'' to obtain X w1 and X w2 ; Use the split operation Splitc(·) to split X w1 and X w2 Combined with the channel size, it is divided into different parts, and then cross-reconstructed to obtain the spatial refinement feature map X sr ; The channel reconstruction unit reconstructs the spatial feature map X sr The channel is divided into two parts with different proportions, where the channel reconstruction unit channel is C' and the proportion is a Indicates that the corresponding generation and , and then use two convolutional layers to transform and obtain the initial feature X t1 and X t2 ; X t1 Perform Group-Wise convolution and Point-Wise convolution to extract high-level representative information ; For X t2 A Point-Wise convolution is used in combination with the CONCATENATE function to extract the hidden details of the shallow layer. ; Finally, SKNet adaptive merging is used and To obtain the final output Xcr of the lightweight spatial channel convolution; Step S5: Based on the loss function, optimize the network parameters of the complete network model formed by steps S1-S4 through end-to-end training; Step S6: Use the trained complete network model to perform shadow removal processing on the document image.

2. The document image shadow removal method based on attention-guided detail restoration according to claim 1, characterized in that: In step S5, the mean square error loss function l1 is used to represent the optimal attention map The corresponding real attention map The loss between , and add the optimal attention map The corresponding real attention map The gradient loss between , the two losses are expressed as: (4) (5)。 3. The method for removing shadows from document images based on attention-guided detail restoration according to claim 2, characterized in that: In step S5, set the parameters The optimal attention map M is used to help the complete network model capture the structure of the shadow area and retain more details. The final attention map loss It is expressed as: (6)。 4. The method for removing shadows from document images based on attention-guided detail restoration according to claim 3, characterized in that: In step S5, the reconstruction loss is used Evaluating prediction results and real images The quality between: (7) (8) (9) in, is the SSIM loss, λ1 and λ2 are the scale parameters; The final optimization function It is expressed as: (10)。 5. An electronic device 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, the steps of a document image shadow removal method based on attention-guided detail restoration as described in any one of claims 1 to 4 are implemented.

6. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of a document image shadow removal method based on attention-guided detail restoration as described in any one of claims 1 to 4 are implemented.

Citation Information

Patent Citations

  • Text image shadow elimination method based on background guidance

    CN116703757A

  • Construction drawing and as-built drawing comparison method and device, terminal equipment and storage medium

    CN117523594A