Skip to main content

Advances, Systems and Applications

Enhancement of damaged-image prediction based on digital twin technology

Abstract

Digital twins have revolutionized the field of image enhancement by applying their unique capabilities. A digital twin refers to a virtual replica of a physical object or system, which can be utilized to simulate and analyze real-world scenarios. In image enhancement, digital twins map entities to images, identify damaged areas, and restore them to their original state. This process involves utilizing the digital twin method to understand the underlying structure and characteristics of the image. The damaged areas can be accurately modeled and repaired using techniques like the Cahn-Hilliard equation. Additionally, neural network models are leveraged to measure the effectiveness of the image restoration process. Compared with the first-order numerical scheme, the second-order method can improve the prediction accuracy by more than 40% in some cases. Through these advancements, digital twins have significantly enhanced images’ quality, clarity, and visual appeal, contributing to various photography, healthcare, and remote sensing applications.

Introduction

Digital twins are virtual replicas of physical objects that can be used to simulate the behavior and performance of their real-world counterparts. Many experts [1,2,3] emphasize that digital twin modeling is the cornerstone for accurately representing physical entities. Image inpainting, a technique used to restore damaged areas in an image by leveraging information from surrounding regions, can be applied in digital twin technology. This method can be categorized into three types: non-texture repair, texture repair, and generative image restoration. Non-texture rehabilitation restores structural details such as boundaries, corners, and curvature, while texture repair corrects global information within the damaged region. Recently, generative image restoration based on deep learning has also made notable advancements.

One of the traditional approaches for image inpainting is the PDE-based model introduced by Bertalmio [4]. This method can be implemented in digital twins to emulate the expertise of museum experts who restore cultural artifacts using a nonlinear partial differential equation. Its fundamental principle involves diffusing sharp boundaries into the areas requiring inpainting. To achieve this, the method creates intensity contours around the repaired region, gradually spreading the gray level from the border of the damaged area to its interior. The isophetes’ direction serves as the boundary condition for the inpainted area. As a result, this method can accurately model the behavior and performance of physical objects in digital twins.

In addition to the aforementioned PDE-based models, there are also alternative approaches to image inpainting. One such method is the curvature-driven diffusion model that employs Euler-Lagrange equations to estimate missing regions within the image. Another popular approach is variational models, which formulate inpainting as an energy minimization problem. The Total Variation (TV) denoising and segmentation model, introduced by Chan and Shen [5], is a well-known example of such models. This model proves effective for image restoration tasks by incorporating a penalty term that preserves the solution’s approximation outside the inpainted regions.

However, the TV model has limitations in dealing with significant gaps or intervals. To address this issue, Chan introduced the integral of the curvature along the boundary contour to the penalty term, enhancing the model’s ability to bridge larger intervals. This modified TV model for image inpainting can be utilized in digital twin technology to simulate the restoration of damaged objects accurately and efficiently.

Combining digital twin technology and image restoration based on the Cahn-Hilliard equation brings a powerful approach to enhancing and repairing damaged images. Digital twin technology provides a virtual replica of the image, allowing for a deep understanding of its structure, features, and underlying physical phenomena. Applying the Cahn-Hilliard equation, a mathematical model used to describe phase separation and interface dynamics, the damaged areas in the image can be effectively modeled and repaired.

The Cahn-Hilliard equation considers factors such as diffusion and surface energies, enabling it to capture complex patterns and enhance restoration. The equation simulates the diffusion of information within the damaged regions, promoting the reconstruction of missing details and smoothing out irregularities. This modeling approach helps restore the image to its original state by minimizing the energy associated with the damaged areas.

Existing CH models only have first-order accuracy in time, and simulating long-term evolution processes will increase the number of calculations. For this purpose this paper uses a second-order accuracy numerical model.

Furthermore, the utilization of digital twin technology allows for a comprehensive assessment of the effectiveness of the image restoration process. Neural network models can measure the restored image’s quality, fidelity, and visual appeal. These models learn from a vast dataset of high-quality images and their corresponding damaged versions, enabling them to evaluate the success of the restoration algorithm and provide quantitative metrics for assessment.

In this paper, we make the following contributions:

  • we give an energy-stable second-order numerical format of the CH equation for image restoration.

  • we introduce the multi-grid solution method of this numerical format, which can solve the problem quickly. Compared with the Newton method, it does not need to calculate the Jacobian matrix and saves memory.

