forked from GoogleCloudPlatform/asl-ml-immersion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathobject_detection.sh
executable file
·37 lines (30 loc) · 1.02 KB
/
object_detection.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
#!/bin/bash
#
# To build the kernel: ./kernels/object_detection.sh
# To remove the kernel: ./kernels/object_detection.sh remove
#
# This scripts will create a ipython kernel named $ENVNAME
MODULE=image_models
ENVNAME=object_detection_kernel
REPO_ROOT_DIR="$(dirname $(cd $(dirname $BASH_SOURCE) && pwd))"
# Cleaning up the kernel and exiting if first arg is 'remove'
if [ "$1" == "remove" ]; then
echo Removing kernel $ENVNAME
jupyter kernelspec remove $ENVNAME
rm -r "$REPO_ROOT_DIR/notebooks/$MODULE/$ENVNAME"
exit 0
fi
cd $REPO_ROOT_DIR/notebooks/$MODULE
# Download the Object Detection API
git clone --depth 1 https://github.com/tensorflow/models
cd models/research/
protoc object_detection/protos/*.proto --python_out=.
cp object_detection/packages/tf2/setup.py .
# Setup virtual env and kernel
python3 -m venv $ENVNAME --system-site-packages
source $ENVNAME/bin/activate
python -m ipykernel install --user --name=$ENVNAME
# Install Object Detection API and its dependencies
pip install -q -U pip
pip install -q .
deactivate