Coder Social home page Coder Social logo

face_prediction's Introduction

face_prediction

学習(ファインチューニングなし)

学習方法は以下の通り、-g はグラボある人

~$ python facePredictionTraining.py -p ./images/ -g 0

画像を入れたフォルダの階層は以下のようにする。   各個人の写真の入ったフォルダの上のフォルダまでを-pで指定する。

./images/
  ├ 0_the_others/*
  ├ akimoto/*
  ├ hashimoto/*
  ├ ikuta/*
  ├ ikoma/*
  ├ nishino/*
  └ shiraishi/*

学習(ファインチューニングあり)

別途alexnetのcaffeモデルをダウンロードして、それをpklファイルに変換します。

~$ python
> #読み込むcaffeモデルとpklファイルを保存するパス
> loadpath = "bvlc_alexnet.caffemodel"
> savepath = "./chainermodels/alexnet.pkl"
 
> from chainer.links.caffe import CaffeFunction
> alexnet = CaffeFunction(loadpath)
 
> import _pickle as pickle
> pickle.dump(alexnet, open(savepath, 'wb'))

学習する時は、保存したpklファイルを指定してあげるだけです。

~$ python facePredictionTraining.py -p ./images/ -g 0 -cmp alexnet.pkl

予測時  

学習したモデルファイルを使って、予測する時は以下のようにします。

~$ python facePrediction.py -m my_output_7.model -p 画像のパス

予測時は、opencvの顔認識でどこに顔があるかを判別し、そこを切り取り、学習済みのモデルファイルに投げて誰かを判別するようになっています。 なので画像は顔の切り取りをしておく必要はありません。 現時点ではファインチューニングした際のモデルに関してそのまま予測することは出来ないと思いますが、モデルの定義の部分を少し変えればできるようになると思います。

face_prediction's People

Contributors

tommyfms2 avatar

Watchers

James Cloos 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.