The full text is organized as follows. Related work section introduces related work, Methodology section introduces the numerical format and multigrid algorithm, and Results and discussion section gives examples to prove the superiority of the second-order format. Finally, we provide some discussions and conclusions in Conclusion section.

Related work

The combination of digital twin technology and the Cahn-Hilliard equation-based image restoration presents a promising solution for the enhancement of damaged images. By leveraging the virtual representation provided by digital twins and the mathematical modeling capabilities of the Cahn-Hilliard equation, it becomes possible to restore images with improved accuracy, clarity, and visual quality. This application holds significant potential in fields like medical imaging, forensics, and historical document restoration, where damaged images need to be recovered and analyzed.

Gillette and Bertozzi [6] were the first to apply the Cahn-Hilliard equation model to image restoration work. They added a fidelity item based on the CH equation, which has a good repair effect on binary images.

$$\begin{aligned} u_{t} = - \Delta (\epsilon \Delta u - \frac{1}{\epsilon }W(u)) + \lambda _{\Omega \smallsetminus D}(u_{0} - u). \end{aligned}$$

\(\lambda (x)\) is the mark of the damaged area, W(u) is the double well potential function, and one of the author’s suggestions is \(u^{2}(u - 1)^{2}\)

Neumann zero-flux boundary value condition, \(\Omega\) is the image area, D is the area to be repaired, if

$$\begin{aligned} \lambda _{\Omega \smallsetminus D}(x) = \left\{ \begin{array}{cc} {0,} &{} {\text {if}{\, x \in D}} \\ {\lambda _{0},} &{} {\text {if}{\, x \in \Omega \smallsetminus D}} \\ \end{array} \right. \end{aligned}$$

The model can fill in a wide range of information gaps very well. In solving the model, the author uses a numerical format of convex decomposition.

Burger [7] obtained the \(TV-H^{-1}\) model after seeking the limit of the energy functional of Bertozzi’s model and removed the free energy item. This model can be applied to grayscale images. \(TV-H^{-1}\) has the same minimum point as the CH equation, but the model slowly converges to a steady state.

Kim [8] pointed out that when repairing an image with broken stripes, the non-smooth break at the boundary and the smooth repair function can cause stepped repair at the edge. For this reason, the author introduces a preprocessing method, which first solves an anisotropic diffusion equation and then solves the improved CH equation.

To address the above problems, Zou [9] proposes to combine the Perona-Malik equation and the CH equation. By adding the nonlinear diffusion coefficient before the diffusion term, the CH equation of anisotropic diffusion is obtained, which ultimately achieves a smooth repair effect at the boundary.

Since then, different scholars have attempted to expand the application of the CH equation in image restoration. Since the free energy term in the CH model specifies a stable point, it is only suitable for binary images. For gray-scale pictures and color images, it is necessary to remove the free energy term or consider the complex-valued CH model [7, 10] in vector form, or use multi-valued potential functions instead of double-well potentials [11]. Other considerations include the inpainting of color images using the multiphase flow CH model [12], and the consideration of fractional CH equations [13].

The CH equation essentially represents the average curvature, but the steady-state calculation time in the CH equation is greatly affected by \(\epsilon\). In [6], the author suggested using a two-stage algorithm but did not provide specific guidance. This paper proposes selecting the value of \(\epsilon\) based on the size of the damaged area. For larger damaged areas, a multi-stage algorithm can be employed to expedite the convergence speed. Additionally, the calculation of the next stage begins after the previous step enters a steady state to prevent oscillation at the boundary.

Carrillo et al. [14] applied the CH model for image preprocessing in the neural network image recognition task. They used the MINIST dataset to verify the CH model as a preprocessor, which can improve the recognition accuracy of damaged data. The above image inpainting models based on the CH equation are all based on the convex decomposition method and the numerical format with first-order precision on time. Since the spatial step is a fixed value of 1 for the image, although the spatial accuracy is second-order in the standard discrete format, the time step will still affect the overall error. If one use a small time step, it will increase a lot of calculations.

This paper presents a time-based second-order numerical scheme based on a convex decomposition method, which has the good properties of unconditional energy stability and unique solvability and is solved using a multigrid method [15]. Based on the work of Carrillo et al. [14], the experimental process of handwritten data is re-examined, proving that the second-order numerical format can achieve a better restoration effect and improve the prediction accuracy of the neural network model (Table 1).

Table 1 Summary of related work

Methodology

Here, we use the second-order numerical scheme of [15] and the geometric multigrid solver [16, 17] for the resulting nonlinear problem. Consider energy first

$$\begin{aligned} E(\phi ) = \int _{\Omega }\frac{\phi ^{4}}{4} - \frac{\phi ^{2}}{2} + \epsilon ^{2}| \nabla \phi |^{2}{dx} + \lambda _{\Omega \smallsetminus D}\int _{\Omega \smallsetminus D}\frac{(\phi ^{0} - \phi )^{2}}{2}{dx} \end{aligned}$$

The original CH equation is the gradient flow in the \(H^{-1}\) space, and it is no longer in the form of gradient flow after adding the fidelity item. After the two terms of the energy functional are varied in the space of \(H^{-1}\) and \(L^2\) respectively, the equation of the continuous situation is obtained:

$$\begin{aligned} \phi _{t} = - \Delta (\epsilon ^{2}\Delta \phi - (\phi ^{3} - \phi )) + \lambda _{\Omega \smallsetminus D}(\phi ^{0} - \phi ). \end{aligned}$$

The boundary condition is the zero-flux Neumann boundary (let \(u = \epsilon \Delta \phi - \frac{1}{\epsilon }(\phi ^{3} - \phi )\))

$$\begin{aligned} \frac{\partial \phi }{\partial n} = 0\quad {\text {on~}{\partial \Omega }},\quad \frac{\partial u}{\partial n} = 0\quad {\text {on~}{\partial \Omega }} \end{aligned}$$

Initial value:

$$\begin{aligned} \phi (0) = \phi ^{0} \end{aligned}$$

For a detailed definition of discrete function space, please refer to [15]. Here is the format after the discretization of time and space directly:

$$\begin{aligned} \frac{\phi _{ij} - \phi _{ij}^{n}}{dt}{} & {} = \frac{\phi _{ij}^{2} + (\phi _{ij}^{n})^{ 2}}{4\epsilon }(\phi _{ij} + \phi _{ij}^{n}) - (\frac{3}{2}\phi _{ij}^{n} - \frac{1}{2}\phi _{ij}^{n - 1})/\epsilon \\{} & {} - \epsilon \Delta _{h}\frac{3\phi _{ij} + \phi _{ij}^{n - 1}}{4} + \lambda _{\Omega \smallsetminus D}(\phi _{ij}^{0 } - \phi _{ij}). \\ \end{aligned}$$

\(\epsilon\) is the interface width parameter, \(\phi _{ij}\) is the unknown pixel value of the image at position (i, j), \(\phi _{ij}^n\) is the known pixel value of the image at position (i, j) at the nth time step, and \(\Delta _h\) is a discrete second-order difference operator.

For CH equations that do not contain fidelity terms, this scheme has unconditional energy stability, unique solvability [15], and the dependence of the convergence constant on the polynomial [18]. After rewriting using the auxiliary variable u, we get:

$$\begin{aligned} \begin{array}{l} \frac{\phi _{ij}-\phi _{ij}^{n}}{d t}=-\epsilon \Delta _{h} u_{ij}+\lambda \left( \phi _{ij}^{0}-\phi _{ij}\right) \\ u_{ij}=\frac{\phi _{ij}^{2}+\left( \phi _{ij}^{n}\right) ^{2}}{4 \epsilon }\left( \phi _{ij}+\phi _{ij}^{n}\right) -\left( \frac{3}{2} \phi _{ij}^{n}-\frac{1}{2} \phi _{ij}^{n-1}\right) / \epsilon -\epsilon \Delta _{h} \frac{3 \phi _{ij}+\phi _{ij}^{n-1}}{4} \end{array} \end{aligned}$$

We use the nonlinear geometric multigrid algorithm for solving the numerical format above. For the original CH equation, which is the gradient flow in \(H^{-1}\) space, the numerical scheme processed by convex decomposition corresponds to the minimization of a convex functional. Then, the convergence of the multigrid solver can be obtained. For the geometric multigrid algorithm, in addition to the conventional Interpolation and Ristriction operators, it is mainly necessary to define the residual function and the Smoothing operator in the code implementation.

After arranging the known and unknown items in the equation, the following form is obtained:

$$\begin{aligned} \begin{array}{l} (1+\lambda d t) \phi _{ij}-d t \epsilon \Delta _{h} u_{ij}=\phi _{ij}^{n}+\lambda d t \phi _{ij}^{0} \\ \frac{\phi _{ij}^{2}+\left( \phi _{ij}^{n}\right) ^{2}}{4 \epsilon }\left( \phi _{ij}+\phi _{ij}^{n}\right) +\frac{3 \epsilon }{4} \Delta _{h} \phi _{ij}+u_{ij}=-\left( \frac{3}{2} \phi _{ij}^{n}-\frac{1}{2} \phi _{ij}^{n-1}\right) / \epsilon -\frac{\epsilon }{4} \Delta _{h} \phi _{ij}^{n-1} \end{array} \end{aligned}$$

Express the residual function r as the difference between the Operator and Source term \(r=N-S.\)

For the sake of simplicity, the definition is as follows:

$$\begin{aligned} \begin{array}{l} \widetilde{\chi }\left( \phi _{i, j}, \phi _{i, j}^{n}\right) =\frac{1}{4 \varepsilon }\left( \phi _{i, j}^{2}+\left( \phi _{i, j}^{n}\right) ^{2}\right) \\ \chi \left( \phi _{i, j}, \phi _{i, j}^{n}\right) =\frac{1}{4 \varepsilon }\left( \phi _{i, j}^{2}+\left( \phi _{i, j}^{n}\right) ^{2}\right) \left( \phi _{i, j}+\phi _{i, j}^{n}\right) \\ \end{array} \end{aligned}$$

The Operator term is defined as a nonlinear operator \(N=(N^1,N^2)^T\) of shape \(2\times N\times N\), and the component form is:

$$\begin{aligned} \begin{array}{l} N_{i, j}^{1}\left( \phi , \phi ^{n}\right) =(1+\lambda d t) \phi _{i, j}-d t \epsilon \Delta _{h} u_{i, j} \\ N_{i, j}^{2}\left( \phi , \phi ^{n}\right) =u_{i, j}-\chi \left( \phi _{i, j}, \phi _{i, j}^{n}\right) +\epsilon \Delta _{h} \phi _{i, j} \end{array} \end{aligned}$$

The Source term is defined as the source \(S=(S^{(1,n)},S^{(2,n)})^T\) of shape \(2\times N\times N\), and the component form is

$$\begin{aligned} \begin{array}{l} S_{i, j}^{(1, n)}=(1+\lambda d t) \phi _{i, j}^{n} \\ S_{i, j}^{(2, n)}=-\left( \frac{3}{2} \phi _{\textrm{ij}}^{n}-\frac{1}{2} \phi _{\textrm{ij}}^{n-1}\right) / \epsilon -\frac{\epsilon }{4} \Delta _{h} \phi _{i, j}^{n-1} \end{array} \end{aligned}$$

Solving the residual equation is equivalent to solving \(N(\phi )=S^n\) The Smooth operator is the local linearization of the Operator term, defined as:

$$\begin{aligned} \begin{array}{l} (1+\lambda d t) \phi _{i, j}+\frac{\varepsilon d t}{h^{2}} 4 \mu _{i, j} \\ =S_{i, j}^{(1, n)}+\frac{\varepsilon d t}{h^{2}}\left[ \mu _{i+1, j}^{n}+\mu _{i-1, j}+\mu _{i, j+1}^{n}+\mu _{i, j-1}\right] \\ {\left[ -\tilde{\chi }\left( \phi _{i, j}, \phi _{i, j}^{n}\right) -\frac{9 \varepsilon }{2 h^{2}}\right] \phi _{i, j}+\mu _{i, j}} \\ =S_{i, j}^{(2, n)}+\tilde{\chi }\left( \phi _{i, j}, \phi _{i, j}^{n}\right) \phi _{i, j}^{n} \\ -\frac{3 \varepsilon }{4 h^{2}}\left[ \phi _{i+1, j}^{n}+\phi _{i-1, j}+\phi _{i, j+1}^{n}+\phi _{i, j-1}\right] \end{array} \end{aligned}$$

Zero-flux Neumann boundary condition:

$$\begin{aligned} \begin{array}{ll} \phi _{\textrm{i}, 0}=\phi _{i, 1} &{} \phi _{\textrm{i}, N+1}=\phi _{i, N } \\ \phi _{0, j}=\phi _{1, j} &{} \phi _{N+1, j}=\phi _{N, j} \\ u_{\textrm{i}, 0}=u_{i, 1} &{} u_{\textrm{i}, N+1}=u_{i, N} \\ u_{0, j}=u_{1, j } &{} u_{N+1, j}=u_{N, j} \end{array} \end{aligned}$$

The initial value is the input data \(\phi (0)=\phi ^0\). A multigrid algorithm in the format of the V-cycle full approximation scheme (FAS) is used here. Unlike the multigrid iteration using Newton’s method for global linearization, a nonlinear disturbance equation is solved on the coarse grid in the FAS format:

$$\begin{aligned} \textrm{N}_{\textrm{H}}\left( \phi _{H}\right) =I_{h}^{H}\left( S_{h}-N_{h}\left( \phi _{h}\right) \right) +N_{\textrm{H}}\left( I_{h}^{H} \phi _{h}\right) \end{aligned}$$

In the FAS format, only local linearization is done in the smoothing operator.

Multigrid works on grids with hierarchies. It does not solve the equations precisely on the coarsest mesh but still uses the smoothing step to obtain an approximate solution. Then, use the standard interpolation and restriction operators to transfer the information between the two layers of grids. The calculation process of the multigrid cycle can refer to [17]. with the second-order extrapolation formula to establish initial value estimates at different time points, we could obtain the complete multigrid process with time step iterations with an outer cycle. The stop condition is defined by the norm of the residual function using normalization.

Parameters and Neural Network Models

In the original CH equation, \(\epsilon\) describes the width \(\delta\) of the boundary layer, and there is an approximate relationship \(\delta = 4.164 \sqrt{\epsilon ^2}\). Meanwhile, in the energy, \(\epsilon\) is Used to weight the gradient term, and the gradient term \(|\nabla \phi |\) is used to describe the boundary. The corresponding energy minimization process requires a reduction in the number of edges. The original physical change is in two stages. The first stage is phase separation, and the stable state of interfaces with multiple \(\delta\) is rapidly formed in the region; the second stage is coarsening, and the boundary in the steady state is merging, showing that small areas merge into larger sizes.

Since \(\epsilon\) determines the width of the boundary layer, smaller epsilon values correspond to sharper boundaries. A two-stage algorithm is used in the image restoration process: the first stage sets a considerable \(\epsilon\) value so that the boundaries connect by diffusion. The second stage sets a small \(\epsilon\) value to make the edges sharper after reconnection.

Since the smallest unit is a pixel point in the image, the grid space step size h in the corresponding difference method is a fixed value of 1. In the CH equation, the more points on the boundary, the smaller the error. According to the relationship between the boundary layer thickness and the parameter \(\epsilon\), it is necessary to set a more significant \(\epsilon\) value when repairing a large damaged area.

The image processing steps are as follows: Step 1, input the image to be repaired and the mask image. Step 2, transform the pixel value of the image to be repaired into the range of [-1,1]. Step 3, uses the transformed result as the initial value and the mask image pixel value to set the indication coefficient. Step 4, establish the numerical format of the Cahn-Hilliard equation and use the FAS format multi-grid solution. Step 5, transform the calculation result into the original image value range.

In the following experiments, the inpainting effect of the second-order CH scheme is verified by using the prediction effect changes before and after preprocessing on the neural network model. To this end, a neural network model is trained on the handwritten digit dataset MINIST. Then, make different damage patterns to the test data, use the neural network model to predict, and obtain the prediction accuracy of the damaged data; then use the CH model to perform image restoration and get the prediction accuracy of the repaired data. Finally, compare the improvement in prediction accuracy before and after restoration. The neural network model building and calculation process following Carrillo et al. [14].

We use two random damage modes: 1) Destroy rows randomly select several rows for shading. 2) Destroy pixels and randomly select several pixels for masking.

The MNIST dataset is handwritten digit data. Each image is a 28*28 grayscale image.

In the numerical solution of the CH equation, the time step \(dt=0.1\), the space step \(h=1\), and the definition domain is a square area of [0,28]*[0,28]. Using a two-stage approach, \(\epsilon _1=1.5,\epsilon _2=0.5\), values changed at time point \(t=2\). Termination time \(T=6\). Penalty coefficient

$$\begin{aligned} \lambda _{\Omega \smallsetminus D}(x) = \left\{ \begin{array}{cc} {0,} &{} {\text {if}{\, x \in D}} \\ {9000,} &{} {\text {if}{\, x \in \Omega \smallsetminus D}} \\ \end{array} \right. \end{aligned}$$

We use the prediction accuracy of the neural network model to evaluate the effect of image restoration. The evaluation index used here is the improvement rate:

$$\begin{aligned} Lift=\frac{postAcc-preAcc}{preAcc} \end{aligned}$$

postAcc is the prediction accuracy rate after processing, and preAcc is the prediction accuracy rate before processing.

The signal-to-noise ratio of an image is defined as:

$$\begin{aligned} SNR=10LOG_{10}\frac{\Vert z\Vert _2}{\Vert z-u\Vert _2} \end{aligned}$$

where z is the original image and u is the inpainted image.

Results and discussion

Comparison of effect with and without CH filter

The evaluation index used here is the lift rate(Lift). It is defined as the relative change value of the prediction accuracy of the neural network model before and after preprocessing.

Because each time a new random number is used for the damaged position of each picture, the prediction accuracy rate obtained by each execution of the program is different. The mean of five experiments is used here as the final result. From Tables 2 and 3, the results show that the second-order format’s improvement rate is higher. Moreover, in the first-order form, the promotion rate obtained is negative when the number of damaged lines is 24 or 26 in the broken line mode. In the pixel-broken way, the pixel ratio is \(30\%, 40\%\), the promotion rate is zero. Both are positive values here. Combined with the previous signal-to-noise ratio analysis, we found that the first-order format may not have selected the optimal time point for prediction.

Table 2 Damaged with rows
Table 3 Damaged with pixels

Note: Compared with the original paper [14] , the initial prediction accuracy is different from that given here due to the use of different initial values.

The tabular data verifies that using the CH model to paint the image can improve the prediction effect of the image, and the improvement rate is higher than that of the first-order scheme. In addition, in the first-order format [14], the promotion rate obtained is negative when the number of lines breaks into 24 and 26 lines. When the pixel destruction ratio is 30%, 40%, the promotion rate is zero. In the second-order format, both are positive values. It shows the superiority of the second-order scheme in terms of accuracy improvement. In terms of calculation speed, use the fsolve function in the scipy package to solve nonlinear equations. After Carrillo et al. [14] changed the direct solution to the alternate direction row solution, they reduced the processing time of an image from 25s to 8s. In this paper, the nonlinear multi-grid algorithm is used, and the calculation time of each print is 1s.

Case Analysis

A single image is compared before and after using the CH filter, and a larger value is used before the first time point \(t=2\), and the change process is dominated by diffusion. With smaller values after the first time point, the region edges sharpen quickly, forming sharp boundaries.

There will be marks on thicker banded edges. We can see that the image has a clearer boundary after 60 steps of evolution.

Comparison of results in pixel destruction mode. It can be seen from Figs. 1 and 2 that: a). A large \(\epsilon\) at the first time point makes the image blurred, and a small \(\epsilon\) value at the following few time points makes the picture gradually more evident, and the boundary sharper. b). Successive row corruption can make repairs difficult. Leave traces at intermediate time points.

