-
-
Save hunterjm/6f9332f92b60c3d5e448ad936d7353c3 to your computer and use it in GitHub Desktop.
# Change this path to your config directory | |
CONFIG_DIR="/home/homeassistant/.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/* |
Got this error: tensorflow_setup.sh: line 16: ./bin/protoc: cannot execute binary file: Exec format error
@robmarkcole - /tmp
should be a standard directory on most *nix distributions. You shouldn't be creating a new tmp
directory, but using the one already on the system under the root folder.
@klaasnicolaas - This gist is for x86_64 linux distributions, if you are running on a Pi, you need a different protoc binary than what is included in this gist. Good news is you can compile the models on your PC and move them to the Pi. This does not need to be done on the system itself.
this script compile protobuffer.
it missing tensorflow compile and install for python.
I think its a bit bold to be doing rm -rf /tmp/*
on line 26
Shouldn't this script have it's own subdir under tmp?
Using Community SSH Add-on, I keep getting zsh: no such file or directory: ./bin/protoc
. Suspected zsh, which Frenck included in the add-on, vs bash but adding bash in front of the command gets ./bin/protoc: ./bin/protoc cannot execute binary file.
Also, I believe this needs a ./
in front of object_detection.
+1 on what @bbrendon said, should probably just rm -rf /tmp/tensorflow-models
instead?
I am having trouble running this sh on my Hassio install that is running on a Virtaulbox machine (host has i5 processor).
I download your script
wget https://gist.github.com/hunterjm/6f9332f92b60c3d5e448ad936d7353c3/raw/05018b802a67b93fa10390d2d3352cdca481133b/tensorflow_setup.sh
then take ownership
'chmod 777 tensorflow_setup.sh'
Then edit the sh to update the config folder location
# Change this path to your config directory
CONFIG_DIR="/config/"
but when I run the script it says.....
core-ssh:~# ./tensorflow_setup.sh
Cloning into 'tensorflow-models'...
remote: Enumerating objects: 3233, done.
remote: Counting objects: 100% (3233/3233), done.
remote: Compressing objects: 100% (2729/2729), done.
remote: Total 3233 (delta 594), reused 2076 (delta 426), pack-reused 0
Receiving objects: 100% (3233/3233), 370.69 MiB | 4.09 MiB/s, done.
Resolving deltas: 100% (594/594), done.
Checking out files: 100% (3058/3058), done.
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 164 0 164 0 0 287 0 --:--:-- --:--:-- --:--:-- 288
100 619 0 619 0 0 757 0 --:--:-- --:--:-- --:--:-- 757
100 1357k 100 1357k 0 0 579k 0 0:00:02 0:00:02 --:--:-- 971k
unzip: unrecognized option: a
BusyBox v1.30.1 (2019-06-12 17:51:55 UTC) multi-call binary.
Usage: unzip [-lnojpq] FILE[.zip] [FILE]... [-x FILE...] [-d DIR]
Extract FILEs from ZIP archive
-l List contents (with -q for short form)
-n Never overwrite files (default: ask)
-o Overwrite
-j Do not restore paths
-p Print to stdout
-q Quiet
-x FILE Exclude FILEs
-d DIR Extract into DIR
mv: can't rename 'protobuf/bin': No such file or directory
./tensorflow_setup.sh: line 16: ./bin/protoc: No such file or directory
mv: can't remove '/config/tensorflow/object_detection/data': Is a directory
mv: can't remove '/config/tensorflow/object_detection/utils': Is a directory
mv: can't remove '/config/tensorflow/object_detection/protos': Is a directory
if i unzip the files myself I just run into a different error when it tries to compile
./bin/protoc: No such file or directory
I am stuck. Any help would be greatly appreciated.
I am having trouble running this sh on my Hassio install that is running on a Virtaulbox machine (host has i5 processor).
I download your script
wget https://gist.github.com/hunterjm/6f9332f92b60c3d5e448ad936d7353c3/raw/05018b802a67b93fa10390d2d3352cdca481133b/tensorflow_setup.sh
then take ownership
'chmod 777 tensorflow_setup.sh'
Then edit the sh to update the config folder location
# Change this path to your config directory CONFIG_DIR="/config/"
but when I run the script it says.....
core-ssh:~# ./tensorflow_setup.sh Cloning into 'tensorflow-models'... remote: Enumerating objects: 3233, done. remote: Counting objects: 100% (3233/3233), done. remote: Compressing objects: 100% (2729/2729), done. remote: Total 3233 (delta 594), reused 2076 (delta 426), pack-reused 0 Receiving objects: 100% (3233/3233), 370.69 MiB | 4.09 MiB/s, done. Resolving deltas: 100% (594/594), done. Checking out files: 100% (3058/3058), done. % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 164 0 164 0 0 287 0 --:--:-- --:--:-- --:--:-- 288 100 619 0 619 0 0 757 0 --:--:-- --:--:-- --:--:-- 757 100 1357k 100 1357k 0 0 579k 0 0:00:02 0:00:02 --:--:-- 971k unzip: unrecognized option: a BusyBox v1.30.1 (2019-06-12 17:51:55 UTC) multi-call binary. Usage: unzip [-lnojpq] FILE[.zip] [FILE]... [-x FILE...] [-d DIR] Extract FILEs from ZIP archive -l List contents (with -q for short form) -n Never overwrite files (default: ask) -o Overwrite -j Do not restore paths -p Print to stdout -q Quiet -x FILE Exclude FILEs -d DIR Extract into DIR mv: can't rename 'protobuf/bin': No such file or directory ./tensorflow_setup.sh: line 16: ./bin/protoc: No such file or directory mv: can't remove '/config/tensorflow/object_detection/data': Is a directory mv: can't remove '/config/tensorflow/object_detection/utils': Is a directory mv: can't remove '/config/tensorflow/object_detection/protos': Is a directory
if i unzip the files myself I just run into a different error when it tries to compile
./bin/protoc: No such file or directory
I am stuck. Any help would be greatly appreciated.
Have you got the unzip application installed?
Try running
sudo apt install unzip
Missing
mkdir tmp
Also on Hassio I got lost for a while as theres already a
tmp
directory