Coder Social home page Coder Social logo

moonpieeee / libfacedetection.train Goto Github PK

View Code? Open in Web Editor NEW

This project forked from shiqiyu/libfacedetection.train

0.0 0.0 0.0 34.23 MB

The training program for libfacedetection for face detection and 5-landmark detection.

License: MIT License

Python 100.00%

libfacedetection.train's Introduction

Training for libfacedetection in PyTorch

License

It is the training program for libfacedetection. The source code is based on FaceBoxes.PyTorch and ssd.pytorch.

Contents

Installation

  1. Install PyTorch >= v1.0.0 following official instruction.

  2. Clone this repository. We will call the cloned directory as $TRAIN_ROOT.

git clone https://github.com/ShiqiYu/libfacedetection.train
  1. Install dependencies.
pip install -r requirements.txt

Note: Codes are based on Python 3+.

Training

  1. Download WIDER FACE dataset, place the images under this directory:
$TRAIN_ROOT/data/WIDER_FACE_rect/images

and create a symbol link to this directory from

$TRAIN_ROOT/data/WIDER_FACE_landmark/images
  1. Train the model using WIDER FACE:
cd $TRAIN_ROOT/tasks/task1/
python3 train.py

Detection

cd $TRAIN_ROOT/tasks/task1/
./detect.py -m weights/yunet_final.pth --image_file=filename.jpg

Evaluation on WIDER Face

  1. Enter the directory.
cd $TRAIN_ROOT/tasks/task1/
  1. Create a symbolic link to WIDER Face. $WIDERFACE is the path to WIDER Face dataset, which contains wider_face_split/, WIDER_val, etc.
ln -s $WIDERFACE widerface
  1. Perform evaluation. To reproduce the following performance, run on the default settings. Run python test.py --help for more options.
mkdir results
python test.py
  1. Download and run the official evaluation tools. NOTE: Matlab required!
# download
wget http://shuoyang1213.me/WIDERFACE/support/eval_script/eval_tools.zip
# extract
unzip eval_tools.zip
# run the offical evaluation script
cd eval_tools
vim wider_eval.m # modify line 10 and line 21 according to your case
matlab -nodesktop -nosplash -r "run wider_eval.m;quit;"

Performance on WIDER Face (Val)

Run on default settings: scales=[1.], confidence_threshold=0.3:

AP_easy=0.849, AP_medium=0.816, AP_hard=0.601

Export CPP source code

The following bash code can export a CPP file for project libfacedetection

cd $TRAIN_ROOT/tasks/task1/
./exportcpp.py -m weights/yunet_final.pth -o output.cpp

Design your own model

You can copy $TRAIN_ROOT/tasks/task1/ to $TRAIN_ROOT/tasks/task2/ or other similar directory, and then modify the model defined in file: tasks/task2/yufacedetectnet.py .

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.