Image crease removing method and device and storage medium
Through the image decreasing method based on the U-Net model, the crease areas in the document are automatically judged and eliminated, and the problems of poor crease processing, slow speed and low degree of automation in the prior art are solved, and efficient and automated document image decreasing effect is achieved.
Patent Information
- Application Number
- CN202510096135.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-21
- Publication Date
- 2025-05-13
AI Technical Summary
When dealing with crease problems in paper documents, the prior art has poor results, slow speed and difficult to automate, and cannot meet the efficient and automation needs of modern document digitization and management.
A method of image de-creasing based on U-Net model is proposed. By obtaining the crease image dataset and background image dataset, the U-Net model is modelly trained, the feature parameters and weighted pixel loss values of the detected image are obtained, and the crease area is automatically judged and eliminated, so as to realize the full process automation.
It realizes efficient and automated image decreasing, and the decreasing effect is more natural, suitable for large-scale document processing, improving image quality and processing efficiency.
Smart Images

Figure CN119991512A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image technology, and in particular to an image crease removal method, device and storage medium. Background Art
[0002] In the process of document digitization and management, the crease problem of paper documents poses a significant challenge to image quality, processing efficiency and automation. The presence of creases can cause the document content to be blurred, incomplete or unreadable, seriously affecting the image quality after copying and scanning, and reducing the readability and usability of the document. When performing OCR (Optical Character Recognition), creases may interfere with the accuracy of character recognition and even cause the characters to be unable to be correctly recognized, further affecting the efficiency of document digitization.
[0003] Traditional image processing methods show obvious limitations when dealing with crease problems. For example, although filtering technology can smooth images, it is often unable to effectively remove creases for complex crease structures, and may instead blur important information in the document. Edge detection algorithms can locate creases, but are prone to misjudgment or omission when dealing with large-area creases, resulting in poor repair effects. Image restoration technology can restore damaged areas to a certain extent, but for complex crease types and large-area creases, its repair effect is not ideal, and its processing speed is slow, making it difficult to meet the needs of large-scale document processing.
[0004] In addition, the traditional method has a low degree of automation and requires manual intervention for parameter adjustment and effect evaluation, which further limits its efficiency and applicability in practical applications. Although manual repair has certain advantages in accuracy, it is time-consuming, inefficient, and easily leads to inconsistent repair results due to human factors. For documents containing a large number of creases, manual repair requires page-by-page inspection and repair, which not only consumes a lot of time, but also makes it difficult to meet the requirements of large-scale batch processing.
[0005] In practical applications, the crease problem not only affects the visual effect of the image, but also interferes with the logical structure analysis of the document. For example, creases may cause errors in the position recognition of text blocks, paragraphs, and lines, and even affect the reconstruction of tables and the recognition of elements such as images and barcodes. The contrast and direction of creases may also increase the difficulty of processing. Some creases have unclear contrast and are difficult to detect and repair by conventional methods. At the same time, the direction of creases is complex and changeable, and may overlap with the text direction or image edge in the document, further increasing the complexity of repair.
[0006] The type and distribution of creases also place higher demands on the processing methods. Creases may appear anywhere in the document, including text areas, image areas or blank areas, and may take different forms, such as straight lines, curves or staggered forms. These complex crease types pose severe challenges to the robustness and adaptability of image processing algorithms. Traditional methods often find it difficult to process multiple types of creases at the same time, especially when creases are intertwined with document content, which can easily lead to misoperation or incomplete repair.
[0007] In large-scale document processing scenarios, the impact of crease problems is more significant. For example, in archives, libraries or corporate document management, a large number of paper documents need to be digitized. The presence of creases not only reduces the image quality, but also increases processing time and cost. The inefficiency and non-automatic characteristics of traditional methods make crease repair a bottleneck in the document digitization process. In addition, inconsistency in crease repair may also lead to errors in subsequent processing processes. For example, in the process of document classification, retrieval and analysis, documents whose creases have not been effectively repaired may be misjudged or missed.
[0008] In summary, the crease problem of paper documents poses a significant challenge to image quality, processing efficiency and degree of automation during the digitization and management process. Traditional image processing methods and manual repair methods have the defects of poor effect, slow speed and difficulty in automation when facing complex creases and large-scale document processing, which makes it difficult to meet the efficiency and automation requirements of modern document digitization and management. Summary of the invention
[0009] The present invention aims to solve at least one of the technical problems existing in the prior art.
[0010] To this end, one object of the present invention is to propose a method for removing creases from an image. The method is based on weighted pixel loss value detection in a network model and the entire process of eliminating crease areas in the detected image has a high degree of automation, does not require human intervention, and is suitable for large-scale document processing.
[0011] To this end, a second object of the present invention is to provide a device for removing creases from an image.
[0012] To this end, a third object of the present invention is to provide a computer-readable storage medium.
[0013] In order to achieve the above-mentioned purpose, an embodiment of the first aspect of the present invention proposes a method for removing creases from an image, and the method for removing creases from an image comprises: obtaining a crease image dataset and a background image dataset; performing model training on a U-Net model based on the crease image dataset and the background image dataset to determine a network model; obtaining feature parameters of a detection image and a weighted pixel loss value of the network model; and eliminating creases in the area of the detection image where the feature parameters are preset feature parameters based on the weighted pixel loss value to determine a decreased image.
[0014] According to the image decrease method of the embodiment of the present invention, by obtaining a crease image dataset and a background image dataset, a U-Net model is trained according to the crease image dataset and the background image dataset, the network model is determined, the feature parameters of the detection image and the weighted pixel loss value of the network model are obtained, the network model automatically determines whether there is a region in the detection image whose feature parameters are preset feature parameters to detect the crease region, eliminates the creases in the crease region according to the weighted pixel loss value, and effectively retains the details and structural information of the detection image to obtain a decrease image, and the decrease effect is more natural. The whole process of detecting and eliminating the crease region in the detection image based on the weighted pixel loss value in the network model has a high degree of automation, does not require human participation, and is suitable for large-scale document processing.
[0015] In some embodiments, a U-Net model is trained according to the crease image dataset and the background image dataset to determine the network model, including: performing image enhancement and normalization processing on the crease image to obtain an enhanced crease image; extracting a first feature parameter of the enhanced crease image and a second feature parameter of the background image; determining initial pixel loss values of the enhanced crease image and the background image according to the first feature parameter and the second feature parameter; determining an initial weighted pixel loss value according to the initial pixel loss value and a weight parameter; when the initial weighted pixel loss value satisfies a preset pixel loss value range and reaches a preset number of times, the network model is obtained.
[0016] In some embodiments, when determining the initial pixel loss values of the enhanced crease image and the background image according to the first feature parameter and the second feature parameter, the first feature parameter and the second feature parameter are substituted into the following formula: , in, is the first initial pixel loss value, is the total number of pixels of the enhanced crease image, is the first pixel values, is the background image pixel values.
[0017] In some embodiments, when determining the initial pixel loss values of the enhanced crease image and the background image according to the first feature parameter and the second feature parameter, the first feature parameter and the second feature parameter are substituted into the following formula: , in, is the second initial pixel loss value, Represents the first Layer features, is the number of feature layers, is the pixel value of the enhanced crease image, is the pixel value of the background image.
[0018] In some embodiments, when determining the initial pixel loss values of the enhanced crease image and the background image according to the first feature parameter and the second feature parameter, the first feature parameter and the second feature parameter are substituted into the following formula: , in, is the third initial pixel loss value, is the pixel value of the enhanced crease image, is the pixel value of the background image.
[0019] In some embodiments, when determining the initial pixel loss values of the enhanced crease image and the background image according to the first feature parameter and the second feature parameter, the first feature parameter and the second feature parameter are substituted into the following formula: , in, is the fourth initial pixel loss value, is the scale number of the enhanced crease image, For the The scale weight of the layer scale, is the pixel value of the enhanced crease image, is the pixel value of the background image.
[0020] In some embodiments, the initial pixel loss value includes a first initial pixel loss value, a second initial pixel loss value, a third initial pixel loss value, and a fourth initial pixel loss value. When determining the first initial pixel loss value of the enhanced crease image and the background image according to the first feature parameter and the second feature parameter, the first feature parameter and the second feature parameter are substituted into the following formula: , in, is the first initial pixel loss value, is the total number of pixels of the enhanced crease image, is the first pixel values, is the background image pixel value; When determining the second initial pixel loss values of the enhanced crease image and the background image according to the first feature parameter and the second feature parameter, the first feature parameter and the second feature parameter are substituted into the following formula: , in, is the second initial pixel loss value, Represents the first Layer features, is the number of feature layers, is the pixel value of the enhanced crease image, is the pixel value of the background image; When determining the third initial pixel loss value of the enhanced crease image and the background image according to the first feature parameter and the second feature parameter, the first feature parameter and the second feature parameter are substituted into the following formula: , in, is the third initial pixel loss value, is the pixel value of the enhanced crease image, is the pixel value of the background image; When determining the fourth initial pixel loss value of the enhanced crease image and the background image according to the first feature parameter and the second feature parameter, the first feature parameter and the second feature parameter are substituted into the following formula: , in, is the fourth initial pixel loss value, is the scale number of the enhanced crease image, For the The scale weight of the layer scale, is the pixel value of the enhanced crease image, is the pixel value of the background image; When determining the initial weighted pixel loss value according to the initial pixel loss value and the weight parameter, the initial pixel loss value and the weight parameter are substituted into the following formula: , in, is the weighted pixel loss value, is the first weight parameter, is the first initial pixel loss value, is the second weight parameter, is the second initial pixel loss value, is the third weight parameter, is the third initial pixel loss value, is the fourth weight parameter, is the fourth initial pixel loss value.
[0021] In some embodiments, the network model includes an encoder to obtain feature parameters of the detection image, including: the encoder extracting a third feature parameter of the detection image, or the encoder adjusting the resolution of the detection image to extract the third feature parameter of the detection image, wherein the third feature parameter includes a crease mask.
[0022] In some embodiments, the network model includes an encoder to obtain feature parameters of the detection image, including: after the encoder extracts the third feature parameter of the detection image, it adjusts the resolution of the detection image and extracts the third feature parameter again, wherein the third feature parameter includes a crease mask.
[0023] In some embodiments, the network model also includes a decoder, which eliminates creases in the area where the feature parameters in the detection image are preset feature parameters according to the weighted pixel loss value to determine the de-creased image, including: the decoder eliminates creases in the area where the crease mask in the detection image is a preset crease mask according to the weighted pixel loss value until the weighted pixel loss value meets the preset pixel loss value range and reaches a preset number of times to determine the de-creased image.
[0024] In some embodiments, after obtaining the decreased image, the method further includes: performing equalization processing and / or enhancement processing on the decreased image.
[0025] In order to achieve the above-mentioned purpose, an embodiment of the second aspect of the present invention proposes an image decrease device, which includes: a first acquisition module, used to acquire a crease image dataset and a background image dataset; a first determination module, used to perform model training on a U-Net model based on the crease image dataset and the background image dataset, and determine the network model; a second acquisition module, used to acquire feature parameters of a detection image and a weighted pixel loss value of the network model; a second determination module, used to eliminate creases in the area of the detection image where the feature parameters are preset feature parameters based on the weighted pixel loss value, so as to determine the decreased image.
[0026] According to the image decrease device of the embodiment of the present invention, by acquiring a crease image dataset and a background image dataset, a U-Net model is trained according to the crease image dataset and the background image dataset, a network model is determined, and feature parameters of the detection image and a weighted pixel loss value of the network model are acquired. The network model automatically determines whether there is a region in the detection image whose feature parameters are preset feature parameters to detect the crease region, eliminates the creases in the crease region according to the weighted pixel loss value, and effectively retains the details and structural information of the detection image to obtain a decrease-free image with a more natural decrease effect. The whole process of detecting and eliminating the crease region in the detection image based on the weighted pixel loss value in the network model has a high degree of automation, does not require human intervention, and is suitable for large-scale document processing.
[0027] In order to achieve the above-mentioned purpose, an embodiment of the third aspect of the present invention proposes a computer-readable storage medium, on which a de-crease program for an image is stored. When the de-crease program for an image is executed by a processor, the de-crease method for an image described in the above-mentioned embodiment is implemented.
[0028] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which: Figure 1 is a flow chart of a method for removing creases from an image according to an embodiment of the present invention; Figure 2 is a flow chart of a method for removing creases from an image according to a specific embodiment of the present invention; Figure 3 It is a structural block diagram of an image decrease device according to an embodiment of the present invention.
[0030] Reference numerals: Image decrease device 2; A first acquisition module 21; a first determination module 22; a second acquisition module 23; and a second determination module 24. DETAILED DESCRIPTION
[0031] Embodiments of the present invention are described in detail below. The embodiments described with reference to the accompanying drawings are exemplary. Embodiments of the present invention are described in detail below.
[0032] Deep learning technology has gradually developed, especially CNN (Convolutional Neural Networks), which has been widely used in image restoration, denoising and enhancement, providing a new method for solving complex image de-crease problems. U-Net, as an efficient deep learning model, has good image feature extraction and reconstruction capabilities, and has performed well in medical image segmentation, image denoising and other fields.
[0033] Combine the following Figure 1-Figure 2 A method for removing creases from an image according to an embodiment of the present invention is described.
[0034] like Figure 1 As shown, the image crease removal method of the embodiment of the present invention at least includes steps S1 to S4.
[0035] Step S1, obtaining a crease image dataset and a background image dataset.
[0036] In an embodiment, a document image dataset containing various types of creases is collected. The dataset should contain a variety of different crease forms, such as crease images containing fine creases, heavy creases, longitudinal creases, cross creases, etc., to form a crease image dataset, and background images containing plain text, patterns, tables, etc. to form a background image dataset. By acquiring a large number of crease image datasets and corresponding background image datasets without creases, data support is provided for subsequent model training.
[0037] Step S2, training the U-Net model according to the crease image dataset and the background image dataset to determine the network model.
[0038] In an embodiment, after obtaining a crease image dataset and a background image dataset, a U-Net model is trained according to the crease image dataset and the background image dataset to determine a network model. The determined network model can cope with crease processing of various types and complex backgrounds, and has strong generalization ability, adaptability and robustness.
[0039] The network model can choose the Adam (Adaptive Moment Estimation) optimizer for training, and use an adaptive learning rate adjustment strategy or a cosine annealing learning rate decay strategy to improve the stability of model training. On a large-scale GPU (Graphics Processing Unit) server, the batch gradient descent method is used to set an appropriate batch size, such as 16 or 32, for model training. During the training process, the validation set is used to monitor the loss and performance indicators to prevent overfitting, and the early stopping strategy is used to improve the generalization ability of the network model.
[0040] Step S3, obtaining the feature parameters of the detection image and the weighted pixel loss value of the network model.
[0041] Among them, the weighted pixel loss value is the loss value determined by optimizing the network model by introducing multiple loss functions and combining it with a multi-scale fusion strategy.
[0042] In an embodiment, the detection image can be a single-channel or three-channel scanned document image or a copied document image, and feature parameters in the detection image are extracted so as to determine whether there is a crease area in the detection image based on the feature parameters; after determining the network model, the network model determines the weighted pixel loss value based on the de-crease requirements using multi-loss function optimization and multi-scale fusion strategy, thereby effectively improving the image restoration quality and perceptual consistency.
[0043] The network model can also use crease image datasets and background image datasets of different scales to perform multiple decrease processes on the same test image, and fuse the multi-scale decrease results, such as weighted averaging, to determine the weighted pixel loss value.
[0044] Step S4, according to the weighted pixel loss value, eliminates the creases in the area where the characteristic parameters in the detection image are the preset characteristic parameters, so as to determine the decrease image.
[0045] In an embodiment, after obtaining the feature parameters of the detection image and the weighted pixel loss value of the network model, it is determined whether there is an area in the detection image whose feature parameters are preset feature parameters. If the preset feature parameters exist in the detection image, it is considered that the area where the preset feature parameters are located is a crease area, and the crease area is eliminated according to the weighted pixel loss value, thereby significantly improving the effect and efficiency of de-crease of the detection image. The detection image after the creases are eliminated is determined to be a de-crease image, and the de-crease image can restore the original clarity and integrity of the document image.
[0046] According to the image decrease method of the embodiment of the present invention, by obtaining a crease image dataset and a background image dataset, a U-Net model is trained according to the crease image dataset and the background image dataset, the network model is determined, the feature parameters of the detection image and the weighted pixel loss value of the network model are obtained, the network model automatically determines whether there is a region in the detection image whose feature parameters are preset feature parameters to detect the crease region, eliminates the creases in the crease region according to the weighted pixel loss value, and effectively retains the details and structural information of the detection image to obtain a decrease image, and the decrease effect is more natural. The whole process of detecting and eliminating the crease region in the detection image based on the weighted pixel loss value in the network model has a high degree of automation, does not require human participation, and is suitable for large-scale document processing.
[0047] In some embodiments, a U-Net model is trained based on a crease image dataset and a background image dataset to determine a network model, including: performing image enhancement and normalization processing on the crease image to obtain an enhanced crease image; extracting a first feature parameter of the enhanced crease image and a second feature parameter of the background image; determining initial pixel loss values of the enhanced crease image and the background image based on the first feature parameter and the second feature parameter; determining an initial weighted pixel loss value based on the initial pixel loss value and a weight parameter; and obtaining a network model when the initial weighted pixel loss value satisfies a preset pixel loss value range and reaches a preset number of times.
[0048] In an embodiment, after obtaining a crease image dataset and a background image dataset, image enhancement is performed on the crease image, including but not limited to data enhancement operations such as rotation, flipping, scaling, adding noise, adjusting brightness and contrast, etc. The crease image after image enhancement retains the original crease features and increases the diversity of image data. At the same time, the crease image is normalized to normalize the pixel values to the range of [0, 1]. At the same time, the image size is adjusted to, for example, 256x256 or 512x512 to unify the input format, and an enhanced crease image is obtained to facilitate network model training and improve the robustness of the network model.
[0049] Extract the first characteristic parameter of the enhanced crease image, such as the total number of pixels , pixel value and the second characteristic parameters of the background image, such as pixel values The above parameters are respectively brought into different initial pixel loss value calculation formulas to determine the pixel-level error between the enhanced crease image and the background image, where the background image is an ideal output image without creases; according to the decrease requirements such as MSE (Mean-Square Error) loss, SSIM (Structural Similarity) loss, perceptual loss, etc., different initial pixel loss values are fused together by weighted summation to determine the initial weighted pixel loss value, which effectively improves the image restoration quality and perceptual consistency.
[0050] Observe the changes in the initial weighted pixel loss value after fusion during the training process. If the initial weighted pixel loss value gradually decreases and tends to be stable with the training iterations, it usually means that the network model has learned enough features. In order to ensure the effect of the training, not only rely on the loss function, but also use some image quality evaluation indicators to measure the effect of de-crease. For example, PSNR (Peak Signal-to-Noise Ratio) is one of the standard indicators for measuring image quality. It is usually used to evaluate image reconstruction tasks such as denoising and de-crease. If the PSNR value is high, it means that the quality of the reconstructed image is good. During the training process, the PSNR value should gradually increase and tend to be stable. If the PSNR value is stable at a high level, it usually means that the image quality has reached a good level.
[0051] In order to prevent overfitting and save training time, early stopping technology is used in the training process. The early stopping strategy defines a tolerance based on the performance on the validation set. For example, when the loss value of the 200 initial weighted pixels does not improve significantly, it is considered that the performance of the validation set will no longer improve during the training process, so the training is stopped early to obtain the network model.
[0052] During the training process, some hyperparameters such as learning rate, batch size, network depth, etc. are adjusted, and the performance of the network model on the validation set is monitored to optimize the training process. During the training process, the hyperparameters are dynamically adjusted according to the performance of the training curve to further improve the effect of the model. The initial learning rate can be set to 10-3, the batch size to 16, the network depth to 4 layers, the convolution kernel size to 3×3, and the step size to 1.
[0053] In some embodiments, when determining the initial pixel loss values of the enhanced crease image and the background image according to the first feature parameter and the second feature parameter, the first feature parameter and the second feature parameter are substituted into the following formula: , in, is the first initial pixel loss value, To enhance the total number of pixels of the crease image, To enhance the crease image pixel values, The background image pixel values. To determine the mean square error loss between the enhanced crease image and the background image.
[0054] In some embodiments, when determining the initial pixel loss values of the enhanced crease image and the background image according to the first feature parameter and the second feature parameter, the first feature parameter and the second feature parameter are substituted into the following formula: , in, is the second initial pixel loss value, Represents the first Layer features, is the number of feature layers, To enhance the pixel value of the crease image, is the pixel value of the background image.
[0055] The feature space loss between the enhanced crease image and the background image is calculated through a pre-trained network such as VGG (Visual Geometry Group). The purpose is to optimize the network model through high-level features rather than pixel-level errors, so that the de-creased image output by the network model is perceptually closer to the real de-creased image.
[0056] In some embodiments, when determining the initial pixel loss values of the enhanced crease image and the background image according to the first feature parameter and the second feature parameter, the first feature parameter and the second feature parameter are substituted into the following formula: , in, is the third initial pixel loss value, To enhance the pixel value of the crease image, is the pixel value of the background image.
[0057] In the embodiment, it is very important to maintain the edge information in the image, especially to preserve the text edge when decressing the document image, so the edge detection function The edge of the image is extracted, and on this basis the pixel error between the enhanced crease image and the background image is calculated and determined.
[0058] In some embodiments, when determining the initial pixel loss values of the enhanced crease image and the background image according to the first feature parameter and the second feature parameter, the first feature parameter and the second feature parameter are substituted into the following formula: , in, is the fourth initial pixel loss value, To enhance the number of scales of the crease image, For the The scale weight of the layer scale, To enhance the pixel value of the crease image, is the pixel value of the background image.
[0059] In an embodiment, the scale weight Used to control the contribution of this scale loss to the total multi-scale loss. It is The loss at the layer scale is usually the absolute error loss. The multi-scale loss considers the image errors at different resolutions, thereby optimizing the performance of the image at different scales and helping the network capture details by reconstructing the image at multiple scales.
[0060] In some embodiments, the initial pixel loss value includes a first initial pixel loss value, a second initial pixel loss value, a third initial pixel loss value, and a fourth initial pixel loss value. When determining the first initial pixel loss value of the enhanced crease image and the background image according to the first feature parameter and the second feature parameter, the first feature parameter and the second feature parameter are substituted into the following formula: , in, is the first initial pixel loss value, To enhance the total number of pixels of the crease image, To enhance the crease image pixel values, The background image pixel value; When determining the second initial pixel loss value of the enhanced crease image and the background image according to the first feature parameter and the second feature parameter, the first feature parameter and the second feature parameter are substituted into the following formula: , in, is the second initial pixel loss value, Represents the first Layer features, is the number of feature layers, To enhance the pixel value of the crease image, is the pixel value of the background image; When determining the third initial pixel loss value of the enhanced crease image and the background image according to the first feature parameter and the second feature parameter, the first feature parameter and the second feature parameter are substituted into the following formula: , in, is the third initial pixel loss value, To enhance the pixel value of the crease image, is the pixel value of the background image; When determining the fourth initial pixel loss value of the enhanced crease image and the background image according to the first feature parameter and the second feature parameter, the first feature parameter and the second feature parameter are substituted into the following formula: , in, is the fourth initial pixel loss value, To enhance the number of scales of the crease image, For the The scale weight of the layer scale, To enhance the pixel value of the crease image, is the pixel value of the background image; When determining the initial weighted pixel loss value based on the initial pixel loss value and the weight parameter, the initial pixel loss value and the weight parameter are substituted into the following formula: , in, is the weighted pixel loss value, is the first weight parameter, is the first initial pixel loss value, is the second weight parameter, is the second initial pixel loss value, is the third weight parameter, is the third initial pixel loss value, is the fourth weight parameter, is the fourth initial pixel loss value.
[0061] In the embodiment, through the weighted fusion method described above, the enhanced crease image can not only be closer to the background image at the pixel level, but also retain higher-level structural information, making the decrease effect more ideal.
[0062] In some embodiments, the network model includes an encoder to obtain feature parameters of the detection image, including: the encoder extracts a third feature parameter of the detection image, or the encoder adjusts the resolution of the detection image to extract the third feature parameter of the detection image, wherein the third feature parameter includes a crease mask.
[0063] In an embodiment, after the network model is determined, the test image is input into the trained network model, and the network model includes an encoder, which is composed of several convolutional layers. The convolutional layers in the encoder process the detection image through convolution operations to extract third feature parameters of the detection image, such as edges and textures. The fold area of the detection image is annotated by using a semi-automatic annotation tool to generate a fold mask as a supervision signal of the network model. The value of the fold mask is in binary form: the fold mask of the fold area is 1, and the fold mask of the non-fold area is 0. The global information of the detection image can be roughly determined through the simple structure of the convolutional layer.
[0064] Alternatively, the encoder is composed of several convolutional layers and pooling layers. The pooling layer in the encoder retains key information of the detection image through aggregation operations, such as gradually reducing the resolution of the detection image to capture higher-level global information in the detection image. While retaining key feature information of the detection image, such as feature information of the fold area, some redundant feature information, such as feature information of the edge area, is eliminated. The convolutional layer in the encoder then extracts a third feature parameter from the key feature information, wherein the fold area of the detection image is annotated by using a semi-automatic annotation tool to generate a fold mask as a supervision signal of the network model. The value of the fold mask is in binary form: the fold mask of the fold area is 1, and the fold mask of the non-fold area is 0. The feature parameters extracted by the structure of the convolutional layer and the pooling layer are more conducive to the subsequent de-folding operation.
[0065] In some embodiments, the network model includes an encoder to obtain feature parameters of the detection image, including: after the encoder extracts the third feature parameter of the detection image, it adjusts the resolution of the detection image and extracts the third feature parameter again, wherein the third feature parameter includes a crease mask.
[0066] In an embodiment, after the network model is determined, the test image is input into the trained network model, the encoder is composed of several convolutional layers and pooling layers, and the convolutional layers and pooling layers are usually used alternately in the network model, that is, the convolutional layer in the encoder first processes the detection image through a convolution operation, and after extracting the third feature parameter of the detection image, the pooling layer in the encoder gradually adjusts the resolution of the detection image, and the convolutional layer in the encoder extracts the third feature parameter again, and repeats the above operation to improve the accuracy of extracting and abstracting the feature parameters of the detection image while gradually adjusting the spatial size of the detection image, thereby enhancing the generalization ability of the network model.
[0067] In some embodiments, the network model also includes a decoder, which eliminates creases in the area where the feature parameters in the detection image are preset feature parameters according to the weighted pixel loss value to determine the de-creased image, including: the decoder eliminates creases in the area where the crease mask in the detection image is the preset crease mask according to the weighted pixel loss value until the weighted pixel loss value satisfies the preset pixel loss value range and reaches a preset number of times to determine the de-creased image.
[0068] In an embodiment, the decoder is composed of a deconvolution layer and an upsampling layer, which is used to gradually restore the spatial resolution of the detection image, determine whether there is an area in the detection image where the characteristic parameter fold mask is a preset fold mask, i.e., 1. If there is a preset fold mask in the detection image, the area where the preset fold mask is located is considered to be a fold area, and the decoder eliminates the fold area according to the weighted pixel loss value, and does not operate on other areas until the weighted pixel loss value meets the preset pixel loss value range and reaches a preset number of times. After the above image reconstruction, a clear image without folds, i.e., a de-folded image, is output, and the de-folded image can restore the original clarity and integrity of the document image. Through the jump connection between the decoder and the encoder, the decoder can effectively utilize the high-resolution features of the encoder to improve the image restoration and repair effects, wherein the jump connection is used to pass the third characteristic parameter of the encoder part to the decoder, helping the network model to retain the structure and detail information of the document when removing folds.
[0069] In some embodiments, after obtaining the decreased image, the method further includes: performing equalization processing and / or enhancement processing on the decreased image.
[0070] In an embodiment, after obtaining the decreased image, the decreased image is subjected to adaptive histogram equalization processing to enhance the local contrast of the decreased image; or the decreased image is enhanced using image sharpening and denoising methods to enhance the edges and details of the decreased image, while reducing the noise in the decreased image to make the image appear smoother and clearer; or on the basis of the adaptive histogram equalization processing of the decreased image, the decreased image is enhanced using image sharpening and denoising methods at the same time to prevent the loss of details of the decreased image, overexposure or over-enhancement caused by histogram equalization when the background and foreground are too bright or too dark, thereby further improving the visual quality of the decreased image.
[0071] The image decrease method of the embodiment of the present invention can be deployed on multiple platforms such as server side, PC client side, embedded devices such as scanners, copiers, etc. to achieve flexible application; it is also suitable for multiple application scenarios of document management and digital processing, such as document digitization and printing in libraries and archives, file processing in the insurance industry, document scanning and repair in the legal field, and document organization in the education and publishing industries.
[0072] Reference below Figure 2 The method for removing creases from an image according to an embodiment of the present invention is described by way of example.
[0073] like Figure 2 As shown, the image crease removal method according to the embodiment of the present invention at least includes steps S11 to S21.
[0074] Step S11, obtaining a crease image dataset and a background image dataset.
[0075] Step S12, performing image enhancement and normalization processing on the fold image to obtain an enhanced fold image.
[0076] Step S13, extracting the first characteristic parameter of the enhanced fold image and the second characteristic parameter of the background image.
[0077] Step S14, determining the initial pixel loss values of the enhanced crease image and the background image according to the first characteristic parameter and the second characteristic parameter.
[0078] Step S15, determining an initial weighted pixel loss value according to the initial pixel loss value and the weight parameter.
[0079] Step S16, when the initial weighted pixel loss value meets the preset pixel loss value range and reaches the preset number of times, a network model is obtained.
[0080] Step S17, the encoder extracts the third characteristic parameter of the detection image, or the encoder adjusts the resolution of the detection image to extract the third characteristic parameter of the detection image, wherein the third characteristic parameter includes a crease mask.
[0081] Step S18, after the encoder extracts the third feature parameter of the detection image, it adjusts the resolution of the detection image and extracts the third feature parameter again, wherein the third feature parameter includes a crease mask.
[0082] Step S19, obtaining the weighted pixel loss value of the network model.
[0083] In step S20, the decoder eliminates creases in the detection image where the crease mask is located in the area where the preset crease mask is located according to the weighted pixel loss value, until the weighted pixel loss value meets the preset pixel loss value range and reaches a preset number of times, so as to determine a decreased image.
[0084] Step S21, performing equalization processing and / or enhancement processing on the decreased image.
[0085] According to the image decrease method of the embodiment of the present invention, by obtaining a crease image dataset and a background image dataset, a U-Net model is trained according to the crease image dataset and the background image dataset, the network model is determined, the feature parameters of the detection image and the weighted pixel loss value of the network model are obtained, the network model automatically determines whether there is a region in the detection image whose feature parameters are preset feature parameters to detect the crease region, eliminates the creases in the crease region according to the weighted pixel loss value, and effectively retains the details and structural information of the detection image to obtain a decrease image, and the decrease effect is more natural. The whole process of detecting and eliminating the crease region in the detection image based on the weighted pixel loss value in the network model has a high degree of automation, does not require human participation, and is suitable for large-scale document processing.
[0086] Combine the following Figure 3 The image decrease device 2 according to the embodiment of the present invention is described.
[0087] like Figure 3 As shown, the image decrease device 2 of the embodiment of the present invention comprises: a first acquisition module 21, a first determination module 22, a second acquisition module 23 and a second determination module 24, wherein: The first acquisition module 21 is used to acquire a crease image dataset and a background image dataset; the first determination module 22 is used to perform model training on a U-Net model based on the crease image dataset and the background image dataset to determine the network model; the second acquisition module 23 is used to acquire feature parameters of the detection image and a weighted pixel loss value of the network model; the second determination module 24 is used to eliminate creases in the detection image in an area where feature parameters are preset feature parameters based on the weighted pixel loss value to determine a de-creased image.
[0088] According to the image decrease device 2 of the embodiment of the present invention, by acquiring a crease image dataset and a background image dataset, a U-Net model is trained according to the crease image dataset and the background image dataset, a network model is determined, and feature parameters of the detection image and a weighted pixel loss value of the network model are acquired. The network model automatically determines whether there is a region in the detection image whose feature parameters are preset feature parameters to detect the crease region, eliminates the creases in the crease region according to the weighted pixel loss value, and effectively retains the details and structural information of the detection image to obtain a decrease-free image with a more natural decrease effect. The whole process of detecting and eliminating the crease region in the detection image based on the weighted pixel loss value in the network model has a high degree of automation, does not require human intervention, and is suitable for large-scale document processing.
[0089] The following describes a computer-readable storage medium according to an embodiment of the present invention.
[0090] The computer-readable storage medium of the embodiment of the present invention stores an image decrease program, and when the image decrease program is executed by a processor, the image decrease method of the above embodiment is implemented.
[0091] According to the computer-readable storage medium of an embodiment of the present invention, by obtaining a crease image dataset and a background image dataset, a U-Net model is trained according to the crease image dataset and the background image dataset, the network model is determined, and the feature parameters of the detection image and the weighted pixel loss value of the network model are obtained. The network model automatically determines whether there is a region in the detection image whose feature parameters are preset feature parameters to detect the crease region, eliminates the creases in the crease region according to the weighted pixel loss value, and effectively retains the details and structural information of the detection image to obtain a de-creased image with a more natural de-crease effect. The whole process of detecting and eliminating the crease region in the detection image based on the weighted pixel loss value in the network model has a high degree of automation, does not require human participation, and is suitable for large-scale document processing.
[0092] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials, or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example.
[0093] Although the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.
Claims
1. A method for removing creases from an image, characterized in that: include: Obtain a crease image dataset and a background image dataset; Performing model training on a U-Net model according to the crease image dataset and the background image dataset to determine a network model; Acquire characteristic parameters of the detection image and weighted pixel loss values of the network model; The creases in the region where the characteristic parameters in the detection image are preset characteristic parameters are eliminated according to the weighted pixel loss value to determine a decrease image.
2. The method for removing creases from an image according to claim 1, characterized in that: The U-Net model is trained according to the crease image dataset and the background image dataset to determine the network model, including: Performing image enhancement and normalization processing on the crease image to obtain an enhanced crease image; Extracting a first characteristic parameter of the enhanced crease image and a second characteristic parameter of the background image; Determine initial pixel loss values of the enhanced crease image and the background image according to the first feature parameter and the second feature parameter; Determining an initial weighted pixel loss value according to the initial pixel loss value and a weight parameter; When the initial weighted pixel loss value meets a preset pixel loss value range and reaches a preset number of times, the network model is obtained.
3. The method for removing creases from an image according to claim 2, characterized in that: When determining the initial pixel loss values of the enhanced crease image and the background image according to the first feature parameter and the second feature parameter, the first feature parameter and the second feature parameter are substituted into the following formula: , in, is the first initial pixel loss value, is the total number of pixels of the enhanced crease image, is the first pixel values, is the background image pixel values.
4. The method for removing creases from an image according to claim 2, characterized in that: When determining the initial pixel loss values of the enhanced crease image and the background image according to the first feature parameter and the second feature parameter, the first feature parameter and the second feature parameter are substituted into the following formula: , in, is the second initial pixel loss value, Represents the first Layer features, is the number of feature layers, is the pixel value of the enhanced crease image, is the pixel value of the background image.
5. The method for removing creases from an image according to claim 2, characterized in that: When determining the initial pixel loss values of the enhanced crease image and the background image according to the first feature parameter and the second feature parameter, the first feature parameter and the second feature parameter are substituted into the following formula: , in, is the third initial pixel loss value, is the pixel value of the enhanced crease image, is the pixel value of the background image.
6. The method for removing creases from an image according to claim 2, characterized in that: When determining the initial pixel loss values of the enhanced crease image and the background image according to the first feature parameter and the second feature parameter, the first feature parameter and the second feature parameter are substituted into the following formula: , in, is the fourth initial pixel loss value, is the scale number of the enhanced crease image, For the The scale weight of the layer scale, is the pixel value of the enhanced crease image, is the pixel value of the background image.
7. The method for removing creases from an image according to claim 2, characterized in that: The initial pixel loss value includes a first initial pixel loss value, a second initial pixel loss value, a third initial pixel loss value, and a fourth initial pixel loss value. When determining the first initial pixel loss value of the enhanced crease image and the background image according to the first feature parameter and the second feature parameter, the first feature parameter and the second feature parameter are substituted into the following formula: , in, is the first initial pixel loss value, is the total number of pixels of the enhanced crease image, is the first pixel values, is the background image pixel value; When determining the second initial pixel loss value of the enhanced crease image and the background image according to the first feature parameter and the second feature parameter, the first feature parameter and the second feature parameter are substituted into the following formula: , in, is the second initial pixel loss value, Represents the first Layer features, is the number of feature layers, is the pixel value of the enhanced crease image, is the pixel value of the background image; When determining the third initial pixel loss value of the enhanced crease image and the background image according to the first feature parameter and the second feature parameter, the first feature parameter and the second feature parameter are substituted into the following formula: , in, is the third initial pixel loss value, is the pixel value of the enhanced crease image, is the pixel value of the background image; When determining the fourth initial pixel loss value of the enhanced crease image and the background image according to the first feature parameter and the second feature parameter, the first feature parameter and the second feature parameter are substituted into the following formula: , in, is the fourth initial pixel loss value, is the scale number of the enhanced crease image, For the The scale weight of the layer scale, is the pixel value of the enhanced crease image, is the pixel value of the background image; When determining the initial weighted pixel loss value according to the initial pixel loss value and the weight parameter, the initial pixel loss value and the weight parameter are substituted into the following formula: , in, is the weighted pixel loss value, is the first weight parameter, is the first initial pixel loss value, is the second weight parameter, is the second initial pixel loss value, is the third weight parameter, is the third initial pixel loss value, is the fourth weight parameter, is the fourth initial pixel loss value.
8. The method for removing creases from an image according to claim 1, characterized in that: The network model includes an encoder, and obtains characteristic parameters of the detection image, including: The encoder extracts a third characteristic parameter of the detection image, or The encoder adjusts the resolution of the detection image and extracts a third feature parameter of the detection image, wherein the third feature parameter includes a crease mask.
9. The method for removing creases from an image according to claim 1, characterized in that: The network model includes an encoder, and obtains characteristic parameters of the detection image, including: After the encoder extracts the third feature parameter of the detection image, it adjusts the resolution of the detection image and extracts the third feature parameter again, wherein the third feature parameter includes a crease mask.
10. The method for removing creases from an image according to claim 8 or 9, characterized in that: The network model further includes a decoder, which eliminates the folds in the region where the feature parameter in the detection image is a preset feature parameter according to the weighted pixel loss value to determine a de-folded image, including: The decoder eliminates the creases in the detection image in the area where the crease mask is a preset crease mask according to the weighted pixel loss value until the weighted pixel loss value meets the preset pixel loss value range and reaches a preset number of times to determine the decreased image.
11. The method for removing creases from an image according to claim 1, characterized in that: After obtaining the decreased image, it also includes: The decreased image is subjected to equalization processing and / or enhancement processing.
12. An image crease removal device, characterized in that: include: A first acquisition module is used to acquire a crease image dataset and a background image dataset; A first determination module is used to perform model training on a U-Net model according to the crease image dataset and the background image dataset to determine a network model; A second acquisition module is used to acquire characteristic parameters of the detection image and a weighted pixel loss value of the network model; The second determination module is used to eliminate the creases in the area where the characteristic parameters in the detection image are preset characteristic parameters according to the weighted pixel loss value, so as to determine a de-crease image.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores an image decrease program, and when the image decrease program is executed by a processor, the image decrease method according to any one of claims 1 to 11 is implemented.
Citation Information
Patent Citations
Image restoration method and device
CN114331912A
Plastic part appearance defect identification and positioning method based on machine vision
CN114612446A
Method and system for nondestructive detection of internal defects of prefabricated part
CN114994091A
Multi-scale image restoration method, storage medium and terminal
CN115018727A
Workpiece defect detection method and device
CN115272310A
Cited By
Intelligent analysis and prediction system and method based on test paper scores
CN120599617A
Document fold repairing method based on deep learning
CN120725929A