-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Expand file tree
/
Copy pathobject_detection.sh
More file actions
executable file
·39 lines (32 loc) · 1.13 KB
/
object_detection.sh
File metadata and controls
executable file
·39 lines (32 loc) · 1.13 KB
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
#!/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 pyyaml==5.3.1
pip install -q tensorflow==2.12.0 tensorflow_text==2.12.1 tf-models-official==2.12.0
pip install -q .
deactivate