简体   繁体   English

使用不同尺寸但具有相同数量的HoG特征的图像训练分类器

[英]Training a classifier using images of different dimensions but same number of HoG features

I want to train my classifier with some images, some of which have different dimensions. 我想用一些图像训练我的分类器,其中一些图像具有不同的尺寸。

They all fall under the following dimensions: 它们都属于以下尺寸:

  • 100x50 100x50
  • 50x100 50×
  • 64x72 64x72
  • 72x64 72x64

However, with 9 orientation bins, and 8 pixels per cell, each of these generates 648 HoG features. 但是,具有9个定向容器,每个像元8个像素,每个容器都会生成648个HoG特征。

I actually chose all images to be of one of these sizes so that they would end up having the same number of HoG features so that training is uniform. 实际上,我选择的所有图像都是其中一种尺寸,这样它们最终将具有相同数量的HoG功能,因此训练是统一的。

The reason I opted for this is because the object of interest in the training images sometimes has a different aspect ratio, hence cropping all the images the same size for some of the images left too much background in there. 我之所以选择这样做,是因为训练图像中的感兴趣对象有时具有不同的宽高比,因此对于其中留有太多背景的某些图像,将所有图像裁剪为相同大小。

Now my question is - does it matter what the aspect ratio/image dimensions of the training images are, as long as the number of HoG features is consistent? 现在我的问题是-只要HoG功能的数量保持一致,训练图像的宽高比/图像尺寸是否重要? (My training algorithm only takes in the HoG features). (我的训练算法仅接受HoG功能)。

If your HOG features all use 8x8 cells, then how can you get the same size vector for different size image? 如果您的HOG功能全部使用8x8像元,那么如何为不同尺寸的图像获得相同尺寸的矢量? Wouldn't you have more cells in a larger image? 您不会在更大的图像中有更多的单元格吗?

Generally, if you want to use HOG, you should resize all images to be the same size. 通常,如果要使用HOG,则应将所有图像调整为相同大小。

Another question: do you just want to classify the images that are already cropped, or do you want to detect objects in a large scene? 另一个问题:您只想对已经裁剪的图像进行分类,还是要在大场景中检测物体? If you just want to classify, then the variation in the aspect ratio may be a problem. 如果您只想分类,则纵横比的变化可能是个问题。 On the other hand, if you want to do sliding-window object detection, the variation in the aspect ration is a much bigger problem. 另一方面,如果要进行滑动窗口对象检测,则宽高比的变化是一个更大的问题。 You may have to break your category into sub-classes based on the aspect ratio, and train a separate detector for each one. 您可能必须根据宽高比将类别划分为子类,并为每个类别训练一个单独的检测器。

Edit: Sorry, but getting the HOG vectors to be the same length by using roundoff errors and differences in aspect ratio is cheating. 编辑:对不起,但是通过使用舍入误差和长宽比差异使HOG向量具有相同的长度是作弊的。 :) The whole point is to have the HOG cells encode spatial information. :)关键是让HOG单元对空间信息进行编码。 The corresponding cells must encode the same spot in different images. 相应的单元必须在不同的图像中编码相同的斑点。 Otherwise you are comparing apples and oranges. 否则,您将比较苹果和橙子。

As far as object detection, aspect ratio is paramount. 就对象检测而言,纵横比至关重要。 You would be sliding a window over the image, and that window had better have the same aspect ratio as the objects you are trying to detect. 您将在图像上滑动一个窗口,并且该窗口最好具有与要检测的对象相同的纵横比。 Otherwise, it simply won't work. 否则,它将根本无法工作。 So if you have these 4 distinct aspect ratios, your best bet is to train 4 different detectors. 因此,如果您具有这4个不同的长宽比,则最好的选择是训练4个不同的探测器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM