Reputation: 5540
The purpose of the task is to classify images by means of SVM. The variable 'images' is supposed to contain the image information and correspondingly labels
contains image labels. How can I build (what format and dimensions) should the images
and labels
have? I tried unsuccesfully images
to be a Python array (appending flattened images) and then, in another attempt, Numpy arrays:
images=np.zeros((number_of_images, image_size))
labels=np.zeros((number_of_images, 1))
svm=cv2.SVM()
svm.train(images, labels)
Is it a right approach to the problem and if so, what is the correct way for training the classifier?
Upvotes: 1
Views: 2267
Reputation: 1707
I don't think that you can use raw image data to train SVM model. Ok-ok, you can, but it won't be very fruitful.
The basic approach is to extract some features from each image and to use these features for training your model. A set of features forms a dictionary of words, each of which describes your image. Due to the fact that you are using the same set of words to describe each image, you can compare features corresponding to different images. This link introduces more details, check it.
Whats next?
Useful links:
Upvotes: 2