Skip to content

Commit

Permalink
Update tflite tutorial to use TFLite r1.13 schema (#3271)
Browse files Browse the repository at this point in the history
  • Loading branch information
apivovarov authored and kevinthesun committed Jun 1, 2019
1 parent 887255a commit fc2b2a0
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions tutorials/frontend/from_tflite.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
flatc --version
# Get the TFLite schema.
wget https://raw.githubusercontent.com/tensorflow/tensorflow/r1.12/tensorflow/contrib/lite/schema/schema.fbs
wget https://raw.githubusercontent.com/tensorflow/tensorflow/r1.13/tensorflow/lite/schema/schema.fbs
# Generate TFLite package.
flatc --python schema.fbs
Expand Down Expand Up @@ -144,7 +144,7 @@ def extract(path):

# target x86 CPU
target = "llvm"
with relay.transform.build_config(opt_level=3):
with relay.build_config(opt_level=3):
graph, lib, params = relay.build(func, target, params=params)

######################################################################
Expand Down Expand Up @@ -180,11 +180,9 @@ def extract(path):
label_file = "labels_mobilenet_quant_v1_224.txt"
label_path = download_testdata(label_file_url, label_file, module='data')

# map id to 1001 classes
labels = dict()
# list of 1001 classes
with open(label_path) as f:
for id, line in enumerate(f):
labels[id] = line
labels = f.readlines()

# convert result to 1D data
predictions = np.squeeze(tvm_output)
Expand Down

0 comments on commit fc2b2a0

Please sign in to comment.