Skip to content

Instantly share code, notes, and snippets.

@tensorAI
Created February 11, 2019 20:27
Show Gist options
  • Save tensorAI/3c1ad238af235e03e07549af3db8d1e6 to your computer and use it in GitHub Desktop.
Save tensorAI/3c1ad238af235e03e07549af3db8d1e6 to your computer and use it in GitHub Desktop.
#!/bin/bash
#setup a new project called 'tf_object_detection'
#open terminal and copy this .sh file to new project folder
# cp ~/object_detection_pycharm.py
#run this script from terminal
apt update
pip install --upgrade pip
#install tensorflow
pip install --upgrade tensorflow-gpu
#install remaining libraries
apt-get install protobuf-compiler python-pil python-lxml python-tk
pip install Cython
pip install contextlib2
pip install jupyter
pip install matplotlib
pip install wheel
pip install pandas
pip install Pillow
#coco api installation
git clone https://github.com/cocodataset/cocoapi.git
cd ./cocoapi/PythonAPI
make
cd ..
cd ..
#download models and copy coco tools
git clone https://github.com/tensorAI/models.git
cp -r ./cocoapi/PythonAPI/pycocotools ./models/research/
#Manual protobuf-compiler installation and usage
cd 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
#compile
./bin/protoc object_detection/protos/*.proto --python_out=.
#Add Libraries to PYTHONPATH
LOCAL_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
var=$(printf 'export PYTHONPATH="${PYTHONPATH}:%s/slim"' "$LOCAL_DIR")
echo $var
echo $var >> ~/.bashrc
#test the installation by opening new terminal in a same project
#-------------------------------------------
#python object_detection/builders/model_builder_test.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment