Method and device for repairing stained vouchers, equipment, storage medium and product
By introducing a hollow convolutional neural network model, the deficient vouchers are noise-added and the stain noise image generation is solved, which is difficult for traditional repair methods to accurately identify and repair deficits, and achieves higher repair accuracy.
Patent Information
- Application Number
- CN202411802699.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-09
- Publication Date
- 2025-03-07
AI Technical Summary
Traditional repair methods for defamation vouchers are difficult to accurately identify and repair different types of defamation, resulting in incorrect repair results.
The hollow convolutional neural network model is used to add noise to the damaged credential images to generate stain noise images, and the repaired images are obtained through subtraction operations.
Improve the accuracy of deficient credential repair, can identify and repair different types of deficiencies, and obtain correct deficit-free credential images.
Smart Images

Figure CN119579470A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence, and in particular to a method for repairing damaged vouchers, electronic equipment, storage medium and products. Background Art
[0002] In daily life, documents (such as deposit certificates) may be damaged for a variety of reasons. For example, long-term storage may cause the paper to age and fade; improper storage environment, such as humidity, high temperature or contact with corrosive substances, may cause the handwriting on the document to be blurred and the paper to be damaged; and documents may also be damaged due to human wear, tear or stains during daily handling.
[0003] The traditional method of repairing damaged vouchers is to use scanning software to digitally scan the vouchers, and then use simple image editing software to repair them; this method is often ineffective for complex damage situations, and relies on the operator's experience and skills, lacking automation and intelligence. However, this method is difficult to accurately identify the contaminated image, which will lead to incorrect repair results in damage repair. Summary of the invention
[0004] The present application provides a method, device, equipment, storage medium and product for repairing a damaged voucher, which is used to solve the technical problem that vouchers of different types of damage are difficult to identify, resulting in erroneous repair results during repair.
[0005] In a first aspect, the present application provides a method for repairing a damaged voucher, comprising: adding noise to a damaged voucher image to be repaired to obtain a first noise image; inputting the first noise image into a pre-trained hole convolutional neural network model to generate a first stained noise image; the hole convolutional neural network model is used to learn to establish a mapping between the stained noise image and the non-destructive image; and subtracting the first stained noise image from the first noise image to obtain a repaired voucher image.
[0006] In a second aspect, the present application provides a device for repairing a damaged voucher, comprising: a processing module, used to add noise to the damaged voucher image to be repaired to obtain a first noise image; a generation module, used to input the first noise image into a pre-trained void convolutional neural network model to generate a first stained noise image; the void convolutional neural network model is used to learn to establish a mapping between the stained noise image and the non-destructive image; the generation module is also used to subtract the first stained noise image from the first noise image to obtain a repaired voucher image.
[0007] In a third aspect, the present application provides an electronic device, comprising: a processor, and a memory communicatively connected to the processor; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory to implement the above method.
[0008] In a fourth aspect, the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the above method.
[0009] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the above first aspect and / or various possible implementation methods of the first aspect.
[0010] The present application provides a method, device, equipment, storage medium and product for repairing a damaged voucher. First, the damaged voucher image to be repaired is denoised to obtain a first noise image; the first noise image is input into a pre-trained atrous convolutional neural network model to generate a first stained noise image; the atrous convolutional neural network model is used to learn to establish a mapping between the stained noise image and the non-defiled image; the first stained noise image is subtracted from the first noise image to obtain a repaired voucher image. This solution introduces a atrous convolutional neural network model to repair damaged vouchers, can identify damaged vouchers, and repair to obtain a correct non-defiled voucher image, thereby improving the accuracy of voucher image repair. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0012] Figure 1 A schematic diagram of a method for repairing a damaged voucher provided in this application Figure 1 ;
[0013] Figure 2 A schematic diagram of the process of defacing image vouchers Figure 2 ;
[0014] Figure 3 A schematic diagram of a method for repairing a damaged voucher provided in this application Figure 3 ;
[0015] Figure 4 A schematic diagram of the structure of a device for repairing a damaged voucher provided in this application;
[0016] Figure 5 A schematic diagram of the structure of a device for repairing a damaged voucher provided in the present application.
[0017] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0018] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0019] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data comply with the relevant laws, regulations and standards of the relevant countries and regions, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0020] In addition, this application involves conducting big data analysis of user information (including but not limited to personal biometrics, identity data, consumption data, asset data, electronic terminal operation data, etc.), and using artificial intelligence technology to make automated decisions, and making technical solutions that have a significant impact on personal rights and interests based on the results of automated decisions. The application provides users with corresponding operation entrances for them to choose to agree or reject the results of automated decisions; if the user chooses to reject, the expert decision-making process will be entered.
[0021] It should be noted that the brief description of the terms in this application is only for the convenience of understanding the implementation methods described below, and is not intended to limit the implementation methods of this application. Unless otherwise specified, these terms should be understood according to their ordinary and usual meanings. The terms "first", "second", etc. in the specification and claims and the above-mentioned drawings in this application are used to distinguish similar or similar objects or entities, and do not necessarily mean to limit a specific order or sequence, unless otherwise indicated. It should be understood that the terms used in this way can be interchangeable where appropriate, for example, they can be implemented in an order other than those given in the diagram or description of the embodiment of this application. The terms "including" and "having" in the specification and claims and the above-mentioned drawings in this application and any of their variations are intended to cover but not exclude inclusion, for example, a product or device containing a series of components is not necessarily limited to those components clearly listed, but may include other components that are not clearly listed or inherent to these products or devices. The term "module" used in this application refers to any known or later developed hardware, software, firmware, artificial intelligence, fuzzy logic or a combination of hardware or / and software code that can perform functions related to the element.
[0022] It should be noted that the method, device, equipment, storage medium and product for repairing contaminated vouchers provided in the present application can be used in the field of artificial intelligence, and can also be used in any field except artificial intelligence. The application field of the method, device, equipment, storage medium and product for repairing contaminated vouchers in the present application is not limited.
[0023] With the improvement of people's living standards and the development of visual culture, the visual requirements for images are getting higher and higher. The rapid development of artificial intelligence and deep learning technology has brought major breakthroughs in image restoration. Deep learning models have powerful feature extraction and learning capabilities, and can automatically learn the semantic information and texture features of images, thereby achieving more accurate and natural image restoration effects.
[0024] Traditional methods for restoring damaged images extract texture information from the surrounding area and apply it to the damaged area to fill in the missing parts; it can generate realistic restoration results based on the characteristics and structure of the surrounding texture. However, with this method, it is difficult to accurately identify the contaminated image, which will lead to erroneous restoration results in damage restoration.
[0025] The technical solution provided by the present application is intended to solve the above technical problems of the prior art. In this embodiment, the damaged voucher image to be repaired is firstly denoised to obtain a first noise image; the first noise image is input into a pre-trained atrous convolutional neural network model to generate a first stained noise image; the atrous convolutional neural network model is used to learn to establish a mapping between the stained noise image and the non-destructive image; the first stained noise image is subtracted from the first noise image to obtain a repaired voucher image. This solution repairs the damaged voucher by introducing a atrous convolutional neural network model, which is capable of identifying the damaged voucher and repairing the correct non-destructive voucher image, thereby improving the accuracy of the repaired voucher image.
[0026] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0027] Embodiment 1
[0028] Figure 1 A schematic diagram of a method for repairing a damaged voucher provided in this application Figure 1 ,like Figure 1 As shown, including:
[0029] S101, adding noise to a damaged voucher image to be repaired to obtain a first noise image.
[0030] S102, inputting the first noise image into a pre-trained dilated convolutional neural network model to generate a first stained noise image; the dilated convolutional neural network model is used to learn to establish a mapping between the stained noise image and the non-stained image.
[0031] S103, performing a subtraction operation on the first stain noise image and the first noise image to obtain a restored voucher image.
[0032] Among them, vouchers refer to written proofs that can prove the occurrence of economic transactions, clarify economic responsibilities, and be used to register account books. There are many types of vouchers: original vouchers and accounting vouchers. Specifically, original vouchers: these are vouchers obtained or filled out when economic transactions occur, used to record and prove the occurrence or completion of economic transactions; for example, invoices, receipts, check stubs, warehouse entry orders, warehouse outbound orders, etc. Accounting vouchers: accounting vouchers filled out after the audited original vouchers or summarized original vouchers are classified according to the content of the economic transactions and the accounting entries are determined; it is the direct basis for registering account books, usually including types such as receipt vouchers, payment vouchers and transfer vouchers.
[0033] Damaged vouchers include physical damage, chemical damage, and biological damage. Specifically, physical damage includes stains (stained by ink, coffee, water stains, etc.); chemical damage includes fading (the writing on the voucher may fade due to light, oxidation or other chemical factors) and corrosion; biological damage includes mildew (mold growth not only deteriorates the paper, but may also cover or destroy the text information on the voucher).
[0034] In addition, the damaged voucher is denoised by adding random natural noise using a noise simulation model; the specific noise simulation model can be expressed by the following formula:
[0035]
[0036] Where n represents natural noise, They represent the Rayleigh noise obeying Rayleigh, represents the standard deviation of the Rayleigh distribution. is Gaussian white noise, is the average value, is the standard deviation, is the coefficient.
[0037] When repairing damaged vouchers, it is necessary to understand the overall structure and contextual information of the image in order to fill and repair the damaged areas more accurately. The atrous convolutional neural network can effectively expand the receptive field without increasing the size of the convolution kernel and the number of parameters. While reducing the network depth, it strengthens the connectivity of the overall network so that the network can extract more contextual information and reduce the computational cost, thus better repairing the voucher image.
[0038] Furthermore, the first stained noise image is subtracted from the first noise image to obtain the restored voucher image. The residual learning method is used to achieve noise cancellation. For example, when the stained voucher image is noised, the first noise image actually contains the information of the original stained voucher image and the additional noise. Assume that the stained voucher image I d (which includes the stained part S and the undamaged part I of the original voucher image ud ), the noise added is N, then the first noise image I noisy It can be expressed as I noisy =I d +N=(I ud +S) + N. After inputting it into the hole convolutional neural network model, the stain-related noise Ns is separated, and the first stain noise image generated is I ns , perform subtraction: I clean =I noisy -I ns =(I ud+S) +N-Ns, Ns includes the noise caused by the stain S and the noise closely related to the stain, then S+N-Ns is approximately 0, and finally I clean ≈I ud , that is, a clean voucher image (the undamaged part of the original voucher image) is obtained, that is, a repaired voucher image is obtained.
[0039] In practical applications, the atrous convolutional neural network model is used to repair voucher images. Whether it is a large area of damage or a small area of local damage, whether it is a regular shape of damage or an irregular shape of damage, the atrous convolutional neural network can cope with it well. Figure 2 A schematic diagram of the process of defacing image vouchers Figure 2 ,like Figure 2 As shown, the damaged voucher image is denoised to obtain a first noisy image; the first noisy image is input into a pre-trained atrous convolutional neural network model to generate a first stained noise image; the atrous convolutional neural network model is used to learn to establish a mapping between the stained noise image and the unstained image; the first stained noise image is subtracted from the first noise image to obtain a repaired voucher image.
[0040] The present embodiment provides a method for repairing a damaged voucher, which introduces a dilated convolutional neural network model to repair the damaged voucher. The method is capable of identifying the damaged voucher and repairing it to obtain a correct, undamaged voucher image, thereby improving the accuracy of voucher image repair.
[0041] Optionally, acquiring a second image set, the second image set including images of different types;
[0042] The second image set is segmented according to a preset stride to obtain a third image set, and the third image set is used to train a dilated convolutional neural network model.
[0043] The stride can be set as required. Specifically, the second image set obtained is constructed by 30 grayscale voucher images of 1650×1130 pixels. The grayscale voucher image sample set is divided into 40×40 pixels according to the stride 10. The 30 grayscale voucher images are divided into 1542242 image blocks.
[0044] By segmenting the second image set, not only can the number of samples in the image set be increased, providing more diverse training samples for the atrous convolutional neural network; it can also allow the atrous convolutional neural network to simulate different types and degrees of contamination in the segmented areas, thereby training the adaptability of the atrous convolutional neural network to various contamination conditions and increasing the diversity of voucher image restoration.
[0045] Optional, Figure 3 A schematic diagram of a method for repairing a damaged voucher provided in this application Figure 3 ,like Figure 3 As shown, before the first noise image is input into the pre-trained hole convolutional neural network model, it also includes:
[0046] S301, adding noise to the third image set to obtain a second noisy image.
[0047] S302: Input the second noise image into the atrous convolutional neural network model to predict a second stain noise image.
[0048] S303: Calculate the loss value between the second noise image and the second stain noise image according to the loss function.
[0049] S304, using the optimizer to perform back propagation, and performing gradient descent optimization to update the model parameters according to the loss value until the training is completed.
[0050] Among them, the loss function is the mean square error function , where w is the weight matrix, b is the offset vector, and n is the noise image. is a stain noise image, and N is the image set. Use the optimizer for back propagation, and select the Adam optimizer. Adam (Adaptive Moment Estimation) is a gradient-based optimization algorithm. In the training process of the neural network, the gradient of the loss function to the model parameters needs to be calculated through the back propagation algorithm, and then the parameters are updated using this gradient information so that the loss function is gradually reduced. The Adam optimizer assumes the role of updating the parameters based on the gradient information. In each iterative training, it calculates the update amount of each parameter based on the current gradient and the previously accumulated gradient information, so that the parameters of the model move in the direction of reducing the loss function.
[0051] The loss value is calculated by the mean square error loss function, and the Adam optimizer is used to optimize the loss value and update the model parameters. This can not only reduce the training time, but also help the atrous convolutional neural network converge to a better parameter faster, thereby improving the final performance of the atrous convolutional neural network model.
[0052] Optionally, according to the second image set, the training parameters of the atrous convolutional neural network model are set, and the weights of the atrous convolutional neural network model are initialized; the training parameters include batch size, number of training rounds, and learning rate.
[0053] Among them, the weights of the atrous convolutional neural network model are randomly set according to the image set; the batch size refers to the number of samples input into the neural network at the same time in one training iteration, which affects the efficiency and stability of model training; the learning rate is one of the most important parameters in neural network training, which determines the step size of the model parameters in the direction of the gradient descent of the loss function during each iteration; the number of training rounds refers to the number of training iterations.
[0054] By setting weights and training parameters according to the image set, the model can learn the characteristics of each type of voucher image in more detail, avoiding learning difficulties caused by inappropriate parameter settings, which can lead to poor performance of the trained model.
[0055] Preferably, before inputting the second noise image into the atrous convolutional neural network model, the method further includes: randomly rotating the second noise image.
[0056] In the training process of neural networks, the amount of data is often limited. By rotating the image, the diversity of the data can be increased. For example, for a voucher image containing an object, after rotating it to different angles, the position and direction of the object in the image change, but the information of the image does not change. This is equivalent to creating new training samples, enriching the representation of the data, and helping the network learn more comprehensive features.
[0057] Preferably, the atrous convolutional neural network model includes: a convolutional layer, a batch normalization layer, and an activation layer;
[0058] Convolutional layer, used to extract features of the input image and output feature maps of the image;
[0059] Batch normalization layer, used to normalize the feature map of the image;
[0060] The activation layer is used to activate the feature map of the normalized image.
[0061] The Dilated Convolutional Neural Network is a neural network architecture that is improved on the traditional convolutional neural network (CNN). Its core is the use of dilated convolution, also known as expanded convolution. The dilated convolutional neural network in the trained dilated convolutional neural network model adopts a 17-layer network structure. In addition, the number of layers of the dilated convolutional neural network is selected according to different application scenarios and task requirements.
[0062] Among them, the conv (convolution) convolution operation is an important operation used to extract features in neural networks. It slides on the input data (such as images, sequences, etc.) through a convolution kernel (filter), multiplies the input data corresponding to each sliding position with the convolution kernel and sums them, thereby obtaining a new output value. This process is performed point by point on the entire input data, and finally a convolved feature map is obtained. BN (Batch Normalization) Batch normalization is a technology to accelerate neural network training and improve its stability. ReLU (Rectified Linear Unit) is a commonly used activation function. After convolution and batch normalization, the data passes through the ReLU activation function, and values less than 0 are set to 0, and values greater than 0 remain unchanged. This enables the network to learn and represent complex nonlinear relationships and enhance the network's expressive power.
[0063] According to the constructed dilated convolutional neural network, a 17-layer network structure is adopted. The dilated convolutional neural network constructed by the dilated convolutional layer is composed of dilated convolutional layers and convolutional layers used alternately. In the network, the 2nd to 8th layers and the 10th to 15th layers are dilated convolutions. The convolution kernel size of each layer is 3×3, and the dilation rate is selected as 2. The dilated convolutional neural network structure, Conv+ BN + ReLU is a standard convolutional layer, which includes convolution operation, batch normalization and ReLU activation function; Dilated Conv + BN + ReLU is a dilated convolutional layer (Dilated Conv), which uses dilation in the convolution operation to expand the receptive field; Conv + ReLU layer, batch normalization operation is omitted here; Conv layer, which is a layer containing only convolution operation, may be used to generate the final output. For example:
[0064] conv + BN + ReLU--Dilated conv + BN + ReLU--…--Dilated conv + BN +ReLU--conv + BN + ReLU-- Dilated conv + BN + ReLU--…-- Dilated conv + BN +ReLU--conv + BN + ReLU-- conv + ReLU—conv.
[0065] By constructing the dilated convolutional neural network structure in the order of convolutional layer-batch normalization layer-activation layer, the receptive field can be expanded without increasing the number of parameters, thereby better capturing the contextual information in the image. Batch normalization (BN) is used to accelerate the training of the ReLU activation function to help the network learn more complex patterns, enabling the dilated convolutional neural network model to recognize different types of defaced voucher images.
[0066] The present embodiment provides a method for repairing a damaged voucher, which first adds noise to the damaged voucher image to be repaired to obtain a first noise image; the first noise image is input into a pre-trained atrous convolutional neural network model to generate a first stained noise image; the atrous convolutional neural network model is used to learn to establish a mapping between the stained noise image and the non-defiled image; the first stained noise image is subtracted from the first noise image to obtain a repaired voucher image. This solution introduces a atrous convolutional neural network model to repair damaged vouchers, can identify damaged vouchers, and repair to obtain a correct non-defiled voucher image, thereby improving the accuracy of voucher image repair.
[0067] Embodiment 2
[0068] Figure 4 A structural schematic diagram of a damaged voucher repair device provided in this application, such as Figure 4 As shown, including:
[0069] A processing module 11 is used to add noise to the damaged voucher image to be repaired to obtain a first noise image;
[0070] A generating module 12 is used to input the first noise image into a pre-trained dilated convolutional neural network model to generate a first stained noise image; the dilated convolutional neural network model is used to learn to establish a mapping between the stained noise image and the non-stained image;
[0071] The generating module 12 is further used to perform a subtraction operation on the first stain noise image and the first noise image to obtain a restored voucher image.
[0072] Among them, vouchers refer to written proofs that can prove the occurrence of economic transactions, clarify economic responsibilities, and be used to register account books. There are many types of vouchers: original vouchers and accounting vouchers. Specifically, original vouchers: these are vouchers obtained or filled out when economic transactions occur, used to record and prove the occurrence or completion of economic transactions; for example, invoices, receipts, check stubs, warehouse entry orders, warehouse outbound orders, etc. Accounting vouchers: accounting vouchers filled out after the audited original vouchers or summarized original vouchers are classified according to the content of the economic transactions and the accounting entries are determined; it is the direct basis for registering account books, usually including types such as receipt vouchers, payment vouchers and transfer vouchers.
[0073] Damaged vouchers include physical damage, chemical damage, and biological damage. Specifically, physical damage includes stains (stained by ink, coffee, water stains, etc.); chemical damage includes fading (the writing on the voucher may fade due to light, oxidation or other chemical factors) and corrosion; biological damage includes mildew (mold growth not only deteriorates the paper, but may also cover or destroy the text information on the voucher).
[0074] In addition, the damaged voucher image is denoised by adding random natural noise using a noise simulation model; the specific noise simulation model can be expressed by the following formula:
[0075]
[0076] Where n represents natural noise, They represent the Rayleigh noise obeying Rayleigh, represents the standard deviation of the Rayleigh distribution. is Gaussian white noise, is the average value, is the standard deviation, is the coefficient.
[0077] When repairing damaged vouchers, it is necessary to understand the overall structure and contextual information of the image in order to fill and repair the damaged areas more accurately. The atrous convolutional neural network can effectively expand the receptive field without increasing the size of the convolution kernel and the number of parameters. While reducing the network depth, it strengthens the connectivity of the overall network so that the network can extract more contextual information and reduce the computational cost, thus better repairing the voucher image.
[0078] Furthermore, the first stained noise image is subtracted from the first noise image to obtain the restored voucher image. The residual learning method is used to achieve noise cancellation. For example, when the stained voucher image is noised, the first noise image actually contains the information of the original stained voucher image and the additional noise. Assume that the stained voucher image I d (which includes the stained part S and the undamaged part I of the original voucher image ud ), the noise added is N, then the first noise image I noisy It can be expressed as I noisy =I d +N=(I ud +S) + N. After inputting it into the hole convolutional neural network model, the stain-related noise Ns is separated, and the first stain noise image generated is I ns , perform subtraction: I clean =I noisy -I ns =(I ud+S) +N-Ns, Ns includes the noise caused by the stain S and the noise closely related to the stain, then S+N-Ns is approximately 0, and finally I clean ≈I ud , that is, a clean voucher image (the undamaged part of the original voucher image) is obtained, that is, a repaired voucher image is obtained.
[0079] The present embodiment provides a device for repairing a damaged voucher, which introduces a dilated convolutional neural network model to repair the damaged voucher. The device is capable of identifying the damaged voucher and repairing it to obtain a correct, undamaged voucher image, thereby improving the accuracy of voucher image repair.
[0080] Optionally, the processing module 11 is further used for:
[0081] acquiring a second image set, the second image set including images of different types;
[0082] The second image set is segmented according to a preset stride to obtain a third image set, and the third image set is used to train a dilated convolutional neural network model.
[0083] The stride can be set as required. Specifically, the second image set obtained is constructed by 30 grayscale voucher images of 1650×1130 pixels. The grayscale voucher image sample set is divided into 40×40 pixels according to the stride 10. The 30 grayscale voucher images are divided into 1542242 image blocks.
[0084] By segmenting the second image set, not only can the number of samples in the image set be increased, providing more diverse training samples for the atrous convolutional neural network; it can also allow the atrous convolutional neural network to simulate different types and degrees of contamination in the segmented areas, thereby training the adaptability of the atrous convolutional neural network to various contamination conditions and increasing the diversity of voucher image restoration.
[0085] Optionally, before inputting the first noise image into the pre-trained dilated convolutional neural network model, the method further includes:
[0086] The third image set is denoised to obtain a second noisy image.
[0087] The second noise image is input into the atrous convolutional neural network model to predict the second stained noise image.
[0088] A loss value between the second noisy image and the second stained noise image is calculated according to the loss function.
[0089] Use the optimizer for back propagation and perform gradient descent optimization to update the model parameters according to the loss value until the training is completed.
[0090] Among them, the loss function is the mean square error function , where w is the weight matrix, b is the offset vector, and n is the noise image. is a stain noise image, and N is the image set. Use the optimizer for back propagation, and select the Adam optimizer. Adam (Adaptive Moment Estimation) is a gradient-based optimization algorithm. In the training process of the neural network, the gradient of the loss function to the model parameters needs to be calculated through the back propagation algorithm, and then the parameters are updated using this gradient information so that the loss function is gradually reduced. The Adam optimizer assumes the role of updating the parameters based on the gradient information. In each iterative training, it calculates the update amount of each parameter based on the current gradient and the previously accumulated gradient information, so that the parameters of the model move in the direction of reducing the loss function.
[0091] The loss value is calculated by the mean square error loss function, and the Adam optimizer is used to optimize the loss value and update the model parameters. This can not only reduce the training time, but also help the atrous convolutional neural network converge to a better parameter faster, thereby improving the final performance of the atrous convolutional neural network model.
[0092] Optionally, according to the second image set, the training parameters of the atrous convolutional neural network model are set, and the weights of the atrous convolutional neural network model are initialized; the training parameters include batch size, number of training rounds, and learning rate.
[0093] Among them, the weights of the atrous convolutional neural network model are randomly set according to the image set; the batch size refers to the number of samples input into the neural network at the same time in one training iteration, which affects the efficiency and stability of model training; the learning rate is one of the most important parameters in neural network training, which determines the step size of the model parameters in the direction of the gradient descent of the loss function during each iteration; the number of training rounds refers to the number of training iterations.
[0094] By setting weights and training parameters according to the image set, the model can learn the characteristics of each type of voucher image in more detail, avoiding learning difficulties caused by inappropriate parameter settings, which can lead to poor performance of the trained model.
[0095] Preferably, before inputting the second noise image into the atrous convolutional neural network model, the method further includes: randomly rotating the second noise image.
[0096] In the training process of neural networks, the amount of data is often limited. By rotating the image, the diversity of the data can be increased. For example, for a voucher image containing an object, after rotating it to different angles, the position and direction of the object in the image change, but the information of the image does not change. This is equivalent to creating new training samples, enriching the representation of the data, and helping the network learn more comprehensive features.
[0097] Preferably, the atrous convolutional neural network model includes: a convolutional layer, a batch normalization layer, and an activation layer;
[0098] Convolutional layer, used to extract features of the input image and output feature maps of the image;
[0099] Batch normalization layer, used to normalize the feature map of the image;
[0100] The activation layer is used to activate the feature map of the normalized image.
[0101] The Dilated Convolutional Neural Network is a neural network architecture that is improved on the traditional convolutional neural network (CNN). Its core is the use of dilated convolution, also known as expanded convolution. The dilated convolutional neural network in the trained dilated convolutional neural network model adopts a 17-layer network structure. In addition, the number of layers of the dilated convolutional neural network is selected according to different application scenarios and task requirements.
[0102] Among them, the conv (convolution) convolution operation is an important operation used to extract features in neural networks. It slides on the input data (such as images, sequences, etc.) through a convolution kernel (filter), multiplies the input data corresponding to each sliding position with the convolution kernel and sums them, thereby obtaining a new output value. This process is performed point by point on the entire input data, and finally a convolved feature map is obtained. BN (Batch Normalization) Batch normalization is a technology to accelerate neural network training and improve its stability. ReLU (Rectified Linear Unit) is a commonly used activation function. After convolution and batch normalization, the data passes through the ReLU activation function, and values less than 0 are set to 0, and values greater than 0 remain unchanged. This enables the network to learn and represent complex nonlinear relationships and enhance the network's expressive power.
[0103] By constructing the dilated convolutional neural network structure in the order of convolutional layer-batch normalization layer-activation layer, the receptive field can be expanded without increasing the number of parameters, thereby better capturing the contextual information in the image. Batch normalization (BN) is used to accelerate the training of the ReLU activation function to help the network learn more complex patterns, enabling the dilated convolutional neural network model to recognize different types of defaced voucher images.
[0104] Figure 5 A schematic diagram of the structure of a device for repairing a damaged voucher provided in this application. Figure 5 As shown, the electronic device 50 provided in this embodiment includes: at least one processor 501 and a memory 502. Optionally, the device 50 also includes a communication component 503. The processor 501, the memory 502 and the communication component 503 are connected via a bus 504.
[0105] In a specific implementation process, at least one processor 501 executes the computer-executable instructions stored in the memory 502, so that at least one processor 501 executes the above method.
[0106] The specific implementation process of the processor 501 can be found in the above method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.
[0107] The present application also provides a computer program product, including a computer program, which implements the above method when executed by a processor.
[0108] The present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the above method is implemented.
[0109] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present application.
[0110] It should be further noted that, although the various steps in the flowchart are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowchart may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0111] It should be understood that the above-mentioned device embodiments are only illustrative, and the device of the present application can also be implemented in other ways. For example, the division of units / modules in the above-mentioned embodiments is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units, modules or components can be combined, or can be integrated into another system, or some features can be ignored or not executed.
[0112] In the above embodiments, the description of each embodiment has its own emphasis. For the part not described in detail in a certain embodiment, please refer to the relevant description of other embodiments. The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of the technical features in the above embodiments are not 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.
[0113] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0114] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A method for repairing a damaged voucher, characterized in that: include: Noising the damaged voucher image to be repaired to obtain a first noisy image; Inputting the first noise image into a pre-trained dilated convolutional neural network model to generate a first stained noise image; the dilated convolutional neural network model is used to learn to establish a mapping between the stained noise image and the non-stained image; A subtraction operation is performed on the first stained noise image and the first noise image to obtain a restored voucher image.
2. The method according to claim 1, characterized in that The method also includes: acquiring a second image set, the second image set comprising credential images of different types; The second image set is segmented according to a preset stride to obtain a third image set, and the third image set is used to train a dilated convolutional neural network model.
3. The method according to claim 2, characterized in that Before inputting the first noise image into the pre-trained dilated convolutional neural network model, it also includes: Adding noise to the third image set to obtain a second noisy image; Inputting the second noise image into the atrous convolutional neural network model to predict a second stain noise image; Calculate the loss value between the second noise image and the second stained noise image according to the loss function; Use the optimizer for back propagation and perform gradient descent optimization to update the model parameters according to the loss value until the training is completed.
4. The method according to claim 3, characterized in that The method also includes: According to the second image set, the training parameters of the atrous convolutional neural network model are set, and the weights of the atrous convolutional neural network model are initialized; the training parameters include batch size, number of training rounds, and learning rate.
5. The method according to claim 3, characterized in that Before inputting the second noise image into the hole convolutional neural network model, it also includes: Randomly rotate the second noise image.
6. According to the method according to any one of claims 1 to 5, the atrous convolutional neural network model comprises: Convolutional layer, batch normalization layer, activation layer; The convolutional layer is used to extract features of the input image and output a feature map of the image; The batch normalization layer is used to normalize the feature map of the image; The activation layer is used to perform an activation operation on the feature map of the normalized image.
7. A device for repairing a damaged voucher, characterized in that: include: A processing module, used for adding noise to the damaged voucher image to be repaired to obtain a first noise image; A generation module is used to input the first noise image into a pre-trained dilated convolutional neural network model to generate a first stained noise image; the dilated convolutional neural network model is used to learn to establish a mapping between the stained noise image and the non-stained image; The generating module is further used to perform a subtraction operation on the first stain noise image and the first noise image to obtain a restored voucher image.
8. A device for repairing a damaged voucher, characterized in that: include: Memory, processor; Memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor performs the method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 6 when executed by a processor.
10. A computer program product, characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 6 when being executed by a processor.