2
votes

I'm using Windows 7 64bit, visual studio 2010, opencv 2.4.2.

I'm trying to use GPU hog detector.

For now I can use my own CPU hog detector (my trained version).

My hog has cellsize of Size(4,4).

However, in opencv/modules/gpu/src/cuda/hog.cu, it states that

 // Other values are not supported
  #define CELL_WIDTH 8
  #define CELL_HEIGHT 8 

or, in opencv/modules/gpu/src/hog.cpp, in the

cv::gpu::HOGDescriptor::HOGDescriptor( ... ) { ... CV_Assert(cell_size == Size(8, 8)); ... }

I think this is the reason why my program crashes. However I don't want to use cell size 8. How can I chage it to 4?

2

2 Answers

4
votes

You have a few options...

  • Open up the OpenCV HOG code and hack around the 8x8 constraint. Change the #define statements from 8x8 to 4x4, and get rid of the assert statement. Recompile the OpenCV code, and run your application. See what happens...maybe it will work.

  • In case a quick hack in the OpenCV code doesn't work, there are other open-source GPU HOG implementations, for example: fastHOG and GroundHOG

  • If none of the above ideas work, you could write your own GPU HOG code in CUDA or OpenCL. A hand-written HOG implementation can be reasonably concise, especially if you hard-code the cell size and other dimensions for your specific case. However, GPU programming can take some time to learn if you're new to it.

Also, I should make sure--the OpenCV HOG runs properly if you run with 8x8 cells, correct?

0
votes

You're not really supposed to change the cell size. The cell size is 8 because that's "enough pixels to perform a gradient", but "not too many to perform unnecessary work". If you have a cell size of 4, that's probably not enough useful information for the gradient strength and precision? Instead of reducing your cell size to 4, why not reduce your image size by 2 in both directions?