Skip to content

Commit

Permalink
Generate string_int_label_map.pb files at build time from proto defin…
Browse files Browse the repository at this point in the history
…ition using protoc in the tensorflow repo. Add v1.5.0 to README
  • Loading branch information
Chris Sharp committed Feb 2, 2018
1 parent b45dc1e commit 9ff16d3
Show file tree
Hide file tree
Showing 10 changed files with 105 additions and 2,981 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
.DS_Store
xcuserdata

string_int_label_map.pb.cc
string_int_label_map.pb.h
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ An Object Detection application on iOS using Tensorflow and pre-trained COCO dat
`git clone https://github.com/tensorflow/tensorflow`


* `cd` into the tensorflow repo and checkout the `v1.5.0` tag. This release has the Makefile support for the following `ANDROID_TYPES` environment variable

`git checkout v1.5.0`


* We need to build the tensorflow components with ANDROID_TYPES_FULL. In the terminal type:

`export ANDROID_TYPES="-D__ANDROID_TYPES_FULL__"`
Expand Down
29 changes: 29 additions & 0 deletions objC/SupportingFiles/BuildPhase.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

#
# Grab the proto definition file from the tensorflow models repository
#
echo "Downloading proto definition from models repo"
curl -s -o /${TMPDIR}/string_int_label_map.proto https://raw.githubusercontent.com/tensorflow/models/master/research/object_detection/protos/string_int_label_map.proto

#
# Test for existence of the protobuf compiler in the tensorflow repo.
#
if [ ! -f $TENSORFLOW_ROOT/tensorflow/contrib/makefile/gen/protobuf-host/bin/protoc ]; then
echo "protoc not found in Tensorflow repo at tensorflow/contrib/makefile/gen/protobuf-host/bin. Did you set TENSORFLOW_ROOT in tensorflow.xcconfig?"
return 1
fi

#
# Generate the string_int_label_map.cc and .h file
#


if [ $? == 0 ]; then
echo "Generating string_int_label_map. Output to '$SRCROOT'"
$TENSORFLOW_ROOT/tensorflow/contrib/makefile/gen/protobuf-host/bin/protoc --proto_path=${TMPDIR} --cpp_out=${SRCROOT}/Tensorflow/ string_int_label_map.proto
else
exit 1
fi

return $?

0 comments on commit 9ff16d3

Please sign in to comment.