# Is deep learning the only way to detect humans in a picture?

I'm looking for a way to detect humans in a picture. For instance, regarding the picture below, I'd like to coarsely determine how many people are in the scene. I must be able to detect both standing and sitting people. I do not mind not detecting people located behind a physical object (such as the glass in the bus picture).

AFAIK, such a problem can rather easily be solved by training deep neural networks. However, my coworkers would like me to also implement a detection technique based on general image processing techniques. I've spent several days looking for techniques designed by researchers but I couldn't find anything else than saliency-based techniques (which may be fine, but I'd like to test several techniques based on old-fashioned image processing).

I have strong constraints on the nature of images, for instance luminosity: whether they've been taken during the day or at night, the pictures will have very different characteristics (e.g. image contrast can strongly vary).

Long story short, I'd like to know if there's indeed some existing segmentation technique for which it'd be interesting giving a shot, given the fact that the information carried by the images vary a lot?

One of the popular feature descriptors used for human detection is HOG - Histogram of Oriented Gradients. Usually you would train a classifier for recognizing human vs non-human, and then you would implement a sliding window technique. HOG has implementations in most of the scientific libraries in the Python community, for example in skimage there is an example here, which I am copying here because a link could always become broken:

import matplotlib.pyplot as plt

from skimage.feature import hog
from skimage import data, exposure

image = data.astronaut()

fd, hog_image = hog(image, orientations=8, pixels_per_cell=(16, 16),
cells_per_block=(1, 1), visualize=True, multichannel=True)

fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(8, 4), sharex=True, sharey=True)

ax1.axis('off')
ax1.imshow(image, cmap=plt.cm.gray)
ax1.set_title('Input image')

# Rescale histogram for better display
hog_image_rescaled = exposure.rescale_intensity(hog_image, in_range=(0, 10))

ax2.axis('off')
ax2.imshow(hog_image_rescaled, cmap=plt.cm.gray)
ax2.set_title('Histogram of Oriented Gradients')
plt.show()