Custom Cascade Classifier for Fast Human Figure Detection
Traditional computer vision algorithms to detect entities in an image rely on block-by-block analysis. Treating an image as a matrix, these algorithms divide the image into much smaller sub-matrices, and check for features that were used in the classifier training stage. If the number of features is huge, which is usually the case when detecting human figures, the calculation slows down considerably in each sub-matrix, resulting in a processing time of a few minutes per frame. With a high resolution and high fps recording setting, tracking of children in one hour’s worth of classroom video data may take a few days.
Cascade classifiers solve this problem by checking for features in each sub-matrix hierarchically. They perform a series of tests, increasingly complex in nature, to look for features, and the number of stages can be restricted based on the quality of the data. We have developed a custom Cascade classifier for the OpenCV computer vision library that takes account of the body size, hair color, etc. of the children in the classroom, using our own training dataset.
To speed up the calculations further, we have integrated some CUDA code to use GPUs for a distributed cascade calculation over many sub-matrices at once. The CUDA version of our tracking code has an optimized task scheduler that takes advantage of a GPU’s light thread construction and destruction, and a matrix data handler that makes the streaming of data from RAM to GPU device memory seamless, while ensuring that the thread-block level overhead is minimized.