recognize {facerec}R Documentation

recognize face

Description

Recognize faces in an image and return the most likely matches from a gallery.

Usage

recognize(image, gallery, min_head_scale = 0.015, threshold = 0.6,
  max_num_results = 10, show_candidate_images = TRUE)

Arguments

image

An image of file type JPG, PNG, or BMP. Can either be an url string or a local image processed with prep_image.

gallery

A string containing the name of the gallery in which the image will be enrolled.

min_head_scale

Set the ratio of the smallest face to look for in the input image. Accepts a value between .015 (1:64 scale) and .5 (1:2 scale).

threshold

Likelihood (between 0 and 1) used to determine a valid facial match. Defaults to 0.6.

max_num_results

The maximum number of potential matches that are returned. Defaults to 10.

show_candidate_images

Whether to return temporary URLs for each potential match. Defaults to TRUE.

Value

A dataframe with the potential matches for the input image. The likelihood of matches is given in column confidence.

Examples

 

facerec_init()

# enroll
finn_image <- 'https://upload.wikimedia.org/wikipedia/en/2/2a/Finn-Force_Awakens_%282015%29.png'
padme_image <- 'https://upload.wikimedia.org/wikipedia/en/e/ee/Amidala.png'
finn_face <- enroll(image = finn_image, subject_id = 'finn', gallery = 'starwars')
padme_face <- enroll(image = padme_image, subject_id = 'padme', gallery = 'starwars')

# recognize
finn_2 <- 'https://upload.wikimedia.org/wikipedia/commons/b/b6/John_Boyega_by_Gage_Skidmore.jpg'
finn_rec <- recognize(image = finn_2, gallery = 'starwars')



[Package facerec version 0.1.0 Index]