Code Monkey home page Code Monkey logo

pytorch-dex's Introduction

DEX: Deep EXpectation of apparent age from a single image

This is a pytorch version of DEX. Refer to its Home Page for more details

You can refer to insight if you want a much smaller model but it uses mxnet instead of pytorch. I haven't convert it to pytorch yet.

Getting Started

A separate Python environment is recommended.

  • Python3.5+ (Python3.5, Python3.6 are tested)
  • Pytorch == 1.0
  • opencv4 (opencv3.4.5 is tested also)
  • numpy

install dependences using pip

pip3 install numpy opencv-python
pip3 install https://download.pytorch.org/whl/cpu/torch-1.0.1.post2-cp36-cp36m-linux_x86_64.whl
pip3 install torchvision (optional)

or install using conda

conda install opencv numpy
conda install pytorch-cpu torchvision-cpu -c pytorch

Usage

git clone https://github.com/siriusdemon/pytorch-DEX.git
cd pytorch-DEX
python demo.py path/to/image 

Results

predict image: imgs/2.png
woman: 0.994, man: 0.006
age: 21.433

predict image: imgs/5.png
woman: 0.010, man: 0.990
age: 42.896

Installation

You can use dex as a separate Python package right now!

cd pytorch-DEX
pip install .

See demo.py for example.

Citation

@InProceedings{Rothe-ICCVW-2015,
  author = {Rasmus Rothe and Radu Timofte and Luc Van Gool},
  title = {DEX: Deep EXpectation of apparent age from a single image},
  booktitle = {IEEE International Conference on Computer Vision Workshops (ICCVW)},
  year = {2015},
  month = {December},
}

pytorch-dex's People

Contributors

siriusdemon 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

Watchers

 avatar  avatar  avatar

pytorch-dex's Issues

Pytorch Models

Hello!
I have a question, have you trained the model by yourself? or you somehow converted the original caffe model to Pytorch?

some minor mistakes of the code.

  1. Image Normalization according to imagenet_mean.binaryproto.
  2. Age Estimation computing mistake.
    Your code:
def expected_age(vector):
    res = [(i+1)*v for i, v in enumerate(vector)]
    return sum(res)

but in the paper:

Fail to load pth model files

I have encountered a problem:
Traceback (most recent call last):
File "demo.py", line 5, in
dex.eval()
File "/home/zyd/Reed/DL/age-estimation/code/pytorch-DEX/dex/api.py", line 23, in _eval
gender_model.load_state_dict(torch.load(gender_model_path))
File "/home/zyd/anaconda3/envs/pytorch/lib/python3.5/site-packages/torch/serialization.py", line 367, in load
return _load(f, map_location, pickle_module)
File "/home/zyd/anaconda3/envs/pytorch/lib/python3.5/site-packages/torch/serialization.py", line 528, in _load
magic_number = pickle_module.load(f)
_pickle.UnpicklingError: invalid load key, 'v'.

How can I solve it?

Accuracy IMDB-dataset

I am a student who is trying to train the network. How could I accurately select the images in the dataset? I noticed that many photos do not correspond to the real case.

git-lfs data quota over

Hi,
when pulling the repo the following error shows:
Error downloading object: dex/pth/age_sd.pth (d754f06): Smudge error: Error downloading dex/pth/age_sd.pth (d754f06341792aecf1c5893269ae849892072532f161b63cd595d713897f5302): batch response: This repository is over its data quota. Purchase more data packs to restore access.
Can you maybe remove the lfs option and provide download links to the pretrained models?

about the loss function in training

hi, sorry to bother. I wanna use your written model to train my own datasets. noticed that the expected_age is calculated directly by the output of model. when doing training, is the loss function cross-entropy between the output of model and the sequence where 1 at the age and 0 otherwise?

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.