This package provides functions to execute perturbed inertial Krasnoselskii-Mann iterations to solve the image inpainting problem.
This code is related to my Bachelor Thesis on the topic of perturbed inertial Krasnoselskii-Mann iterations. In this thesis, I devise an inertial framework to accelerate the convergence of the standard KM iterations, and apply this algorithm to the image inpainting problem. This problem consists of reconstructing an image after part of it has been deleted (in this case a number of random pixels). The full text is available via this link.
After more careful analysis the work gave rise to a paper, on the same topic. The preprint of this work may be found on ArXiV.
The package is available through pip, and may be installed via:
pip install PIKM_Inpainter
In order to run the package, an image is required. The image must imperatively be called Venice.jpeg
, and be placed in the same folder as the code is executed. Examples may be found in /tests
.
To utilize this package, you can call the getInpainted
function:
getInpainted(rho, sigma, lamb, percent, res)
- rho (float): Step size parameter, in the interval (0,2).
- sigma (float): Regularisation parameter, positive number.
- lamb (float): Relaxation parameter, in the interval (0,1).
- percent (float): Percentage of pixels erased randomly in the image, in the interval (0,1).
- res (string): Type of residual (
"rel"
for relative residual,"Tx-x"
for pointwise residual)
- None
Experiments are pre-coded in the library, through the function plotExperiments
.
plotExperiments(rho, sigma, lamb, percent, res)
One of the parameters should be a list of parameters, which will determine the experiment.
- rho (float): Step size parameter, in the interval (0,2).
- sigma (float): Regularisation parameter, positive number.
- lamb (float): Relaxation parameter, in the interval (0,1).
- percent (float): Percentage of pixels erased randomly in the image, in the interval (0,1).
- res (string): Type of residual (
"rel"
for relative residual,"Tx-x"
for pointwise residual)
- its_S (list): List of iterations required for static.
- its_H (list): List of iterations required for heavy-ball.
- its_N (list): List of iterations required for Nesterov.
- its_R (list): List of iterations required for reflected.
- time_S (list): List of times required for static.
- time_H (list): List of times required for heavy-ball.
- time_N (list): List of times required for Nesterov.
- time_R (list): List of times required for reflected.
A specific type of experiment may be run on the regularisation parameter, through the function plotExperimentRegularisation
.
plotExperimentRegularisation(rho, sigmas, lamb, percent, method, res)
- rho (float): Step size parameter, in the interval (0,2).
- sigmas (list): List of regularisation parameters. Array must have 6 regularisation parameters.
- lamb (float): Relaxation parameter, in the interval (0,1).
- percent (float): Percentage of pixels erased randomly in the image, in the interval (0,1).
- method (string): The chosen acceleration method. Must be one of
"static"
,"heavyball"
,"nesterov"
or"reflected"
. - res (string): Type of residual (
"rel"
for relative residual,"Tx-x"
for pointwise residual)
from PIKM_Inpainter import getInpainted
getInpainted(rho=1.8, sigma=.5, lamb=.8, percent=.5, res="Tx-x")
In this example we select a step size
This produces the result in the following two figures.