Fig. 1
figure 1

Row Damage:the 1st image is the original image, the 2nd image is the damaged image (with 12 random rows of data masked), and the 3rd-8th images are the repaired images, corresponding to time points 1-6, respectively

Fig. 2
figure 2

Pixel Damage:the first image is the original image, the second is the damaged image (covering 30% of the pixels), and the third-eighth images are the repaired images, corresponding to time points 1-6, respectively

SNR analysis

SNR is the signal-to-noise ratio initially used to measure the percentage of signal-to-noise. The larger the signal-to-noise ratio, the better the image quality. The SNR is used here to measure how close the repaired image is to the original image. The signal-to-noise ratio was used to compare the difference in image processing effects between the first-order and second-order schemes of the CH equation.

The mean value of SNR at different time points for 2000 samples in row corruption mode was calculated. The abscissa is the number of time steps, and the number of damaged lines is 22, 24, and 26, respectively. It can be seen from the Fig. 3: a. At the first three time points, the SNR of the second-order scheme is higher than that of the first-order form [14] and reaches the maximum at the second time point. It shows that the 2nd order scheme has a better repair effect in the first stage of the calculation. b. The entire SNR curve rises first and then falls. The best repair effect is at the middle time point. c. The more destroyed rows, the smaller the maximum SNR that can be achieved. The more damaged points, the worse the repair effect.

Fig. 3
figure 3

Compare the SNR,the damaged lines are 22, 24, and 26, respectively. The mean point curve of 2,000 test images

The above analysis suggests that using the repair value of the last time point is unnecessary when using neural network prediction, and a better prediction effect can be obtained by using the repair value of the second time point.

Compared with the restoration effect of other CH models

A comparison of the repair effects of different variants of the CH model is shown in Fig. 4. The time step is 0.1, the end time is 110, and the image size is 128*128. All models are solved using the method based on time evolution. Table 4 show that the repair effect of the fractional CH equation [13] is the worst. The existence of the fractional term increases the difficulty of solving and introduces a larger parameter search space. The same problem exists in the PeronaMalik method [9] and the preprocessing CH [8] method. The introduction of nonlinear terms increases the difficulty of solving the original equation and increases the parameter search space. In contrast, the problem of the CH model exists only in the choice of two-stage parameters. Regarding calculation speed, the solution of the CH equation using the geometric multigrid algorithm is faster.

Fig. 4
figure 4

Compared with other CH models

Table 4 The SNR value of different CH model

Discussion

In the previous section, we have highlighted the effectiveness of the CH high-precision numerical model in binary image restoration. This model offers a more accurate and efficient solution than traditional first-order formats. Using a second-order format, we can achieve higher signal-to-noise ratios and greater prediction accuracy for image restoration tasks, resulting in superior output quality.

