Converting JPG images for input to scikit learn SVM classifier

Soumya Simanta

I have a bunch of training images (.jpg format) that I want to give as training input to scikit learn's SVM classifier. Any idea what's the preferred way to doing this?

For example, in the example here the image data is loaded from a predefined set and converted to a format that the SVM classifier understands in the following steps.

# The digits dataset
digits = datasets.load_digits()

# To apply an classifier on this data, we need to flatten the image, to
# turn the data in a (samples, feature) matrix:
n_samples = len(digits.images)
data = digits.images.reshape((n_samples, -1))

My question is if I've my own set of images that I want to load as a training set to the SVM classifier how should I go about converting those images into a format that the classifier will understand.

My developing on OS-X (Mavericks) but I'll run the actual code on Linux (Ubuntu)

Thanks

jb.

Why not use standard python libraries for working with images, like PIL or it's fork Pillow. It should be straightforward to obtain numpy arrays of bytes from that.

As for feature extraction I guess Thorsten has better tools.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Converting JPG images for input to scikit learn SVM classifier

From Dev

How to get all alpha values of scikit-learn SVM classifier?

From Dev

Python Tuple & List Manipulation (As an input to the SVM model in scikit-learn)

From Dev

'bad input shape' when using scikit-learn SVM and optunity

From Dev

Python scikit-learn SVM Classifier "ValueError: Found array with dim 3. Expected <= 2"

From Dev

Evaluating convergence of SGD classifier in scikit learn

From Dev

Evaluating convergence of SGD classifier in scikit learn

From Dev

Scikit-learn SVM digit recognition

From Dev

Convert scikit-learn SVM model to LibSVM

From Dev

load data from csv into Scikit learn SVM

From Dev

User defined SVM kernel with scikit-learn

From Dev

Convert scikit-learn SVM model to LibSVM

From Dev

load data from csv into Scikit learn SVM

From Dev

User defined SVM kernel with scikit-learn

From Dev

How to increase the speed for SVM classifier using Sk-learn

From Dev

What is the theorical foundation for scikit-learn dummy classifier?

From Dev

scikit-learn get certainty of classification / score of the classifier for the chosen category

From Dev

Scikit-learn Ridge classifier: extracting class probabilities

From Dev

Does scikit learn include a Naive Bayes classifier with continuous inputs?

From Dev

Post-process classifier output in scikit learn Pipeline

From Dev

combine two different classifier result in scikit-learn python

From Dev

Plot Confusion Matrix with scikit-learn without a Classifier

From Dev

How to upgrade the classifier to the latest version of scikit-learn

From Dev

Scikit-learn Ridge classifier: extracting class probabilities

From Dev

Converting png images with transparency to jpg is ruining the image

From Dev

What is the difference between SVC and SVM in scikit-learn?

From Dev

Scikit learn - How to use SVM and Random Forest for text classification?

From Dev

Scaling of target causes Scikit-learn SVM regression to break down

From Dev

Error in using Non Linear SVM in Scikit-Learn

Related Related

  1. 1

    Converting JPG images for input to scikit learn SVM classifier

  2. 2

    How to get all alpha values of scikit-learn SVM classifier?

  3. 3

    Python Tuple & List Manipulation (As an input to the SVM model in scikit-learn)

  4. 4

    'bad input shape' when using scikit-learn SVM and optunity

  5. 5

    Python scikit-learn SVM Classifier "ValueError: Found array with dim 3. Expected <= 2"

  6. 6

    Evaluating convergence of SGD classifier in scikit learn

  7. 7

    Evaluating convergence of SGD classifier in scikit learn

  8. 8

    Scikit-learn SVM digit recognition

  9. 9

    Convert scikit-learn SVM model to LibSVM

  10. 10

    load data from csv into Scikit learn SVM

  11. 11

    User defined SVM kernel with scikit-learn

  12. 12

    Convert scikit-learn SVM model to LibSVM

  13. 13

    load data from csv into Scikit learn SVM

  14. 14

    User defined SVM kernel with scikit-learn

  15. 15

    How to increase the speed for SVM classifier using Sk-learn

  16. 16

    What is the theorical foundation for scikit-learn dummy classifier?

  17. 17

    scikit-learn get certainty of classification / score of the classifier for the chosen category

  18. 18

    Scikit-learn Ridge classifier: extracting class probabilities

  19. 19

    Does scikit learn include a Naive Bayes classifier with continuous inputs?

  20. 20

    Post-process classifier output in scikit learn Pipeline

  21. 21

    combine two different classifier result in scikit-learn python

  22. 22

    Plot Confusion Matrix with scikit-learn without a Classifier

  23. 23

    How to upgrade the classifier to the latest version of scikit-learn

  24. 24

    Scikit-learn Ridge classifier: extracting class probabilities

  25. 25

    Converting png images with transparency to jpg is ruining the image

  26. 26

    What is the difference between SVC and SVM in scikit-learn?

  27. 27

    Scikit learn - How to use SVM and Random Forest for text classification?

  28. 28

    Scaling of target causes Scikit-learn SVM regression to break down

  29. 29

    Error in using Non Linear SVM in Scikit-Learn

HotTag

Archive