How to Use Pigo for Face Detection

Jan 17, 2022 | Data Science

Welcome to the exciting world of Pigo, a pure Go face detection library that doesn’t just stop at identifying faces. It also specializes in pupil localization and facial landmark detection!

How to Use Pigo for Face Detection

Pigo has been developed with the intention of providing a lightweight and efficient alternative to existing solutions that depend on external C/C++ libraries such as OpenCV or dlib. Here’s how you can utilize Pigo for various functionalities:

Installation

  • Make sure you have Go installed on your machine.
  • Set your GOPATH and add $GOPATH/bin to your PATH.
  • Execute the following command:
  • bash
    $ go install github.com/esimov/pigo/cmd/pigo@latest
    

Basic Usage

To perform face detection, Pigo provides a command line utility:

bash
$ pigo -in input.jpg -out out.jpg -cf cascadefacefinder

Here, input.jpg is your source image, while out.jpg is where you wish to store the result.

Understanding the Code

When you use Pigo’s API for face detection, think of it as baking a cake:

  • First, you gather the ingredients — loading the binary classifier.
  • Then, prep the base — converting the image to grayscale.
  • Next, mix everything in — running the cascade function to extract faces.

This process will give you a “slice” containing details of detected faces, such as the row and column coordinates and detection score!

Advanced Features

Pigo doesn’t just stop at face detection. It also includes:

Pupil/Eyes Localization

With version 1.2.0, Pigo can localize pupils and eyes. This feature relies on a unique methodology that uses an ensemble of randomized trees. Check [this example](https://github.com/esimov/pigo/tree/master/examples/puploc) for a real-time demo.

Facial Landmark Points Detection

Version 1.3.0 introduced the ability to detect facial landmarks. This feature is based on fast localization techniques. Discover its potential [here](https://github.com/esimov/pigo/tree/master/examples/facial_landmark).

Troubleshooting

If you encounter issues, here are some suggestions:

  • Make sure your Go environment is properly configured.
  • If you experience errors due to image formats, ensure you have either image/jpeg or image/png imported, depending on your image type.
  • For issues related to face detection, try adjusting the parameters like -angle or -iou to see if it improves the results.
  • If you’re using pupil localization or facial landmark detection, ensure the respective cascade files are in the correct path.

For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.

Conclusion

Pigo offers a robust face detection solution that caters to advanced needs without the burden of extra dependencies. At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

Stay Informed with the Newest F(x) Insights and Blogs

Tech News and Blog Highlights, Straight to Your Inbox