GithubHelp home page GithubHelp logo

face-orientation's Introduction

Face Orientation Resnet Project

Description

A trained classifier that is able to detect face orientation. The model is based off a pre-trained resnet model that is transferred over. It is able to detect up and down very well but struggles a slight amount with right and left. This model could be improved further with more precise fine tuning.

Results

Face Orientation Classifier

Up Down Left Right Total
Train Accuracy 100% 100% 96.8% 90% 96.8%
Validation Accuracy 96.8% 100% 93.8% 81.2% 93%

Instructions

  1. Download the CelebA Database. This should be saved as "img_align_celeba".
  2. Run the ImageProcessor.py to convert the data into the correct size and folders. Note you will need to create the "processedImages/" folders. This includes a train and validate folder with each label "up" , "down", "left" , and "right". See Command #1 for help.
  3. clone the GitHub repo for Tensorflow Models and follow the instructions in the official folder README. This should be in the same folder as this repo.
  4. Run the build_image_data.py command using Command #2. The "tfRecords/" will also have to be created. With the latest Tensorflow binaries you will need to add the following lines to line 77-78. import tensorflow.compat.v1 as tf tf.disable_eager_execution()
  5. Download the latest model from the official/r1/resnet/ README. Rename this to "PreResNet/".
  6. Finally you can run the code using Command #3. You will need to make the following changes.
    1. Line 714 of resnet_run_loop.py change to classifier.export_saved_model("results/", input_receiver_fn)
    2. The final line of imagenet_preprocessing.py change to image = tf.image.decode_image(image_buffer, channels=num_channels , expand_animations=False) image.set_shape([output_height, output_width, num_channels])
  7. Explore the data using the Predict.ipynb

Commands

  1. mkdir -p processedImages/train/up && mkdir -p processedImages/train/down && mkdir -p processedImages/train/left && mkdir -p processedImages/train/right && mkdir -p processedImages/validate/up && mkdir -p processedImages/validate/down && mkdir -p processedImages/validate/left && mkdir -p processedImages/validate/right
  2. python models/research/inception/inception/data/build_image_data.py --train_directory processedImages/train/ --validation_directory processedImages/validate/ --output_directory tfrecords/ --labels_file labels.txt --train_shards 1024 --validation_shards 128
  3. python models/official/r1/resnet/imagenet_main.py --data_dir tfrecords/ --pretrained_model_checkpoint_path PreResNet --fine_tune False --rv 2 --export_dir results/ --train_epoch 10

face-orientation's People

Contributors

wert23239 avatar

Stargazers

 avatar  avatar  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.