TensorFlow object detection API应用–配置
主要参考 :
https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md
https://www.cnblogs.com/zongfa/p/9662832.html
1) 首先下载 TensorFlow object detection API
官网下载地址 https://github.com/tensorflow/models
git clone --recurse-submodules https://github.com/tensorflow/models
官网下载太慢了
https://download.csdn.net/download/qq_36661831/10489285
下载完后解压,放在哪里是一个问题,推荐地址: /home/zhangjun/miniconda3/envs/tensorflow 下面。我一开始在 /home/zhangjun/ 目录下建立了一个文件夹 Tensorflow ,放在这个文件夹下面了
-
Tensorflow Object Detection API 以来以下库文件
Tensorflow Object Detection API depends on the following libraries:Protobuf 3.0.0
Python-tk
Pillow 1.0
lxml
tf Slim (which is included in the “tensorflow/models/research/” checkout)
Jupyter notebook
Matplotlib
Tensorflow (>=1.9.0)
Cython
contextlib2
cocoapi
The remaining libraries can be installed on Ubuntu 16.04 using via apt-get:
sudo apt-get install protobuf-compiler python-pil python-lxml python-tk
pip install --user Cython
pip install --user contextlib2
pip install --user jupyter
pip install --user matplotlib
3)手动安装 protobuf, protobuf 3.6 可能有问题,我后来又用了 protobuf3.0.0
If you are on linux:
Download and install the 3.0 release of protoc, then unzip the file.
# From tensorflow/models/research/
wget -O protobuf.zip https://github.com/google/protobuf/releases/download/v3.0.0/protoc-3.0.0-linux-x86_64.zip
unzip protobuf.zip
Run the compilation process again, but use the downloaded version of protoc
# From tensorflow/models/research/
./bin/protoc object_detection/protos/*.proto --python_out=.
export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/slim
5) python object_detection/builders/model_builder_test.py
报错
ubuntu16.04 ‘No module named ‘object_detection’’
https://blog.csdn.net/weixin_41683218/article/details/81214785
/home/zhangjun/miniconda3/envs/tensorflow/lib/python3.6/site-packages
建立文件
tensorflow_model.pth
文件内容如下:
/home/zhangjun/Tensorflow/models/research
/home/zhangjun/Tensorflow/models/research/slim
再运行 python object_detection/builders/model_builder_test.py
没有问题了
Ran 7 tests in 0.024s
OK
6)接下来,跑一个demo,你可以在这个路径下运行jupyter notebook
报错: jupyter: command not found
路径问题
~/.local/bin/jupyter-notebook
找不到 /object_detection/object_detection_tutorial.ipynb
在 /home/zhangjun/Tensorflow/models/research/object_detection
下面运行 ~/.local/bin/jupyter-notebook
就可以看到了 /object_detection/object_detection_tutorial.ipynb