Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting JPG images for input to scikit learn SVM classifier

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

like image 804
Soumya Simanta Avatar asked Nov 22 '25 16:11

Soumya Simanta


1 Answers

You could use DeCAF / nolearn / convnet for this task. See this page for an example.

like image 74
Thorsten Kranz Avatar answered Nov 25 '25 06:11

Thorsten Kranz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!