Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

C3AE implement

License

NotificationsYou must be signed in to change notification settings

StevenBanama/C3AE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

101 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a unofficial keras implements of c3ae for age estimation. welcome to discuss ~

--------[result]-----------------

Update History:

  • 2019-9 C3AE org
  • 2020-7 transfer to tensorflow2.1 and exposing gender branch.
    • 1.add gender prediction
    • 2.change neck
    • 3.add Mish6, GeM, Smooth label and so on.
    • 4.add utk, afad, asia dataset
    • 5.add tflite freezing
  • 2020-8 fixed bugs and add fixed-precision model
      1. remove nan weights (it may case predict as unpredict)
      1. add -fp16

Part1 age branch

sourceversionIMDB(mae)WIKI(mae)extra changemodel
from papper--6.576.44----
our implementc3ae-v846.776.74change kl to focal loss without se_netmodel/imdb_focal_loss_c3ae_v84.h5
our implement v2c3ae-v896.58--SE_NET + focal_lossmodel/c3ae_imdb_v89.h5
our implement v3c3ae-v906.51--white norm + SE_NET + focal_lossmail togeekpeakspar@gmail.com

Part2 add gender branch

Triple-Boxes show much influence with different dataset, meanwhile the distribution plays an important role.

sourceversionasiautkafadmodel
our implement v4asiaage: 5.83 gender 0.955----./model/c3ae_model_v2_117_5.830443-0.955
our implement v4asia+utk--age: 5.2 gender 0.967--./model/c3ae_model_v2_91_5.681206-0.949
our implement v4asia+utk+afadage: 5.9 gender 0.9234age: 5.789 gender: 0.9491age: 3.61 gender: 0.9827./model/c3ae_model_v2_151_4.301724-0.962
our implement v4fp16+white-norm asia+utk+afadage: 6.0 gender 0.97age: 5.6 gender: 0.942age: 3.72 gender: 0.987./model/c3ae_model_v2_fp16_white_se_132_4.208622-0.973

cation: Gender annotaion of utk is opposite to wiki/imdb/asia.

**You can change weights of loss to improve age mae, [1, 20, 20].

python nets/C3AE_expand.py --white -se --source "afad" -gpu -m "fp16_white_se" -p ./model/c3ae_model_v2_fp16_white_se_132_4.208622-0.973 -fp16 -test

structs

  • assets
  • dataset (you`d better put dataset into this dir.)
  • detect (MTCNN and align)
  • download.sh (bash script of downloading dataset)
  • model (pretrain model will be here)
  • nets (all tainging code)
    • C3AE.py
  • preproccessing (preprocess dataset), which contains "wiki" "imdb" "afad" "asia" "utk"

Pretrain model(a temp model)

all trainned model saved in dir named "model"

required enviroments:

numpy, tensorflow(2.1), pandas, feather, opencv, python=3.6.5

pip install -r requirements2.1.txt

numpy, tensorflow(1.8), pandas, feather, opencv, python=2.7

pip install -r requirements.txt

test

age and gender branch(only for py3 and tensorflow2+)

  • for image

    python nets/test.py -g -white -se -i assets/timg.jpg -m ./model/c3ae_model_v2_fp16_white_se_132_4.208622-0.973

  • for video

    python nets/test.py -g -white -v -se -m ./model/c3ae_model_v2_fp16_white_se_132_4.208622-0.973

age branch

  • for image

    python nets/test.py -se -i assets/timg.jpg -m model/c3ae_imdb_v89.h5

  • for video

    python nets/test.py -v -se -m model/c3ae_imdb_v89.h5

Preparation Datasets

download imdb/wiki dataset and thenextract those data to the "./dataset/"
download wikidownload imdbdownload asiadownload utkdownload afad

Preprocess:

>>> python preproccessing/dataset_proc.py -i ./dataset/wiki_crop --source wiki>>> python preproccessing/dataset_proc.py -i ./dataset/imdb_crop --source imdb>>> python preproccessing/dataset_proc.py -i ./dataset/AFAD-Full --source afad

training:

plain net>>> python C3AE.py -gpu -p c3ae_v16.h5 -s c3ae_v16.h5 --source imdb -w 10with se-net and white-norm (better result)>>> python C3AE.py -gpu -p c3ae_v16.h5 -s c3ae_v16.h5 --source imdb -w 10 -white -sefor gender and age prediction:>>> python nets/C3AE_expand.py -se -white --source "afad" -gpu -fp16 -p ./model/c3ae_model_v2_fp16_white_se_132_4.208622-0.973

freeze tflite

python nets/C3AE_expand.py -se -white --source "asia" -gpu -fp16 -p ./model/c3ae_model_v2_fp16_white_se_132_4.208622-0.973 -fz

DETECT:

[mtcnn] (https://github.com/YYuanAnyVision/mxnet_mtcnn_face_detection): detect\align\random erasing
trible box

net struct

 params  plain_model

Q&A:

  • only 10 bins in paper: why we got 12 category: we can split it as "[0, 10, ... 110 ]" by two points!\
  • Conv5 1 * 1 * 32, has 1056 params, which mean 32 * 32 + 32. It contains a conv(1 * 1 * 32) with bias
  • feat: change [4 * 4 * 32] to [12] with 6156 params.As far as known, it may be compose of conv(6144+12) ,pooling and softmax.
  • the distribution of imdb and wiki are unbalanced, that`s why change the KL loss to focal loss
  • gender prediction: detail in nets/C3AE_expand.py

To-Do:

- 1.anchor free boundbox- 2.add another new feathers

Reference

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2026 Movatter.jp