Our dataset contains images of varying sizes. Now, we will preprocess our data and build a facial recognition model:
- Let's load a sample input image and resize it:
width_resized = 500height_resized = 500test_img = image_read("data/face_recognition/brad_pitt/brad_pitt_21.jpg")test_img <- image_scale(test_img,paste0(width_resized,"x",height_resized,sep =""))
- Now, we can localize the face in the image using the image_detect_faces() function:
faces <- image_detect_faces(test_img)
Let's print and save the attributes of the face's locale:
faces$detections[,1:4]face_width = faces$detections$widthface_height = faces$detections$height face_x = faces$detections$xface_y = faces$detections$y
- Now that we have localized the face in ...