ubunu16.04 TensorFlow object detection API 應用配置
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=.
-
Add Libraries to PYTHONPATH
From tensorflow/models/research/
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