Giter VIP home page Giter VIP logo

lyssandra's Introduction

Lyssandra

A collection of Python tools for feature extraction and image classification with Sparse Coding algorithms.

features

Sparse Coding algorithms

Sparse coding is a class of unsupervised methods for learning sets of over-complete dictionaries to represent data efficiently. Each signal can be expressed as a sparse linear combination of the atoms in the dictionary:

alt text

To encode a set of datapoints X over a dictionary D:

from lyssa.sparse_coding import sparse_encoder

# ...
se = sparse_encoder(algorithm='bomp', params={'n_nonzero_coefs': 5}, n_jobs=8)
Z = se.encode(X, D)

Some of the supported solvers include:

  • Orthogonal Matching Pursuit (OMP)
  • Batch OMP [1]
  • Group OMP [2]
  • Non-Negative OMP [3]
  • Iterative Hard Thresholding

Dictionary Learning algorithms

Learning the dictionary from the data involves solving the following objective

alt text

A dictionary learned from image patched of natural images looks like

alt text

Supported solvers:

  • K-SVD and its approximate variant [4]
  • Online Dictionary Learning [5]
  • Projected Gradient Descent

Feature Extraction

  • Spatial Pyramid Matching using Sparse Coding [6]
  • Convolutional Feature Encoders [8]
  • Dense SIFT extraction

Classification

  • Label Consistent K-SVD [9]
  • Sparse Representation based Classification [10]

Installation

Install the dependencies using:

pip install -r requirements.txt

For LASSO problems, the Python version of SPAMS http://spams-devel.gforge.inria.fr/index.html must be installed in your system.

First edit config.yml to specify the

  • workspace path, the location of the directory in which outputs of feature extraction tasks will be saved
  • path to OpenBLAS in your system (optional)

and then do:

pip install .

For best performance, configuring numpy with OpenBLAS is recommended (see Dockerfile).

Usage

Have a look at the lyssa/examples folder for some usage examples, and typical workflows.

References

[1] R. Rubinstein, M. Zibulevsky and M. Elad: Efficient Implementation of the K-SVD Algorithm and the Batch-OMP Method.

[2] A. Lozano, G. Swirszcz, N. Abe: Group Orthogonal Matching Pursuit for Variable Selection and Prediction.

[3] A. Bruckstein, M. Elad and, M. Zibulevsky: On the uniqueness of nonnegative sparse solutions to underdetermined systems of equations. IEEE Trans. Inform. Theory, 54(11):4813โ€“4820, 2008.

[4] M. Aharon, M. Elad, and A. Bruckstein: K-SVD: An Algorithm for Designing Overcomplete Dictionaries for Sparse Representation.

[5] J. Mairal, F. Bach, J. Ponce, and G. Sapiro: Online Dictionary Learning for Sparse Coding.

[6] J. Yang, K. Yu, Y. Gong, and T. Huang: Linear spatial pyramid matching using sparse coding for image classification, CVPR (2009).

[7] L. Bo, X. Ren, and D. Fox: Hierarchical Matching Pursuit for Image Classification: Architecture and Fast Algorithms. In NIPS, 2011.

[8] A. Coates and, A. Y. Ng: The Importance of Encoding Versus Training with Sparse Coding and Vector Quantization.

[9] Z. Jiang, Z. Lin, and L. S. Davis: Learning a discriminative dictionary for sparse coding via label consistent k-svd. CVPR, 2011.

[10] J. Wright, A. Yang, A. Ganesh, S. Sastry, and Y. Ma: Robust face recognition via sparse representation, PAMI (2009).

lyssandra's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

lyssandra's Issues

how to install

I am not able to install the package even after completing all the dependencies. Could you help me with this.

[Errno 13] Permission denied: '/workspace_map.yml'

File "/Volumes/DEV/ular_gigit/Riset2/Lyssandra/lyssa/examples/object_classification/caltech101.py", line 2, in <module> from lyssa.classify import linear_svm File "/Volumes/DEV/ular_gigit/Riset2/Lyssandra/lyssa/__init__.py", line 1, in <module> from .feature_extract import hmp_network File "/Volumes/DEV/ular_gigit/Riset2/Lyssandra/lyssa/feature_extract/__init__.py", line 1, in <module> from .preproc import preproc File "/Volumes/DEV/ular_gigit/Riset2/Lyssandra/lyssa/feature_extract/preproc.py", line 5, in <module> from lyssa.utils.math import normalize, norm_cols File "/Volumes/DEV/ular_gigit/Riset2/Lyssandra/lyssa/utils/__init__.py", line 8, in <module> from .dataset import split_dataset, get_mmap, get_empty_mmap, img_dataset File "/Volumes/DEV/ular_gigit/Riset2/Lyssandra/lyssa/utils/dataset.py", line 8, in <module> from .workspace import mmap_base File "/Volumes/DEV/ular_gigit/Riset2/Lyssandra/lyssa/utils/workspace.py", line 13, in <module> open(workspace_map_file, 'wa').close() IOError: [Errno 13] Permission denied: '/workspace_map.yml'

I always get this error, do you have any idea?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.