LoginSignup
5
13

More than 5 years have passed since last update.

pythonで骨格推定をするための準備

Last updated at Posted at 2019-02-24

Mac環境でtensorflow(tf-openpose)で画像から骨格推定の準備をしてみたという記事です。

swigのインストール

$ brew install swig

swigのバージョン確認

$ swig -version

tf-pose-estimationのソースをクローンする

$ git clone https://github.com/ildoonet/tf-pose-estimation.git

Python

venvで仮想環境を作成

$ python3 -m venv testenv

pythonの仮想環境に入る

$ source testenv/bin/activate

setuptoolsのアップグレード

tf-pose-estimationのインストールをしようと思ったらsetuptoolsが古いよって怒られたのでアップグレードする。

$ pip install setuptools --upgrade

tf-pose-estimationのインストール

$ pip install -r requirements.txt

OpenCVのインストール

$ pip install opencv-contrib-python

tensorflowのインストール

$ pip install tensorflow

pafprocessのビルド

$ cd tf_pose/pafprocess/
$ swig -python -c++ pafprocess.i && python3 setup.py build_ext --inplace

モデルデータのダウンロード

macにはwgetコマンドがないので事前準備としてwgetコマンドのインストールも必要。

$ brew install wget

モデルデータをダウンロードするシェルを実行する

$ cd models/graph/cmu/
$ sh download.sh

実行

元のディレクトリに戻って実行

$ python run.py
5
13
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
5
13