facial analysis techniques for pythonista (and beyond!) - pycon8

Post on 21-Apr-2017

99 Views

Category:

Engineering

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

clda.co/pycon8-­‐facial-­‐analysis

Facial  Analysis  Techniques  for  Pythonista

(and  beyond!)

4/9/2017 PYCON  OTTO  @  Florence

About  Me

@alex_casalboni

clda.co/pycon8-­‐facial-­‐analysis

Computer  Science  Background

Master  in  Sound  &  Music  Engineering

Sr.  SoDware  Engineer  &  Web  Developer

Cloud  Evangelist  @  Cloud  Academy

Agenda

What  is  a  Face?

Problem  decomposiLon

AlternaLves  to  DIY

clda.co/pycon8-­‐facial-­‐analysis

What  is  a  Face?

You  thought  you  knew,  but  you  didn’t…  ?

clda.co/pycon8-­‐facial-­‐analysis

About  “Normal”  Faces

clda.co/pycon8-­‐facial-­‐analysis

What  about  rotaCon  invariance?

clda.co/pycon8-­‐facial-­‐analysis

What  about  animals?

clda.co/pycon8-­‐facial-­‐analysis

What  about  painCngs?

clda.co/pycon8-­‐facial-­‐analysis

What  about  masks?

clda.co/pycon8-­‐facial-­‐analysis

What  about  smilies?

clda.co/pycon8-­‐facial-­‐analysis

Problem  decomposiLon

What  are  the  main  building  blocks  for  facial  analysis?

clda.co/pycon8-­‐facial-­‐analysis

1.  Face  DetecLon

clda.co/pycon8-­‐facial-­‐analysis

Face  DetecCon

clda.co/pycon8-­‐facial-­‐analysis

Input:  1  image  &  unknown  context

Goal:  finding  faces  (how  many?)

Output:  lists  of  coordinates

Difficulty:  preUy  easy

Face  DetecCon  Results

clda.co/pycon8-­‐facial-­‐analysis

Face  DetecCon  Techniques

clda.co/pycon8-­‐facial-­‐analysis

Algorithmical  techniques

Not  too  much  “intelligence”

Real-­‐Lme  tracking

Face  DetecCon  Techniques  -­‐  HOG

clda.co/pycon8-­‐facial-­‐analysis

Histogram  of  Oriented  Gradients

HOG  w/  OpenCV  and  dlib

clda.co/pycon8-­‐facial-­‐analysis

*  Vectors  allow  for  more  advanced  analysis  (see  hUp://www.paulvangent.com/2016/08/05/emoLon-­‐recogniLon-­‐using-­‐facial-­‐landmarks/)*  That  .dat  file  is  100+MB

Face  DetecCon  Techniques  -­‐  Haar  Cascades

clda.co/pycon8-­‐facial-­‐analysis

Haar  Feature-­‐based  Cascade  Classifiers

Haar  Cascades  w/  OpenCV

clda.co/pycon8-­‐facial-­‐analysis

clda.co/pycon8-­‐facial-­‐analysis

2.  Face  RecogniLon

clda.co/pycon8-­‐facial-­‐analysis

Face  RecogniCon

clda.co/pycon8-­‐facial-­‐analysis

Input:  1  reference  and  1  target  image

Goal:  finding  facial  matches

Output:  lists  of  (potenLal)  matches

Difficulty:  medium

Facial  Encoding

clda.co/pycon8-­‐facial-­‐analysis

Vector  RepresentaLon  (128D)  *

*  could  be  learned  with  DL

Facial  Distance

clda.co/pycon8-­‐facial-­‐analysis

A  and  B  are  the  same  person  if  distance(A,  B)  <  tolerance

Face  Matching  w/  face_recogni2on

clda.co/pycon8-­‐facial-­‐analysis

3.  Facial  Analysis

clda.co/pycon8-­‐facial-­‐analysis

Facial  Analysis

clda.co/pycon8-­‐facial-­‐analysis

Input:  1  detected  face

Goal:  extracLng  high-­‐level  informaLon

Output:  gender,  age,  emoLons,  headwear,  etc.

Difficulty:  preUy  hard

Facial  Analysis

clda.co/pycon8-­‐facial-­‐analysis

ML  Model  (gender)

ML  Model  (emoLons)

ML  Model  (….)

ML  Model  (age)

ML  Model  (headwear)

Facial  Analysis

clda.co/pycon8-­‐facial-­‐analysis

How  many  training  sets?

Parallel  features  extracLon  &  predicLon

Accuracy  is  more  subjecLve  (source/target  audience)

Real-­‐Lme  is  not  guaranteed

AlternaLves  to  DIY

How  about  Facial  Analysis  services?

clda.co/pycon8-­‐facial-­‐analysis

Facial  Analysis  Services

Amazon  RekogniLon

Google  Cloud  Vision

Azure  Face  API

Face++  

Kairos

EmoVu

clda.co/pycon8-­‐facial-­‐analysis

Amazon  RekogniCon  &  Python

clda.co/pycon8-­‐facial-­‐analysis

Google  Cloud  Vision  &  Python

clda.co/pycon8-­‐facial-­‐analysis

Azure  Face  API  &  Python

clda.co/pycon8-­‐facial-­‐analysis

clda.co/pycon8-­‐facial-­‐analysis

clda.co/pycon8-­‐facial-­‐analysis

Cloud  Services  Pros

Language  agnosLc  (RESTful  APIs)

Models  are  updated  under  the  hood

No  infrastructure  to  manage

PAYG  model  (w/  free  Ler)

Great  for  embedded  systems

Granted  accuracy  (globally)

clda.co/pycon8-­‐facial-­‐analysis

Cloud  Services  Cons

Hardly  real-­‐Lme  (HTTPs  calls)

ConnecLvity  is  always  needed

Training  set  is  never  customizable

ML  Models  are  a  black  box

Thank  you  :)

jobs.cloudacademy.com

P.S.  we  are  hiring!

PYCON  OTTO  @  Florence

top related