GithubHelp home page GithubHelp logo

guofenggitlearning / automatic-face-detection-annotation-and-preprocessing Goto Github PK

View Code? Open in Web Editor NEW

This project forked from robinreni96/automatic-face-detection-annotation-and-preprocessing

0.0 1.0 0.0 12.08 MB

Its an open source code to easily preprocess your images for mapping faces and convert a tfrecord , csv file to train your model.

Python 100.00%

automatic-face-detection-annotation-and-preprocessing's Introduction

Automatic-Face-Detection-Annotation-and-Preprocessing

Build Status Codacy Badge

For creating a facial recognition model we need the facial landmarked data from the images . To get it , we need to manually label all the images using the labeltools , annotate the image with their coordiantes and then convert it to a csv file . Then we preprocess it to respective data file format like tfrecord etc. To make it easy for the AI Developers , I coded this module which can automatically detect , annotate , collect the coordinates , convert to csv and to tfrecord . And I added a feature to visulaize your detected face on the image according by their respective classes.

Compatibility

The code is tested and developed in ubuntu 18.04 and using pyton 3.6.But the code has the realiability to run on most of the configuration . If you face issues , do open up an issue for this repo .All the package dependencies are mentioned in requirements.txt.

Workings

  1. Preprocessing all the images to a standard size and format
  2. Loading the preprocessed image
  3. Detecting the Face in the image using MTCNN or Harr-Cascade Algorithm and removing bad images
  4. Getting the face coordinates
  5. Writing into csv
  6. Converting into tfrecord
  7. Exporting the images with the face bounding box for debuging

Core Functionality

  • main.py - Parse the arguments , load the images , call the detect,cordinates,preprocess functions
  • coordinates.py - Using MTCNN it detects the facial boundary coordinates
  • cascade.py - Using Harr-Cascade detects the facial boundary coordinates
  • generate_tfrecord.py - Used to generate the tfrecord for the csv
  • dataset_util - some utility functions for generate_tfrecord
  • check.py - load the processed image and export the output with the bounding box
  • bounding.py - draw the bounding box using opencv
  • requirements.txt - contains all the packages and their versions

Note : The images should be in jpg format and each image of a class should have only one person image.

Steps to run the code for your custom dataset

  1. Create a python virtual environment and pip install the requirements.txt
  2. Then prepare the images folder according to structure
  3. Create a empty output directory
  4. To detect the face using Facenet run python main.py csv_name tfrecord_name facenet.Example : python main.py train.csv train.record facenet
  5. To detect the face using Harr-Cascade run python main.py csv_name tfrecord_name harr. Example : python main.py train.csv train.record harr
  6. After code execution , you will get a csv and tfrecord file . To view the detection is perfect , go to the output directory you can view all the images with detection according to their respective class.
  7. Simple !

Additional Feature

It automatically removes all the bad format images and multiple face images

For More Reference :

ALL THE WORKS ARE DEVELOPED WITH THE GUIDANCE AND SUPPORT FROM INNOVATION INCUBATOR

automatic-face-detection-annotation-and-preprocessing's People

Contributors

codacy-badger avatar robinreni96 avatar

Watchers

 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.