Giter Club home page Giter Club logo

face-detection's Introduction

Face Detection

Fast and reliable face detection with RetinaFace.

This repo provides the out-of-box RetinaFace detector.

Requirements

  • Python 3.5+ (it may work with other versions too)
  • Linux, Windows or macOS
  • PyTorch (>=1.0)

While not required, for optimal performance it is highly recommended to run the code using a CUDA enabled GPU.

Install

The easiest way to install it is using pip:

pip install git+https://github.com/elliottzheng/face-detection.git@master

Usage

Detect face and five landmarks on single image
from skimage import io
from face_detection import RetinaFace

detector = RetinaFace()
img= io.imread('examples/obama.jpg')
faces = detector(img)
box, landmarks, score = faces[0]
Running on CPU/GPU

In order to specify the device (GPU or CPU) on which the code will run one can explicitly pass the device id.

from face_detection import RetinaFace
# 0 means using GPU with id 0 for inference
# default -1: means using cpu for inference
detector = RetinaFace(gpu_id=0) 
GPU(GTX 1080TI,batch size=1) GPU(GTX 1080TI,batch size=750) CPU(Intel(R) Core(TM) i7-7800X CPU @ 3.50GHz)
FPS 44.02405810720893 96.64058005582535 15.452635835550483
SPF 0.022714852809906007 0.010347620010375976 0.0647138786315918
Batch input for faster detection

All the input images must of the same size.

Detector with CUDA process batch input faster than the same amount of single input.

from skimage import io
from face_detection import RetinaFace

detector = RetinaFace()
img= io.imread('examples/obama.jpg')
all_faces = detector([img,img]) # return faces list of all images
box, landmarks, score = all_faces[0][0]

Reference

@inproceedings{deng2019retinaface,
title={RetinaFace: Single-stage Dense Face Localisation in the Wild},
author={Deng, Jiankang and Guo, Jia and Yuxiang, Zhou and Jinke Yu and Irene Kotsia and Zafeiriou, Stefanos},
booktitle={arxiv},
year={2019}

face-detection's People

Contributors

elliottzheng avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.