Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ideal number of HoG features

So there many options of how one can extract HoG features. Using different orientations, different numbers of pixels per cell and different block sizes.

But is there a standard or optimal configuration? I have training images of size 50x100, and I'm opting for 8 directions of orientation. I'm extracting the features from training data in order to do vehicle classification. But I really don't know what's "optimal".

For example, I have 2 configurations here, is there any reason to choose one over the other? Personally I feel like the second one is a better choice, but why?

enter image description here

enter image description here

like image 284
user961627 Avatar asked Jun 20 '14 17:06

user961627


People also ask

Is there a way to calculate more features using HOG?

From each block. A 36 point feature vector is collected. In the horizontal direction there are 7 blocks and in the vertical direction there are 15 blocks. So the total length of HOG features will be : 7 x 15 x 36 = 3780.

What are HOG features used for?

The HOG features are widely use for object detection. HOG decomposes an image into small squared cells, computes an histogram of oriented gradients in each cell, normalizes the result using a block-wise pattern, and return a descriptor for each cell.

What is HOG in object detection?

The histogram of oriented gradients (HOG) is a feature descriptor used in computer vision and image processing for the purpose of object detection.

What is the output of HOG?

Typically, a feature descriptor converts an image of size width x height x 3 (channels ) to a feature vector / array of length n. In the case of the HOG feature descriptor, the input image is of size 64 x 128 x 3 and the output feature vector is of length 3780.


1 Answers

I used HOG for product recognition. From what I understood at the time, you are pointing to a real problem of the standard HOG. There is simply no optimal configuration, it depends on the dataset. If you have the optimal values for your dataset, and then resize all the pictures of your dataset, you should resize your values too. Thus, there is no optimal "one size fits all" values for HOG.

But all is not lost. What you should do instead is a method that works "all the time". The idea is to do Spatial Pyramid Matching. This is just doing HOG at various scales and combining them together. A picture being worth a thousand words :

From the article

You can see that here, level 2 is just the standard HOG with fine cells. But perhaps it is not the best scale (because the cells are too small and you just observe noise) (On the other hand, too large cells, like level 0, may be too large, and you will have uniform histograms everywhere). You can compute the best weights for each level when you do the training on your dataset, and you will know what are the optimal values, i.e : what is the most relevant cell size

like image 169
B. Decoster Avatar answered Sep 22 '22 11:09

B. Decoster