Skip to main content

A package for sparse representations and dictionary learning

Project description

Sparselandtools

PyPI - Python Version PyPI PyPI - Implementation Build Status PyPI - Downloads Requires.io

Sparselandtools is a Python 3 package that provides implementations for sparse representations and dictionary learning. In particular, it includes implementations for

For Sparse Representations:

  • Matching Pursuit
  • Orthogonal Matching Pursuit
  • Thresholding Pursuit
  • Basis Pursuit

For Dictionaries in General:

  • Mutual Coherence
  • DCT Dictionary
  • Haar Dictionary
  • Overcomplete DCT Dictionary
  • Visualization Tools for Dictionaries

For Dictionary Learning:

  • K-SVD Algorithm
  • Approximate K-SVD Algorithm

For Application:

  • Approximate K-SVD Image Denoiser

Note: I did this project mainly to generate plots for my Master's thesis. Some of the implementations are more educational than efficient. If you want to learn more about sparse representations and dictionary learning using Python, or use dictionary learning algorithms in small dimensions this ,package is for you. If you want to use these functions for industrial applications, you should have a look at more efficient C++-based implementations:

Getting Started

Sparselandtools is available as a PyPI package. You can install it using

pip install sparselandtools

DCT and Haar Dictionary

The following code creates a redundant (=overcomplete) DCT-II dictionary and plots it. It also prints out the dictionaries mutual coherence.

from sparselandtools.dictionaries import DCTDictionary
import matplotlib.pyplot as plt

# create dictionary
dct_dictionary = DCTDictionary(8, 11)

# plot dictionary
plt.imshow(dct_dictionary.to_img())
plt.show()

# print mutual coherence
print(dct_dictionary.mutual_coherence())

More examples can be found in the corresponding Jupyter Notebook.

Contribute

There are a lot of algorithms based on sparse representations and dictionary learning that are not (yet) included in this package. These include - among others:

  • The Double Sparsity Method
  • Trainlets
  • Denoiser with Method Noise Post Processing
  • Boosted Denoiser with Patch Disagreement

and much more. It would also be interesting to see more applications in this package. Currently, this package only provides the K-SVD image denoiser based on the work of Aharon and Elad. K-SVD can also be used in many other applications, such as face recognition. Furthermore, it would be nice to have GPU-versions of all the algorithms available as well.

If you want to see a specific algorithm in this package, please consider opening a feature request here on Github. If you have written an algorithm that you think would fit into this package, please fork this repository, add your algorithm and file a pull request. If something doesn't work as expected, please open an issue.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sparselandtools-1.0.2.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

sparselandtools-1.0.2-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file sparselandtools-1.0.2.tar.gz.

File metadata

  • Download URL: sparselandtools-1.0.2.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.3

File hashes

Hashes for sparselandtools-1.0.2.tar.gz
Algorithm Hash digest
SHA256 b64a8a3c6c3ec42173797ba2ae42c1f586c65ecdaf268bc3e62e427f62142218
MD5 77794274b85689cd461672fc6d517675
BLAKE2b-256 1cba09c102ecaaa9469eea39f2ce303db3cba9669a11bcfcaf27e8829ab91279

See more details on using hashes here.

File details

Details for the file sparselandtools-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: sparselandtools-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.3

File hashes

Hashes for sparselandtools-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5ac84df698d0337d4ddc8962f066455f9d8fd5e0ff281185cbec9a0699bc8071
MD5 9e1845ac03d6a4e861ee2a1f616d4fac
BLAKE2b-256 b34690b7bfafc257270b385a69d2af7cb054a9536c3e3339b2e85df123bdbf19

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page