Skip to content
Permalink
Browse files

Initial public release commit

  • Loading branch information...
fubel committed Nov 30, 2018
0 parents commit 09bfdf47748ccfd05fcfe0f84e1974686e6bda53
@@ -0,0 +1,117 @@
tests/
.idea/

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/
@@ -0,0 +1,12 @@
language: python
python:
- "3.5"
- "3.5-dev"
- "3.6"
- "3.6-dev" # 3.6 development branch
- "3.7-dev" # 3.7 development branch
# command to install dependencies
install:
- pip install -r requirements.txt
script:
- echo "skipping tests"
21 LICENSE
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 Fabian Herzog

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
@@ -0,0 +1,95 @@
# Sparselandtools

[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/sparselandtools.svg?style=flat-square)](https://pypi.org/project/sparselandtools/1.0.0.dev2/)
[![PyPI](https://img.shields.io/pypi/v/sparselandtools.svg?style=flat-square)](https://pypi.org/manage/project/sparselandtools/releases/)
[![PyPI - Implementation](https://img.shields.io/pypi/implementation/sparselandtools.svg?style=flat-square)](https://pypi.org/project/sparselandtools/#description)
[![Read the Docs](https://img.shields.io/readthedocs/sparselandtools.svg?style=flat-square)](https://sparselandtools.readthedocs.io/en/latest/)[![Build Status](https://travis-ci.com/fubel/sparselandtools.svg?token=e6hQaTqfZFZnG6RmEYXr&branch=master&style=flat-square)](https://travis-ci.com/fubel/sparselandtools)

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:

* [The Efficient K-SVD Algorithm by Rubinstein](http://www.cs.technion.ac.il/~ronrubin/software.html)
* [The Efficient K-SVD Denoiser by Lebrun](https://github.com/npd/ksvd)


## Getting Started

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

```
pip install sparselandtools
```

![DCT and Haar Dictionary](https://snag.gy/h7Il2j.jpg)

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

```python
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](https://www.egr.msu.edu/~aviyente/elad06.pdf). 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.
@@ -0,0 +1,55 @@
alabaster==0.7.12
atomicwrites==1.2.1
attrs==18.2.0
Babel==2.6.0
bleach==3.0.2
brewer2mpl==1.4.1
certifi==2018.10.15
chardet==3.0.4
cloudpickle==0.5.3
cycler==0.10.0
Cython==0.29
dask==0.18.2
decorator==4.3.0
docutils==0.14
idna==2.7
imageio==2.3.0
imagesize==1.1.0
Jinja2==2.10
kiwisolver==1.0.1
llvmlite==0.25.0
MarkupSafe==1.1.0
matplotlib==2.2.2
more-itertools==4.3.0
networkx==2.1
numba==0.40.1
numpy==1.15.0
packaging==18.0
pandas==0.23.4
Pillow==5.2.0
pkginfo==1.4.2
pluggy==0.8.0
prettyplotlib==0.1.7
py==1.7.0
Pygments==2.2.0
pyparsing==2.2.0
pytest==3.10.0
python-dateutil==2.7.3
pytz==2018.5
PyWavelets==0.5.2
readme-renderer==24.0
requests==2.20.0
requests-toolbelt==0.8.0
scikit-image==0.14.0
scikit-learn==0.19.2
scipy==1.1.0
seaborn==0.9.0
six==1.11.0
snowballstemmer==1.2.1
Sphinx==1.8.1
sphinxcontrib-websupport==1.1.0
toolz==0.9.0
tqdm==4.28.1
twine==1.12.1
urllib3==1.24.1
webencodings==0.5.1
@@ -0,0 +1,50 @@
import setuptools

with open("README.md", "r") as fh:
long_description = fh.read()

setuptools.setup(
name="sparselandtools",
version="1.0.0",
author="Fabian Herzog",
author_email="fabian.herzog.dev@gmail.com",
description="A package for sparse representations and dictionary learning",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/fubel/py-sparselandtools",
packages=setuptools.find_packages(),
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
python_requires='>=3.5',
install_requires=[
"brewer2mpl==1.4.1",
"cloudpickle==0.5.3",
"cycler==0.10.0",
"Cython==0.29",
"dask==0.18.2",
"decorator==4.3.0",
"imageio==2.3.0",
"kiwisolver==1.0.1",
"llvmlite==0.25.0",
"matplotlib==2.2.2",
"networkx==2.1",
"numpy==1.15.0",
"pandas==0.23.4",
"Pillow==5.2.0",
"prettyplotlib==0.1.7",
"pyparsing==2.2.0",
"pytest==3.10.0",
"python-dateutil==2.7.3",
"pytz==2018.5",
"scikit-image==0.14.0",
"scikit-learn==0.19.2",
"scipy==1.1.0",
"seaborn==0.9.0",
"six==1.11.0",
"toolz==0.9.0",
"tqdm==4.28.1",
]
)

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1 @@
name = "sparselandtools"
No changes.
Oops, something went wrong.

0 comments on commit 09bfdf4

Please sign in to comment.
You can’t perform that action at this time.