GithubHelp home page GithubHelp logo

cyruschiu / image-recognition Goto Github PK

View Code? Open in Web Editor NEW
57.0 4.0 29.0 261.49 MB

Image recognition methods from bag of words (BoW), Spatial Pyramid Matching (SPM), Sparse Codeing SPM (ScSPM) to convolutional neural networks (CNN)

Python 100.00%

image-recognition's Introduction

Image-recognition

Image recognition methods from bag of words (BoW), Spatial Pyramid Matching (SPM), Sparse Codeing SPM (ScSPM) to convolutional neural networks (CNN) and CNN-SVM.

Author: CyrusChiu @ntu

Included methods

  • Bag of words [1]
  • Spatial Pyramid Matching [2]
  • Sparse Coding SPM [3]
  • Convolutional neural networks [4]
  • CNN-SVM [5]

Requirements

Basic (BoW, SPM, ScSPM)

We use OpenCV here to load the image and extract SIFT descriptor only, you can use any image library if you want.

Optional (CNN, CNN-SVM)

Demo

example.py training a SVM with SPM method on Caltech101 Dataset [6]

$python example.py --train Caltech101/DatasetFile.txt

Usage

An end-to-end script with training and testing is provided

  • Dataset
    Dataset File is a text file with the format of label and path like:

    #train.txt
    label path/to/train1.jpg  
    label path/to/train2.jpg  
    label path/to/train3.jpg  
    
    #test.txt
    label path/to/test1.jpg
    label path/to/test2.jpg
    
  • Training and evaluation on training set, predict on test set which is labeled

    $python yourMethod.py --train path/to/train.txt --test path/to/test.py
    

References

[1] CSURKA, Gabriella, et al. Visual categorization with bags of keypoints. In: Workshop on statistical learning in computer vision, ECCV. 2004. p. 1-2.

[2] LAZEBNIK, Svetlana; SCHMID, Cordelia; PONCE, Jean. Beyond bags of features: Spatial pyramid matching for recognizing natural scene categories. In: Computer Vision and Pattern Recognition, 2006 IEEE Computer Society Conference on. IEEE, 2006. p. 2169-2178.

[3] Jianchao Yang, Kai Yu, Yihong Gong, and Thomas Huang. Linear spatial pyramid matching using sparse coding for image classification. CVPR2009

[4] Krizhevsky, Alex, Ilya Sutskever, and Geoffrey E. Hinton. "Imagenet classification with deep convolutional neural networks." Advances in neural information processing systems. 2012.

[5] Girshick, Ross, et al. "Rich feature hierarchies for accurate object detection and semantic segmentation." Computer Vision and Pattern Recognition (CVPR), 2014 IEEE Conference on. IEEE, 2014. 2014.

[6] http://www.vision.caltech.edu/Image_Datasets/Caltech101/

[7] http://www.cs.toronto.edu/~kriz/cifar.html

image-recognition's People

Contributors

cyruschiu avatar

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

Watchers

 avatar  avatar  avatar  avatar

image-recognition's Issues

bow.py running error

Hello ,when I run bow.py I got this error in line 25
x_train = [each for each in zip(x_train, y_train) if each[0] != None]

ValueError: The truth value of an array with more than one element is ambiguous.Use a.any() or a.all()

Because each[0] here has more than one element and if I use each[0].any() or each[0].all() ,In the condition that each is None, It will get error also because None doesn't have the attribute any() or all()

Could you please tell me how can I solve this problem?Thanks a lot

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.