Skip to main content

Perturbed Inertial KM Iterations for Image Inpainting

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.

Installation

The package is available through pip, and may be installed via:

pip install PIKM_Inpainter

Setup

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.

Main Usage

To utilize this package, you can call the getInpainted function:

getInpainted(rho, sigma, lamb, percent)

Parameters:

  • 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).

Returns:

  • None

Running Experiments

Experiments are pre-coded in the library, through the function plotExperiments.

plotExperiments(rho, sigma, lamb, percent)

Parameters:

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).

Output:

  • 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.

Experiment on Regularisation Parameter

A specific type of experiment may be run on the regularisation parameter, through the function plotExperimentRegularisation.

plotExperimentRegularisation(rho, sigmas, lamb, percent, method)

Parameters:

  • 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".

Example

from PIKM_Inpainter import getInpainted
getInpainted(rho=1.8, sigma=.5, lamb=.8, percent=.5)

In this example we select a step size $\rho=1.8$, a regularisation parameter $\sigma=0.5$, a relaxation parameter $\lambda=0.8$, and a percentage of erased pixels of $50%$.

This produces the result in the following two figures.

Metadata

Release files for PIKM-Inpainter 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for PIKM-Inpainter 0.0.2
File Size Uploaded
PIKM_Inpainter-0.0.2.tar.gz 10.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for PIKM-Inpainter 0.0.2
File Interpreter ABI Platform
PIKM_Inpainter-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 21.5 kB

Release files / PIKM_Inpainter-0.0.2.tar.gz

Download URL PIKM_Inpainter-0.0.2.tar.gz
Size 10.3 kB
Tags Source
SHA-256 checksum
How to use checksums
80a85f7d5e8c612811a6d66042353a03e2af23c983faff755e887af99e9ed7ab
BLAKE2b-256 checksum
How to use checksums
d88aab898d7acee380a890bc8b7e8ca61226f813cf3020b7df1d5f2e42f340b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Release files / PIKM_Inpainter-0.0.2-py3-none-any.whl

Download URL PIKM_Inpainter-0.0.2-py3-none-any.whl
Size 11.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9ddd7aeda137905f43e807ee92ba33198532fe91d8d6541419c2f27e4989a4a5
BLAKE2b-256 checksum
How to use checksums
7a08ee7bd43a4af8e9302ab30940d3f555496b55d07a5d49e701c76608ba7d24
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page