1
$\begingroup$

I'm training a non linear svm to do classification on images. I'm featurizing the image by creating 3 features for each pixel, its rgb value. My question is: How should i normalize images of different dimensions. My initial thought is to go through all the images and find the maximum width and height; then extend all the images to that width and height and fill its missing pixel values with -1's. Will a non-linear svm work ok with this image normalization? How do other people deal with images of different sizes?

$\endgroup$
  • $\begingroup$ You can do whitening: remove the mean and divide by standard deviation. Look at Yann LeCun papers for more details. $\endgroup$ – Vladislavs Dovgalecs Aug 4 '15 at 18:19
  • 4
    $\begingroup$ I just looked it up: it doesn't seem related. how does whitening make it so that all images end up having the same number of features? thanks for the help. $\endgroup$ – mt88 Aug 4 '15 at 18:27
  • $\begingroup$ I asked the same question here - stackoverflow.com/questions/37016276/… I ended up using random crops and it seemed to work fine $\endgroup$ – Frobot Oct 17 '16 at 18:09
1
$\begingroup$

You can compare images with different number of features (arising from images of different sizes). Pyramid Match Kernel does just that. It tries to measure the similarity between images that have different number of features. The code is available on the internet.

$\endgroup$
0
$\begingroup$

I would be more worried about having images of different aspect ratios than images of different sizes. The way I would approach the problem would be to discard some of the images (the one who are abnormally small) and downscale all the other to a common size. Why I did propose downsampling instead of upsampling the images? By upsampling you will be introducing a lot of noise and opportunity to overfit (high variance), downsampling will work the other way around... only on massive datasets do big images appear.

A personal recommendation: why use svm for image classification? By my experience you would be much better suited with a CNN classifier, it is better suited to capture the non-linearities that are common on this kind of tasks and they overfit much less, when used wisely of course.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.