Skip to content

Instantly share code, notes, and snippets.

@zoecarver
Last active November 27, 2018 03:29
Show Gist options
  • Save zoecarver/3fe42f5f7cd8220c0ad9ec591d26a533 to your computer and use it in GitHub Desktop.
Save zoecarver/3fe42f5f7cd8220c0ad9ec591d26a533 to your computer and use it in GitHub Desktop.
def get_hog_features(image, visualize=False):
features = hog(
image,
orientations=9,
pixels_per_cell=(8, 8),
cells_per_block=(2, 2),
visualize=visualize,
feature_vector=True,
block_norm='L1'
)
return features
def get_features(images):
if type(images) is not list:
images = [images]
all_features = []
for image in images:
features = get_hog_features(image)
all_features.append(features)
return all_features
people_features = get_features(people)
not_people_features = get_features(not_people)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment