Systems and methods for providing an image classifier
Systems and methods are provided for image classification using histograms of oriented gradients (HoG) in conjunction with a trainer. The efficiency of the process is greatly increased by first establishing a bitmap which identifies a subset of the pixels in the HoG window as including relevant foreground information, and limiting the HoG calculation and comparison process to only the pixels included in the bitmap.
1. A computing device for image classification comprising:
a memory including:
a non-rectangular foreground silhouette generated based on a set of training images, and
a non-rectangular bitmap that identifies a subset of cells of a rectangular detection window, the rectangular detection window having a cell width and cell height;
a hardware accelerator to:
identify a portion of an image to be classified based on the non-rectangular foreground silhouette,
identify a cell within the portion of the image to be classified that match the subset of the cells of the non-rectangular bitmap, the portion having the cell width and the cell height,
generate and store a histogram of orientations of pixels within the cell that matches the subset of cells, and
determine a cell block having a plurality of contiguous identified cells from the image; and
a processor to:
generate, for the cell block, a descriptor including at least a portion of the histogram, and
evaluate the descriptor against the set of training images to selectively identify the portion of the image as including a class of object associated with at least one of the training images.
2. The computing device of claim 1 , wherein the hardware accelerator is to:
re-scale the image to a second cell width and cell height; and
apply the rectangular detection window to a portion of the re-scaled image having the cell width and cell height.
3. The computing device of claim 1 , wherein at least one of the hardware accelerator or the processor is to:
average the training images; and
store the averaged training images as the non-rectangular foreground silhouette.
4. The computing device of claim 1 , wherein at least one of the hardware accelerator or the processor is to:
determine intensity values of pixels for the training images;
add the intensity values of the pixels for the training images to generate resulting values;
divide the resulting values by a number of the training images; and
store the divided resulting values as the non-rectangular foreground silhouette.
5. The computing device of claim 1 , wherein the hardware accelerator is to:
calculate gradients, the gradients having magnitudes and corresponding orientations;
associate the orientations to respective ones of a plurality of bins; and
add the magnitudes to the respective ones of the bins associated with corresponding ones of the orientations.
6. The computing device of claim 1 , wherein the processor is to determine whether the class of object is one of:
a person;
a face;
a non-rectangular geometric shape; or
a non-geometric shape.
7. The computing device of claim 1 , wherein determining the cell block includes determining a plurality of overlapping cell blocks having a plurality of contiguous identified cells.
8. A non-transitory computer readable medium comprising instructions that, when executed, cause a computing device to at least:
store a non-rectangular bitmap that identifies a subset of cells of a rectangular detection window, the rectangular detection window having a cell width and cell height;
identify a portion of an image to be classified based on a non-rectangular foreground silhouette, the non-rectangular foreground silhouette generated based on a set of training images;
identify a cell within the portion of the image to be classified that match the subset of the cells of the non-rectangular bitmap, the portion having the cell width and the cell height;
generate and store a histogram of orientations of pixels within the cell that matches the subset of cells;
determine a cell block from the image;
generate, for the cell block, a descriptor including at least a portion of the histogram; and
evaluate the descriptor based on the set of training images to identify the portion of the image as including a class of object associated with at least one of the training images.
9. The non-transitory computer readable medium of claim 8 , wherein the instructions, when executed, cause the computing device to:
re-scale the image to a second cell width and cell height; and
apply the rectangular detection window to a portion of the re-scaled image having the cell width and cell height.
10. The non-transitory computer readable medium of claim 8 , wherein the instructions, when executed, cause the computing device to:
average the training images; and
store the averaged training images as the non-rectangular foreground silhouette.
11. The non-transitory computer readable medium of claim 8 , wherein the instructions, when executed, cause the computing device to:
determine intensity values of pixels for the training images;
add the intensity values of the pixels for the training images to generate resulting values;
divide the resulting values by a number of the training images; and
store the divided resulting values as the non-rectangular foreground silhouette.
12. The non-transitory computer readable medium of claim 8 , wherein the instructions, when executed, cause the computing device to:
calculate gradients, the gradients having magnitudes and corresponding orientations;
associate the orientations to respective ones of a plurality of bins; and
add the magnitudes to the respective ones of the bins associated with corresponding ones of the orientations.
13. The non-transitory computer readable medium of claim 8 , wherein the instructions, when executed, cause the computing device to determine whether the class of object is one of:
a person;
a face;
a non-rectangular geometric shape; or
a non-geometric shape.
14. The non-transitory computer readable medium of claim 8 , wherein the instructions, when executed, cause the computing device to determine the cell block by determining a plurality of overlapping cell blocks having a plurality of contiguous identified cells.
15. A method comprising:
storing a non-rectangular foreground silhouette generated based on a set of training images;
storing a non-rectangular bitmap that identifies a subset of cells of a rectangular detection window, the rectangular detection window having a cell width and cell height;
identifying a portion of an image to be classified based on the non-rectangular foreground silhouette;
identifying a cell within the portion of the image to be classified that match the subset of the cells of the non-rectangular bitmap, the portion having the cell width and the cell height;
generating and store a histogram of orientations of pixels within the cell that matches the subset of cells;
determining a cell block having a plurality of contiguous identified cells from the image;
generating, for the cell block, a descriptor including at least a portion of the histogram; and
evaluating the descriptor against the set of training images to selectively identify the portion of the image as including a class of object associated with at least one of the training images.
16. The method of claim 15 , further including:
re-scaling the image to a second cell width and cell height; and
applying the rectangular detection window to a portion of the re-scaled image having the cell width and cell height.
17. The method of claim 15 , further including:
averaging the training images; and
storing the averaged training images as the non-rectangular foreground silhouette.
18. The method of claim 15 , further including:
determining intensity values of pixels for the training images;
adding the intensity values of the pixels for the training images to generate resulting values;
dividing the resulting values by a number of the training images; and
storing the divided resulting values as the non-rectangular foreground silhouette.
19. The method of claim 15 , further including:
calculating gradients, the gradients having magnitudes and corresponding orientations;
associating the orientations to respective ones of a plurality of bins; and
adding the magnitudes to the respective ones of the bins associated with corresponding ones of the orientations.
20. The method of claim 15 , further including determining whether the class of object is one of:
a person;
a face;
a non-rectangular geometric shape; or
a non-geometric shape.
21. The method of claim 15 , wherein determining the cell block includes determining a plurality of overlapping cell blocks having a plurality of contiguous identified cells.
22. A computing device for image classification comprising:
means for storing:
a non-rectangular foreground silhouette generated based on a set of training images, and
a non-rectangular bitmap that identifies a subset of cells of a rectangular detection window, the rectangular detection window having a cell width and cell height;
means for determining a cell block to:
identify a portion of an image to be classified based on the non-rectangular foreground silhouette,
identify a cell within the portion of the image to be classified that match the subset of the cells of the non-rectangular bitmap, the portion having the cell width and the cell height,
generate and store a histogram of orientations of pixels within the cell that matches the subset of cells, and
determine a cell block having a plurality of contiguous identified cells from the image; and
means for identifying to:
generate, for the cell block, a descriptor including at least a portion of the histogram, and
evaluate the descriptor against the set of training images to selectively identify the portion of the image as including a class of object associated with at least one of the training images.
23. The computing device of claim 22 , wherein the means for determining the cell block is to:
re-scale the image to a second cell width and cell height; and
apply the rectangular detection window to a portion of the re-scaled image having the cell width and cell height.
24. The computing device of claim 22 , wherein the means for determining the cell block is to:
average the training images; and
store the averaged training images as the non-rectangular foreground silhouette.
25. The computing device of claim 22 , wherein the means for determining the cell block is to:
determine intensity values of pixels for the training images;
add the intensity values of the pixels for the training images to generate resulting values;
divide the resulting values by a number of the training images; and
store the divided resulting values as the non-rectangular foreground silhouette.
26. The computing device of claim 22 , further including means for determining whether the class of object is one of:
a person;
a face;
a non-rectangular geometric shape; or
a non-geometric shape.
27. The computing device of claim 22 , wherein the means for determining the cell block is to determine a plurality of overlapping cell blocks having a plurality of contiguous identified cells.