We can further enhance its capabilities by integrating the CH high-precision numerical model with a nonlinear multigrid solver that accelerates data preprocessing tasks. The multigrid solver enables faster calculations for large datasets by approximating solutions on successively coarser grids. This approach reduces the number of measures required, significantly improving computational efficiency.

In digital twin technology, integrating the CH high-precision numerical model and the nonlinear multigrid solver can be applied to various areas, such as medical imaging and engineering. For instance, in medical imaging, this approach can be used to restore damaged or degraded images, diagnose anomalies, and improve the accuracy of medical models. Similarly, in engineering, digital twins can be created to simulate system behavior and predict potential issues, such as equipment failure or performance degradation, allowing for proactive maintenance and minimizing the risk of downtime.

Conclusion

This paper introduces a digital twin-based approach with a modeling method by CH equation in image restoration tasks with high temporal precision. The proposed method utilizes a nonlinear multigrid solver, which enhances the signal-to-noise ratio and prediction accuracy compared to the first-order format. Additionally, the multigrid solver enables faster data preprocessing, making it particularly beneficial for handling large datasets. This study applies advanced techniques to image restoration for the first time by adopting a high-order numerical scheme for the CH equation.

The FAS format offers advantages by eliminating the need to calculate the Jacobian matrix and reducing memory requirements for extensive computations. However, its implementation for application problems faces challenges due to the demand for custom smoothing operators for different dimensions and equations, which may affect code implementation.

Furthermore, this article primarily focuses on a limited number of examples, mainly simple textures in handwritten datasets, and concentrates on addressing local texture restoration. Further investigations are necessary to showcase the full potential of high-precision solutions of the CH equation. Future work will apply the proposed approach to more complex datasets to comprehensively demonstrate its advantages.

Availability of data and materials

Data and materials are available upon request.

Code availability

Codes used in the study are available upon request.

