Giter VIP home page Giter VIP logo

hyperface's Introduction

Hyper Face

Hyper Face implementation which predicts face/non-face, landmarks, pose and gender simultaneously.

This is NOT official implementation.

This software is released under the MIT License, see LICENSE.txt.

Features

  • Chainer implementation
  • Image viewer on web browsers

Testing Environments

Ubuntu 16.04

  • Python 2.7
  • Chainer 1.14.0
  • OpenCV 2.4.9
  • Flask 0.11.1
  • Flask_SocketIO 2.4
  • Dlib 19.1.0

Arch Linux

  • Python 3.5
  • Chainer 1.14.0
  • OpenCV 3.1.0
  • Flask 0.10.1
  • Flask_SocketIO 2.2
  • Dlib 19.1.0

Configuration

Important variables are configured by config.json.

Set gpu positive number to use GPU, port numbers of web servers and so on.

Train

Preparation

Download AFLW Dataset and AlexNet Caffe Model, expand them and set aflw_sqlite_path, aflw_imgdir_path, and alexnet_caffemodel_path in config.json

Pre-training

Pre-training with RCNN_Face model.

python ./scripts/train.py --pretrain

Open http://localhost:8888/, http://localhost:8889/ and http://localhost:8890/ with your web browser to see loss graphs, network weights and predictions. Port numbers are configured by config.json.

Main training

python ./scripts/train.py --pretrainedmodel result_pretrain/model_epoch_40

Use arbitrary epoch number instead of 40.

Test

To skip training, please use trained model from here (Do not expand as zip).

AFLW test images

python ./scripts/use_on_test.py --model model_epoch_190

Open http://localhost:8891/ to see predictions.

Your image file

Set your image file with --img argument. The dependence are less than other tests and demos.

python ./scripts/use_on_file.py --model model_epoch_190 --img sample_images/lena_face.png

Input images are contained in sample_images directory.

Demos with post-processes

Open http://localhost:8891/ to see demos.

AFLW test images

python ./scripts/demo_on_test.py --model model_epoch_190

Demo using AFLW test images

Web camera on your browser

python ./scripts/demo_live.py --model model_epoch_190

ToDo

  • Tune training parameters.
  • Fix pose drawing.
  • Implement post processes.
  • Tune post processes parameters.

hyperface's People

Contributors

takiyu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

hyperface's Issues

How to fine-tuning pre-trained model with my own data?

Hi,
I want to improve the gender accuracy,
so I'd like to finetune your model (model_epoch_190) with my dataset
(some croped face with 21 landmarks and gender label)

but I still don't know how to start it,
should I add my dataset to aflw.sqlite ?
can you give me some tips ?

Any help will be highly appreciated,Thanks!

Any good env configuration ?!

Trying to find any good env configuration where train.py uses gpu. Tried various chainer and cupy versions. Was able to run train on CPU but thats it. Anybody succeed with GPU ?

_proposal_region relation with original HyperFace

Hi,
I look to your entire code. I was wondering if the function called "proposal_region" in your code is the one called FaceRectCalculator present in the HyperFace paper.
If so, how did you understand what it if should perform?

Thanks
Anna

ValueError: Invalid async_mode specified

I get an error when I run:

python ./scripts/demo_live.py --model model_epoch_190

I have a MacOsX system and Here is the log:

Traceback (most recent call last):
  File "/anaconda/envs/hyperface/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/anaconda/envs/hyperface/lib/python2.7/multiprocessing/process.py", line 114, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/aminbarekatain/Desktop/hyperface/scripts/extensions/imgliveuploader/app.py", line 99, in new_server
    logger=False, engineio_logger=False)
  File "/anaconda/envs/hyperface/lib/python2.7/site-packages/flask_socketio/__init__.py", line 119, in __init__
    self.init_app(app, **kwargs)
  File "/anaconda/envs/hyperface/lib/python2.7/site-packages/flask_socketio/__init__.py", line 144, in init_app
    self.server = socketio.Server(**self.server_options)
  File "/anaconda/envs/hyperface/lib/python2.7/site-packages/socketio/server.py", line 89, in __init__
    self.eio = self._engineio_server_class()(**engineio_options)
  File "/anaconda/envs/hyperface/lib/python2.7/site-packages/engineio/server.py", line 122, in __init__
    raise ValueError('Invalid async_mode specified')

Can you help me to fix this problem?

Test problem

Hi @takiyu
I have a problem that must the Test part use gpu?
Thank you very much!

How to contact you?

Hello, i am reimplement hyperfaec in pytorch these days.
I meet some problems, and I hope to talk about these questions with you.
May i have your e-mail or other social media ?

raise IndexError

Hello, thanks for your impressive work!
When I run your code to reproduce the work, I met the following errors:

[2017/08/28 09:51:03] WARNING (13199) datasets : No selective search rectangle
Process Process-10:...........................................] 4.93%
Traceback (most recent call last):ochs
File "/home/users/yuxi.feng/anaconda2/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
self.run()
File "/home/users/yuxi.feng/anaconda2/lib/python2.7/multiprocessing/process.py", line 114, in run
self._target(*self._args, **self._kwargs)
File "/home/users/yuxi.feng/anaconda2/lib/python2.7/site-packages/chainer/iterators/multiprocess_iterator.py", line 162, in _worker
out_queue.put(dataset[index])
File "/home/users/yuxi.feng/anaconda2/lib/python2.7/site-packages/chainer/dataset/dataset_mixin.py", line 30, in getitem
return self.get_example(index)
File "/home/users/yuxi.feng/anaconda2/lib/python2.7/site-packages/chainer/datasets/sub_dataset.py", line 75, in get_example
return self._dataset[index]
File "/home/users/yuxi.feng/anaconda2/lib/python2.7/site-packages/chainer/dataset/dataset_mixin.py", line 30, in getitem
return self.get_example(index)
File "/home/users/yuxi.feng/Project/hyperface/scripts/datasets.py", line 293, in get_example
raise IndexError
IndexError
I used aflw datasets as your example mentined, it seems some exapmles has no proposal rects??

Error with trained model

Hi takiyu,

I tried to use trained model (model_epoch_190 downloaded from your link). It seems there is an error when I use python ./scripts/use_on_file.py --model model_epoch_190 --img sample_images/lena_face.png

I have looked into model_epoch_190. There are all .npy files in that folder. But it needs chainer.serializers.load_npz(args.model, model).

Am I using the trained model in a right way? Could you tell me more details about how I can use model_epoch_190, please?

How can i set the pretrained model?

I want to test my image with pretrained model. After download your trained model and unzip, I try "python ./scripts/use_on_file.py --model model_epoch_190 --img sample_images/my_image.png".
But i get some error like below.
File "./scripts/use_on_file.py", line 57, in
chainer.serializers.load_npz(args.model, model)
File "/usr/local/lib/python2.7/dist-packages/chainer/serializers/npz.py", line 150, in load_npz
with numpy.load(file) as f:
File "/home/sungkwonan/.local/lib/python2.7/site-packages/numpy/lib/npyio.py", line 372, in load
fid = open(file, "rb")
IOError: [Errno 21] Is a directory: 'model_epoch_190'

how can i set the trained model?

Invalid crop rectangle

Hi,

Sometimes, when I train a model , I get the following error:

WARNING (29033) datasets : Invalid crop rectangle. (rect:(1209, 0, 281, 169), img:(170, 0, 3), org_img(1600, 1142, 3)")

Do you know what could be the cause ?

How to convert AFLW pose float value to angle?

I don't know what's the range of roll, pitch and yaw, so I couldn't convert the float value to specific angle? Does all of them is between [-90, 90] ? Or[-100,100] for yaw, [-45,45] for pitch, [-25, 25] for roll ? Or some other function I don't know ?
And why the Yaw value reading from db is not between [-1., 1.] ? For example:
Roll: 0.21319378912448883
Pitch: 0.0004151661123614758
Yaw: -1.1322304010391235
x: 198
y: 55
w: 220
h: 220

output for more then one face

Hi, many thanks for the good work! (will you implement the latest work 'all in one cnn for face analysis' as well?)
Anyway, by running use_on_cap or demo_on_test or use_on_file etc the output (landmarks, rectangle ..) is only for ONE face although there are more then one clear and focused faces in the image.
How can I change it?

is aflw_cache.npz missing?

Hi takiyu,
I am trying to run your implementation of Hyperface but I can't see the file "aflw_cache.npz".
Thanks.
Cheers,
Anna

ValueError: train argument is not supported anymore

Hi, @takiyu
I'm running the use_on_file.py like this
python scripts/use_on_file.py --model model_epoch_190 --img age_gender/input/jan2.jpg

The error I'm getting is this:

Traceback (most recent call last):
  File "scripts/use_on_file.py", line 87, in <module>
    y = model(x)
  File "/datadrive/hyperface/scripts/models.py", line 80, in __call__
    h = F.dropout(h, train=self.train)
  File "/datadrive/virtualenvs/py2/local/lib/python2.7/site-packages/chainer/functions/noise/dropout.py", line 163, in dropout
    kwargs, train='train argument is not supported anymore. '
  File "/datadrive/virtualenvs/py2/local/lib/python2.7/site-packages/chainer/utils/argument.py", line 7, in check_unexpected_kwargs
    raise ValueError(message)
ValueError: train argument is not supported anymore. Use chainer.using_config

The model is successfully running till this step:
[2018/10/12 04:45:15] INFO (4127) __main__ : Forward the network

Is there some step I'm missing out?

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.