Skip to content

Instantly share code, notes, and snippets.

@petewarden
petewarden / convert_cc_to_tflite.py
Created February 27, 2020 23:55
Example of converting a .cc TensorFlow Lite C data array file back into a binary flatbuffer on disk
import re
output_data = bytearray()
with open('tensorflow/tensorflow/lite/micro/examples/magic_wand/magic_wand_model_data.cc', 'r') as file:
for line in file:
values_match = re.match(r"\W*(0x[0-9a-fA-F,x ]+).*", line)
if values_match:
list_text = values_match.group(1)
values_text = filter(None, list_text.split(","))
values = [int(x, base=16) for x in values_text]
output_data.extend(values)
@rccursach
rccursach / Gemfile
Last active October 4, 2023 13:08 — forked from daqing/Gemfile
redis_pubsub_demo.rb
source "https://rubygems.org"
gem 'eventmachine'
gem 'sinatra'
gem 'yajl-ruby', require: 'yajl'
gem 'thin'
gem 'em-websocket'