Giter Club home page Giter Club logo

Comments (3)

mpatacchiola avatar mpatacchiola commented on June 10, 2024 1

Yes that code it is pretty similar to the one I have implemented. I think the guy took inspiration from Deepgaze to create that blog post. I think that MTCNN may be a good choice. Good luck with your experiments!

from deepgaze.

mpatacchiola avatar mpatacchiola commented on June 10, 2024

Anyways, I would not mind trying this out on my project and supplying the scripts and videos if you can add me as a minor contributor.

You are welcome to contribute. If you think you can provide an additional feature or do some useful tests then do it! Based on the contribution we will decide if adding you as major or minor contributor.

Yes the bottleneck is the face detector. The OpenCV Haar cascade can recognize front and profile faces. A slight rotation on the vertical axis is also allowed.

There are a few parameters in the method returnFacePosition() that you can manage in Deepgaze to allocate more resources to tilted and scaled faces. Give a look at this method (also reported below).

For instance if you change the value of rotationAngleCCW and rotationAngleCW the detector will look for faces at different degrees. Changing minSizeX you can allow the detector to look for smaller faces.

The problem is that since the detector is called multiple times, the method starts to be slow and it is difficult to guarantee real-time. We were working on something faster based on Deep Learning, but the feature has never been finished.

Directly from the description of the method:

def returnFacePosition(self, inputImg, 
                           runFrontal=True, runFrontalRotated=True, 
                           runLeft=True, runRight=True, 
                           frontalScaleFactor=1.1, rotatedFrontalScaleFactor=1.1, 
                           leftScaleFactor=1.1, rightScaleFactor=1.1,
                           minSizeX=30, minSizeY=30, 
                           rotationAngleCCW=30, rotationAngleCW=-30, 
                           lastFaceType=0):
        """Find a face (frontal or profile) in the input image 
        Find a face and return the position. To find the right profile the input 
        image is vertically flipped, this is done because the training 
        file for profile faces was trained only on left profile. When all the
        classifiers are working the computation can be slow. To solve the problem
        it is possible to accurately tune the minSize and ScaleFactor parameters.
        @param inputImg the image where the cascade will be called
        @param runFrontal if True it looks for frontal faces
        @param runFrontalRotated if True it looks for frontal rotated faces
        @param runLeft if True it looks for left profile faces
        @param runRight if True it looks for right profile faces
        @param frontalScaleFactor=1.1
        @param rotatedFrontalScaleFactor=1.1
        @param leftScaleFactor=1.1
        @param rightScaleFactor=1.1
        @param minSizeX=30
        @param minSizeY=30
        @param rotationAngleCCW (positive) angle for rotated face detector
        @param rotationAngleCW (negative) angle for rotated face detector
        @param lastFaceType to speed up the chain of classifier
        Return code for face_type variable: 1=Frontal, 2=FrontRotLeft, 
        3=FronRotRight, 4=ProfileLeft, 5=ProfileRight.
        """

from deepgaze.

nyck33 avatar nyck33 commented on June 10, 2024

@mpatacchiola
I'll definitely try replacing the Haar face detector with MTCNN, Tencent DFSD (this one is good but very slow as you mentioned it rotates, resizes and calls detect() multiple times) but I know with MTCNN, it did not detect a frontal face lying sideways without rotate so it's probably going to be slow as well.
Thank you for all the info above. By the way though, I am just learning PnP and found this: https://www.learnopencv.com/head-pose-estimation-using-opencv-and-dlib/ but are the fundamentals behind your implementation similar?

from deepgaze.

Related Issues (20)

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.