选择/归一化目标检测的 HoG 参数? [英] Choosing/Normalizing HoG parameters for object detection?

查看:28
本文介绍了选择/归一化目标检测的 HoG 参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 HoG 功能通过分类进行对象检测.

I'm using HoG features for object detection via classification.

我对如何处理不同长度的 HoG 特征向量感到困惑.

I'm confused about how to deal with HoG feature vectors of different lengths.

我使用大小相同的训练图像训练了我的分类器.

I've trained my classifier using training images that all have the same size.

现在,我正在从图像中提取要在其上运行分类器的区域 - 例如,使用滑动窗口方法.我提取的一些窗口比训练分类器的图像大小要大得多.(它是根据测试图像中可能预期的最小物体尺寸进行训练的).

Now, I'm extracting regions from my image on which to run the classifier - say, using the sliding windows approach. Some of the windows that I extract are a lot bigger than the size of images the classifier was trained on. (It was trained on the smallest possible size of the object that might be expected in test images).

问题是,当我需要分类的窗口大于训练图像大小时,HoG 特征向量也比训练模型的特征向量大很多.

The problem is, when the windows I need to classify are bigger than the training image sizes, then the HoG feature vector is also much bigger than the trained model's feature vector.

那么如何使用模型的特征向量对提取窗口进行分类呢?

So how can I use the model's feature vector to classify the extract window?

例如,让我们取一个提取窗口的尺寸,即 360x240,并将其命名为 extractedwindow.然后让我们取一张我的训练图像,它只有 20x30,并将其命名为 trainingsample.

For example, let's take the dimensions of one extracted window, which is 360x240, and call it extractedwindow. Then let's take one of my training images, which is only 20x30, and call it trainingsample.

如果我取 HoG 特征向量,像这样:

If I take the HoG feature vectors, like this:

fd1, hog_image1 = hog(extractedwindow, orientations=8, pixels_per_cell=(16, 16), cells_per_block=(1, 1), visualise=True, normalise=True)

fd2, hog_image2 = hog(trainingsample, orientations=8, pixels_per_cell=(16, 16), cells_per_block=(1, 1), visualise=True, normalise=True)

print len(fd1)
print len(fd2)

那么这就是特征向量之间的长度差:

Then this is the difference in length between the feature vectors:

2640
616

那么这是如何处理的呢?提取的窗口是否应该按比例缩小到训练分类器的样本大小?还是应该根据每个提取的窗口更改/归一化 HoG 特征的参数?还是有其他方法可以做到这一点?

So how is this dealt with? Are extracted windows supposed to be scaled down to the size of the samples the classifier was trained on? Or should the parameters for HoG features be changed/normalized according to each extracted window? Or is there another way to do this?

我个人在 python 中工作,使用 scikit-image,但我想这个问题与我使用的平台无关.

I'm personally working in python, using scikit-image, but I guess the problem is independent of what platform I'm using.

推荐答案

正如你所说,HOG 基本上使用一个参数来确定单元格大小(以像素为单位).所以如果图像大小发生变化,那么单元格的数量不同,那么描述符的大小就不同.

As you say, HOG basically uses a parameter that establishes the cell size in pixels. So if the image size changes, then the number of cells is different and then the descriptor is different in size.

主要做法是使用HOG就是使用像素大小相同的窗口(训练期间和测试期间的大小相同).所以extracted window应该和trainingsample大小一样.

The main approach is to use HOG is to use windows with the same size in pixels (the same size during training and also during testing). So extracted window should be the same size of trainingsample.

那个参考中,一位用户说:

In that reference, one user says:

HOG 不是尺度不变的.获得相同长度的特征向量每张图片不保证尺度不变性.

HOG is not scale invariant. Getting the same length feature vector for each image does not guarantee the scale invariance.

所以你应该使用相同的窗口大小...

So you should use the same window size...

这篇关于选择/归一化目标检测的 HoG 参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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