References

  1. Botin-Sanabria DM, Mihaita AS, Peimbert-Garcia RE, Ramirez-Moreno MA, Ramirez-Mendoza RA, Lozoya-Santos JDJ (2022) Digital twin technology challenges and applications: A comprehensive review. Remote Sens 14(6):1335. https://doi.org/10.3390/rs14061335

  2. Li, L, Lei B, Mao C (2022) Digital twin in smart manufacturing. J Ind Inf Integr 26:100289. https://doi.org/10.1016/j.jii.2021.100289

  3. Tao F, Xiao B, Qi Q, Cheng J, Ji P (2022) Digital twin modeling. J Manuf Syst 64:372–389

    Article  Google Scholar 

  4. Bertalmio M, Sapiro G, Caselles V, Ballester C (2000) Image inpainting. In: Proceedings of the 27th annual conference on computer graphics and interactive techniques - SIGGRAPH ’00. ACM Press, NEW ORLEANS, LA. ACM Press/Addison-Wesley Publishing Co., USA. pp. 417– 424. https://doi.org/10.1145/344779.344972

  5. Shen J,Chan TF (2002) Mathematical models for local nontexture inpaintings. Soc Ind Appl Math 62(3):372– 389. https://doi.org/10.1137/S0036139900368844

  6. Bertozzi AL, Esedoglu S, Gillette A (2007) Inpainting of binary images using the Cahn-Hilliard equation. IEEE Trans Image Process 16(1):285–291

    Article  MathSciNet  Google Scholar 

  7. Burger M, He L, Schoenlieb CB (2009) Cahn-Hilliard Inpainting and a Generalization for Grayvalue Images. Siam J Imaging Sci 2(4):1129–1167

    Article  MathSciNet  Google Scholar 

  8. Kim J, Lee CO (2019) Three-Dimensional Volume Reconstruction Using Two-Dimensional Parallel Slices. Siam J Imaging Sci 12(1):1–27

    Article  MathSciNet  Google Scholar 

  9. Zou Q (2021) An image inpainting model based on the mixture of Perona-Malik equation and Cahn-Hilliard equation. J Appl Math Comput 66(1–2):21–38

    Article  MathSciNet  Google Scholar 

  10. Cherfils L, Fakih H, Miranville A (2017) A complex version of the Cahn-Hilliard equation for grayscale image inpainting. Multiscale Model Simul 15(1):575–605

    Article  MathSciNet  Google Scholar 

  11. Bosch J, Kay D, Stoll M, Wathen AJ (2014) Fast Solvers for Cahn-Hilliard Inpainting. Siam J Imaging Sci 7(1):67–97

    Article  MathSciNet  Google Scholar 

  12. Cherfils L, Fakih H, Miranville A (2016) A Cahn-Hilliard system with a fidelity term for color image inpainting. J Math Imaging Vis 54(1):117–131

    Article  MathSciNet  Google Scholar 

  13. Brkić AL, Mitrović D, Novak A (2020) On the image inpainting problem from the viewpoint of a nonlocal Cahn-Hilliard type equation. J Adv Res 25:67–76

    Article  Google Scholar 

  14. Carrillo JA, Kalliadasis S, Liang F, Perez SP (2021) Enhancement of damaged-image prediction through Cahn-Hilliard image inpainting. R Soc Open Sci 8(5):201294

    Article  Google Scholar 

  15. Guo J, Wang C, Wise S, Yue X (2016) An \(H^2\) convergence of a second-order convex-splitting, finite difference scheme for the three-dimensional Cahn-Hilliard equation. Commun Math Sci 14:489–515

  16. Wise S, Wang C, Lowengrub J (2009) An energy stable and convergent finite-difference scheme for the phase field crystal equation. Siam J Numer Anal 47:2269–2288

    Article  MathSciNet  Google Scholar 

  17. Wise S (2010) Unconditionally stable finite difference, nonlinear multigrid simulation of the Cahn-Hilliard-Hele-Shaw system of equations. J Sci Comput 44:38–68

    Article  MathSciNet  Google Scholar 

  18. Guo J, Wang C, Wise SM, Yue X (2021) An improved error analysis for a second-order numerical scheme for the cahn-hilliard equation. J Comput Appl Math 388:113300

    Article  MathSciNet  Google Scholar 

Download references

Funding

This work was supported by the National Natural Science Foundation of China(No.61070015), Guangdong Frontier and Key Technological Innovation Special Funds(Grant Scientific and Technological Project)(No.2014B010110004), Funds of The University Engineering and Technology Research Center Of Guangdong(No.2022GCZX013).

Author information

Authors and Affiliations

Authors

Contributions

J.G wrote the main manuscript text and prepared figures. All authors reviewed the manuscript.

Corresponding author

Correspondence to Deyu Qi.

Ethics declarations

Ethics approval and consent to participate

Not applicable.

Consent for publication

We obtained consent from all participants to use their personal information and data in the publication.

Competing interests

The authors declare no competing interests.

Additional information

Publisher’s Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Rights and permissions

Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Guo, J., Qi, D. Enhancement of damaged-image prediction based on digital twin technology. J Cloud Comp 12, 177 (2023). https://doi.org/10.1186/s13677-023-00563-y

Download citation

  • Received:

  • Accepted:

  • Published:

  • DOI: https://doi.org/10.1186/s13677-023-00563-y

Keywords