GithubHelp home page GithubHelp logo

anasgit / azsegface Goto Github PK

View Code? Open in Web Editor NEW

This project forked from azmathmoosa/azsegface

0.0 1.0 0.0 14.52 MB

A Semantic Segmentation Network trained to segment Human Faces in potrait photos

License: MIT License

CMake 0.62% C++ 97.18% C 0.23% Cuda 0.42% Shell 0.10% Java 0.04% MATLAB 0.01% Batchfile 0.01% Makefile 0.03% HTML 0.10% XSLT 0.44% CSS 0.04% JavaScript 0.01% Python 0.78% Perl 0.01%

azsegface's Introduction

azSegFace

A Semantic Segmentation Network trained to segment Human Faces in potrait photos.

Details

Framework: Dlib DNN

Network Type: FCN

Network was first trained on Pascal VOC then retrained on a custom dataset with masked faces in potrait images. The results are reasonable. The underlying network is an FCN with 200+ layers.

Usage

Build

The project uses CMake.

Build in Windows

  • Install Cmake, VS 2017 x64 with VC tools v140.
  • Also install CUDA and cuDNN from NVidia's website. This was tested on CUDA v9.0. (If CUDA install fails, disable VS integration ad install again)
  • In the repo directory create a new directory called build
  • Open a PS terminal, and type cmake-gui ../
  • In the cmake gui, select VS 2017 x64 as generator. Click configure.
  • Cmake will try to configure build environment. It will print a warning saying Dlib will not use cuda
  • After configure completes, edit DLIB_USE_CUDA and set it to ON.
  • Then edit CUDA_HOST_COMPILER and set it to C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe
  • Click configure again and this time it should complete without errors.
  • Click generate and cmake will generate project files.
  • Exit cmake-gui and in the PS terminal type cmake --build . --config Release
  • Build might take 15 to 20 minutes depending on your system configuration.

Build in Linux

  • Install cmake, makeutils etc.
  • Install Nvidia CUDA and cuDNN
  • In the repo directory create a new directory called build
  • Open a terminal, and type cmake-gui ../
  • In the cmake gui, select Unix Makefiles as generator. Click configure.
  • Cmake will try to configure build environment.
  • Click generate and cmake will generate project files.
  • Exit cmake-gui and in the terminal type cmake --build .
  • Build might take 15 to 20 minutes depending on your system configuration.

Inference

  • After build, you can run the application
>cd Release\
>.\dnn_semantic_face_ex.exe \path\to\images\directory

-- or in linux --
$./dnn_semantic_face_ex.exe path/to/images/directory
  • The application will scan and load the CNN from ..\..\nets\ directory.
  • It will show the output for each image in the directory. Hit enter for next image.

Training

  • Use the VOC annotation tool in voc_utl folder to annotate on your custom images.
  • The tool will organize the dataset as a directory

dataset

  • To train, use ./dnn_semantic_face_train_ex.exe path/to/dataset/dir
  • The app will first look for semantic_segmentation_voc2012net.dnn in the current directory and do transfer learning.
  • You may have to edit the src file with the correct path to the net or move the net to the same directory as the training executable.
  • After training completes, a new .dnn file will be saved that can be used with the inference executable.

Preview

segmentated face segmentated face segmentated face segmentated face segmentated face segmentated face segmentated face segmentated face

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.