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 computer-implemented method for image classification, the method comprising:
generating, from a set of training images, a non-rectangular foreground silhouette representing a relevant portion of an image window;
generating, from the silhouette, a non-rectangular bitmap identifying fewer than all cells within a rectangular detection window;
applying the rectangular detection window to a portion of the image having a cell width and a cell height of the rectangular detection window, wherein applying the detection window includes identifying cells within the image portion matching the identified cells of the non-rectangular bitmap;
for an identified cell within the image portion, analyzing orientations of pixels within the cell;
identifying an overlapping cell block having a plurality of contiguous identified cells from the image portion;
generating a descriptor for the cell block, wherein a contents of the descriptor is normalized to contents of another descriptor; and
evaluating the generated descriptor against the set of training images to determine whether to identify the image portion as including a class of object associated with the set of training images.
2. The method of claim 1 , 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.
3. The method of claim 1 , further including:
averaging the training images; and
storing the averaged training images as the non-rectangular foreground silhouette.
4. The method of claim 1 , 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.
5. The method of claim 1 , 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.
6. The method of claim 1 , 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.
7. The method of claim 1 , wherein the description includes a histogram for the cell block, wherein the histogram is normalized to a histogram of the another descriptor.
8. A computing device for image classification comprising:
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:
apply the rectangular detection window to a portion of the image having a cell width and a cell height of the rectangular detection window, wherein applying the detection window includes identifying cells within the image portion matching the identified cells of the non-rectangular bitmap;
for an identified cell within the image portion, analyze orientations of pixels within the cell;
identify an overlapping cell block having a plurality of contiguous identified cells from the image portion;
generate a descriptor for the cell block, wherein a contents of the descriptor is normalized to contents of another descriptor; and
evaluate the generated descriptor against the set of training images to determine whether to identify the image portion as including a class of object associated with the set of training images.
9. The computing device of claim 8 , 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.
10. The computing device of claim 8 , wherein the hardware accelerator is to:
average the training images; and
store the averaged training images as the non-rectangular foreground silhouette.
11. The computing device of claim 8 , wherein the hardware accelerator 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.
12. The computing device of claim 8 , 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.
13. The computing device of claim 8 , wherein the hardware accelerator 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.
14. The computing device of claim 8 , wherein determining the cell block includes determining a plurality of overlapping cell blocks having a plurality of contiguous identified cells.
15. A non-transitory computer readable medium comprising instructions that, when executed, cause a computing device to at least:
generate, from a set of training images, a non-rectangular foreground silhouette representing a relevant portion of an image window;
generate, from the silhouette, a non-rectangular bitmap identifying fewer than all cells within a rectangular detection window;
apply the rectangular detection window to a portion of the image having a cell width and a cell height of the rectangular detection window, wherein applying the detection window includes identifying cells within the image portion matching the identified cells of the non-rectangular bitmap;
for an identified cell within the image portion, analyze orientations of pixels within the cell;
identify an overlapping cell block having a plurality of contiguous identified cells from the image portion;
generate a descriptor for the cell block, wherein a contents of the descriptor is normalized to contents of another descriptor; and
evaluate the generated descriptor against the set of training images to determine whether to identify the image portion as including a class of object associated with the set of training images.
16. The non-transitory computer readable medium of claim 15 , 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.
17. The non-transitory computer readable medium of claim 15 , 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.
18. The non-transitory computer readable medium of claim 15 , 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.
19. The non-transitory computer readable medium of claim 15 , 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.
20. The non-transitory computer readable medium of claim 15 , 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.