2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

単一顔画像からの 3D 復元 Deep3DFaceReconstruction を試す(2019 年 9 月 7 日)

Last updated at Posted at 2019-09-06

Accurate 3D Face Reconstruction with Weakly-Supervised Learning: From Single Image to Image Set
https://github.com/microsoft/Deep3DFaceReconstruction

を試します.

少し古いですが, 既存の他のアルゴリズムとかはこちらを参照ください.

単一画像からの最新ディープラーニング顔アルゴリズムを試す(2017 年 7 月 14 日時点)
https://qiita.com/syoyo/items/5277906d29b2dd49e3a2

準備

  • Basel Face Model 2009(BFM)
  • Expression Basis
  • pre-trained model

のデータが必要になります. Basel Face Model については, 利用規約(商用利用 NG など)に同意して登録することで, ファイルのダウンロードが可能になります.

Expression Basis なども, 商用利用 NG にっていますので注意ください.

あとは readme.md にある通りにセットアップするだけです.

動作

TensorFlow r1.14 + GPU(pip install tensorflow-gpu. NVIDIA GPU) で動作確認しました.
だいたい標準的なライブラリ(e.g. scipy)を使っていますので, python 環境が整備されていればハマるところはなしに demo.py が動きます.

生成された .obj を meshlab で開き, うまく推論できているのを確認しました.

deep3d-face.png

Voila!

考察

詳細は論文にありますが, ネットワーク自体はあまり特殊なものではなく, ResNet をベースにしているため, tflite に変換して動くのを確認しました(近いうちにコード公開予定).
また, ROCm TensorFlow でも動く(学習できる)ものと思われます.

顔領域検出(landmark 検出)

任意画像から形状復元するためには, facial landmark 5 点を使って顔領域を crop し, network に与えています.

論文では,

How far are we from solving the 2D & 3D Face Alignment problem? (and a dataset of 230,000 3D facial landmarks)
https://github.com/1adrianb/2D-and-3D-face-alignment

https://github.com/1adrianb/face-alignment
(pytorch 実装)

の landmark detector を使っています(そして, 検出された 68 点から代表となる 5 点を利用)

上のは torch or pytorch 実装になっていて, Deep3DFaceReconstruction(TensorFlow) と組み合わせて利用するには面倒ですね.

facial landmark 検出の TensorFlow/TFlite の実装を探すか,

あまり横顔になっていない場合, dlib の landmark 検出でも代用できるかと思います.

BlazeFace を使う手もあります.

もしくはユーザに顔領域を指定してもらうか, でしょうか.

TODO

  • tflite 化してモバイルで動かす
  • Basel Face Model の依存性をなくして学習したい(FML: Face Model Learning from Video https://gvv.mpi-inf.mpg.de/projects/FML19/ あたりの手法を使うなど). 商用利用できるように(Basel Face Model のライセンスを買うという手もあるが)
2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?