ShiqiYu / libfacedetection

An open source library for face detection in images. The face detection speed can reach 1000FPS.
Other
12.27k stars 3.05k forks source link

R wrapper #122

Closed jwijffels closed 4 years ago

jwijffels commented 5 years ago

Thanks for the C++ code and the trained weights. I've created an R package around it which was pretty easy to do. It's at https://github.com/bnosac/image

In case anyone is interested to use it, here is some code - install with install.packages("image.libfacedetection", repos = "https://bnosac.github.io/drat")

And apply it as follows.

library(image.libfacedetection)
library(magick)
path  <- system.file(package="image.libfacedetection", "images", "handshake.jpg")
image <- image_read(path)
faces <- image_detect_faces(image)
faces
$nr
[1] 3

$detections
    x   y width height neighbours  angle
1 427 161    60     60         94      0
2 735 166    82     82         73  24713
3 264 131    66     66         67 -15416
plot(faces, image, border = "red", lwd = 7, col = "white")

combined

Some questions

many thanks!

ShiqiYu commented 4 years ago

I will realse the model file of V3 soon. The model files for V1 and V2 are at https://github.com/ShiqiYu/libfacedetection/tree/master/models

Please read the sample source code for the format of returned result.