-
Notifications
You must be signed in to change notification settings - Fork 1
/
init.sh
executable file
·76 lines (57 loc) · 1.83 KB
/
init.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/env bash
set -euox pipefail
XTRACE=${XTRACE:-false}
if [[ "$XTRACE" = "true" ]]; then
set -x
fi
IFS=$'\n\t'
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
# Install python packages
pip install -r ${DIR}/requirements.txt
TENSORFLOW_MODEL_GARDEN_DIR="${DIR}/tensorflow_model_garden"
WORKSPACE_DIR="${DIR}/workspace"
SKIP_CLONE=false
while getopts "s" FLAG; do
case "${FLAG}" in
s) SKIP_CLONE=true ;;
esac
done
if ! command -v git &> /dev/null; then
echo "You must install 'git' in order to run this script"
exit
fi
if [ ${SKIP_CLONE} = false ]; then
if [ -d "${TENSORFLOW_MODEL_GARDEN_DIR}" ]; then
echo "Deleting existing directory ${TENSORFLOW_MODEL_GARDEN_DIR}"
rm -rf "${TENSORFLOW_MODEL_GARDEN_DIR}"
fi
echo "Cloning https://github.com/tensorflow/models"
git clone --depth 1 https://github.com/tensorflow/models "${TENSORFLOW_MODEL_GARDEN_DIR}"
fi
cd "${TENSORFLOW_MODEL_GARDEN_DIR}"
echo "Installing protobuf"
pip install protobuf
if command -v protoc &> /dev/null; then
echo "Found protoc"
else
echo "Installing protoc"
if [ $(uname -s) == "Darwin" ]; then
PROTOC_ZIP=protoc-3.7.1-osx-x86_64.zip
else
PROTOC_ZIP=protoc-3.7.1-linux-x86_64.zip
fi
curl -OL https://github.com/google/protobuf/releases/download/v3.7.1/${PROTOC_ZIP}
unzip -o ${PROTOC_ZIP} -d /usr/local bin/protoc
unzip -o ${PROTOC_ZIP} -d /usr/local include/*
rm -f ${PROTOC_ZIP}
fi
# echo "Installing tf_slim"
# pip install tf_slim
echo "Install the Object Detection API"
cd research/
protoc object_detection/protos/*.proto --python_out=.
cp object_detection/packages/tf2/setup.py .
python -m pip install .
echo "Installation complete"
# pip install cython
# pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI