不同的HOG代码混淆 [英] Confusion in different HOG codes

查看:142
本文介绍了不同的HOG代码混淆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经下载了三种不同的HoG代码. 使用64x128的图片

I have downloaded three different HoG codes. using the image of 64x128

1)使用matlab函数:extractHOGFeatures

1) using the matlab function:extractHOGFeatures,

[hog, vis] = extractHOGFeatures(img,'CellSize',[8 8]);

hog的大小为3780.

如何计算:

HOG特征长度N基于图像大小和功能参数值.

HOG feature length, N, is based on the image size and the function parameter values.

N = prod([BlocksPerImage, BlockSize, NumBins])
BlocksPerImage = floor((size(I)./CellSize – BlockSize)./(BlockSize – BlockOverlap) + 1)

2)第二个HOG功能可从此处下载. 使用相同的图片

2) the second HOG function is downloaded from here. Same image is used

H = hog( double(rgb2gray(img)), 8, 9 );

 %  I        - [mxn] color or grayscale input image (must have type double)
%  sBin     - [8] spatial bin size
%  oBin     - [9] number of orientation bins

H的大小为3024

如何计算:

H        - [m/sBin-2 n/sBin-2 oBin*4] computed hog features

3)来自vl_feat的HoG代码.

3) HoG code from vl_feat.

cellSize = 8;
 hog = vl_hog(im2single(rgb2gray(img)), cellSize, 'verbose','variant', 'dalaltriggs') ;
vl_hog: image: [64 x 128 x 1]
vl_hog: descriptor: [8 x 16 x 36]
vl_hog: number of orientations: 9
vl_hog: bilinear orientation assignments: no
vl_hog: variant: DalalTriggs
vl_hog: input type: Image

输出为4608.

哪个是正确的?

推荐答案

都正确. HOG功能提取功能默认参数随程序包而异. (例如-opencv,matlab,scikit-image等).我所说的参数是Winsize,Stride,Blocksize,Scale等.

All are correct. Thing is HOG feature extraction function default parameters vary with packages. (Eg - opencv, matlab, scikit-image etc). By parameters I mean, winsize, stride, blocksize, scale etc.

通常,HOG描述符的长度为:

Usually HOG descriptor length is :

 Length = Number of Blocks x Cells in each Block x Number of Bins in each Cell

由于所有内容都是正确的,因此您可以使用多种方式回答. 您可以尝试使用不同的参数值,然后选择适合您的参数值.由于没有固定的方法来找到正确的值,因此如果您知道每个参数的变化如何影响结果,这将很有帮助.

Since all are correct, which one you may use can be answered in many ways. You can experiment with different param values and choose the one that suits you. Since there is no fixed way to find right values, it would be helpful if you know how change in each parameters affect the result.

单元格大小:如果增加此大小,则可能无法捕获小的细节.

Cell-size : If you increase this, you may not capture small details.

块大小:同样,具有大像元大小的大块可能无法帮助您捕获小细节.同样,由于大块意味着照明变化可能更大,并且由于梯度归一化步骤,很多细节将丢失.因此,请相应选择.

Block-size : Again, large block with large cell size may not help you capture the small details. Also since large block means illumination variation can be more and due to gradient normalization step, lot of details will be lost. So choose accordingly.

重叠/跨度:如果选择重叠块,这又可以帮助您捕获有关图像补丁的更多信息.通常将其设置为块大小的一半.

Overlap/Stride: This again helps you capture more information about the image patch if you choose overlapping blocks. Usually it is set to half the blocksize.

通过相应地选择上述参数的值,您可能会有很多信息.但是描述符的长度会变得不必要的长.

You may have lot of information by choosing the values of the above params accordingly. But the descriptor length will become unnecessarily long.

希望这会有所帮助:)

Hope this helps :)

这篇关于不同的HOG代码混淆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