Skip to content

Instantly share code, notes, and snippets.

@MattCurryCom
Last active April 3, 2020 22:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MattCurryCom/402c1988200a94b0639775c01d44d002 to your computer and use it in GitHub Desktop.
Save MattCurryCom/402c1988200a94b0639775c01d44d002 to your computer and use it in GitHub Desktop.
TensorFlowPrep.sh
#!/bin/bash
# Description: Preps a system (debian/ubuntu/raspbian), with needed tensorflow libs.
# Author : Matt Curry
# GH : MattCurryCom
#
####
USER=
# Change this path to your config directory
CONFIG_DIR="/home/$USER/.homeassistant"
cd /tmp
# Clone the latest code from GitHub
git clone --depth 1 https://github.com/tensorflow/models.git tensorflow-models
# download protobuf 3.4
curl -OL https://github.com/google/protobuf/releases/download/v3.4.0/protoc-3.4.0-linux-x86_64.zip
unzip -a protoc-3.4.0-linux-x86_64.zip -d protobuf
mv protobuf/bin /tmp/tensorflow-models/research
# Build the protobuf models
cd /tmp/tensorflow-models/research/
./bin/protoc object_detection/protos/*.proto --python_out=.
# Copy only necessary files
mkdir -p ${CONFIG_DIR}/tensorflow/object_detection
touch ${CONFIG_DIR}/tensorflow/object_detection/__init__.py
mv object_detection/data ${CONFIG_DIR}/tensorflow/object_detection
mv object_detection/utils ${CONFIG_DIR}/tensorflow/object_detection
mv object_detection/protos ${CONFIG_DIR}/tensorflow/object_detection
# Cleanup
rm -rf /tmp/*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment