DNN

tensorflow obj detection

Small Octopus 2018. 6. 4. 14:22

0. SSD를 직접 구현한 코드

https://github.com/seann999/ssd_tensorflow


1. protocol buffer 설치

anaconda 환경에 tensorflow을 설치했다면 아래 명령어고 protocol buffer를 설치할 수 있다.

$conda install -c anaconda protobuf

설치가 제대로 됐는지 확인하려면 아래 명령어로 할 수 있다.

$protoc


2. tensorflow Detection API 다운로드 및 설치

$git clone https://github.com/tensorflow/models


3. protocol buffer 컴파일

models 폴더에서 아래 명령어로 컴파일 할 수 있다.

$protoc object_detection/protos/*.proto --python_out=.

컴파일한 것을 사용하기 위해 path 설정을 해준다. 

ubuntu에서는 .profile 파일에 아래와 같이 추가했다

#tf obj detection

export PYTHONPATH=/home/jsh/tf_projects/models/research/object_detection/models:$PYTHONPATH

export PYTHONPATH=/home/jsh/tf_projects/models/research/slim:$PYTHONPATH

export PATH=/home/jsh/tf_projects/models/research/object_detection/models:$PATH

export PATH=/home/jsh/tf_projects/models/research/slim:$PATH

제대로 경로가 설치되었는지 확인하려면 아래와 같이 해보면 된다

$python object_detection/builders/model_builder_test.py


4. 예제 돌려보기

models/object_detection/ 에서 아래와 같이 주피터 노트북을 실행하면 된다

$ipython notebook object_detection_tutorial.ipynb