リポジトリのclone
$ git clone https://github.com/tensorflow/models
Protocol Bufferをインストール
cd ./models/research
wget -O protobuf.zip https://github.com/protocolbuffers/protobuf/releases/download/v3.7.0/protoc-3.7.0-linux-aarch_64.zip
unzip protobuf.zip
./bin/protoc object_detection/protos/*.proto --python_out=.
テスト
export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/slim
python3 object_detection/builders/model_builder_test.py
モデルのダウンロード
cd
git clone https://github.com/karaage0703/object_detection_tools
~/object_detection_tools/models
./get_ssd_mobilenet_v1_coco_model.sh
TensorRT
cd
git clone https://github.com/NVIDIA-AI-IOT/tf_trt_models
cd tf_trt_models
convert
cp ../object_detection_tools/scripts/convert_rt_model.py .
python3 convert_rt_model.py -c='../models/research/object_detection/samples/configs/ssd_mobilenet_v1_coco.config' -m='../object_detection_tools/models/ssd_mobilenet_v1_coco_2018_01_28/model.ckpt' -o='./frozen_inference_graph_trt.pb'
python3 convert_rt_model.py -c='../models/research/object_detection/samples/configs/ssd_inception_v2_coco.config' -m='../object_detection_tools/models/ssd_inception_v2_coco_2018_01_28/model.ckpt' -o='./frozen_inference_graph_trt.pb'
importの追加
object_detection.py
import tensorflow as tf
import tensorflow.contrib.tensorrt as trt # <-- add
物体検出
cd ./object_detection_tools
python3 scripts/object_detection.py -l='models/coco-labels-paper.txt' -m='../tf_trt_models/frozen_inference_graph_trt.pb' -d='jetson_nano_raspi_cam'
お世話になった情報