https://github.com/marieroald/condat_tv

Python wrapper for the fast TV denoising algorithm by Laurent Condat

https://github.com/marieroald/condat_tv

Science Score: 10.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: ieee.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.7%) to scientific vocabulary

Keywords

compressive-sensing denoising regularization signal-processing statistics total-variation

Keywords from Contributors

tensors
Last synced: 5 months ago · JSON representation

Repository

Python wrapper for the fast TV denoising algorithm by Laurent Condat

Basic Info
  • Host: GitHub
  • Owner: MarieRoald
  • License: other
  • Language: C
  • Default Branch: main
  • Homepage:
  • Size: 83 KB
Statistics
  • Stars: 3
  • Watchers: 2
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Topics
compressive-sensing denoising regularization signal-processing statistics total-variation
Created about 5 years ago · Last pushed about 4 years ago
Metadata Files
Readme License

README.md

CondatTV

Cython wrapper for the efficient TV denoising algorithm by Laurent Condat. This wrapper wraps Condats C implementation of the algorithm for use with NumPy.

The algorithm this code uses is the improved fast total variation algorithm. The original C and MATLAB code is available on the software page of Laurent Condat's webpage.

Installation instructions

To install these bindings, you should have a C-compiler installed on your system. Make sure you have NumPy and Cython installed beforehand (both packages come with Anaconda by default) and write

pip install condat-tv

in your terminal window. In case that does not work, you can install it directly from github by running the command

pip install git+https://github.com/yngvem/condat_tv.git

Example of denoising with total variation minimization

The following example is inspired by the experiments on syntetic data in [1]

python import condat_tv import numpy as np import matplotlib.pyplot as plt

Generate syntetic data

```python np.random.seed(0)

N = 500 # number of samples

Generate a sparse "derivative" vector

signalderivative = np.random.standardnormal(N)4 for k in range(N): signalderivative[k] = signalderivative[k](np.random.uniform(0,1)>0.95)

Integrate the sparse derivative vector to obtain a piecewise constant vector

signal = np.cumsum(signal_derivative)

Add noise

noisysignal = signal + np.random.standardnormal(signal.shape) ```

Plot the syntetic data

```python plt.figure(figsize=(12, 4))

plt.plot(signal, label="Signal") plt.plot(noisy_signal, label="Noisy signal")

plt.xlim(0, N) plt.legend() plt.title("Plot showing the signal with and without the added noies") plt.show() ```

png

Denoise and visualize the results

```python plt.figure(figsize=(12, 4)) plt.plot(signal, label="Signal")

for regstrength in [0.5, 2, 8, 32]: # Denoise the signal with total variation minimization denoisedsignal = condattv.tvdenoise(noisysignal, regstrength)

# Visualize denoised signal
plt.plot(denoised_signal, label=f"Reg strength: {reg_strength}")

# Calculate and print RMSE
RMSE = np.linalg.norm(denoised_signal-signal)/np.sqrt(N)
print(f"Regularisation strength: {reg_strength:.1e}, RMSE: {RMSE:.2e}")

plt.xlim(0, N) plt.legend(ncol=5) plt.title("Visualisation of denoising results for different regularisation strengths") plt.show() ```

Regularisation strength: 5.0e-01, RMSE: 5.70e-01
Regularisation strength: 2.0e+00, RMSE: 3.56e-01
Regularisation strength: 8.0e+00, RMSE: 5.89e-01
Regularisation strength: 3.2e+01, RMSE: 1.52e+00

png

References

[1] Condat L. A direct algorithm for 1-D total variation denoising. IEEE Signal Processing Letters. 2013 Aug 15;20(11):1054-7. (link)

Owner

  • Name: Marie Roald
  • Login: MarieRoald
  • Kind: user
  • Location: Oslo
  • Company: Simula Metropolitan

PhD student and educator working on data mining with tensor decomposition. Excited about science outreach and visualization.

GitHub Events

Total
  • Watch event: 1
Last Year
  • Watch event: 1

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 17
  • Total Committers: 2
  • Avg Commits per committer: 8.5
  • Development Distribution Score (DDS): 0.294
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Yngve Mardal Moe y****e@g****m 12
Marie Roald r****e@g****m 5

Issues and Pull Requests

Last synced: 7 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Dependencies

requirements.txt pypi
  • pip *
  • twine *
  • wheel *