Moved TensorFlow Lite Micro out of experimental folder

PiperOrigin-RevId: 284600414
Change-Id: I62238882b1447e53fe5c5c36d021f42eaf56486a
This commit is contained in:
Pete Warden 2019-12-09 11:39:34 -08:00 committed by TensorFlower Gardener
parent 59329ef58f
commit 59c06b9016
435 changed files with 3509 additions and 3431 deletions

View File

@ -1,42 +0,0 @@
HELLO_WORLD_TEST_SRCS := \
tensorflow/lite/experimental/micro/examples/hello_world/hello_world_test.cc \
tensorflow/lite/experimental/micro/examples/hello_world/sine_model_data.cc
HELLO_WORLD_TEST_HDRS := \
tensorflow/lite/experimental/micro/examples/hello_world/sine_model_data.h
OUTPUT_HANDLER_TEST_SRCS := \
tensorflow/lite/experimental/micro/examples/hello_world/output_handler_test.cc \
tensorflow/lite/experimental/micro/examples/hello_world/output_handler.cc
OUTPUT_HANDLER_TEST_HDRS := \
tensorflow/lite/experimental/micro/examples/hello_world/output_handler.h \
tensorflow/lite/experimental/micro/examples/hello_world/constants.h
HELLO_WORLD_SRCS := \
tensorflow/lite/experimental/micro/examples/hello_world/main.cc \
tensorflow/lite/experimental/micro/examples/hello_world/main_functions.cc \
tensorflow/lite/experimental/micro/examples/hello_world/sine_model_data.cc \
tensorflow/lite/experimental/micro/examples/hello_world/output_handler.cc \
tensorflow/lite/experimental/micro/examples/hello_world/constants.cc
HELLO_WORLD_HDRS := \
tensorflow/lite/experimental/micro/examples/hello_world/sine_model_data.h \
tensorflow/lite/experimental/micro/examples/hello_world/output_handler.h \
tensorflow/lite/experimental/micro/examples/hello_world/constants.h \
tensorflow/lite/experimental/micro/examples/hello_world/main_functions.h
#Find any platform-specific rules for this example.
include $(wildcard tensorflow/lite/experimental/micro/examples/hello_world/*/Makefile.inc)
# Tests loading and running the sine model.
$(eval $(call microlite_test,hello_world_test,\
$(HELLO_WORLD_TEST_SRCS),$(HELLO_WORLD_TEST_HDRS)))
# Tests producing an output.
$(eval $(call microlite_test,output_handler_test,\
$(OUTPUT_HANDLER_TEST_SRCS),$(OUTPUT_HANDLER_TEST_HDRS)))
# Builds a standalone binary.
$(eval $(call microlite_test,hello_world,\
$(HELLO_WORLD_SRCS),$(HELLO_WORLD_HDRS)))

File diff suppressed because one or more lines are too long

View File

@ -1,238 +0,0 @@
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
// Automatically created from a TensorFlow Lite flatbuffer using the command:
// xxd -i sine_model.tflite > sine_model_data.cc
// See the README for a full description of the creation process.
#include "tensorflow/lite/experimental/micro/examples/hello_world/sine_model_data.h"
// We need to keep the data array aligned on some architectures.
#ifdef __has_attribute
#define HAVE_ATTRIBUTE(x) __has_attribute(x)
#else
#define HAVE_ATTRIBUTE(x) 0
#endif
#if HAVE_ATTRIBUTE(aligned) || (defined(__GNUC__) && !defined(__clang__))
#define DATA_ALIGN_ATTRIBUTE __attribute__((aligned(4)))
#else
#define DATA_ALIGN_ATTRIBUTE
#endif
const unsigned char g_sine_model_data[] DATA_ALIGN_ATTRIBUTE = {
0x1c, 0x00, 0x00, 0x00, 0x54, 0x46, 0x4c, 0x33, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0e, 0x00, 0x18, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0c, 0x00,
0x10, 0x00, 0x14, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x10, 0x09, 0x00, 0x00, 0x58, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x30, 0x02, 0x00, 0x00,
0x1c, 0x02, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0xa4, 0x01, 0x00, 0x00,
0x94, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00,
0x1c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x7c, 0xfd, 0xff, 0xff, 0x80, 0xfd, 0xff, 0xff,
0x84, 0xfd, 0xff, 0xff, 0x88, 0xfd, 0xff, 0xff, 0x22, 0xfe, 0xff, 0xff,
0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0xad, 0x67, 0x48, 0xc4,
0x7f, 0x82, 0x9c, 0x47, 0x5f, 0x28, 0x36, 0x35, 0x89, 0x38, 0x8b, 0xed,
0x3e, 0xfe, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x6f, 0x01, 0x00, 0x00, 0x13, 0xf6, 0xff, 0xff,
0x00, 0x00, 0x00, 0x00, 0x25, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xdd, 0xe9, 0xff, 0xff, 0x25, 0xef, 0xff, 0xff,
0x36, 0xe5, 0xff, 0xff, 0xf8, 0xf2, 0xff, 0xff, 0x65, 0x15, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x38, 0xe9, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x8a, 0xfe, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00,
0x00, 0x01, 0x00, 0x00, 0xe7, 0xf4, 0x03, 0xe5, 0x0e, 0x19, 0x0d, 0xe3,
0x1a, 0xca, 0x16, 0x1e, 0xe3, 0x02, 0xf6, 0xff, 0xfb, 0x10, 0x1f, 0xf4,
0xfa, 0xf1, 0xff, 0xff, 0x0f, 0xb6, 0xf5, 0x19, 0x0e, 0xf3, 0xe1, 0xf9,
0xdc, 0x13, 0xf2, 0xea, 0xf4, 0xd9, 0xef, 0xd9, 0x1b, 0xfd, 0xe4, 0x14,
0x20, 0xc9, 0x1c, 0x0e, 0xe2, 0xda, 0xfc, 0xfe, 0xe1, 0x0b, 0x06, 0xde,
0xdf, 0xe3, 0xde, 0x1d, 0x11, 0xf5, 0xec, 0x1d, 0x18, 0xf9, 0xe4, 0xe9,
0xe0, 0x16, 0xea, 0xfd, 0x1d, 0xf1, 0x08, 0x0e, 0x0f, 0x1d, 0x15, 0xfe,
0x13, 0xd6, 0xe8, 0xec, 0xdd, 0xf4, 0xdd, 0xf9, 0xee, 0xdd, 0x09, 0x15,
0x01, 0xec, 0x13, 0xdf, 0x13, 0xea, 0x17, 0x1d, 0xe3, 0x05, 0x1d, 0x09,
0xe3, 0x0d, 0xfc, 0xda, 0xe9, 0xf6, 0x0b, 0xeb, 0x06, 0xf6, 0x10, 0xdc,
0x09, 0xf8, 0x0f, 0x18, 0xda, 0x2b, 0xf2, 0x19, 0x09, 0xeb, 0x00, 0xee,
0x01, 0xe8, 0x1c, 0xf1, 0x0c, 0xf2, 0x1b, 0xc4, 0x0c, 0xd2, 0xf0, 0x0b,
0xe4, 0x87, 0xdc, 0x1b, 0x0d, 0xf1, 0x14, 0xe1, 0x28, 0x12, 0x16, 0xd0,
0xf1, 0xca, 0x09, 0xf5, 0xdd, 0xbf, 0x19, 0x0d, 0xdc, 0x15, 0xea, 0x18,
0x05, 0xf3, 0x12, 0xfb, 0x17, 0x3b, 0x1a, 0xf1, 0xf6, 0x32, 0x15, 0x10,
0x04, 0x0d, 0x0e, 0x16, 0x20, 0x12, 0xff, 0x07, 0x2b, 0x04, 0xe7, 0x02,
0xed, 0x17, 0xdb, 0x1b, 0xe9, 0xde, 0x07, 0x15, 0x17, 0xdc, 0x05, 0x21,
0xdb, 0xdf, 0x0a, 0xf1, 0x0a, 0xff, 0xdd, 0xf4, 0xf7, 0x1c, 0xf1, 0x1f,
0x34, 0xf4, 0x04, 0x81, 0xcc, 0x6f, 0xb2, 0x20, 0x08, 0x86, 0x20, 0x0c,
0xea, 0x0f, 0xfe, 0xfb, 0xe8, 0xe1, 0xfb, 0xe3, 0xf6, 0xf3, 0xe4, 0xe7,
0xe4, 0x07, 0xda, 0xf1, 0xe9, 0xd7, 0x04, 0xf8, 0x07, 0x18, 0x18, 0xde,
0xed, 0xd7, 0xdf, 0x12, 0xfa, 0xef, 0xfc, 0xfc, 0x96, 0xff, 0xff, 0xff,
0x04, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x22, 0x03, 0x00, 0x00,
0x63, 0x03, 0x00, 0x00, 0xf8, 0x0c, 0x00, 0x00, 0x0a, 0xff, 0xff, 0xff,
0x00, 0x00, 0x00, 0x00, 0x47, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x6c, 0xf8, 0xff, 0xff, 0x3b, 0x07, 0x00, 0x00, 0x5e, 0x0e, 0x00, 0x00,
0x82, 0xed, 0xff, 0xff, 0x25, 0xfa, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
0x09, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xfd, 0xff, 0xff,
0xe2, 0xff, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
0xea, 0xe6, 0xb9, 0x08, 0xe0, 0x92, 0x01, 0x00, 0x23, 0xb3, 0x24, 0x19,
0xd8, 0x7f, 0xf8, 0x17, 0x00, 0x00, 0x06, 0x00, 0x08, 0x00, 0x04, 0x00,
0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x31, 0xf5, 0xff, 0xff, 0x80, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00,
0x54, 0x4f, 0x43, 0x4f, 0x20, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74,
0x65, 0x64, 0x2e, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0xbc, 0xf9, 0xff, 0xff, 0x48, 0x01, 0x00, 0x00, 0x3c, 0x01, 0x00, 0x00,
0x30, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
0x04, 0x01, 0x00, 0x00, 0xb8, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00,
0x28, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1a, 0xff, 0xff, 0xff,
0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xca, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x08,
0x1c, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00,
0x14, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0c, 0x00, 0x07, 0x00, 0x10, 0x00,
0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x1c, 0x00, 0x00, 0x00,
0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xba, 0xff, 0xff, 0xff,
0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x16, 0x00, 0x00, 0x00,
0x08, 0x00, 0x0c, 0x00, 0x07, 0x00, 0x10, 0x00, 0x0e, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x08, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00,
0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x08, 0x00, 0x07, 0x00,
0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00,
0x10, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0c, 0x00, 0x0a, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x0a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
0xdc, 0x04, 0x00, 0x00, 0x54, 0x04, 0x00, 0x00, 0xc4, 0x03, 0x00, 0x00,
0x54, 0x03, 0x00, 0x00, 0xd0, 0x02, 0x00, 0x00, 0x4c, 0x02, 0x00, 0x00,
0xe0, 0x01, 0x00, 0x00, 0x5c, 0x01, 0x00, 0x00, 0xd8, 0x00, 0x00, 0x00,
0x6c, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0xd8, 0xff, 0xff, 0xff, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79,
0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x04, 0x00, 0x00, 0x00,
0x00, 0x00, 0x08, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x64, 0x65, 0x6e, 0x73,
0x65, 0x5f, 0x32, 0x5f, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0xc2, 0xfb, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x58, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0xc4, 0xfc, 0xff, 0xff, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x1d, 0xc4, 0x1c, 0x39, 0x20, 0x00, 0x00, 0x00,
0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x31,
0x2f, 0x64, 0x65, 0x6e, 0x73, 0x65, 0x5f, 0x34, 0x2f, 0x4d, 0x61, 0x74,
0x4d, 0x75, 0x6c, 0x5f, 0x62, 0x69, 0x61, 0x73, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2a, 0xfc, 0xff, 0xff,
0x00, 0x00, 0x00, 0x09, 0x6c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x28, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x2c, 0xfd, 0xff, 0xff,
0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0xae, 0x03, 0x63, 0x3c, 0x34, 0x00, 0x00, 0x00, 0x73, 0x65, 0x71, 0x75,
0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x31, 0x2f, 0x64, 0x65, 0x6e,
0x73, 0x65, 0x5f, 0x34, 0x2f, 0x4d, 0x61, 0x74, 0x4d, 0x75, 0x6c, 0x2f,
0x52, 0x65, 0x61, 0x64, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65,
0x4f, 0x70, 0x2f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x73, 0x65,
0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x10, 0x00, 0x00, 0x00, 0xaa, 0xfc, 0xff, 0xff, 0x00, 0x00, 0x00, 0x09,
0x6c, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x9c, 0xfc, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00,
0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x42, 0xc8, 0x30, 0x3c,
0x01, 0x00, 0x00, 0x00, 0x7a, 0x17, 0x30, 0x40, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x73, 0x65, 0x71, 0x75,
0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x31, 0x2f, 0x64, 0x65, 0x6e,
0x73, 0x65, 0x5f, 0x33, 0x2f, 0x52, 0x65, 0x6c, 0x75, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
0x2a, 0xfd, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x58, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x2c, 0xfe, 0xff, 0xff, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x61, 0x33, 0x28, 0x39, 0x20, 0x00, 0x00, 0x00,
0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x31,
0x2f, 0x64, 0x65, 0x6e, 0x73, 0x65, 0x5f, 0x33, 0x2f, 0x4d, 0x61, 0x74,
0x4d, 0x75, 0x6c, 0x5f, 0x62, 0x69, 0x61, 0x73, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x92, 0xfd, 0xff, 0xff,
0x00, 0x00, 0x00, 0x09, 0x6c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x28, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x94, 0xfe, 0xff, 0xff,
0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0xa0, 0xef, 0x36, 0x3c, 0x34, 0x00, 0x00, 0x00, 0x73, 0x65, 0x71, 0x75,
0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x31, 0x2f, 0x64, 0x65, 0x6e,
0x73, 0x65, 0x5f, 0x33, 0x2f, 0x4d, 0x61, 0x74, 0x4d, 0x75, 0x6c, 0x2f,
0x52, 0x65, 0x61, 0x64, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65,
0x4f, 0x70, 0x2f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x73, 0x65,
0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
0x10, 0x00, 0x00, 0x00, 0x12, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x09,
0x6c, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x04, 0xfe, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00,
0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x22, 0x61, 0x6b, 0x3c,
0x01, 0x00, 0x00, 0x00, 0xc1, 0x75, 0x6a, 0x40, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x73, 0x65, 0x71, 0x75,
0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x31, 0x2f, 0x64, 0x65, 0x6e,
0x73, 0x65, 0x5f, 0x32, 0x2f, 0x52, 0x65, 0x6c, 0x75, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
0x92, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x5c, 0x00, 0x00, 0x00,
0x05, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x94, 0xff, 0xff, 0xff, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2d, 0x60, 0xd5, 0x38,
0x20, 0x00, 0x00, 0x00, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x74, 0x69,
0x61, 0x6c, 0x5f, 0x31, 0x2f, 0x64, 0x65, 0x6e, 0x73, 0x65, 0x5f, 0x32,
0x2f, 0x4d, 0x61, 0x74, 0x4d, 0x75, 0x6c, 0x5f, 0x62, 0x69, 0x61, 0x73,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
0xfe, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x09, 0x78, 0x00, 0x00, 0x00,
0x06, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
0x0c, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00,
0x0c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x37, 0xb9, 0x87, 0x3b, 0x34, 0x00, 0x00, 0x00,
0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x31,
0x2f, 0x64, 0x65, 0x6e, 0x73, 0x65, 0x5f, 0x32, 0x2f, 0x4d, 0x61, 0x74,
0x4d, 0x75, 0x6c, 0x2f, 0x52, 0x65, 0x61, 0x64, 0x56, 0x61, 0x72, 0x69,
0x61, 0x62, 0x6c, 0x65, 0x4f, 0x70, 0x2f, 0x74, 0x72, 0x61, 0x6e, 0x73,
0x70, 0x6f, 0x73, 0x65, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x8a, 0xff, 0xff, 0xff,
0x00, 0x00, 0x00, 0x09, 0x60, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00,
0x40, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x7c, 0xff, 0xff, 0xff,
0x2c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0xba, 0x3b, 0xc9, 0x3c,
0x01, 0x00, 0x00, 0x00, 0x7e, 0x72, 0xc8, 0x40, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x64, 0x65, 0x6e, 0x73,
0x65, 0x5f, 0x32, 0x5f, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x5f, 0x69, 0x6e,
0x74, 0x38, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x18, 0x00, 0x08, 0x00,
0x07, 0x00, 0x0c, 0x00, 0x10, 0x00, 0x14, 0x00, 0x0e, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x09, 0x6c, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
0x50, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x14, 0x00,
0x04, 0x00, 0x08, 0x00, 0x0c, 0x00, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00,
0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0xfb, 0x3a, 0xfd, 0x3b, 0x01, 0x00, 0x00, 0x00, 0x2e, 0xed, 0x76, 0x3f,
0x01, 0x00, 0x00, 0x00, 0x29, 0xc7, 0x80, 0xbf, 0x0d, 0x00, 0x00, 0x00,
0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x5f, 0x69, 0x6e, 0x74,
0x38, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00,
0x28, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00,
0x0e, 0x00, 0x07, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0a, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00,
0x06, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x72, 0x0a, 0x00,
0x0c, 0x00, 0x07, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0a, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00};
const int g_sine_model_data_len = 2432;

View File

@ -1,89 +0,0 @@
ifeq ($(TARGET), sparkfun_edge)
INCLUDES += \
-I$(APOLLO3_SDK)/boards/SparkFun_TensorFlow_Apollo3_BSP/examples/example1_edge_test/src/tf_accelerometer/ \
-I$(APOLLO3_SDK)/boards/SparkFun_TensorFlow_Apollo3_BSP/examples/example1_edge_test/src/tf_adc/
THIRD_PARTY_CC_SRCS += \
$(APOLLO3_SDK)/boards/SparkFun_TensorFlow_Apollo3_BSP/examples/example1_edge_test/src/tf_accelerometer/tf_accelerometer.c \
$(APOLLO3_SDK)/boards/SparkFun_TensorFlow_Apollo3_BSP/examples/example1_edge_test/src/tf_accelerometer/lis2dh12_reg.c \
$(APOLLO3_SDK)/boards/SparkFun_TensorFlow_Apollo3_BSP/examples/example1_edge_test/src/tf_adc/tf_adc.c
THIRD_PARTY_CC_HDRS += \
$(APOLLO3_SDK)/boards/SparkFun_TensorFlow_Apollo3_BSP/examples/example1_edge_test/src/tf_accelerometer/tf_accelerometer.h \
$(APOLLO3_SDK)/boards/SparkFun_TensorFlow_Apollo3_BSP/examples/example1_edge_test/src/tf_accelerometer/lis2dh12_reg.h \
$(APOLLO3_SDK)/boards/SparkFun_TensorFlow_Apollo3_BSP/examples/example1_edge_test/src/tf_adc/tf_adc.h
endif
ACCELEROMETER_HANDLER_TEST_SRCS := \
tensorflow/lite/experimental/micro/examples/magic_wand/accelerometer_handler.cc \
tensorflow/lite/experimental/micro/examples/magic_wand/accelerometer_handler_test.cc
ACCELEROMETER_HANDLER_TEST_HDRS := \
tensorflow/lite/experimental/micro/examples/magic_wand/accelerometer_handler.h
OUTPUT_HANDLER_TEST_SRCS := \
tensorflow/lite/experimental/micro/examples/magic_wand/output_handler.cc \
tensorflow/lite/experimental/micro/examples/magic_wand/output_handler_test.cc
OUTPUT_HANDLER_TEST_HDRS := \
tensorflow/lite/experimental/micro/examples/magic_wand/output_handler.h
GESTURE_PREDICTOR_TEST_SRCS := \
tensorflow/lite/experimental/micro/examples/magic_wand/constants.cc \
tensorflow/lite/experimental/micro/examples/magic_wand/gesture_predictor.cc \
tensorflow/lite/experimental/micro/examples/magic_wand/gesture_predictor_test.cc
GESTURE_PREDICTOR_TEST_HDRS := \
tensorflow/lite/experimental/micro/examples/magic_wand/constants.h \
tensorflow/lite/experimental/micro/examples/magic_wand/gesture_predictor.h \
magic_wand_TEST_SRCS := \
tensorflow/lite/experimental/micro/examples/magic_wand/magic_wand_test.cc \
tensorflow/lite/experimental/micro/examples/magic_wand/magic_wand_model_data.cc \
tensorflow/lite/experimental/micro/examples/magic_wand/slope_micro_features_data.cc \
tensorflow/lite/experimental/micro/examples/magic_wand/ring_micro_features_data.cc
magic_wand_TEST_HDRS := \
tensorflow/lite/experimental/micro/examples/magic_wand/magic_wand_model_data.h \
tensorflow/lite/experimental/micro/examples/magic_wand/slope_micro_features_data.h \
tensorflow/lite/experimental/micro/examples/magic_wand/ring_micro_features_data.h
magic_wand_SRCS := \
tensorflow/lite/experimental/micro/examples/magic_wand/main.cc \
tensorflow/lite/experimental/micro/examples/magic_wand/main_functions.cc \
tensorflow/lite/experimental/micro/examples/magic_wand/constants.cc \
tensorflow/lite/experimental/micro/examples/magic_wand/magic_wand_model_data.cc \
tensorflow/lite/experimental/micro/examples/magic_wand/accelerometer_handler.cc \
tensorflow/lite/experimental/micro/examples/magic_wand/gesture_predictor.cc \
tensorflow/lite/experimental/micro/examples/magic_wand/output_handler.cc
magic_wand_HDRS := \
tensorflow/lite/experimental/micro/examples/magic_wand/main_functions.h \
tensorflow/lite/experimental/micro/examples/magic_wand/constants.h \
tensorflow/lite/experimental/micro/examples/magic_wand/magic_wand_model_data.h \
tensorflow/lite/experimental/micro/examples/magic_wand/accelerometer_handler.h \
tensorflow/lite/experimental/micro/examples/magic_wand/gesture_predictor.h \
tensorflow/lite/experimental/micro/examples/magic_wand/output_handler.h
# Find any platform-specific rules for this example.
include $(wildcard tensorflow/lite/experimental/micro/examples/magic_wand/*/Makefile.inc)
# Tests the accelerometer handler
$(eval $(call microlite_test,gesture_accelerometer_handler_test,\
$(ACCELEROMETER_HANDLER_TEST_SRCS),$(ACCELEROMETER_HANDLER_TEST_HDRS)))
# Tests the output handler
$(eval $(call microlite_test,gesture_output_handler_test,\
$(OUTPUT_HANDLER_TEST_SRCS),$(OUTPUT_HANDLER_TEST_HDRS)))
# Tests the gesture predictor
$(eval $(call microlite_test,gesture_predictor_test,\
$(GESTURE_PREDICTOR_TEST_SRCS),$(GESTURE_PREDICTOR_TEST_HDRS)))
# Tests loading and running the gesture recognition model
$(eval $(call microlite_test,magic_wand_test,\
$(magic_wand_TEST_SRCS),$(magic_wand_TEST_HDRS)))
# Builds a standalone binary
$(eval $(call microlite_test,magic_wand,\
$(magic_wand_SRCS),$(magic_wand_HDRS)))

View File

@ -1,282 +0,0 @@
INCLUDES += \
-I$(MAKEFILE_DIR)/downloads/kissfft
GENERATED_PROJECT_INCLUDES += \
-I./third_party/kissfft
PROJECT_INCLUDES += \
third_party/kissfft
KISSFFT_LIB_SRCS := \
$(MAKEFILE_DIR)/downloads/kissfft/kiss_fft.c \
$(MAKEFILE_DIR)/downloads/kissfft/tools/kiss_fftr.c
KISSFFT_LIB_HDRS := \
$(MAKEFILE_DIR)/downloads/kissfft/COPYING \
$(MAKEFILE_DIR)/downloads/kissfft/kiss_fft.h \
$(MAKEFILE_DIR)/downloads/kissfft/_kiss_fft_guts.h \
$(MAKEFILE_DIR)/downloads/kissfft/tools/kiss_fftr.h
$(eval $(call add_third_party_download,$(KISSFFT_URL),$(KISSFFT_MD5),kissfft,patch_kissfft))
THIRD_PARTY_CC_HDRS += \
third_party/kissfft/COPYING \
third_party/kissfft/kiss_fft.h \
third_party/kissfft/_kiss_fft_guts.h \
third_party/kissfft/tools/kiss_fftr.h
MICRO_SPEECH_TEST_SRCS := \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_speech_test.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/tiny_conv_micro_features_model_data.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/no_micro_features_data.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/yes_micro_features_data.cc
MICRO_SPEECH_TEST_HDRS := \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/tiny_conv_micro_features_model_data.h \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/no_micro_features_data.h \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/yes_micro_features_data.h \
SIMPLE_FEATURES_GENERATOR_TEST_SRCS := \
tensorflow/lite/experimental/micro/examples/micro_speech/simple_features/simple_features_generator.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/simple_features/simple_features_generator_test.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/no_30ms_sample_data.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/yes_30ms_sample_data.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/simple_features/no_power_spectrum_data.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/simple_features/yes_power_spectrum_data.cc
SIMPLE_FEATURES_GENERATOR_TEST_HDRS := \
tensorflow/lite/experimental/micro/examples/micro_speech/simple_features/simple_model_settings.h \
tensorflow/lite/experimental/micro/examples/micro_speech/simple_features/simple_features_generator.h \
tensorflow/lite/experimental/micro/examples/micro_speech/no_30ms_sample_data.h \
tensorflow/lite/experimental/micro/examples/micro_speech/yes_30ms_sample_data.h \
tensorflow/lite/experimental/micro/examples/micro_speech/simple_features/no_power_spectrum_data.h \
tensorflow/lite/experimental/micro/examples/micro_speech/simple_features/yes_power_spectrum_data.h
MICRO_FEATURES_LIB_SRCS := \
tensorflow/lite/experimental/microfrontend/lib/fft.cc \
tensorflow/lite/experimental/microfrontend/lib/fft_util.cc \
tensorflow/lite/experimental/microfrontend/lib/filterbank.c \
tensorflow/lite/experimental/microfrontend/lib/filterbank_util.c \
tensorflow/lite/experimental/microfrontend/lib/frontend.c \
tensorflow/lite/experimental/microfrontend/lib/frontend_util.c \
tensorflow/lite/experimental/microfrontend/lib/log_lut.c \
tensorflow/lite/experimental/microfrontend/lib/log_scale.c \
tensorflow/lite/experimental/microfrontend/lib/log_scale_util.c \
tensorflow/lite/experimental/microfrontend/lib/noise_reduction.c \
tensorflow/lite/experimental/microfrontend/lib/noise_reduction_util.c \
tensorflow/lite/experimental/microfrontend/lib/pcan_gain_control.c \
tensorflow/lite/experimental/microfrontend/lib/pcan_gain_control_util.c \
tensorflow/lite/experimental/microfrontend/lib/window.c \
tensorflow/lite/experimental/microfrontend/lib/window_util.c \
$(KISSFFT_LIB_SRCS)
MICRO_FEATURES_LIB_HDRS := \
tensorflow/lite/experimental/microfrontend/lib/bits.h \
tensorflow/lite/experimental/microfrontend/lib/fft.h \
tensorflow/lite/experimental/microfrontend/lib/fft_util.h \
tensorflow/lite/experimental/microfrontend/lib/filterbank.h \
tensorflow/lite/experimental/microfrontend/lib/filterbank_util.h \
tensorflow/lite/experimental/microfrontend/lib/frontend.h \
tensorflow/lite/experimental/microfrontend/lib/frontend_util.h \
tensorflow/lite/experimental/microfrontend/lib/log_lut.h \
tensorflow/lite/experimental/microfrontend/lib/log_scale.h \
tensorflow/lite/experimental/microfrontend/lib/log_scale_util.h \
tensorflow/lite/experimental/microfrontend/lib/noise_reduction.h \
tensorflow/lite/experimental/microfrontend/lib/noise_reduction_util.h \
tensorflow/lite/experimental/microfrontend/lib/pcan_gain_control.h \
tensorflow/lite/experimental/microfrontend/lib/pcan_gain_control_util.h \
tensorflow/lite/experimental/microfrontend/lib/window.h \
tensorflow/lite/experimental/microfrontend/lib/window_util.h \
$(KISSFFT_LIB_HDRS)
MICRO_FEATURES_GENERATOR_SRCS := \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/micro_features_generator.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/micro_model_settings.cc \
$(MICRO_FEATURES_LIB_SRCS)
MICRO_FEATURES_GENERATOR_HDRS := \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/micro_features_generator.h \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/micro_model_settings.h \
$(MICRO_FEATURES_LIB_HDRS)
MICRO_FEATURES_GENERATOR_TEST_SRCS := \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/micro_features_generator_test.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/no_feature_data_slice.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/yes_feature_data_slice.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/no_30ms_sample_data.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/yes_30ms_sample_data.cc \
$(MICRO_FEATURES_GENERATOR_SRCS)
MICRO_FEATURES_GENERATOR_TEST_HDRS := \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/no_feature_data_slice.h \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/yes_feature_data_slice.h \
tensorflow/lite/experimental/micro/examples/micro_speech/no_30ms_sample_data.h \
tensorflow/lite/experimental/micro/examples/micro_speech/yes_30ms_sample_data.h \
$(MICRO_FEATURES_GENERATOR_HDRS)
AUDIO_PROVIDER_TEST_SRCS := \
tensorflow/lite/experimental/micro/examples/micro_speech/audio_provider_test.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/micro_model_settings.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/audio_provider.cc
AUDIO_PROVIDER_TEST_HDRS := \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/micro_model_settings.h \
tensorflow/lite/experimental/micro/examples/micro_speech/audio_provider.h \
AUDIO_PROVIDER_MOCK_TEST_SRCS := \
tensorflow/lite/experimental/micro/examples/micro_speech/audio_provider_mock_test.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/micro_model_settings.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/no_1000ms_sample_data.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/yes_1000ms_sample_data.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/audio_provider_mock.cc
AUDIO_PROVIDER_MOCK_TEST_HDRS := \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/micro_model_settings.h \
tensorflow/lite/experimental/micro/examples/micro_speech/no_1000ms_sample_data.h \
tensorflow/lite/experimental/micro/examples/micro_speech/yes_1000ms_sample_data.h \
tensorflow/lite/experimental/micro/examples/micro_speech/audio_provider.h \
FEATURE_PROVIDER_TEST_SRCS := \
tensorflow/lite/experimental/micro/examples/micro_speech/feature_provider_test.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/audio_provider.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/feature_provider.cc \
$(MICRO_FEATURES_GENERATOR_SRCS)
FEATURE_PROVIDER_TEST_HDRS := \
tensorflow/lite/experimental/micro/examples/micro_speech/audio_provider.h \
tensorflow/lite/experimental/micro/examples/micro_speech/feature_provider.h \
$(MICRO_FEATURES_GENERATOR_HDRS)
FEATURE_PROVIDER_MOCK_TEST_SRCS := \
tensorflow/lite/experimental/micro/examples/micro_speech/feature_provider_test.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/audio_provider_mock.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/no_1000ms_sample_data.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/yes_1000ms_sample_data.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/feature_provider.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/no_micro_features_data.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/yes_micro_features_data.cc \
$(MICRO_FEATURES_GENERATOR_SRCS)
FEATURE_PROVIDER_MOCK_TEST_HDRS := \
tensorflow/lite/experimental/micro/examples/micro_speech/audio_provider.h \
tensorflow/lite/experimental/micro/examples/micro_speech/no_1000ms_sample_data.h \
tensorflow/lite/experimental/micro/examples/micro_speech/yes_1000ms_sample_data.h \
tensorflow/lite/experimental/micro/examples/micro_speech/feature_provider.h \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/no_micro_features_data.h \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/yes_micro_features_data.h \
$(MICRO_FEATURES_GENERATOR_HDRS)
RECOGNIZE_COMMANDS_TEST_SRCS := \
tensorflow/lite/experimental/micro/examples/micro_speech/recognize_commands_test.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/micro_model_settings.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/recognize_commands.cc
RECOGNIZE_COMMANDS_TEST_HDRS := \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/micro_model_settings.h \
tensorflow/lite/experimental/micro/examples/micro_speech/recognize_commands.h
COMMAND_RESPONDER_TEST_SRCS := \
tensorflow/lite/experimental/micro/examples/micro_speech/command_responder_test.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/command_responder.cc
COMMAND_RESPONDER_TEST_HDRS := \
tensorflow/lite/experimental/micro/examples/micro_speech/command_responder.h
MICRO_SPEECH_SRCS := \
tensorflow/lite/experimental/micro/examples/micro_speech/main.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/main_functions.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/audio_provider.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/feature_provider.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/no_micro_features_data.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/yes_micro_features_data.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/tiny_conv_micro_features_model_data.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/recognize_commands.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/command_responder.cc \
$(MICRO_FEATURES_GENERATOR_SRCS)
MICRO_SPEECH_HDRS := \
tensorflow/lite/experimental/micro/examples/micro_speech/audio_provider.h \
tensorflow/lite/experimental/micro/examples/micro_speech/feature_provider.h \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/no_micro_features_data.h \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/yes_micro_features_data.h \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/tiny_conv_micro_features_model_data.h \
tensorflow/lite/experimental/micro/examples/micro_speech/recognize_commands.h \
tensorflow/lite/experimental/micro/examples/micro_speech/command_responder.h \
tensorflow/lite/experimental/micro/examples/micro_speech/main_functions.h \
$(MICRO_FEATURES_GENERATOR_HDRS)
MICRO_SPEECH_MOCK_SRCS := \
tensorflow/lite/experimental/micro/examples/micro_speech/main.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/main_functions.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/audio_provider_mock.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/no_1000ms_sample_data.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/yes_1000ms_sample_data.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/feature_provider.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/no_micro_features_data.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/yes_micro_features_data.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/tiny_conv_micro_features_model_data.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/recognize_commands.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/command_responder.cc \
$(MICRO_FEATURES_GENERATOR_SRCS)
MICRO_SPEECH_MOCK_HDRS := \
tensorflow/lite/experimental/micro/examples/micro_speech/audio_provider.h \
tensorflow/lite/experimental/micro/examples/micro_speech/no_1000ms_sample_data.h \
tensorflow/lite/experimental/micro/examples/micro_speech/yes_1000ms_sample_data.h \
tensorflow/lite/experimental/micro/examples/micro_speech/feature_provider.h \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/micro_features_generator.h \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/no_micro_features_data.h \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/yes_micro_features_data.h \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/tiny_conv_micro_features_model_data.h \
tensorflow/lite/experimental/micro/examples/micro_speech/recognize_commands.h \
tensorflow/lite/experimental/micro/examples/micro_speech/command_responder.h \
tensorflow/lite/experimental/micro/examples/micro_speech/main_functions.h \
$(MICRO_FEATURES_GENERATOR_HDRS)
# Find any platform-specific rules for this example.
include $(wildcard tensorflow/lite/experimental/micro/examples/micro_speech/*/Makefile.inc)
# Test the code for feature generation.
$(eval $(call microlite_test,micro_features_generator_test,\
$(MICRO_FEATURES_GENERATOR_TEST_SRCS), $(MICRO_FEATURES_GENERATOR_TEST_HDRS)))
# Tests loading and running a speech model.
$(eval $(call microlite_test,micro_speech_test,\
$(MICRO_SPEECH_TEST_SRCS),$(MICRO_SPEECH_TEST_HDRS)))
# Test the code for feature generation.
$(eval $(call microlite_test,simple_features_generator_test,\
$(SIMPLE_FEATURES_GENERATOR_TEST_SRCS), $(SIMPLE_FEATURES_GENERATOR_TEST_HDRS)))
# Tests the audio provider module.
$(eval $(call microlite_test,audio_provider_test,\
$(AUDIO_PROVIDER_TEST_SRCS),$(AUDIO_PROVIDER_TEST_HDRS)))
# Tests the audio provider mock module.
$(eval $(call microlite_test,audio_provider_mock_test,\
$(AUDIO_PROVIDER_MOCK_TEST_SRCS),$(AUDIO_PROVIDER_MOCK_TEST_HDRS)))
# Tests the feature provider module.
$(eval $(call microlite_test,feature_provider_test,\
$(FEATURE_PROVIDER_TEST_SRCS),$(FEATURE_PROVIDER_TEST_HDRS)))
# Tests the feature provider module using the mock audio provider.
$(eval $(call microlite_test,feature_provider_mock_test,\
$(FEATURE_PROVIDER_MOCK_TEST_SRCS),$(FEATURE_PROVIDER_MOCK_TEST_HDRS)))
# Tests the command recognizer module.
$(eval $(call microlite_test,recognize_commands_test,\
$(RECOGNIZE_COMMANDS_TEST_SRCS),$(RECOGNIZE_COMMANDS_TEST_HDRS)))
# Tests responding to a command.
$(eval $(call microlite_test,command_responder_test,\
$(COMMAND_RESPONDER_TEST_SRCS),$(COMMAND_RESPONDER_TEST_HDRS)))
# Builds a standalone speech command recognizer binary.
$(eval $(call microlite_test,micro_speech,\
$(MICRO_SPEECH_SRCS),$(MICRO_SPEECH_HDRS)))
# Builds a standalone speech command recognizer binary using fake audio input.
$(eval $(call microlite_test,micro_speech_mock,\
$(MICRO_SPEECH_MOCK_SRCS),$(MICRO_SPEECH_MOCK_HDRS)))

View File

@ -1,68 +0,0 @@
$(eval $(call add_third_party_download,$(PERSON_MODEL_URL),$(PERSON_MODEL_MD5),person_model_grayscale,))
person_detection_MODEL_SRCS := \
tensorflow/lite/experimental/micro/examples/person_detection/model_settings.cc \
$(MAKEFILE_DIR)/downloads/person_model_grayscale/person_detect_model_data.cc
person_detection_MODEL_HDRS := \
tensorflow/lite/experimental/micro/examples/person_detection/model_settings.h \
tensorflow/lite/experimental/micro/examples/person_detection/person_detect_model_data.h
person_detection_TEST_SRCS := \
tensorflow/lite/experimental/micro/examples/person_detection/person_detection_test.cc \
$(MAKEFILE_DIR)/downloads/person_model_grayscale/no_person_image_data.cc \
$(MAKEFILE_DIR)/downloads/person_model_grayscale/person_image_data.cc \
$(person_detection_MODEL_SRCS)
person_detection_TEST_HDRS := \
tensorflow/lite/experimental/micro/examples/person_detection/no_person_image_data.h \
tensorflow/lite/experimental/micro/examples/person_detection/person_image_data.h \
$(person_detection_MODEL_HDRS)
IMAGE_PROVIDER_TEST_SRCS := \
tensorflow/lite/experimental/micro/examples/person_detection/image_provider.cc \
tensorflow/lite/experimental/micro/examples/person_detection/image_provider_test.cc \
tensorflow/lite/experimental/micro/examples/person_detection/model_settings.cc
IMAGE_PROVIDER_TEST_HDRS := \
tensorflow/lite/experimental/micro/examples/person_detection/image_provider.h \
tensorflow/lite/experimental/micro/examples/person_detection/model_settings.h
DETECTION_RESPONDER_TEST_SRCS := \
tensorflow/lite/experimental/micro/examples/person_detection/detection_responder.cc \
tensorflow/lite/experimental/micro/examples/person_detection/detection_responder_test.cc
DETECTION_RESPONDER_TEST_HDRS := \
tensorflow/lite/experimental/micro/examples/person_detection/detection_responder.h
person_detection_SRCS := \
tensorflow/lite/experimental/micro/examples/person_detection/detection_responder.cc \
tensorflow/lite/experimental/micro/examples/person_detection/image_provider.cc \
tensorflow/lite/experimental/micro/examples/person_detection/main.cc \
tensorflow/lite/experimental/micro/examples/person_detection/main_functions.cc \
$(person_detection_MODEL_SRCS)
person_detection_HDRS := \
tensorflow/lite/experimental/micro/examples/person_detection/detection_responder.h \
tensorflow/lite/experimental/micro/examples/person_detection/image_provider.h \
tensorflow/lite/experimental/micro/examples/person_detection/main_functions.h \
$(person_detection_MODEL_HDRS)
# Find any platform-specific rules for this example.
include $(wildcard tensorflow/lite/experimental/micro/examples/person_detection/*/Makefile.inc)
# Tests loading and running a vision model.
$(eval $(call microlite_test,person_detection_test,\
$(person_detection_TEST_SRCS),$(person_detection_TEST_HDRS)))
# Tests the image provider module.
$(eval $(call microlite_test,image_provider_test,\
$(IMAGE_PROVIDER_TEST_SRCS),$(IMAGE_PROVIDER_TEST_HDRS)))
# Tests the detection responder module.
$(eval $(call microlite_test,detection_responder_test,\
$(DETECTION_RESPONDER_TEST_SRCS),$(DETECTION_RESPONDER_TEST_HDRS)))
# Builds a standalone object recognition binary.
$(eval $(call microlite_test,person_detection,\
$(person_detection_SRCS),$(person_detection_HDRS)))

View File

@ -1,14 +0,0 @@
ifeq ($(TARGET),$(filter $(TARGET),apollo3evb sparkfun_edge))
person_detection_SRCS += \
tensorflow/lite/experimental/micro/examples/person_detection/himax_driver/HM01B0.c \
tensorflow/lite/experimental/micro/examples/person_detection/himax_driver/HM01B0_debug.c \
tensorflow/lite/experimental/micro/examples/person_detection/himax_driver/HM01B0_optimized.c
person_detection_HDRS += \
tensorflow/lite/experimental/micro/examples/person_detection/himax_driver/HM01B0.h \
tensorflow/lite/experimental/micro/examples/person_detection/himax_driver/HM01B0_debug.h \
tensorflow/lite/experimental/micro/examples/person_detection/himax_driver/HM01B0_optimized.h \
tensorflow/lite/experimental/micro/examples/person_detection/himax_driver/HM01B0_RAW8_QVGA_8bits_lsb_5fps.h \
tensorflow/lite/experimental/micro/examples/person_detection/himax_driver/HM01B0_Walking1s_01.h \
tensorflow/lite/experimental/micro/examples/person_detection/himax_driver/platform_Sparkfun_Edge.h
endif

View File

@ -1,7 +1,7 @@
# Library for generating feature vectors from audio data
load(
"//tensorflow/lite/experimental/micro/testing:micro_test.bzl",
"//tensorflow/lite/micro/testing:micro_test.bzl",
"tflite_micro_cc_test",
)
@ -128,7 +128,7 @@ tflite_micro_cc_test(
srcs = ["fft_test.cc"],
deps = [
":fft",
"//tensorflow/lite/experimental/micro/testing:micro_test",
"//tensorflow/lite/micro/testing:micro_test",
],
)
@ -137,7 +137,7 @@ tflite_micro_cc_test(
srcs = ["filterbank_test.cc"],
deps = [
":filterbank",
"//tensorflow/lite/experimental/micro/testing:micro_test",
"//tensorflow/lite/micro/testing:micro_test",
],
)
@ -146,7 +146,7 @@ tflite_micro_cc_test(
srcs = ["frontend_test.cc"],
deps = [
":frontend",
"//tensorflow/lite/experimental/micro/testing:micro_test",
"//tensorflow/lite/micro/testing:micro_test",
],
)
@ -155,7 +155,7 @@ tflite_micro_cc_test(
srcs = ["log_scale_test.cc"],
deps = [
":log_scale",
"//tensorflow/lite/experimental/micro/testing:micro_test",
"//tensorflow/lite/micro/testing:micro_test",
],
)
@ -164,7 +164,7 @@ tflite_micro_cc_test(
srcs = ["noise_reduction_test.cc"],
deps = [
":noise_reduction",
"//tensorflow/lite/experimental/micro/testing:micro_test",
"//tensorflow/lite/micro/testing:micro_test",
],
)
@ -173,7 +173,7 @@ tflite_micro_cc_test(
srcs = ["pcan_gain_control_test.cc"],
deps = [
":pcan_gain_control",
"//tensorflow/lite/experimental/micro/testing:micro_test",
"//tensorflow/lite/micro/testing:micro_test",
],
)
@ -182,6 +182,6 @@ tflite_micro_cc_test(
srcs = ["window_test.cc"],
deps = [
":window",
"//tensorflow/lite/experimental/micro/testing:micro_test",
"//tensorflow/lite/micro/testing:micro_test",
],
)

View File

@ -14,8 +14,8 @@ limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/microfrontend/lib/fft.h"
#include "tensorflow/lite/experimental/micro/testing/micro_test.h"
#include "tensorflow/lite/experimental/microfrontend/lib/fft_util.h"
#include "tensorflow/lite/micro/testing/micro_test.h"
namespace {

View File

@ -13,11 +13,11 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/microfrontend/lib/filterbank.h"
#include "tensorflow/lite/experimental/microfrontend/lib/filterbank_util.h"
#include <cstring>
#include "tensorflow/lite/experimental/micro/testing/micro_test.h"
#include "tensorflow/lite/experimental/microfrontend/lib/filterbank_util.h"
#include "tensorflow/lite/micro/testing/micro_test.h"
namespace {

View File

@ -13,9 +13,9 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/microfrontend/lib/frontend.h"
#include "tensorflow/lite/experimental/microfrontend/lib/frontend_util.h"
#include "tensorflow/lite/experimental/micro/testing/micro_test.h"
#include "tensorflow/lite/experimental/microfrontend/lib/frontend_util.h"
#include "tensorflow/lite/micro/testing/micro_test.h"
namespace {

View File

@ -13,9 +13,9 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/microfrontend/lib/log_scale.h"
#include "tensorflow/lite/experimental/microfrontend/lib/log_scale_util.h"
#include "tensorflow/lite/experimental/micro/testing/micro_test.h"
#include "tensorflow/lite/experimental/microfrontend/lib/log_scale_util.h"
#include "tensorflow/lite/micro/testing/micro_test.h"
namespace {

View File

@ -13,9 +13,9 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/microfrontend/lib/noise_reduction.h"
#include "tensorflow/lite/experimental/microfrontend/lib/noise_reduction_util.h"
#include "tensorflow/lite/experimental/micro/testing/micro_test.h"
#include "tensorflow/lite/experimental/microfrontend/lib/noise_reduction_util.h"
#include "tensorflow/lite/micro/testing/micro_test.h"
namespace {

View File

@ -13,9 +13,9 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/microfrontend/lib/pcan_gain_control.h"
#include "tensorflow/lite/experimental/microfrontend/lib/pcan_gain_control_util.h"
#include "tensorflow/lite/experimental/micro/testing/micro_test.h"
#include "tensorflow/lite/experimental/microfrontend/lib/pcan_gain_control_util.h"
#include "tensorflow/lite/micro/testing/micro_test.h"
namespace {

View File

@ -13,9 +13,9 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/microfrontend/lib/window.h"
#include "tensorflow/lite/experimental/microfrontend/lib/window_util.h"
#include "tensorflow/lite/experimental/micro/testing/micro_test.h"
#include "tensorflow/lite/experimental/microfrontend/lib/window_util.h"
#include "tensorflow/lite/micro/testing/micro_test.h"
namespace {

View File

@ -12,7 +12,7 @@ guidance on designing and training a model to fit in limited memory.
For an end-to-end, runnable example of building and converting a model, see the
following Colab which is part of the *Hello World* example:
<a class="button button-primary" href="https://colab.research.google.com/github/tensorflow/tensorflow/blob/master/tensorflow/lite/experimental/micro/examples/hello_world/create_sine_model.ipynb">create_sine_model.ipynb</a>
<a class="button button-primary" href="https://colab.research.google.com/github/tensorflow/tensorflow/blob/master/tensorflow/lite/micro/examples/hello_world/create_sine_model.ipynb">create_sine_model.ipynb</a>
## Model conversion
@ -71,7 +71,7 @@ important to change the array declaration to `const` for better memory
efficiency on embedded platforms.
For an example of how to include and use a model in your program, see
[`sine_model_data.cc`](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/experimental/micro/examples/hello_world/sine_model_data.cc)
[`sine_model_data.cc`](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/micro/examples/hello_world/sine_model_data.cc)
in the *Hello World* example.
## Model architecture and training
@ -109,4 +109,4 @@ to run. We are working on expanding operation support, both in terms of
reference implementations and optimizations for specific architectures.
The supported operations can be seen in the file
[`all_ops_resolver.cc`](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/experimental/micro/kernels/all_ops_resolver.cc)
[`all_ops_resolver.cc`](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/micro/kernels/all_ops_resolver.cc)

View File

@ -30,15 +30,15 @@ TensorFlow Lite for Microcontrollers comes with several example applications
that demonstrate its use for various tasks. At the time of writing, the
following are available:
* [Hello World](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/experimental/micro/examples/hello_world) -
* [Hello World](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/micro/examples/hello_world) -
Demonstrates the absolute basics of using TensorFlow Lite for
Microcontrollers
* [Micro speech](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/experimental/micro/examples/micro_speech) -
* [Micro speech](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/micro/examples/micro_speech) -
Captures audio with a microphone in order to detect the words "yes" and "no"
* [Person detection](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/experimental/micro/examples/person_detection) -
* [Person detection](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/micro/examples/person_detection) -
Captures camera data with an image sensor in order to detect the presence or
absence of a person
* [Magic wand](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/experimental/micro/examples/magic_wand) -
* [Magic wand](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/micro/examples/magic_wand) -
Captures accelerometer data in order to classify three different physical
gestures
@ -46,7 +46,7 @@ Each example application has a `README.md` file that explains how it can be
deployed to its supported platforms.
The rest of this guide walks through the
[Hello World](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/experimental/micro/examples/hello_world)
[Hello World](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/micro/examples/hello_world)
example application.
## The Hello World example
@ -73,13 +73,13 @@ The example includes the following:
To run the example on your device, walk through the instructions in the
`README.md`:
<a class="button button-primary" href="https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/experimental/micro/examples/hello_world/README.md">Hello
<a class="button button-primary" href="https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/micro/examples/hello_world/README.md">Hello
World README.md</a>
## How to run inference
The following section walks through the *Hello World* example's
[`hello_world_test.cc`](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/experimental/micro/examples/hello_world/hello_world_test.cc),
[`hello_world_test.cc`](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/micro/examples/hello_world/hello_world_test.cc),
which demonstrates how to run inference using TensorFlow Lite for
Microcontrollers.
@ -91,18 +91,18 @@ To use the TensorFlow Lite for Microcontrollers library, we must include the
following header files:
```C++
#include "tensorflow/lite/experimental/micro/kernels/all_ops_resolver.h"
#include "tensorflow/lite/experimental/micro/micro_error_reporter.h"
#include "tensorflow/lite/experimental/micro/micro_interpreter.h"
#include "tensorflow/lite/micro/kernels/all_ops_resolver.h"
#include "tensorflow/lite/micro/micro_error_reporter.h"
#include "tensorflow/lite/micro/micro_interpreter.h"
#include "tensorflow/lite/schema/schema_generated.h"
#include "tensorflow/lite/version.h"
```
- [`all_ops_resolver.h`](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/experimental/micro/kernels/all_ops_resolver.h)
- [`all_ops_resolver.h`](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/micro/kernels/all_ops_resolver.h)
provides the operations used by the interpreter to run the model.
- [`micro_error_reporter.h`](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/experimental/micro/micro_error_reporter.h)
- [`micro_error_reporter.h`](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/micro/micro_error_reporter.h)
outputs debug information.
- [`micro_interpreter.h`](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/experimental/micro/micro_interpreter.h)
- [`micro_interpreter.h`](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/micro/micro_interpreter.h)
contains code to load and run models.
- [`schema_generated.h`](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/schema/schema_generated.h)
contains the schema for the TensorFlow Lite
@ -118,7 +118,7 @@ provided as a C++ array. In the *Hello World* example, the model is defined in
following line:
```C++
#include "tensorflow/lite/experimental/micro/examples/hello_world/sine_model_data.h"
#include "tensorflow/lite/micro/examples/hello_world/sine_model_data.h"
```
### Set up the unit test
@ -128,7 +128,7 @@ Microcontrollers unit test framework. To load the framework, we include the
following file:
```C++
#include "tensorflow/lite/experimental/micro/testing/micro_test.h"
#include "tensorflow/lite/micro/testing/micro_test.h"
```
The test is defined using the following macros:
@ -175,7 +175,7 @@ if (model->version() != TFLITE_SCHEMA_VERSION) {
### Instantiate operations resolver
An
[`AllOpsResolver`](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/experimental/micro/kernels/all_ops_resolver.h)
[`AllOpsResolver`](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/micro/kernels/all_ops_resolver.h)
instance is declared. This will be used by the interpreter to access the
operations that are used by the model:
@ -190,7 +190,7 @@ load only the operations that are needed.
This is done using a different class, `MicroMutableOpResolver`. You can see how
to use it in the *Micro speech* example's
[`micro_speech_test.cc`](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/experimental/micro/examples/micro_speech/micro_speech_test.cc).
[`micro_speech_test.cc`](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/micro/examples/micro_speech/micro_speech_test.cc).
### Allocate memory
@ -348,7 +348,7 @@ TF_LITE_MICRO_EXPECT_NEAR(-0.959, value, 0.05);
Once you have walked through this unit test, you should be able to understand
the example's application code, located in
[`main_functions.cc`](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/experimental/micro/examples/hello_world/main_functions.cc).
[`main_functions.cc`](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/micro/examples/hello_world/main_functions.cc).
It follows a similar process, but generates an input value based on how many
inferences have been run, and calls a device-specific function that displays the
model's output to the user.
@ -359,7 +359,7 @@ To understand how the library can be used with a variety of models and
applications, we recommend deploying the other examples and walking through
their code.
<a class="button button-primary" href="https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/experimental/micro/examples">Example
<a class="button button-primary" href="https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/micro/examples">Example
applications on GitHub</a>
To learn how to use the library in your own project, read

View File

@ -22,17 +22,17 @@ within various embedded development environments.
The most important files for using the TensorFlow Lite for Microcontrollers
interpreter are located in the root of the project, accompanied by tests:
- [`all_ops_resolver.h`](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/experimental/micro/kernels/all_ops_resolver.h)
- [`all_ops_resolver.h`](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/micro/kernels/all_ops_resolver.h)
or
[`micro_mutable_op_resolver.h`](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/experimental/micro/micro_mutable_op_resolver.h)
[`micro_mutable_op_resolver.h`](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/micro/micro_mutable_op_resolver.h)
can be used to provide the operations used by the interpreter to run the
model. Since `all_ops_resolver.h` pulls in every available operation, it
uses a lot of memory. In production applications, you should use
`micro_mutable_op_resolver.h` to pull in only the operations your model
needs.
- [`micro_error_reporter.h`](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/experimental/micro/micro_error_reporter.h)
- [`micro_error_reporter.h`](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/micro/micro_error_reporter.h)
outputs debug information.
- [`micro_interpreter.h`](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/experimental/micro/micro_interpreter.h)
- [`micro_interpreter.h`](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/micro/micro_interpreter.h)
contains code to handle and run models.
See [Get started with microcontrollers](get_started.md) for a walkthrough of
@ -40,15 +40,15 @@ typical usage.
The build system provides for platform-specific implementations of certain
files. These are located in a directory with the platform name, for example
[`sparkfun_edge`](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/experimental/micro/sparkfun_edge).
[`sparkfun_edge`](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/micro/sparkfun_edge).
Several other directories exist, including:
- [`kernel`](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/experimental/micro/kernels),
- [`kernel`](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/micro/kernels),
which contains operation implementations and the associated code.
- [`tools`](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/experimental/micro/tools),
- [`tools`](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/micro/tools),
which contains build tools and their output.
- [`examples`](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/experimental/micro/examples),
- [`examples`](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/micro/examples),
which contains sample code.
## Start a new project
@ -79,33 +79,32 @@ To generate these projects with Make, clone the
following command:
```bash
make -f tensorflow/lite/experimental/micro/tools/make/Makefile generate_projects
make -f tensorflow/lite/micro/tools/make/Makefile generate_projects
```
This will take a few minutes, since it has to download some large toolchains for
the dependencies. Once it has finished, you should see some folders created
inside a path like
`tensorflow/lite/experimental/micro/tools/make/gen/linux_x86_64/prj/` (the exact
path depends on your host operating system). These folders contain the generated
project and source files.
inside a path like `tensorflow/lite/micro/tools/make/gen/linux_x86_64/prj/` (the
exact path depends on your host operating system). These folders contain the
generated project and source files.
After running the command, you'll be able to find the *Hello World* projects in
`tensorflow/lite/experimental/micro/tools/make/gen/linux_x86_64/prj/hello_world`.
For example, `hello_world/keil` will contain the Keil project.
`tensorflow/lite/micro/tools/make/gen/linux_x86_64/prj/hello_world`. For
example, `hello_world/keil` will contain the Keil project.
## Run the tests
To build the library and run all of its unit tests, use the following command:
```bash
make -f tensorflow/lite/experimental/micro/tools/make/Makefile test
make -f tensorflow/lite/micro/tools/make/Makefile test
```
To run an individual test, use the following command, replacing `<test_name>`
with the name of the test:
```bash
make -f tensorflow/lite/experimental/micro/tools/make/Makefile test_<test_name>
make -f tensorflow/lite/micro/tools/make/Makefile test_<test_name>
```
You can find the test names in the project's Makefiles. For example,
@ -119,14 +118,14 @@ use the following command, replacing `<project_name>` with the project you wish
to build:
```bash
make -f tensorflow/lite/experimental/micro/tools/make/Makefile <project_name>_bin
make -f tensorflow/lite/micro/tools/make/Makefile <project_name>_bin
```
For example, the following command will build a binary for the *Hello World*
application:
```bash
make -f tensorflow/lite/experimental/micro/tools/make/Makefile hello_world_bin
make -f tensorflow/lite/micro/tools/make/Makefile hello_world_bin
```
By default, the project will be compiled for the host operating system. To
@ -134,7 +133,7 @@ specify a different target architecture, use `TARGET=`. The following example
shows how to build the *Hello World* example for the SparkFun Edge:
```bash
make -f tensorflow/lite/experimental/micro/tools/make/Makefile TARGET=sparkfun_edge hello_world_bin
make -f tensorflow/lite/micro/tools/make/Makefile TARGET=sparkfun_edge hello_world_bin
```
When a target is specified, any available target-specific source files will be
@ -149,9 +148,9 @@ World* example.
## Optimized kernels
The reference kernels in the root of
`tensorflow/lite/experimental/micro/kernels` are implemented in pure C/C++, and
do not include platform-specific hardware optimizations.
The reference kernels in the root of `tensorflow/lite/micro/kernels` are
implemented in pure C/C++, and do not include platform-specific hardware
optimizations.
Optimized versions of kernels are provided in subdirectories. For example,
`kernels/cmsis-nn` contains several optimized kernels that make use of Arm's
@ -162,7 +161,7 @@ replacing `<subdirectory_name>` with the name of the subdirectory containing the
optimizations:
```bash
make -f tensorflow/lite/experimental/micro/tools/make/Makefile TAGS=<subdirectory_name> generate_projects
make -f tensorflow/lite/micro/tools/make/Makefile TAGS=<subdirectory_name> generate_projects
```
You can add your own optimizations by creating a new subfolder for them. We
@ -177,14 +176,14 @@ If you need to generate a new build of the library, you can run the following
script from the TensorFlow repository:
```bash
./tensorflow/lite/experimental/micro/tools/ci_build/test_arduino.sh
./tensorflow/lite/micro/tools/ci_build/test_arduino.sh
```
The resulting library can be found in
`tensorflow/lite/experimental/micro/tools/make/gen/arduino_x86_64/prj/tensorflow_lite.zip`.
`tensorflow/lite/micro/tools/make/gen/arduino_x86_64/prj/tensorflow_lite.zip`.
## Port to new devices
Guidance on porting TensorFlow Lite for Microcontrollers to new platforms and
devices can be found in
[`micro/README.md`](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/experimental/micro/README.md).
[`micro/README.md`](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/micro/README.md).

View File

@ -19,7 +19,7 @@ limitations under the License.
// non-portable function.
#ifdef TF_LITE_MCU_DEBUG_LOG
#include "tensorflow/lite/experimental/micro/micro_error_reporter.h"
#include "tensorflow/lite/micro/micro_error_reporter.h"
#define DEBUG_LOG(x) \
do { \

View File

@ -1,5 +1,5 @@
load(
"//tensorflow/lite/experimental/micro/testing:micro_test.bzl",
"//tensorflow/lite/micro/testing:micro_test.bzl",
"tflite_micro_cc_test",
)
@ -45,8 +45,8 @@ cc_library(
"//tensorflow/lite:type_to_tflitetype",
"//tensorflow/lite/c:common",
"//tensorflow/lite/core/api",
"//tensorflow/lite/experimental/micro/memory_planner:greedy_memory_planner",
"//tensorflow/lite/kernels/internal:tensor",
"//tensorflow/lite/micro/memory_planner:greedy_memory_planner",
"//tensorflow/lite/schema:schema_fbs",
],
)
@ -81,7 +81,7 @@ tflite_micro_cc_test(
],
deps = [
":micro_framework",
"//tensorflow/lite/experimental/micro/testing:micro_test",
"//tensorflow/lite/micro/testing:micro_test",
],
)
@ -92,7 +92,7 @@ tflite_micro_cc_test(
],
deps = [
":micro_framework",
"//tensorflow/lite/experimental/micro/testing:micro_test",
"//tensorflow/lite/micro/testing:micro_test",
],
)
@ -103,7 +103,7 @@ tflite_micro_cc_test(
],
deps = [
":micro_framework",
"//tensorflow/lite/experimental/micro/testing:micro_test",
"//tensorflow/lite/micro/testing:micro_test",
],
)
@ -114,7 +114,7 @@ tflite_micro_cc_test(
],
deps = [
":micro_framework",
"//tensorflow/lite/experimental/micro/testing:micro_test",
"//tensorflow/lite/micro/testing:micro_test",
],
)
@ -125,7 +125,7 @@ tflite_micro_cc_test(
],
deps = [
":micro_framework",
"//tensorflow/lite/experimental/micro/testing:micro_test",
"//tensorflow/lite/micro/testing:micro_test",
],
)
@ -136,7 +136,7 @@ tflite_micro_cc_test(
],
deps = [
":micro_framework",
"//tensorflow/lite/experimental/micro/testing:micro_test",
"//tensorflow/lite/micro/testing:micro_test",
],
)
@ -147,6 +147,6 @@ tflite_micro_cc_test(
],
deps = [
":micro_utils",
"//tensorflow/lite/experimental/micro/testing:micro_test",
"//tensorflow/lite/micro/testing:micro_test",
],
)

View File

@ -1,8 +1,8 @@
# TensorFlow Lite for Microcontrollers
TensorFlow Lite for Microcontrollers is an experimental port of TensorFlow Lite
designed to run machine learning models on microcontrollers and other devices
with only kilobytes of memory.
TensorFlow Lite for Microcontrollers is a port of TensorFlow Lite designed to run
machine learning models on microcontrollers and other devices with only kilobytes
of memory.
To learn how to use the framework, visit the developer documentation at
[tensorflow.org/lite/microcontrollers](https://www.tensorflow.org/lite/microcontrollers).
@ -88,13 +88,13 @@ As mentioned above, the one function you will need to implement for a completely
new platform is debug logging. If your device is just a variation on an existing
platform you may be able to reuse code that's already been written. To
understand what's available, begin with the default reference implementation at
[tensorflow/lite/experimental/micro/debug_log.cc](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/experimental/micro/debug_log.cc),
[tensorflow/lite/micro/debug_log.cc](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/micro/debug_log.cc),
which uses fprintf and stderr. If your platform has this level of support for
the C standard library in its toolchain, then you can just reuse this.
Otherwise, you'll need to do some research into how your platform and device can
communicate logging statements to the outside world. As another example, take a
look at
[the Mbed version of `DebugLog()`](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/experimental/micro/mbed/debug_log.cc),
[the Mbed version of `DebugLog()`](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/micro/mbed/debug_log.cc),
which creates a UART object and uses it to output strings to the host's console
if it's connected.
@ -115,7 +115,7 @@ make sure that C++11 compatibility is turned on, and that the right include
paths (as mentioned in the makefile) have been added.
You'll see the default `DebugLog()` implementation in
'tensorflow/lite/experimental/micro/debug_log.cc' inside the
'tensorflow/lite/micro/debug_log.cc' inside the
micro_error_reporter_test folder. Modify that file to add the right
implementation for your platform, and then you should be able to build the set
of files into an executable. Transfer that executable to your target device (for
@ -174,13 +174,13 @@ specialized implementation, you can create a folder in the same directory as the
header and reference source, name it after your platform, and put your
implementation in a `.cc` file inside that folder. We've already seen one
example of this, where the Mbed and Bluepill versions of `DebugLog()` are inside
[mbed](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/experimental/micro/mbed)
[mbed](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/micro/mbed)
and
[bluepill](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/experimental/micro/bluepill)
[bluepill](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/micro/bluepill)
folders, children of the
[same directory](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/experimental/micro)
[same directory](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite//micro)
where the stdio-based
[`debug_log.cc`](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/experimental/micro/debug_log.cc)
[`debug_log.cc`](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/micro/debug_log.cc)
reference implementation is found.
The advantage of this approach is that we can automatically pick specialized
@ -266,7 +266,7 @@ kernel implementations, but with some specific conventions:
- No platform-specific macros or #ifdefs should be used in any portable code.
The implementation of these rules is handled inside the Makefile, with a
[`specialize` function](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/experimental/micro/tools/make/helper_functions.inc#L42)
[`specialize` function](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/micro/tools/make/helper_functions.inc#L42)
that takes a list of reference source file paths as an input, and returns the
equivalent list with specialized versions of those files swapped in if they
exist.
@ -283,9 +283,9 @@ bottlenecks, and then add specialized implementations in their own folders.
These don't need to be platform specific, they can also be broken out by which
library they rely on for example. [Here's where we do that for the CMSIS
implementation of integer fast-fourier
transforms](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/experimental/micro/examples/micro_speech/simple_features/simple_features_generator.cc).
transforms](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/micro/examples/micro_speech/simple_features/simple_features_generator.cc).
This more complex case shows that you can also add helper source files alongside
the main implementation, as long as you
[mention them in the platform-specific makefile](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/experimental/micro/examples/micro_speech/CMSIS/Makefile.inc).
[mention them in the platform-specific makefile](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/micro/examples/micro_speech/CMSIS/Makefile.inc).
You can also do things like update the list of libraries that need to be linked
in, or add include paths to required headers.

View File

@ -31,10 +31,10 @@ limitations under the License.
// To add an equivalent function for your own platform, create your own
// implementation file, and place it in a subfolder with named after the OS
// you're targeting. For example, see the Cortex M bare metal version in
// tensorflow/lite/experimental/micro/bluepill/debug_log.cc or the mbed one on
// tensorflow/lite/experimental/micro/mbed/debug_log.cc.
// tensorflow/lite/micro/bluepill/debug_log.cc or the mbed one on
// tensorflow/lite/micro/mbed/debug_log.cc.
#include "tensorflow/lite/experimental/micro/debug_log.h"
#include "tensorflow/lite/micro/debug_log.h"
// These are headers from Ambiq's Apollo3 SDK.
#include "am_bsp.h" // NOLINT

View File

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/micro/debug_log.h"
#include "tensorflow/lite/micro/debug_log.h"
#include "Arduino.h"

View File

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/micro/debug_log.h"
#include "tensorflow/lite/micro/debug_log.h"
// For Arm Cortex-M devices, calling SYS_WRITE0 will output the zero-terminated
// string pointed to by R1 to any debug console that's attached to the system.

View File

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/micro/debug_log.h"
#include "tensorflow/lite/micro/debug_log.h"
#include <chre.h>

View File

@ -12,8 +12,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_LITE_EXPERIMENTAL_MICRO_COMPATIBILITY_H_
#define TENSORFLOW_LITE_EXPERIMENTAL_MICRO_COMPATIBILITY_H_
#ifndef TENSORFLOW_LITE_MICRO_COMPATIBILITY_H_
#define TENSORFLOW_LITE_MICRO_COMPATIBILITY_H_
// C++ will automatically create class-specific delete operators for virtual
// objects, which by default call the global delete function. For embedded
@ -29,4 +29,4 @@ limitations under the License.
#define TF_LITE_REMOVE_VIRTUAL_DELETE
#endif
#endif // TENSORFLOW_LITE_EXPERIMENTAL_MICRO_COMPATIBILITY_H_
#endif // TENSORFLOW_LITE_MICRO_COMPATIBILITY_H_

View File

@ -31,10 +31,10 @@ limitations under the License.
// To add an equivalent function for your own platform, create your own
// implementation file, and place it in a subfolder with named after the OS
// you're targeting. For example, see the Cortex M bare metal version in
// tensorflow/lite/experimental/micro/bluepill/debug_log.cc or the mbed one on
// tensorflow/lite/experimental/micro/mbed/debug_log.cc.
// tensorflow/lite/micro/bluepill/debug_log.cc or the mbed one on
// tensorflow/lite/micro/mbed/debug_log.cc.
#include "tensorflow/lite/experimental/micro/debug_log.h"
#include "tensorflow/lite/micro/debug_log.h"
#include <cstdio>

View File

@ -12,12 +12,12 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_LITE_EXPERIMENTAL_MICRO_DEBUG_LOG_H_
#define TENSORFLOW_LITE_EXPERIMENTAL_MICRO_DEBUG_LOG_H_
#ifndef TENSORFLOW_LITE_MICRO_DEBUG_LOG_H_
#define TENSORFLOW_LITE_MICRO_DEBUG_LOG_H_
// This function should be implemented by each target platform, and provide a
// way for strings to be output to some text stream. For more information, see
// tensorflow/lite/experimental/micro/debug_log.cc.
// tensorflow/lite/micro/debug_log.cc.
extern "C" void DebugLog(const char* s);
#endif // TENSORFLOW_LITE_EXPERIMENTAL_MICRO_DEBUG_LOG_H_
#endif // TENSORFLOW_LITE_MICRO_DEBUG_LOG_H_

View File

@ -19,9 +19,9 @@ limitations under the License.
// of DebugLog() and then get the numerical variations without requiring any
// more code.
#include "tensorflow/lite/experimental/micro/debug_log_numbers.h"
#include "tensorflow/lite/micro/debug_log_numbers.h"
#include "tensorflow/lite/experimental/micro/debug_log.h"
#include "tensorflow/lite/micro/debug_log.h"
namespace {

View File

@ -12,8 +12,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_LITE_EXPERIMENTAL_MICRO_DEBUG_LOG_NUMBERS_H_
#define TENSORFLOW_LITE_EXPERIMENTAL_MICRO_DEBUG_LOG_NUMBERS_H_
#ifndef TENSORFLOW_LITE_MICRO_DEBUG_LOG_NUMBERS_H_
#define TENSORFLOW_LITE_MICRO_DEBUG_LOG_NUMBERS_H_
#include <cstdint>
@ -25,4 +25,4 @@ void DebugLogHex(uint32_t i);
void DebugLogFloat(float i);
}
#endif // TENSORFLOW_LITE_EXPERIMENTAL_MICRO_DEBUG_LOG_NUMBERS_H_
#endif // TENSORFLOW_LITE_MICRO_DEBUG_LOG_NUMBERS_H_

View File

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/micro/debug_log.h"
#include "tensorflow/lite/micro/debug_log.h"
#include "eta_csp_io.h"

View File

@ -1,12 +1,15 @@
# Description:
# TensorFlow Lite for Microcontrollers "hello world" example.
licenses(["notice"]) # Apache 2.0
load(
"//tensorflow/lite/experimental/micro/testing:micro_test.bzl",
"//tensorflow/lite/micro/testing:micro_test.bzl",
"tflite_micro_cc_test",
)
package(default_visibility = ["//visibility:public"])
licenses(["notice"]) # Apache 2.0
cc_library(
name = "sine_model_data",
srcs = [
@ -24,11 +27,11 @@ tflite_micro_cc_test(
],
deps = [
"//tensorflow/lite:schema_fbs_version",
"//tensorflow/lite/experimental/micro:micro_framework",
"//tensorflow/lite/experimental/micro/examples/hello_world:sine_model_data",
"//tensorflow/lite/experimental/micro/kernels:all_ops_resolver",
"//tensorflow/lite/experimental/micro/kernels:micro_ops",
"//tensorflow/lite/experimental/micro/testing:micro_test",
"//tensorflow/lite/micro:micro_framework",
"//tensorflow/lite/micro/examples/hello_world:sine_model_data",
"//tensorflow/lite/micro/kernels:all_ops_resolver",
"//tensorflow/lite/micro/kernels:micro_ops",
"//tensorflow/lite/micro/testing:micro_test",
"//tensorflow/lite/schema:schema_fbs",
],
)
@ -43,7 +46,7 @@ cc_library(
],
deps = [
"//tensorflow/lite/c:common",
"//tensorflow/lite/experimental/micro:micro_framework",
"//tensorflow/lite/micro:micro_framework",
],
)
@ -73,9 +76,9 @@ cc_binary(
":constants",
":output_handler",
"//tensorflow/lite:schema_fbs_version",
"//tensorflow/lite/experimental/micro:micro_framework",
"//tensorflow/lite/experimental/micro/examples/hello_world:sine_model_data",
"//tensorflow/lite/experimental/micro/kernels:all_ops_resolver",
"//tensorflow/lite/micro:micro_framework",
"//tensorflow/lite/micro/examples/hello_world:sine_model_data",
"//tensorflow/lite/micro/kernels:all_ops_resolver",
"//tensorflow/lite/schema:schema_fbs",
],
)

View File

@ -0,0 +1,42 @@
HELLO_WORLD_TEST_SRCS := \
tensorflow/lite/micro/examples/hello_world/hello_world_test.cc \
tensorflow/lite/micro/examples/hello_world/sine_model_data.cc
HELLO_WORLD_TEST_HDRS := \
tensorflow/lite/micro/examples/hello_world/sine_model_data.h
OUTPUT_HANDLER_TEST_SRCS := \
tensorflow/lite/micro/examples/hello_world/output_handler_test.cc \
tensorflow/lite/micro/examples/hello_world/output_handler.cc
OUTPUT_HANDLER_TEST_HDRS := \
tensorflow/lite/micro/examples/hello_world/output_handler.h \
tensorflow/lite/micro/examples/hello_world/constants.h
HELLO_WORLD_SRCS := \
tensorflow/lite/micro/examples/hello_world/main.cc \
tensorflow/lite/micro/examples/hello_world/main_functions.cc \
tensorflow/lite/micro/examples/hello_world/sine_model_data.cc \
tensorflow/lite/micro/examples/hello_world/output_handler.cc \
tensorflow/lite/micro/examples/hello_world/constants.cc
HELLO_WORLD_HDRS := \
tensorflow/lite/micro/examples/hello_world/sine_model_data.h \
tensorflow/lite/micro/examples/hello_world/output_handler.h \
tensorflow/lite/micro/examples/hello_world/constants.h \
tensorflow/lite/micro/examples/hello_world/main_functions.h
#Find any platform - specific rules for this example.
include $(wildcard tensorflow/lite/micro/examples/hello_world/*/Makefile.inc)
# Tests loading and running the sine model.
$(eval $(call microlite_test,hello_world_test,\
$(HELLO_WORLD_TEST_SRCS),$(HELLO_WORLD_TEST_HDRS)))
# Tests producing an output.
$(eval $(call microlite_test,output_handler_test,\
$(OUTPUT_HANDLER_TEST_SRCS),$(OUTPUT_HANDLER_TEST_HDRS)))
# Builds a standalone binary.
$(eval $(call microlite_test,hello_world,\
$(HELLO_WORLD_SRCS),$(HELLO_WORLD_HDRS)))

View File

@ -10,7 +10,7 @@ contains implementations for several platforms. In each case, the model is used
to generate a pattern of data that is used to either blink LEDs or control an
animation.
![Animation of example running on STM32F746](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/experimental/micro/examples/hello_world/images/STM32F746.gif)
![Animation of example running on STM32F746](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/micro/examples/hello_world/images/STM32F746.gif)
## Table of contents
@ -18,13 +18,12 @@ animation.
- [Deploy to Arduino](#deploy-to-arduino)
- [Deploy to SparkFun Edge](#deploy-to-sparkfun-edge)
- [Deploy to STM32F746](#deploy-to-STM32F746)
- [Deploy to Adafruit devices](#deploy-to-adafruit)
- [Run the tests on a development machine](#run-the-tests-on-a-development-machine)
## Understand the model
The sample comes with a pre-trained model. The code used to train and convert
the model is available as a tutorial in [create_sine_model.ipynb](https://colab.research.google.com/github/tensorflow/tensorflow/blob/master/tensorflow/lite/experimental/micro/examples/hello_world/create_sine_model.ipynb).
the model is available as a tutorial in [create_sine_model.ipynb](https://colab.research.google.com/github/tensorflow/tensorflow/blob/master/tensorflow/lite/micro/examples/hello_world/create_sine_model.ipynb).
Walk through this tutorial to understand what the model does,
how it works, and how it was converted for use with TensorFlow Lite for
@ -35,7 +34,7 @@ Microcontrollers.
The following instructions will help you build and deploy this sample
to [Arduino](https://www.arduino.cc/) devices.
![Animation of example running on Arduino MKRZERO](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/experimental/micro/examples/hello_world/images/arduino_mkrzero.gif)
![Animation of example running on Arduino MKRZERO](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/micro/examples/hello_world/images/arduino_mkrzero.gif)
The sample has been tested with the following devices:
@ -93,14 +92,14 @@ The next steps assume that the
### Generate the examples
The example project can be generated with the following command:
```
make -f tensorflow/lite/experimental/micro/tools/make/Makefile TARGET=esp generate_hello_world_esp_project
make -f tensorflow/lite/micro/tools/make/Makefile TARGET=esp generate_hello_world_esp_project
```
### Building the example
Go the the example project directory
```
cd tensorflow/lite/experimental/micro/tools/make/gen/esp_xtensa-esp32/prj/hello_world/esp-idf
cd tensorflow/lite/micro/tools/make/gen/esp_xtensa-esp32/prj/hello_world/esp-idf
```
Then build with `idf.py`
@ -132,7 +131,7 @@ idf.py --port /dev/ttyUSB0 flash monitor
The following instructions will help you build and deploy this sample on the
[SparkFun Edge development board](https://sparkfun.com/products/15170).
![Animation of example running on SparkFun Edge](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/experimental/micro/examples/hello_world/images/sparkfun_edge.gif)
![Animation of example running on SparkFun Edge](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/micro/examples/hello_world/images/sparkfun_edge.gif)
If you're new to using this board, we recommend walking through the
[AI on a microcontroller with TensorFlow Lite and SparkFun Edge](https://codelabs.developers.google.com/codelabs/sparkfun-tensorflow)
@ -144,13 +143,13 @@ The following command will download the required dependencies and then compile a
binary for the SparkFun Edge:
```
make -f tensorflow/lite/experimental/micro/tools/make/Makefile TARGET=sparkfun_edge hello_world_bin
make -f tensorflow/lite/micro/tools/make/Makefile TARGET=sparkfun_edge hello_world_bin
```
The binary will be created in the following location:
```
tensorflow/lite/experimental/micro/tools/make/gen/sparkfun_edge_cortex-m4/bin/hello_world.bin
tensorflow/lite/micro/tools/make/gen/sparkfun_edge_cortex-m4/bin/hello_world.bin
```
### Sign the binary
@ -164,15 +163,15 @@ Enter the following command to set up some dummy cryptographic keys we can use
for development:
```
cp tensorflow/lite/experimental/micro/tools/make/downloads/AmbiqSuite-Rel2.0.0/tools/apollo3_scripts/keys_info0.py \
tensorflow/lite/experimental/micro/tools/make/downloads/AmbiqSuite-Rel2.0.0/tools/apollo3_scripts/keys_info.py
cp tensorflow/lite/micro/tools/make/downloads/AmbiqSuite-Rel2.0.0/tools/apollo3_scripts/keys_info0.py \
tensorflow/lite/micro/tools/make/downloads/AmbiqSuite-Rel2.0.0/tools/apollo3_scripts/keys_info.py
```
Next, run the following command to create a signed binary:
```
python3 tensorflow/lite/experimental/micro/tools/make/downloads/AmbiqSuite-Rel2.0.0/tools/apollo3_scripts/create_cust_image_blob.py \
--bin tensorflow/lite/experimental/micro/tools/make/gen/sparkfun_edge_cortex-m4/bin/hello_world.bin \
python3 tensorflow/lite/micro/tools/make/downloads/AmbiqSuite-Rel2.0.0/tools/apollo3_scripts/create_cust_image_blob.py \
--bin tensorflow/lite/micro/tools/make/gen/sparkfun_edge_cortex-m4/bin/hello_world.bin \
--load-address 0xC000 \
--magic-num 0xCB \
-o main_nonsecure_ota \
@ -184,7 +183,7 @@ command to create a final version of the file that can be used to flash our
device with the bootloader script we will use in the next step:
```
python3 tensorflow/lite/experimental/micro/tools/make/downloads/AmbiqSuite-Rel2.0.0/tools/apollo3_scripts/create_cust_wireupdate_blob.py \
python3 tensorflow/lite/micro/tools/make/downloads/AmbiqSuite-Rel2.0.0/tools/apollo3_scripts/create_cust_wireupdate_blob.py \
--load-address 0x20000 \
--bin main_nonsecure_ota.bin \
-i 6 \
@ -220,7 +219,7 @@ hit the button marked `RST`. Continue holding the button marked `14` while
running the following command:
```
python3 tensorflow/lite/experimental/micro/tools/make/downloads/AmbiqSuite-Rel2.0.0/tools/apollo3_scripts/uart_wired_update.py \
python3 tensorflow/lite/micro/tools/make/downloads/AmbiqSuite-Rel2.0.0/tools/apollo3_scripts/uart_wired_update.py \
-b ${BAUD_RATE} ${DEVICENAME} \
-r 1 \
-f main_nonsecure_wire.bin \
@ -272,7 +271,7 @@ The following instructions will help you build and deploy the sample to the
[STM32F7 discovery kit](https://os.mbed.com/platforms/ST-Discovery-F746NG/)
using [ARM Mbed](https://github.com/ARMmbed/mbed-cli).
![Animation of example running on STM32F746](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/experimental/micro/examples/hello_world/images/STM32F746.gif)
![Animation of example running on STM32F746](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/micro/examples/hello_world/images/STM32F746.gif)
Before we begin, you'll need the following:
@ -286,13 +285,13 @@ command to generate a subfolder containing the required source files in this
structure:
```
make -f tensorflow/lite/experimental/micro/tools/make/Makefile TARGET=mbed TAGS="CMSIS disco_f746ng" generate_hello_world_mbed_project
make -f tensorflow/lite/micro/tools/make/Makefile TARGET=mbed TAGS="CMSIS disco_f746ng" generate_hello_world_mbed_project
```
This will result in the creation of a new folder:
```
tensorflow/lite/experimental/micro/tools/make/gen/mbed_cortex-m4/prj/hello_world/mbed
tensorflow/lite/micro/tools/make/gen/mbed_cortex-m4/prj/hello_world/mbed
```
This folder contains all of the example's dependencies structured in the correct
@ -347,6 +346,11 @@ cp ./BUILD/DISCO_F746NG/GCC_ARM/mbed.bin /Volumes/DIS_F746NG/
Copying the file will initiate the flashing process. Once this is complete, you
should see an animation on the device's screen.
```
screen /dev/tty.usbmodem14403 9600
```
In addition to this animation, debug information is logged by the board while
the program is running. To view it, establish a serial connection to the board
using a baud rate of `9600`. On OSX and Linux, the following command should
@ -369,16 +373,6 @@ x_value: 1.1843798*2^2, y_value: -1.9542645*2^-1
To stop viewing the debug output with `screen`, hit `Ctrl+A`, immediately
followed by the `K` key, then hit the `Y` key.
## Deploy to Adafruit devices <a name="deploy-to-adafruit"></a>
This sample has been tested with the following Adafruit devices. To deploy to
each device, read the accompanying guide on Adafruit's website.
| Device | Guide |
|--------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------|
| [Adafruit EdgeBadge](https://www.adafruit.com/product/4400) | [TensorFlow Lite for EdgeBadge Kit Quickstart](https://learn.adafruit.com/tensorflow-lite-for-edgebadge-kit-quickstart?view=all) |
| [Adafruit TensorFlow Lite for Microcontrollers Kit](https://www.adafruit.com/product/4317) | [TensorFlow Lite for EdgeBadge Kit Quickstart](https://learn.adafruit.com/tensorflow-lite-for-edgebadge-kit-quickstart?view=all) |
### Run the tests on a development machine
To compile and test this example on a desktop Linux or macOS machine, first
@ -392,7 +386,7 @@ Next, `cd` into the source directory from a terminal, and then run the following
command:
```bash
make -f tensorflow/lite/experimental/micro/tools/make/Makefile test_hello_world_test
make -f tensorflow/lite/micro/tools/make/Makefile test_hello_world_test
```
This will take a few minutes, and downloads frameworks the code uses. Once the
@ -405,7 +399,7 @@ the trained TensorFlow model, runs some example inputs through it, and got the
expected outputs.
To understand how TensorFlow Lite does this, you can look at the source in
[hello_world_test.cc](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/experimental/micro/examples/hello_world/hello_world_test.cc).
[hello_world_test.cc](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/micro/examples/hello_world/hello_world_test.cc).
It's a fairly small amount of code that creates an interpreter, gets a handle to
a model that's been compiled into the program, and then invokes the interpreter
with the model and sample inputs.

View File

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/micro/examples/hello_world/constants.h"
#include "tensorflow/lite/micro/examples/hello_world/constants.h"
// This is tuned so that a full cycle takes ~4 seconds on an Arduino MKRZERO.
const int kInferencesPerCycle = 1000;

View File

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/micro/examples/hello_world/main_functions.h"
#include "tensorflow/lite/micro/examples/hello_world/main_functions.h"
// Arduino automatically calls the setup() and loop() functions in a sketch, so
// where other systems need their own main routine in this file, it can be left

View File

@ -13,22 +13,25 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/micro/examples/hello_world/output_handler.h"
#include "tensorflow/lite/micro/examples/hello_world/output_handler.h"
#include "Arduino.h"
#include "tensorflow/lite/experimental/micro/examples/hello_world/constants.h"
#include "tensorflow/lite/micro/examples/hello_world/constants.h"
// Adjusts brightness of an LED to represent the current y value
// The pin of the Arduino's built-in LED
int led = LED_BUILTIN;
// Track whether the function has run at least once
bool initialized = false;
// Animates a dot across the screen to represent the current x and y values
void HandleOutput(tflite::ErrorReporter* error_reporter, float x_value,
float y_value) {
// Track whether the function has run at least once
static bool is_initialized = false;
// Do this only once
if (!is_initialized) {
if (!initialized) {
// Set the LED pin to output
pinMode(LED_BUILTIN, OUTPUT);
is_initialized = true;
pinMode(led, OUTPUT);
initialized = true;
}
// Calculate the brightness of the LED such that y=-1 is fully off
@ -37,7 +40,7 @@ void HandleOutput(tflite::ErrorReporter* error_reporter, float x_value,
// Set the brightness of the LED. If the specified pin does not support PWM,
// this will result in the LED being on when y > 127, off otherwise.
analogWrite(LED_BUILTIN, brightness);
analogWrite(led, brightness);
// Log the current brightness value for display in the Arduino plotter
error_reporter->Report("%d\n", brightness);

View File

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/micro/examples/hello_world/constants.h"
#include "tensorflow/lite/micro/examples/hello_world/constants.h"
// This is a small number so that it's easy to read the logs
const int kInferencesPerCycle = 20;

View File

@ -13,8 +13,8 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_LITE_EXPERIMENTAL_MICRO_EXAMPLES_HELLO_WORLD_CONSTANTS_H_
#define TENSORFLOW_LITE_EXPERIMENTAL_MICRO_EXAMPLES_HELLO_WORLD_CONSTANTS_H_
#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_HELLO_WORLD_CONSTANTS_H_
#define TENSORFLOW_LITE_MICRO_EXAMPLES_HELLO_WORLD_CONSTANTS_H_
// This constant represents the range of x values our model was trained on,
// which is from 0 to (2 * Pi). We approximate Pi to avoid requiring additional
@ -29,4 +29,4 @@ const float kXrange = 2.f * 3.14159265359f;
// inference, this value should be defined per-device.
extern const int kInferencesPerCycle;
#endif // TENSORFLOW_LITE_EXPERIMENTAL_MICRO_EXAMPLES_HELLO_WORLD_CONSTANTS_H_
#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_HELLO_WORLD_CONSTANTS_H_

File diff suppressed because one or more lines are too long

View File

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/micro/examples/hello_world/constants.h"
#include "tensorflow/lite/micro/examples/hello_world/constants.h"
// A larger number than the default to make the animation smoother
const int kInferencesPerCycle = 70;

View File

@ -13,10 +13,10 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/micro/examples/hello_world/output_handler.h"
#include "tensorflow/lite/micro/examples/hello_world/output_handler.h"
#include "LCD_DISCO_F746NG.h"
#include "tensorflow/lite/experimental/micro/examples/hello_world/constants.h"
#include "tensorflow/lite/micro/examples/hello_world/constants.h"
// The LCD driver
LCD_DISCO_F746NG lcd;
@ -26,6 +26,8 @@ const uint32_t background_color = 0xFFF4B400; // Yellow
const uint32_t foreground_color = 0xFFDB4437; // Red
// The size of the dot we'll draw
const int dot_radius = 10;
// Track whether the function has run at least once
bool initialized = false;
// Size of the drawable area
int width;
int height;
@ -37,11 +39,8 @@ int x_increment;
// Animates a dot across the screen to represent the current x and y values
void HandleOutput(tflite::ErrorReporter* error_reporter, float x_value,
float y_value) {
// Track whether the function has run at least once
static bool is_initialized = false;
// Do this only once
if (!is_initialized) {
if (!initialized) {
// Set the background and foreground colors
lcd.Clear(background_color);
lcd.SetTextColor(foreground_color);
@ -52,9 +51,12 @@ void HandleOutput(tflite::ErrorReporter* error_reporter, float x_value,
midpoint = height / 2;
// Calculate fractional pixels per unit of x_value
x_increment = static_cast<float>(width) / kXrange;
is_initialized = true;
initialized = true;
}
// Log the current X and Y values
error_reporter->Report("x_value: %f, y_value: %f\n", x_value, y_value);
// Clear the previous drawing
lcd.Clear(background_color);
@ -75,7 +77,4 @@ void HandleOutput(tflite::ErrorReporter* error_reporter, float x_value,
// Draw the dot
lcd.FillCircle(x_pos, y_pos, dot_radius);
// Log the current X and Y values
error_reporter->Report("x_value: %f, y_value: %f\n", x_value, y_value);
}

View File

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/micro/examples/hello_world/main_functions.h"
#include "tensorflow/lite/micro/examples/hello_world/main_functions.h"
extern "C" void app_main(void) {
setup();

View File

@ -14,11 +14,11 @@ limitations under the License.
==============================================================================*/
// #include "tensorflow/lite/c/common.h"
#include "tensorflow/lite/experimental/micro/examples/hello_world/sine_model_data.h"
#include "tensorflow/lite/experimental/micro/kernels/all_ops_resolver.h"
#include "tensorflow/lite/experimental/micro/micro_error_reporter.h"
#include "tensorflow/lite/experimental/micro/micro_interpreter.h"
#include "tensorflow/lite/experimental/micro/testing/micro_test.h"
#include "tensorflow/lite/micro/examples/hello_world/sine_model_data.h"
#include "tensorflow/lite/micro/kernels/all_ops_resolver.h"
#include "tensorflow/lite/micro/micro_error_reporter.h"
#include "tensorflow/lite/micro/micro_interpreter.h"
#include "tensorflow/lite/micro/testing/micro_test.h"
#include "tensorflow/lite/schema/schema_generated.h"
#include "tensorflow/lite/version.h"
@ -44,7 +44,7 @@ TF_LITE_MICRO_TEST(LoadModelAndPerformInference) {
// Create an area of memory to use for input, output, and intermediate arrays.
// Finding the minimum value for your model may require some trial and error.
const int tensor_arena_size = 3 * 1024;
const int tensor_arena_size = 2 * 1024;
uint8_t tensor_arena[tensor_arena_size];
// Build an interpreter to run the model with
@ -88,8 +88,8 @@ TF_LITE_MICRO_TEST(LoadModelAndPerformInference) {
// Obtain the output value from the tensor
float value = output->data.f[0];
// Check that the output value is within 0.07 of the expected value
TF_LITE_MICRO_EXPECT_NEAR(0., value, 0.07);
// Check that the output value is within 0.05 of the expected value
TF_LITE_MICRO_EXPECT_NEAR(0., value, 0.05);
// Run inference on several more values and confirm the expected outputs
input->data.f[0] = 1.;
@ -97,21 +97,21 @@ TF_LITE_MICRO_TEST(LoadModelAndPerformInference) {
TF_LITE_MICRO_EXPECT_EQ(kTfLiteOk, invoke_status);
value = output->data.f[0];
TF_LITE_MICRO_EXPECT_NEAR(0.841, value, 0.07);
TF_LITE_MICRO_EXPECT_NEAR(0.841, value, 0.05);
input->data.f[0] = 3.;
invoke_status = interpreter.Invoke();
TF_LITE_MICRO_EXPECT_EQ(kTfLiteOk, invoke_status);
value = output->data.f[0];
TF_LITE_MICRO_EXPECT_NEAR(0.141, value, 0.07);
TF_LITE_MICRO_EXPECT_NEAR(0.141, value, 0.05);
input->data.f[0] = 5.;
invoke_status = interpreter.Invoke();
TF_LITE_MICRO_EXPECT_EQ(kTfLiteOk, invoke_status);
value = output->data.f[0];
TF_LITE_MICRO_EXPECT_NEAR(-0.959, value, 0.07);
TF_LITE_MICRO_EXPECT_NEAR(-0.959, value, 0.05);
}
TF_LITE_MICRO_TESTS_END

View File

Before

Width:  |  Height:  |  Size: 292 KiB

After

Width:  |  Height:  |  Size: 292 KiB

View File

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/micro/examples/magic_wand/main_functions.h"
#include "tensorflow/lite/micro/examples/hello_world/main_functions.h"
// This is the default main used on systems that have the standard C entry
// point. Other devices (for example FreeRTOS or ESP32) that have different

View File

@ -13,14 +13,14 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/micro/examples/hello_world/main_functions.h"
#include "tensorflow/lite/micro/examples/hello_world/main_functions.h"
#include "tensorflow/lite/experimental/micro/examples/hello_world/constants.h"
#include "tensorflow/lite/experimental/micro/examples/hello_world/output_handler.h"
#include "tensorflow/lite/experimental/micro/examples/hello_world/sine_model_data.h"
#include "tensorflow/lite/experimental/micro/kernels/all_ops_resolver.h"
#include "tensorflow/lite/experimental/micro/micro_error_reporter.h"
#include "tensorflow/lite/experimental/micro/micro_interpreter.h"
#include "tensorflow/lite/micro/examples/hello_world/constants.h"
#include "tensorflow/lite/micro/examples/hello_world/output_handler.h"
#include "tensorflow/lite/micro/examples/hello_world/sine_model_data.h"
#include "tensorflow/lite/micro/kernels/all_ops_resolver.h"
#include "tensorflow/lite/micro/micro_error_reporter.h"
#include "tensorflow/lite/micro/micro_interpreter.h"
#include "tensorflow/lite/schema/schema_generated.h"
#include "tensorflow/lite/version.h"

View File

@ -13,8 +13,8 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_LITE_EXPERIMENTAL_MICRO_EXAMPLES_MAGIC_WAND_MAIN_FUNCTIONS_H_
#define TENSORFLOW_LITE_EXPERIMENTAL_MICRO_EXAMPLES_MAGIC_WAND_MAIN_FUNCTIONS_H_
#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_HELLO_WORLD_MAIN_FUNCTIONS_H_
#define TENSORFLOW_LITE_MICRO_EXAMPLES_HELLO_WORLD_MAIN_FUNCTIONS_H_
// Initializes all data needed for the example. The name is important, and needs
// to be setup() for Arduino compatibility.
@ -25,4 +25,4 @@ void setup();
// compatibility.
void loop();
#endif // TENSORFLOW_LITE_EXPERIMENTAL_MICRO_EXAMPLES_MAGIC_WAND_MAIN_FUNCTIONS_H_
#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_HELLO_WORLD_MAIN_FUNCTIONS_H_

View File

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/micro/examples/hello_world/output_handler.h"
#include "tensorflow/lite/micro/examples/hello_world/output_handler.h"
void HandleOutput(tflite::ErrorReporter* error_reporter, float x_value,
float y_value) {

View File

@ -13,14 +13,14 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_LITE_EXPERIMENTAL_MICRO_EXAMPLES_HELLO_WORLD_OUTPUT_HANDLER_H_
#define TENSORFLOW_LITE_EXPERIMENTAL_MICRO_EXAMPLES_HELLO_WORLD_OUTPUT_HANDLER_H_
#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_HELLO_WORLD_OUTPUT_HANDLER_H_
#define TENSORFLOW_LITE_MICRO_EXAMPLES_HELLO_WORLD_OUTPUT_HANDLER_H_
#include "tensorflow/lite/c/common.h"
#include "tensorflow/lite/experimental/micro/micro_error_reporter.h"
#include "tensorflow/lite/micro/micro_error_reporter.h"
// Called by the main loop to produce some output based on the x and y values
void HandleOutput(tflite::ErrorReporter* error_reporter, float x_value,
float y_value);
#endif // TENSORFLOW_LITE_EXPERIMENTAL_MICRO_EXAMPLES_HELLO_WORLD_OUTPUT_HANDLER_H_
#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_HELLO_WORLD_OUTPUT_HANDLER_H_

View File

@ -13,10 +13,10 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/micro/examples/hello_world/output_handler.h"
#include "tensorflow/lite/micro/examples/hello_world/output_handler.h"
#include "tensorflow/lite/experimental/micro/testing/micro_test.h"
#include "tensorflow/lite/experimental/micro/testing/test_utils.h"
#include "tensorflow/lite/micro/testing/micro_test.h"
#include "tensorflow/lite/micro/testing/test_utils.h"
TF_LITE_MICRO_TESTS_BEGIN

View File

@ -0,0 +1,255 @@
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
// Automatically created from a TensorFlow Lite flatbuffer using the command:
// xxd -i sine_model.tflite > sine_model_data.cc
// See the README for a full description of the creation process.
#include "tensorflow/lite/micro/examples/hello_world/sine_model_data.h"
// We need to keep the data array aligned on some architectures.
#ifdef __has_attribute
#define HAVE_ATTRIBUTE(x) __has_attribute(x)
#else
#define HAVE_ATTRIBUTE(x) 0
#endif
#if HAVE_ATTRIBUTE(aligned) || (defined(__GNUC__) && !defined(__clang__))
#define DATA_ALIGN_ATTRIBUTE __attribute__((aligned(4)))
#else
#define DATA_ALIGN_ATTRIBUTE
#endif
const unsigned char g_sine_model_data[] DATA_ALIGN_ATTRIBUTE = {
0x18, 0x00, 0x00, 0x00, 0x54, 0x46, 0x4c, 0x33, 0x00, 0x00, 0x0e, 0x00,
0x18, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0c, 0x00, 0x10, 0x00, 0x14, 0x00,
0x0e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x0a, 0x00, 0x00,
0xb8, 0x05, 0x00, 0x00, 0xa0, 0x05, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x0b, 0x00, 0x00, 0x00, 0x90, 0x05, 0x00, 0x00, 0x7c, 0x05, 0x00, 0x00,
0x24, 0x05, 0x00, 0x00, 0xd4, 0x04, 0x00, 0x00, 0xc4, 0x00, 0x00, 0x00,
0x74, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00,
0x14, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x54, 0xf6, 0xff, 0xff, 0x58, 0xf6, 0xff, 0xff, 0x5c, 0xf6, 0xff, 0xff,
0x60, 0xf6, 0xff, 0xff, 0xc2, 0xfa, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00,
0x40, 0x00, 0x00, 0x00, 0x7c, 0x19, 0xa7, 0x3e, 0x99, 0x81, 0xb9, 0x3e,
0x56, 0x8b, 0x9f, 0x3e, 0x88, 0xd8, 0x12, 0xbf, 0x74, 0x10, 0x56, 0x3e,
0xfe, 0xc6, 0xdf, 0xbe, 0xf2, 0x10, 0x5a, 0xbe, 0xf0, 0xe2, 0x0a, 0xbe,
0x10, 0x5a, 0x98, 0xbe, 0xb9, 0x36, 0xce, 0x3d, 0x8f, 0x7f, 0x87, 0x3e,
0x2c, 0xb1, 0xfd, 0xbd, 0xe6, 0xa6, 0x8a, 0xbe, 0xa5, 0x3e, 0xda, 0x3e,
0x50, 0x34, 0xed, 0xbd, 0x90, 0x91, 0x69, 0xbe, 0x0e, 0xfb, 0xff, 0xff,
0x04, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x67, 0x41, 0x48, 0xbf,
0x24, 0xcd, 0xa0, 0xbe, 0xb7, 0x92, 0x0c, 0xbf, 0x00, 0x00, 0x00, 0x00,
0x98, 0xfe, 0x3c, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4a, 0x17, 0x9a, 0xbe,
0x41, 0xcb, 0xb6, 0xbe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x13, 0xd6, 0x1e, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x5a, 0xfb, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00,
0x4b, 0x98, 0xdd, 0xbd, 0x40, 0x6b, 0xcb, 0xbe, 0x36, 0x0c, 0xd4, 0x3c,
0xbd, 0x44, 0xb5, 0x3e, 0x95, 0x70, 0xe3, 0x3e, 0xe7, 0xac, 0x86, 0x3e,
0x00, 0xc4, 0x4e, 0x3d, 0x7e, 0xa6, 0x1d, 0x3e, 0xbd, 0x87, 0xbb, 0x3e,
0xb4, 0xb8, 0x09, 0xbf, 0xa1, 0x1f, 0xf8, 0xbe, 0x8d, 0x90, 0xdd, 0x3e,
0xde, 0xfa, 0x6f, 0xbe, 0xb2, 0x75, 0xe4, 0x3d, 0x6e, 0xfe, 0x36, 0x3e,
0x20, 0x18, 0xc2, 0xbe, 0x39, 0xc7, 0xfb, 0xbe, 0xfe, 0xa4, 0x30, 0xbe,
0xf7, 0x91, 0xde, 0xbe, 0xde, 0xab, 0x24, 0x3e, 0xfb, 0xbb, 0xce, 0x3e,
0xeb, 0x23, 0x80, 0xbe, 0x7b, 0x58, 0x73, 0xbe, 0x9a, 0x2e, 0x03, 0x3e,
0x10, 0x42, 0xa9, 0xbc, 0x10, 0x12, 0x64, 0xbd, 0xe3, 0x8d, 0x0c, 0x3d,
0x9e, 0x48, 0x97, 0xbe, 0x34, 0x51, 0xd4, 0xbe, 0x02, 0x3b, 0x0d, 0x3e,
0x62, 0x67, 0x89, 0xbe, 0x74, 0xdf, 0xa2, 0x3d, 0xf3, 0x25, 0xb3, 0xbe,
0xef, 0x34, 0x7b, 0x3d, 0x61, 0x70, 0xe3, 0x3d, 0xba, 0x76, 0xc0, 0xbe,
0x7d, 0xe9, 0xa7, 0x3e, 0xc3, 0xab, 0xd0, 0xbe, 0xcf, 0x7c, 0xdb, 0xbe,
0x70, 0x27, 0x9a, 0xbe, 0x98, 0xf5, 0x3c, 0xbd, 0xff, 0x4b, 0x4b, 0x3e,
0x7e, 0xa0, 0xf8, 0xbd, 0xd4, 0x6e, 0x86, 0x3d, 0x00, 0x4a, 0x07, 0x3a,
0x4c, 0x24, 0x61, 0xbe, 0x54, 0x68, 0xf7, 0xbd, 0x02, 0x3f, 0x77, 0xbe,
0x23, 0x79, 0xb3, 0x3e, 0x1c, 0x83, 0xad, 0xbd, 0xc8, 0x92, 0x8d, 0x3e,
0xa8, 0xf3, 0x15, 0xbd, 0xe6, 0x4d, 0x6c, 0x3d, 0xac, 0xe7, 0x98, 0xbe,
0x81, 0xec, 0xbd, 0x3e, 0xe2, 0x55, 0x73, 0x3e, 0xc1, 0x77, 0xc7, 0x3e,
0x6e, 0x1b, 0x5e, 0x3d, 0x27, 0x78, 0x02, 0x3f, 0xd4, 0x21, 0x90, 0x3d,
0x52, 0xdc, 0x1f, 0x3e, 0xbf, 0xda, 0x88, 0x3e, 0x80, 0x79, 0xe3, 0xbd,
0x40, 0x6f, 0x10, 0xbe, 0x20, 0x43, 0x2e, 0xbd, 0xf0, 0x76, 0xc5, 0xbd,
0xcc, 0xa0, 0x04, 0xbe, 0xf0, 0x69, 0xd7, 0xbe, 0xb1, 0xfe, 0x64, 0xbe,
0x20, 0x41, 0x84, 0xbe, 0xb2, 0xc3, 0x26, 0xbe, 0xd8, 0xf4, 0x09, 0xbe,
0x64, 0x44, 0xd1, 0x3d, 0xd5, 0xe1, 0xc8, 0xbe, 0x35, 0xbc, 0x3f, 0xbe,
0xc0, 0x94, 0x82, 0x3d, 0xdc, 0x2b, 0xb1, 0xbd, 0x02, 0xdb, 0xbf, 0xbe,
0xa5, 0x7f, 0x8a, 0x3e, 0x21, 0xb4, 0xa2, 0x3e, 0xcd, 0x86, 0x56, 0xbf,
0x9c, 0x3b, 0x76, 0xbc, 0x85, 0x6d, 0x60, 0xbf, 0x86, 0x00, 0x3c, 0xbe,
0xc1, 0x23, 0x7e, 0x3e, 0x96, 0xcd, 0x3f, 0x3e, 0x86, 0x91, 0x2d, 0x3e,
0x55, 0xef, 0x87, 0x3e, 0x7e, 0x97, 0x03, 0xbe, 0x2a, 0xcd, 0x01, 0x3e,
0x32, 0xc9, 0x8e, 0xbe, 0x72, 0x77, 0x3b, 0xbe, 0xe0, 0xa1, 0xbc, 0xbe,
0x8d, 0xb7, 0xa7, 0x3e, 0x1c, 0x05, 0x95, 0xbe, 0xf7, 0x1f, 0xbb, 0x3e,
0xc9, 0x3e, 0xd6, 0x3e, 0x80, 0x42, 0xe9, 0xbd, 0x27, 0x0c, 0xd2, 0xbe,
0x5c, 0x32, 0x34, 0xbe, 0x14, 0xcb, 0xca, 0xbd, 0xdd, 0x3a, 0x67, 0xbe,
0x1c, 0xbb, 0x8d, 0xbe, 0x91, 0xac, 0x5c, 0xbe, 0x52, 0x40, 0x6f, 0xbe,
0xd7, 0x71, 0x94, 0x3e, 0x18, 0x71, 0x09, 0xbe, 0x9b, 0x29, 0xd9, 0xbe,
0x7d, 0x66, 0xd2, 0xbe, 0x98, 0xd6, 0xb2, 0xbe, 0x00, 0xc9, 0x84, 0x3a,
0xbc, 0xda, 0xc2, 0xbd, 0x1d, 0xc2, 0x1b, 0xbf, 0xd4, 0xdd, 0x92, 0x3e,
0x07, 0x87, 0x6c, 0xbe, 0x40, 0xc2, 0x3b, 0xbe, 0xbd, 0xe2, 0x9c, 0x3e,
0x0a, 0xb5, 0xa0, 0xbe, 0xe2, 0xd5, 0x9c, 0xbe, 0x3e, 0xbb, 0x7c, 0x3e,
0x17, 0xb4, 0xcf, 0x3e, 0xd5, 0x8e, 0xc8, 0xbe, 0x7c, 0xf9, 0x5c, 0x3e,
0x80, 0xfc, 0x0d, 0x3d, 0xc5, 0xd5, 0x8b, 0x3e, 0xf5, 0x17, 0xa2, 0x3e,
0xc7, 0x60, 0x89, 0xbe, 0xec, 0x95, 0x87, 0x3d, 0x7a, 0xc2, 0x5d, 0xbf,
0x77, 0x94, 0x98, 0x3e, 0x77, 0x39, 0x07, 0xbc, 0x42, 0x29, 0x00, 0x3e,
0xaf, 0xd0, 0xa9, 0x3e, 0x31, 0x23, 0xc4, 0xbe, 0x95, 0x36, 0x5b, 0xbe,
0xc7, 0xdc, 0x83, 0xbe, 0x1e, 0x6b, 0x47, 0x3e, 0x5b, 0x24, 0x99, 0x3e,
0x99, 0x27, 0x54, 0x3e, 0xc8, 0x20, 0xdd, 0xbd, 0x5a, 0x86, 0x2f, 0x3e,
0x80, 0xf0, 0x69, 0xbe, 0x44, 0xfc, 0x84, 0xbd, 0x82, 0xa0, 0x2a, 0xbe,
0x87, 0xe6, 0x2a, 0x3e, 0xd8, 0x34, 0xae, 0x3d, 0x50, 0xbd, 0xb5, 0x3e,
0xc4, 0x8c, 0x88, 0xbe, 0xe3, 0xbc, 0xa5, 0x3e, 0xa9, 0xda, 0x9e, 0x3e,
0x3e, 0xb8, 0x23, 0xbe, 0x80, 0x90, 0x15, 0x3d, 0x97, 0x3f, 0xc3, 0x3e,
0xca, 0x5c, 0x9d, 0x3e, 0x21, 0xe8, 0xe1, 0x3e, 0xc0, 0x49, 0x01, 0xbc,
0x00, 0x0b, 0x88, 0xbd, 0x3f, 0xf7, 0xca, 0x3c, 0xfb, 0x5a, 0xb1, 0x3e,
0x60, 0xd2, 0x0d, 0x3c, 0xce, 0x23, 0x78, 0xbf, 0x8f, 0x4f, 0xb9, 0xbe,
0x69, 0x6a, 0x34, 0xbf, 0x4b, 0x5e, 0xa9, 0x3e, 0x64, 0x8c, 0xd9, 0x3e,
0x52, 0x77, 0x36, 0x3e, 0xeb, 0xaf, 0xbe, 0x3e, 0x40, 0xbe, 0x36, 0x3c,
0x08, 0x65, 0x3b, 0xbd, 0x55, 0xe0, 0x66, 0xbd, 0xd2, 0xe8, 0x9b, 0xbe,
0x86, 0xe3, 0x09, 0xbe, 0x93, 0x3d, 0xdd, 0x3e, 0x0f, 0x66, 0x18, 0x3f,
0x18, 0x05, 0x33, 0xbd, 0xde, 0x15, 0xd7, 0xbe, 0xaa, 0xcf, 0x49, 0xbe,
0xa2, 0xa5, 0x64, 0x3e, 0xe6, 0x9c, 0x42, 0xbe, 0x54, 0x42, 0xcc, 0x3d,
0xa0, 0xbd, 0x9d, 0xbe, 0xc2, 0x69, 0x48, 0x3e, 0x5b, 0x8b, 0xa2, 0xbe,
0xc0, 0x13, 0x87, 0x3d, 0x36, 0xfd, 0x69, 0x3e, 0x05, 0x86, 0x40, 0xbe,
0x1e, 0x7a, 0xce, 0xbe, 0x46, 0x13, 0xa7, 0xbe, 0x68, 0x52, 0x86, 0xbe,
0x04, 0x9e, 0x86, 0xbd, 0x8c, 0x54, 0xc1, 0x3d, 0xe0, 0x3b, 0xad, 0x3c,
0x42, 0x67, 0x85, 0xbd, 0xea, 0x97, 0x42, 0x3e, 0x6e, 0x13, 0x3b, 0xbf,
0x56, 0x5b, 0x16, 0x3e, 0xaa, 0xab, 0xdf, 0x3e, 0xc8, 0x41, 0x36, 0x3d,
0x24, 0x2d, 0x47, 0xbe, 0x77, 0xa5, 0xae, 0x3e, 0xc0, 0xc2, 0x5b, 0x3c,
0xac, 0xac, 0x4e, 0x3e, 0x99, 0xec, 0x13, 0xbe, 0xf2, 0xab, 0x73, 0x3e,
0xaa, 0xa1, 0x48, 0xbe, 0xe8, 0xd3, 0x01, 0xbe, 0x60, 0xb7, 0xc7, 0xbd,
0x64, 0x72, 0xd3, 0x3d, 0x83, 0xd3, 0x99, 0x3e, 0x0c, 0x76, 0x34, 0xbe,
0x42, 0xda, 0x0d, 0x3e, 0xfb, 0x47, 0x9a, 0x3e, 0x8b, 0xdc, 0x92, 0xbe,
0x56, 0x7f, 0x6b, 0x3e, 0x04, 0xd4, 0x88, 0xbd, 0x11, 0x9e, 0x80, 0x3e,
0x3c, 0x89, 0xff, 0x3d, 0xb3, 0x3e, 0x88, 0x3e, 0xf7, 0xf0, 0x88, 0x3e,
0x28, 0xfb, 0xc9, 0xbe, 0x53, 0x3e, 0xcf, 0x3e, 0xac, 0x75, 0xdc, 0xbe,
0xdd, 0xca, 0xd7, 0x3e, 0x01, 0x58, 0xa7, 0x3e, 0x29, 0xb8, 0x13, 0xbf,
0x76, 0x81, 0x12, 0xbc, 0x28, 0x8b, 0x16, 0xbf, 0x0e, 0xec, 0x0e, 0x3e,
0x40, 0x0a, 0xdb, 0xbd, 0x98, 0xec, 0xbf, 0xbd, 0x32, 0x55, 0x0c, 0xbe,
0xfb, 0xf9, 0xc9, 0x3e, 0x83, 0x4a, 0x6d, 0xbe, 0x76, 0x59, 0xe2, 0xbe,
0x54, 0x7d, 0x9f, 0xbb, 0x9d, 0xe8, 0x95, 0x3e, 0x5c, 0xd3, 0xd0, 0x3d,
0x19, 0x8a, 0xb0, 0x3e, 0xde, 0x6f, 0x2e, 0xbe, 0xd0, 0x16, 0x83, 0x3d,
0x9c, 0x7d, 0x11, 0xbf, 0x2b, 0xcc, 0x25, 0x3c, 0x2a, 0xa5, 0x27, 0xbe,
0x22, 0x14, 0xc7, 0xbe, 0x5e, 0x7a, 0xac, 0x3e, 0x4e, 0x41, 0x94, 0xbe,
0x5a, 0x68, 0x7b, 0x3e, 0x86, 0xfd, 0x4e, 0x3e, 0xa2, 0x56, 0x6a, 0xbe,
0xca, 0xfe, 0x81, 0xbe, 0x43, 0xc3, 0xb1, 0xbd, 0xc5, 0xb8, 0xa7, 0x3e,
0x55, 0x23, 0xcd, 0x3e, 0xaf, 0x2e, 0x76, 0x3e, 0x69, 0xa8, 0x90, 0xbe,
0x0d, 0xba, 0xb9, 0x3e, 0x66, 0xff, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00,
0x40, 0x00, 0x00, 0x00, 0x53, 0xd6, 0xe2, 0x3d, 0x66, 0xb6, 0xcc, 0x3e,
0x03, 0xe7, 0xf6, 0x3e, 0xe0, 0x28, 0x10, 0xbf, 0x00, 0x00, 0x00, 0x00,
0x3e, 0x3d, 0xb0, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x62, 0xf0, 0x77, 0x3e,
0xa6, 0x9d, 0xa4, 0x3e, 0x3a, 0x4b, 0xf3, 0xbe, 0x71, 0x9e, 0xa7, 0x3e,
0x00, 0x00, 0x00, 0x00, 0x34, 0x39, 0xa2, 0x3e, 0x00, 0x00, 0x00, 0x00,
0xcc, 0x9c, 0x4a, 0x3e, 0xab, 0x40, 0xa3, 0x3e, 0xb2, 0xff, 0xff, 0xff,
0x04, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0xb3, 0x71, 0x67, 0x3f,
0x9a, 0x7a, 0x95, 0xbf, 0xe1, 0x48, 0xe8, 0xbe, 0x8a, 0x72, 0x96, 0x3e,
0x00, 0xd2, 0xd3, 0xbb, 0x1a, 0xc5, 0xd7, 0x3f, 0xac, 0x7e, 0xc8, 0xbe,
0x90, 0xa7, 0x95, 0xbe, 0x3b, 0xd7, 0xdc, 0xbe, 0x41, 0xa8, 0x16, 0x3f,
0x50, 0x5b, 0xcb, 0x3f, 0x52, 0xb9, 0xed, 0xbe, 0x2e, 0xa7, 0xc6, 0xbe,
0xaf, 0x0f, 0x14, 0xbf, 0xb3, 0xda, 0x59, 0x3f, 0x02, 0xec, 0xd7, 0xbe,
0x00, 0x00, 0x06, 0x00, 0x08, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x66, 0x11, 0x1f, 0xbf,
0xb8, 0xfb, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x54, 0x4f, 0x43, 0x4f,
0x20, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x65, 0x64, 0x2e, 0x00,
0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x14, 0x00,
0x04, 0x00, 0x08, 0x00, 0x0c, 0x00, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00,
0xf0, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x00, 0x00, 0xd8, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00,
0x48, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xce, 0xff, 0xff, 0xff,
0x00, 0x00, 0x00, 0x08, 0x18, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x1c, 0xfc, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00,
0x14, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0c, 0x00, 0x07, 0x00, 0x10, 0x00,
0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x1c, 0x00, 0x00, 0x00,
0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xba, 0xff, 0xff, 0xff,
0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x16, 0x00, 0x00, 0x00,
0x08, 0x00, 0x0c, 0x00, 0x07, 0x00, 0x10, 0x00, 0x0e, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x08, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00,
0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x08, 0x00, 0x07, 0x00,
0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x0a, 0x00, 0x00, 0x00, 0x10, 0x03, 0x00, 0x00, 0xa4, 0x02, 0x00, 0x00,
0x40, 0x02, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0xac, 0x01, 0x00, 0x00,
0x48, 0x01, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00,
0x50, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x26, 0xfd, 0xff, 0xff,
0x3c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x18, 0xfd, 0xff, 0xff, 0x20, 0x00, 0x00, 0x00,
0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x31,
0x2f, 0x64, 0x65, 0x6e, 0x73, 0x65, 0x5f, 0x34, 0x2f, 0x4d, 0x61, 0x74,
0x4d, 0x75, 0x6c, 0x5f, 0x62, 0x69, 0x61, 0x73, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6e, 0xfd, 0xff, 0xff,
0x50, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x60, 0xfd, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00,
0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x31,
0x2f, 0x64, 0x65, 0x6e, 0x73, 0x65, 0x5f, 0x34, 0x2f, 0x4d, 0x61, 0x74,
0x4d, 0x75, 0x6c, 0x2f, 0x52, 0x65, 0x61, 0x64, 0x56, 0x61, 0x72, 0x69,
0x61, 0x62, 0x6c, 0x65, 0x4f, 0x70, 0x2f, 0x74, 0x72, 0x61, 0x6e, 0x73,
0x70, 0x6f, 0x73, 0x65, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0xce, 0xfd, 0xff, 0xff,
0x34, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0xc0, 0xfd, 0xff, 0xff, 0x19, 0x00, 0x00, 0x00,
0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x31,
0x2f, 0x64, 0x65, 0x6e, 0x73, 0x65, 0x5f, 0x33, 0x2f, 0x52, 0x65, 0x6c,
0x75, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x10, 0x00, 0x00, 0x00, 0x12, 0xfe, 0xff, 0xff, 0x3c, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x04, 0xfe, 0xff, 0xff, 0x20, 0x00, 0x00, 0x00, 0x73, 0x65, 0x71, 0x75,
0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x31, 0x2f, 0x64, 0x65, 0x6e,
0x73, 0x65, 0x5f, 0x33, 0x2f, 0x4d, 0x61, 0x74, 0x4d, 0x75, 0x6c, 0x5f,
0x62, 0x69, 0x61, 0x73, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x10, 0x00, 0x00, 0x00, 0x5a, 0xfe, 0xff, 0xff, 0x50, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x4c, 0xfe, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x73, 0x65, 0x71, 0x75,
0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x31, 0x2f, 0x64, 0x65, 0x6e,
0x73, 0x65, 0x5f, 0x33, 0x2f, 0x4d, 0x61, 0x74, 0x4d, 0x75, 0x6c, 0x2f,
0x52, 0x65, 0x61, 0x64, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65,
0x4f, 0x70, 0x2f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x73, 0x65,
0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
0x10, 0x00, 0x00, 0x00, 0xba, 0xfe, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00,
0x0a, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0xac, 0xfe, 0xff, 0xff, 0x19, 0x00, 0x00, 0x00, 0x73, 0x65, 0x71, 0x75,
0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x31, 0x2f, 0x64, 0x65, 0x6e,
0x73, 0x65, 0x5f, 0x32, 0x2f, 0x52, 0x65, 0x6c, 0x75, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
0xfe, 0xfe, 0xff, 0xff, 0x3c, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xf0, 0xfe, 0xff, 0xff,
0x20, 0x00, 0x00, 0x00, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x74, 0x69,
0x61, 0x6c, 0x5f, 0x31, 0x2f, 0x64, 0x65, 0x6e, 0x73, 0x65, 0x5f, 0x32,
0x2f, 0x4d, 0x61, 0x74, 0x4d, 0x75, 0x6c, 0x5f, 0x62, 0x69, 0x61, 0x73,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
0x46, 0xff, 0xff, 0xff, 0x50, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x38, 0xff, 0xff, 0xff,
0x34, 0x00, 0x00, 0x00, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x74, 0x69,
0x61, 0x6c, 0x5f, 0x31, 0x2f, 0x64, 0x65, 0x6e, 0x73, 0x65, 0x5f, 0x32,
0x2f, 0x4d, 0x61, 0x74, 0x4d, 0x75, 0x6c, 0x2f, 0x52, 0x65, 0x61, 0x64,
0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x4f, 0x70, 0x2f, 0x74,
0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x73, 0x65, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0xa6, 0xff, 0xff, 0xff, 0x48, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00,
0x2c, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0c, 0x00,
0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00,
0x64, 0x65, 0x6e, 0x73, 0x65, 0x5f, 0x32, 0x5f, 0x69, 0x6e, 0x70, 0x75,
0x74, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x14, 0x00, 0x04, 0x00,
0x00, 0x00, 0x08, 0x00, 0x0c, 0x00, 0x10, 0x00, 0x0e, 0x00, 0x00, 0x00,
0x28, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79,
0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0a, 0x00, 0x0c, 0x00, 0x07, 0x00, 0x00, 0x00, 0x08, 0x00,
0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x03, 0x00, 0x00, 0x00};
const int g_sine_model_data_len = 2640;

View File

@ -18,10 +18,10 @@ limitations under the License.
// don't have a file system. It was created using the command:
// xxd -i sine_model.tflite > sine_model_data.cc
#ifndef TENSORFLOW_LITE_EXPERIMENTAL_MICRO_EXAMPLES_HELLO_WORLD_SINE_MODEL_DATA_H_
#define TENSORFLOW_LITE_EXPERIMENTAL_MICRO_EXAMPLES_HELLO_WORLD_SINE_MODEL_DATA_H_
#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_HELLO_WORLD_SINE_MODEL_DATA_H_
#define TENSORFLOW_LITE_MICRO_EXAMPLES_HELLO_WORLD_SINE_MODEL_DATA_H_
extern const unsigned char g_sine_model_data[];
extern const int g_sine_model_data_len;
#endif // TENSORFLOW_LITE_EXPERIMENTAL_MICRO_EXAMPLES_HELLO_WORLD_SINE_MODEL_DATA_H_
#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_HELLO_WORLD_SINE_MODEL_DATA_H_

View File

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/micro/examples/hello_world/constants.h"
#include "tensorflow/lite/micro/examples/hello_world/constants.h"
// This is tuned so that a full cycle takes ~4 seconds on a SparkFun Edge.
const int kInferencesPerCycle = 1000;

View File

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/micro/examples/hello_world/output_handler.h"
#include "tensorflow/lite/micro/examples/hello_world/output_handler.h"
#include "am_bsp.h" // NOLINT

View File

@ -1,15 +1,15 @@
# Description:
# TensorFlow Lite for Microcontrollers "gesture recognition" example.
load(
"//tensorflow/lite/micro/testing:micro_test.bzl",
"tflite_micro_cc_test",
)
package(default_visibility = ["//visibility:public"])
licenses(["notice"]) # Apache 2.0
load(
"//tensorflow/lite/experimental/micro/testing:micro_test.bzl",
"tflite_micro_cc_test",
)
cc_library(
name = "magic_wand_model_data",
srcs = [
@ -41,10 +41,10 @@ tflite_micro_cc_test(
":magic_wand_model_data",
":sample_feature_data",
"//tensorflow/lite:schema_fbs_version",
"//tensorflow/lite/experimental/micro:micro_framework",
"//tensorflow/lite/experimental/micro/kernels:all_ops_resolver",
"//tensorflow/lite/experimental/micro/kernels:micro_ops",
"//tensorflow/lite/experimental/micro/testing:micro_test",
"//tensorflow/lite/micro:micro_framework",
"//tensorflow/lite/micro/kernels:all_ops_resolver",
"//tensorflow/lite/micro/kernels:micro_ops",
"//tensorflow/lite/micro/testing:micro_test",
"//tensorflow/lite/schema:schema_fbs",
],
)
@ -69,7 +69,7 @@ cc_library(
],
deps = [
"//tensorflow/lite/c:common",
"//tensorflow/lite/experimental/micro:micro_framework",
"//tensorflow/lite/micro:micro_framework",
],
)
@ -81,8 +81,8 @@ tflite_micro_cc_test(
deps = [
":accelerometer_handler",
"//tensorflow/lite/c:common",
"//tensorflow/lite/experimental/micro:micro_framework",
"//tensorflow/lite/experimental/micro/testing:micro_test",
"//tensorflow/lite/micro:micro_framework",
"//tensorflow/lite/micro/testing:micro_test",
],
)
@ -107,8 +107,8 @@ tflite_micro_cc_test(
deps = [
":constants",
":gesture_predictor",
"//tensorflow/lite/experimental/micro:micro_framework",
"//tensorflow/lite/experimental/micro/testing:micro_test",
"//tensorflow/lite/micro:micro_framework",
"//tensorflow/lite/micro/testing:micro_test",
],
)
@ -122,7 +122,7 @@ cc_library(
],
deps = [
"//tensorflow/lite/c:common",
"//tensorflow/lite/experimental/micro:micro_framework",
"//tensorflow/lite/micro:micro_framework",
],
)
@ -134,8 +134,8 @@ tflite_micro_cc_test(
deps = [
":output_handler",
"//tensorflow/lite/c:common",
"//tensorflow/lite/experimental/micro:micro_framework",
"//tensorflow/lite/experimental/micro/testing:micro_test",
"//tensorflow/lite/micro:micro_framework",
"//tensorflow/lite/micro/testing:micro_test",
],
)
@ -158,8 +158,8 @@ cc_binary(
":magic_wand_model_data",
":output_handler",
"//tensorflow/lite:schema_fbs_version",
"//tensorflow/lite/experimental/micro:micro_framework",
"//tensorflow/lite/experimental/micro/kernels:micro_ops",
"//tensorflow/lite/micro:micro_framework",
"//tensorflow/lite/micro/kernels:micro_ops",
"//tensorflow/lite/schema:schema_fbs",
],
)

View File

@ -0,0 +1,89 @@
ifeq ($(TARGET), sparkfun_edge)
INCLUDES += \
-I$(APOLLO3_SDK)/boards/SparkFun_TensorFlow_Apollo3_BSP/examples/example1_edge_test/src/tf_accelerometer/ \
-I$(APOLLO3_SDK)/boards/SparkFun_TensorFlow_Apollo3_BSP/examples/example1_edge_test/src/tf_adc/
THIRD_PARTY_CC_SRCS += \
$(APOLLO3_SDK)/boards/SparkFun_TensorFlow_Apollo3_BSP/examples/example1_edge_test/src/tf_accelerometer/tf_accelerometer.c \
$(APOLLO3_SDK)/boards/SparkFun_TensorFlow_Apollo3_BSP/examples/example1_edge_test/src/tf_accelerometer/lis2dh12_reg.c \
$(APOLLO3_SDK)/boards/SparkFun_TensorFlow_Apollo3_BSP/examples/example1_edge_test/src/tf_adc/tf_adc.c
THIRD_PARTY_CC_HDRS += \
$(APOLLO3_SDK)/boards/SparkFun_TensorFlow_Apollo3_BSP/examples/example1_edge_test/src/tf_accelerometer/tf_accelerometer.h \
$(APOLLO3_SDK)/boards/SparkFun_TensorFlow_Apollo3_BSP/examples/example1_edge_test/src/tf_accelerometer/lis2dh12_reg.h \
$(APOLLO3_SDK)/boards/SparkFun_TensorFlow_Apollo3_BSP/examples/example1_edge_test/src/tf_adc/tf_adc.h
endif
ACCELEROMETER_HANDLER_TEST_SRCS := \
tensorflow/lite/micro/examples/magic_wand/accelerometer_handler.cc \
tensorflow/lite/micro/examples/magic_wand/accelerometer_handler_test.cc
ACCELEROMETER_HANDLER_TEST_HDRS := \
tensorflow/lite/micro/examples/magic_wand/accelerometer_handler.h
OUTPUT_HANDLER_TEST_SRCS := \
tensorflow/lite/micro/examples/magic_wand/output_handler.cc \
tensorflow/lite/micro/examples/magic_wand/output_handler_test.cc
OUTPUT_HANDLER_TEST_HDRS := \
tensorflow/lite/micro/examples/magic_wand/output_handler.h
GESTURE_PREDICTOR_TEST_SRCS := \
tensorflow/lite/micro/examples/magic_wand/constants.cc \
tensorflow/lite/micro/examples/magic_wand/gesture_predictor.cc \
tensorflow/lite/micro/examples/magic_wand/gesture_predictor_test.cc
GESTURE_PREDICTOR_TEST_HDRS := \
tensorflow/lite/micro/examples/magic_wand/constants.h \
tensorflow/lite/micro/examples/magic_wand/gesture_predictor.h \
magic_wand_TEST_SRCS := \
tensorflow/lite/micro/examples/magic_wand/magic_wand_test.cc \
tensorflow/lite/micro/examples/magic_wand/magic_wand_model_data.cc \
tensorflow/lite/micro/examples/magic_wand/slope_micro_features_data.cc \
tensorflow/lite/micro/examples/magic_wand/ring_micro_features_data.cc
magic_wand_TEST_HDRS := \
tensorflow/lite/micro/examples/magic_wand/magic_wand_model_data.h \
tensorflow/lite/micro/examples/magic_wand/slope_micro_features_data.h \
tensorflow/lite/micro/examples/magic_wand/ring_micro_features_data.h
magic_wand_SRCS := \
tensorflow/lite/micro/examples/magic_wand/main.cc \
tensorflow/lite/micro/examples/magic_wand/main_functions.cc \
tensorflow/lite/micro/examples/magic_wand/constants.cc \
tensorflow/lite/micro/examples/magic_wand/magic_wand_model_data.cc \
tensorflow/lite/micro/examples/magic_wand/accelerometer_handler.cc \
tensorflow/lite/micro/examples/magic_wand/gesture_predictor.cc \
tensorflow/lite/micro/examples/magic_wand/output_handler.cc
magic_wand_HDRS := \
tensorflow/lite/micro/examples/magic_wand/main_functions.h \
tensorflow/lite/micro/examples/magic_wand/constants.h \
tensorflow/lite/micro/examples/magic_wand/magic_wand_model_data.h \
tensorflow/lite/micro/examples/magic_wand/accelerometer_handler.h \
tensorflow/lite/micro/examples/magic_wand/gesture_predictor.h \
tensorflow/lite/micro/examples/magic_wand/output_handler.h
#Find any platform - specific rules for this example.
include $(wildcard tensorflow/lite/micro/examples/magic_wand/*/Makefile.inc)
# Tests the accelerometer handler
$(eval $(call microlite_test,gesture_accelerometer_handler_test,\
$(ACCELEROMETER_HANDLER_TEST_SRCS),$(ACCELEROMETER_HANDLER_TEST_HDRS)))
# Tests the output handler
$(eval $(call microlite_test,gesture_output_handler_test,\
$(OUTPUT_HANDLER_TEST_SRCS),$(OUTPUT_HANDLER_TEST_HDRS)))
# Tests the gesture predictor
$(eval $(call microlite_test,gesture_predictor_test,\
$(GESTURE_PREDICTOR_TEST_SRCS),$(GESTURE_PREDICTOR_TEST_HDRS)))
# Tests loading and running the gesture recognition model
$(eval $(call microlite_test,magic_wand_test,\
$(magic_wand_TEST_SRCS),$(magic_wand_TEST_HDRS)))
# Builds a standalone binary
$(eval $(call microlite_test,magic_wand,\
$(magic_wand_SRCS),$(magic_wand_HDRS)))

View File

@ -13,7 +13,6 @@ then outputs the gesture to the serial port.
- [Getting started](#getting-started)
- [Deploy to Arduino](#deploy-to-arduino)
- [Deploy to SparkFun Edge](#deploy-to-sparkfun-edge)
- [Deploy to Adafruit devices](#deploy-to-adafruit)
- [Run the tests on a development machine](#run-the-tests-on-a-development-machine)
- [Train your own model](#train-your-own-model)
@ -29,7 +28,7 @@ The sample has been tested with the following devices:
### Install the Arduino_TensorFlowLite library
Download the current nightly build of the library:
[magic_wand.zip](https://storage.googleapis.com/tensorflow-nightly/github/tensorflow/tensorflow/lite/experimental/micro/tools/make/gen/arduino_x86_64/prj/magic_wand/magic_wand.zip)
[magic_wand.zip](https://storage.googleapis.com/tensorflow-nightly/github/tensorflow/tensorflow/lite/micro/tools/make/gen/arduino_x86_64/prj/magic_wand/magic_wand.zip)
Next, import this zip file into the Arduino Desktop IDE by going to `Sketch
->Include Library -> Add .ZIP Library...`. This example application is included
@ -160,13 +159,13 @@ codelab to get an understanding of the workflow.
Run the following command to build a binary for SparkFun Edge.
```
make -f tensorflow/lite/experimental/micro/tools/make/Makefile TARGET=sparkfun_edge magic_wand_bin
make -f tensorflow/lite/micro/tools/make/Makefile TARGET=sparkfun_edge magic_wand_bin
```
The binary will be created in the following location:
```
tensorflow/lite/experimental/micro/tools/make/gen/sparkfun_edge_cortex-m4/bin/magic_wand.bin
tensorflow/lite/micro/tools/make/gen/sparkfun_edge_cortex-m4/bin/magic_wand.bin
```
### Sign the binary
@ -180,15 +179,15 @@ Enter the following command to set up some dummy cryptographic keys we can use
for development:
```
cp tensorflow/lite/experimental/micro/tools/make/downloads/AmbiqSuite-Rel2.0.0/tools/apollo3_scripts/keys_info0.py \
tensorflow/lite/experimental/micro/tools/make/downloads/AmbiqSuite-Rel2.0.0/tools/apollo3_scripts/keys_info.py
cp tensorflow/lite/micro/tools/make/downloads/AmbiqSuite-Rel2.0.0/tools/apollo3_scripts/keys_info0.py \
tensorflow/lite/micro/tools/make/downloads/AmbiqSuite-Rel2.0.0/tools/apollo3_scripts/keys_info.py
```
Next, run the following command to create a signed binary:
```
python3 tensorflow/lite/experimental/micro/tools/make/downloads/AmbiqSuite-Rel2.0.0/tools/apollo3_scripts/create_cust_image_blob.py \
--bin tensorflow/lite/experimental/micro/tools/make/gen/sparkfun_edge_cortex-m4/bin/magic_wand.bin \
python3 tensorflow/lite/micro/tools/make/downloads/AmbiqSuite-Rel2.0.0/tools/apollo3_scripts/create_cust_image_blob.py \
--bin tensorflow/lite/micro/tools/make/gen/sparkfun_edge_cortex-m4/bin/magic_wand.bin \
--load-address 0xC000 \
--magic-num 0xCB \
-o main_nonsecure_ota \
@ -200,7 +199,7 @@ command to create a final version of the file that can be used to flash our
device with the bootloader script we will use in the next step:
```
python3 tensorflow/lite/experimental/micro/tools/make/downloads/AmbiqSuite-Rel2.0.0/tools/apollo3_scripts/create_cust_wireupdate_blob.py \
python3 tensorflow/lite/micro/tools/make/downloads/AmbiqSuite-Rel2.0.0/tools/apollo3_scripts/create_cust_wireupdate_blob.py \
--load-address 0x20000 \
--bin main_nonsecure_ota.bin \
-i 6 \
@ -238,7 +237,7 @@ hit the button marked `RST`. Continue holding the button marked `14` while
running the following command:
```
python3 tensorflow/lite/experimental/micro/tools/make/downloads/AmbiqSuite-Rel2.0.0/tools/apollo3_scripts/uart_wired_update.py \
python3 tensorflow/lite/micro/tools/make/downloads/AmbiqSuite-Rel2.0.0/tools/apollo3_scripts/uart_wired_update.py \
-b ${BAUD_RATE} ${DEVICENAME} \
-r 1 \
-f main_nonsecure_wire.bin \
@ -319,16 +318,6 @@ SLOPE:
To stop viewing the debug output with `screen`, hit `Ctrl+A`, immediately
followed by the `K` key, then hit the `Y` key.
## Deploy to Adafruit devices <a name="deploy-to-adafruit"></a>
This sample has been tested with the following Adafruit devices. To deploy to
each device, read the accompanying guide on Adafruit's website.
| Device | Guide |
|--------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------|
| [Adafruit EdgeBadge](https://www.adafruit.com/product/4400) | [TensorFlow Lite for EdgeBadge Kit Quickstart](https://learn.adafruit.com/tensorflow-lite-for-edgebadge-kit-quickstart?view=all) |
| [Adafruit TensorFlow Lite for Microcontrollers Kit](https://www.adafruit.com/product/4317) | [TensorFlow Lite for EdgeBadge Kit Quickstart](https://learn.adafruit.com/tensorflow-lite-for-edgebadge-kit-quickstart?view=all) |
## Run the tests on a development machine
To compile and test this example on a desktop Linux or macOS machine, first
@ -339,11 +328,11 @@ git clone --depth 1 https://github.com/tensorflow/tensorflow.git
```
Next, put this folder under the
tensorflow/tensorflow/lite/experimental/micro/examples/ folder, then `cd` into
tensorflow/tensorflow/lite/micro/examples/ folder, then `cd` into
the source directory from a terminal and run the following command:
```bash
make -f tensorflow/lite/experimental/micro/tools/make/Makefile test_magic_wand_test
make -f tensorflow/lite/micro/tools/make/Makefile test_magic_wand_test
```
This will take a few minutes, and downloads frameworks the code uses like
@ -357,7 +346,7 @@ the trained TensorFlow model, runs some example inputs through it, and got the
expected outputs.
To understand how TensorFlow Lite does this, you can look at the source in
[hello_world_test.cc](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/experimental/micro/examples/hello_world/hello_world_test.cc).
[hello_world_test.cc](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/micro/examples/hello_world/hello_world_test.cc).
It's a fairly small amount of code that creates an interpreter, gets a handle to
a model that's been compiled into the program, and then invokes the interpreter
with the model and sample inputs.

View File

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/micro/examples/magic_wand/accelerometer_handler.h"
#include "tensorflow/lite/micro/examples/magic_wand/accelerometer_handler.h"
int begin_index = 0;

View File

@ -13,17 +13,17 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_LITE_EXPERIMENTAL_MICRO_EXAMPLES_MAGIC_WAND_ACCELEROMETER_HANDLER_H_
#define TENSORFLOW_LITE_EXPERIMENTAL_MICRO_EXAMPLES_MAGIC_WAND_ACCELEROMETER_HANDLER_H_
#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_ACCELEROMETER_HANDLER_H_
#define TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_ACCELEROMETER_HANDLER_H_
#define kChannelNumber 3
#include "tensorflow/lite/c/common.h"
#include "tensorflow/lite/experimental/micro/micro_error_reporter.h"
#include "tensorflow/lite/micro/micro_error_reporter.h"
extern int begin_index;
extern TfLiteStatus SetupAccelerometer(tflite::ErrorReporter* error_reporter);
extern bool ReadAccelerometer(tflite::ErrorReporter* error_reporter,
float* input, int length, bool reset_buffer);
#endif // TENSORFLOW_LITE_EXPERIMENTAL_MICRO_EXAMPLES_MAGIC_WAND_ACCELEROMETER_HANDLER_H_
#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_ACCELEROMETER_HANDLER_H_

View File

@ -13,13 +13,13 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/micro/examples/magic_wand/accelerometer_handler.h"
#include "tensorflow/lite/micro/examples/magic_wand/accelerometer_handler.h"
#include <string.h>
#include "tensorflow/lite/c/common.h"
#include "tensorflow/lite/experimental/micro/micro_error_reporter.h"
#include "tensorflow/lite/experimental/micro/testing/micro_test.h"
#include "tensorflow/lite/micro/micro_error_reporter.h"
#include "tensorflow/lite/micro/testing/micro_test.h"
TF_LITE_MICRO_TESTS_BEGIN

View File

@ -0,0 +1,65 @@
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/micro/examples/magic_wand/angle_micro_features_data.h"
const int g_angle_micro_f2e59fea_nohash_1_length = 128;
const int g_angle_micro_f2e59fea_nohash_1_dim = 3;
// Raw accelerometer data with a sample rate of 25Hz
const float g_angle_micro_f2e59fea_nohash_1_data[] = {
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, -766.0, 132.0, 709.0, -751.0, 249.0, 659.0,
-714.0, 314.0, 630.0, -709.0, 244.0, 623.0, -707.0, 230.0, 659.0,
-704.0, 202.0, 748.0, -714.0, 219.0, 728.0, -722.0, 239.0, 710.0,
-744.0, 116.0, 612.0, -753.0, -49.0, 570.0, -748.0, -279.0, 527.0,
-668.0, -664.0, 592.0, -601.0, -635.0, 609.0, -509.0, -559.0, 606.0,
-286.0, -162.0, 536.0, -255.0, -144.0, 495.0, -209.0, -85.0, 495.0,
6.0, 416.0, 698.0, -33.0, 304.0, 1117.0, -82.0, 405.0, 1480.0,
-198.0, 1008.0, 1908.0, -229.0, 990.0, 1743.0, -234.0, 934.0, 1453.0,
-126.0, 838.0, 896.0, -78.0, 792.0, 911.0, -27.0, 741.0, 918.0,
114.0, 734.0, 960.0, 135.0, 613.0, 959.0, 152.0, 426.0, 1015.0,
106.0, -116.0, 1110.0, 63.0, -314.0, 1129.0, -12.0, -486.0, 1179.0,
-118.0, -656.0, 1510.0, -116.0, -558.0, 1553.0, -126.0, -361.0, 1367.0,
-222.0, -76.0, 922.0, -210.0, -26.0, 971.0, -194.0, 50.0, 1053.0,
-178.0, 72.0, 1082.0, -169.0, 100.0, 1073.0, -162.0, 133.0, 1050.0,
-156.0, 226.0, 976.0, -154.0, 323.0, 886.0, -130.0, 240.0, 1154.0,
-116.0, 124.0, 916.0, -132.0, 124.0, 937.0, -153.0, 115.0, 981.0,
-184.0, 94.0, 962.0, -177.0, 85.0, 1017.0, -173.0, 92.0, 1027.0,
-168.0, 158.0, 1110.0, -181.0, 101.0, 1030.0, -180.0, 139.0, 1054.0,
-152.0, 10.0, 1044.0, -169.0, 74.0, 1007.0,
};

View File

@ -0,0 +1,23 @@
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_ANGLE_MICRO_FEATURES_DATA_H_
#define TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_ANGLE_MICRO_FEATURES_DATA_H_
extern const int g_angle_micro_f2e59fea_nohash_1_length;
extern const int g_angle_micro_f2e59fea_nohash_1_dim;
extern const float g_angle_micro_f2e59fea_nohash_1_data[];
#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_ANGLE_MICRO_FEATURES_DATA_H_

View File

@ -13,12 +13,12 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/micro/examples/magic_wand/accelerometer_handler.h"
#include "tensorflow/lite/micro/examples/magic_wand/accelerometer_handler.h"
#include <Arduino.h>
#include <Arduino_LSM9DS1.h>
#include "tensorflow/lite/experimental/micro/examples/magic_wand/constants.h"
#include "tensorflow/lite/micro/examples/magic_wand/constants.h"
// A buffer holding the last 200 sets of 3-channel values
float save_data[600] = {0.0};

View File

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/micro/examples/magic_wand/constants.h"
#include "tensorflow/lite/micro/examples/magic_wand/constants.h"
// The number of expected consecutive inferences for each gesture type.
// Established with the Arduino Nano 33 BLE Sense.

View File

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/micro/examples/hello_world/main_functions.h"
#include "tensorflow/lite/micro/examples/hello_world/main_functions.h"
// Arduino automatically calls the setup() and loop() functions in a sketch, so
// where other systems need their own main routine in this file, it can be left

View File

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/micro/examples/magic_wand/output_handler.h"
#include "tensorflow/lite/micro/examples/magic_wand/output_handler.h"
#include "Arduino.h"

View File

@ -0,0 +1,65 @@
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/micro/examples/magic_wand/circle_micro_features_data.h"
const int g_circle_micro_f9643d42_nohash_4_length = 128;
const int g_circle_micro_f9643d42_nohash_4_dim = 3;
// Raw accelerometer data with a sample rate of 25Hz
const float g_circle_micro_f9643d42_nohash_4_data[] = {
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, -665.0, 228.0, 827.0, -680.0, 339.0, 716.0,
-680.0, 564.0, 812.0, -679.0, 552.0, 818.0, -665.0, 528.0, 751.0,
-658.0, 432.0, 618.0, -655.0, 445.0, 592.0, -667.0, 484.0, 556.0,
-684.0, 590.0, 510.0, -674.0, 672.0, 475.0, -660.0, 786.0, 390.0,
-562.0, 1124.0, 128.0, -526.0, 1140.0, 111.0, -486.0, 1044.0, 33.0,
-416.0, 652.0, -134.0, -390.0, 534.0, -143.0, -365.0, 381.0, -117.0,
-314.0, 60.0, 94.0, -322.0, 7.0, 190.0, -338.0, -95.0, 342.0,
-360.0, -106.0, 842.0, -351.0, -41.0, 965.0, -352.0, 12.0, 960.0,
-366.0, 42.0, 1124.0, -322.0, 56.0, 1178.0, -312.0, 15.0, 1338.0,
-254.0, 10.0, 1532.0, -241.0, 5.0, 1590.0, -227.0, 60.0, 1565.0,
-204.0, 282.0, 1560.0, -180.0, 262.0, 1524.0, -138.0, 385.0, 1522.0,
-84.0, 596.0, 1626.0, -55.0, 639.0, 1604.0, -19.0, 771.0, 1511.0,
16.0, 932.0, 1132.0, 15.0, 924.0, 1013.0, 1.0, 849.0, 812.0,
-88.0, 628.0, 500.0, -114.0, 609.0, 463.0, -155.0, 559.0, 382.0,
-234.0, 420.0, 278.0, -254.0, 390.0, 272.0, -327.0, 200.0, 336.0,
-558.0, -556.0, 630.0, -640.0, -607.0, 740.0, -706.0, -430.0, 868.0,
-778.0, 42.0, 1042.0, -763.0, 84.0, 973.0, -735.0, 185.0, 931.0,
-682.0, 252.0, 766.0, -673.0, 230.0, 757.0, -671.0, 218.0, 757.0,
-656.0, 222.0, 714.0, -659.0, 238.0, 746.0, -640.0, 276.0, 731.0,
-634.0, 214.0, 754.0, -637.0, 207.0, 735.0, -637.0, 194.0, 742.0,
-634.0, 248.0, 716.0, -631.0, 265.0, 697.0, -628.0, 252.0, 797.0,
-592.0, 204.0, 816.0, -618.0, 218.0, 812.0, -633.0, 231.0, 828.0,
-640.0, 222.0, 736.0, -634.0, 221.0, 787.0,
};

View File

@ -0,0 +1,23 @@
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_CIRCLE_MICRO_FEATURES_DATA_H_
#define TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_CIRCLE_MICRO_FEATURES_DATA_H_
extern const int g_circle_micro_f9643d42_nohash_4_length;
extern const int g_circle_micro_f9643d42_nohash_4_dim;
extern const float g_circle_micro_f9643d42_nohash_4_data[];
#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_CIRCLE_MICRO_FEATURES_DATA_H_

View File

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/micro/examples/magic_wand/constants.h"
#include "tensorflow/lite/micro/examples/magic_wand/constants.h"
// The number of expected consecutive inferences for each gesture type.
// These defaults were established with the SparkFun Edge board.

View File

@ -13,12 +13,12 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_LITE_EXPERIMENTAL_MICRO_EXAMPLES_MAGIC_WAND_CONSTANTS_H_
#define TENSORFLOW_LITE_EXPERIMENTAL_MICRO_EXAMPLES_MAGIC_WAND_CONSTANTS_H_
#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_CONSTANTS_H_
#define TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_CONSTANTS_H_
// The expected accelerometer data sample frequency
const float kTargetHz = 25;
// The number of expected consecutive inferences for each gesture type
extern const int kConsecutiveInferenceThresholds[3];
#endif // TENSORFLOW_LITE_EXPERIMENTAL_MICRO_EXAMPLES_MAGIC_WAND_CONSTANTS_H_
#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_CONSTANTS_H_

View File

@ -13,9 +13,9 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/micro/examples/magic_wand/gesture_predictor.h"
#include "tensorflow/lite/micro/examples/magic_wand/gesture_predictor.h"
#include "tensorflow/lite/experimental/micro/examples/magic_wand/constants.h"
#include "tensorflow/lite/micro/examples/magic_wand/constants.h"
// How many times the most recent gesture has been matched in a row
int continuous_count = 0;

View File

@ -13,9 +13,9 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_LITE_EXPERIMENTAL_MICRO_EXAMPLES_MAGIC_WAND_GESTURE_PREDICTOR_H_
#define TENSORFLOW_LITE_EXPERIMENTAL_MICRO_EXAMPLES_MAGIC_WAND_GESTURE_PREDICTOR_H_
#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_GESTURE_PREDICTOR_H_
#define TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_GESTURE_PREDICTOR_H_
extern int PredictGesture(float* output);
#endif // TENSORFLOW_LITE_EXPERIMENTAL_MICRO_EXAMPLES_MAGIC_WAND_GESTURE_PREDICTOR_H_
#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_GESTURE_PREDICTOR_H_

View File

@ -13,10 +13,10 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/micro/examples/magic_wand/gesture_predictor.h"
#include "tensorflow/lite/micro/examples/magic_wand/gesture_predictor.h"
#include "tensorflow/lite/experimental/micro/examples/magic_wand/constants.h"
#include "tensorflow/lite/experimental/micro/testing/micro_test.h"
#include "tensorflow/lite/micro/examples/magic_wand/constants.h"
#include "tensorflow/lite/micro/testing/micro_test.h"
TF_LITE_MICRO_TESTS_BEGIN

View File

@ -17,7 +17,7 @@ limitations under the License.
// xxd -i magic_wand_model.tflite > magic_wand_model_data.cc
// See the README for a full description of the creation process.
#include "tensorflow/lite/experimental/micro/examples/magic_wand/magic_wand_model_data.h"
#include "tensorflow/lite/micro/examples/magic_wand/magic_wand_model_data.h"
// We need to keep the data array aligned on some architectures.
#ifdef __has_attribute

View File

@ -18,10 +18,10 @@ limitations under the License.
// don't have a file system. It was created using the command:
// xxd -i magic_wand_model.tflite > magic_wand_model_data.cc
#ifndef TENSORFLOW_LITE_EXPERIMENTAL_MICRO_EXAMPLES_MAGIC_WAND_MAGIC_WAND_MODEL_DATA_H_
#define TENSORFLOW_LITE_EXPERIMENTAL_MICRO_EXAMPLES_MAGIC_WAND_MAGIC_WAND_MODEL_DATA_H_
#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_MAGIC_WAND_MODEL_DATA_H_
#define TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_MAGIC_WAND_MODEL_DATA_H_
extern const unsigned char g_magic_wand_model_data[];
extern const int g_magic_wand_model_data_len;
#endif // TENSORFLOW_LITE_EXPERIMENTAL_MICRO_EXAMPLES_MAGIC_WAND_MAGIC_WAND_MODEL_DATA_H_
#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_MAGIC_WAND_MODEL_DATA_H_

View File

@ -13,14 +13,14 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/micro/examples/magic_wand/magic_wand_model_data.h"
#include "tensorflow/lite/experimental/micro/examples/magic_wand/ring_micro_features_data.h"
#include "tensorflow/lite/experimental/micro/examples/magic_wand/slope_micro_features_data.h"
#include "tensorflow/lite/experimental/micro/kernels/micro_ops.h"
#include "tensorflow/lite/experimental/micro/micro_error_reporter.h"
#include "tensorflow/lite/experimental/micro/micro_interpreter.h"
#include "tensorflow/lite/experimental/micro/micro_mutable_op_resolver.h"
#include "tensorflow/lite/experimental/micro/testing/micro_test.h"
#include "tensorflow/lite/micro/examples/magic_wand/magic_wand_model_data.h"
#include "tensorflow/lite/micro/examples/magic_wand/ring_micro_features_data.h"
#include "tensorflow/lite/micro/examples/magic_wand/slope_micro_features_data.h"
#include "tensorflow/lite/micro/kernels/micro_ops.h"
#include "tensorflow/lite/micro/micro_error_reporter.h"
#include "tensorflow/lite/micro/micro_interpreter.h"
#include "tensorflow/lite/micro/micro_mutable_op_resolver.h"
#include "tensorflow/lite/micro/testing/micro_test.h"
#include "tensorflow/lite/schema/schema_generated.h"
#include "tensorflow/lite/version.h"

View File

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/micro/examples/hello_world/main_functions.h"
#include "tensorflow/lite/micro/examples/magic_wand/main_functions.h"
// This is the default main used on systems that have the standard C entry
// point. Other devices (for example FreeRTOS or ESP32) that have different

View File

@ -13,16 +13,16 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/micro/examples/magic_wand/main_functions.h"
#include "tensorflow/lite/micro/examples/magic_wand/main_functions.h"
#include "tensorflow/lite/experimental/micro/examples/magic_wand/accelerometer_handler.h"
#include "tensorflow/lite/experimental/micro/examples/magic_wand/gesture_predictor.h"
#include "tensorflow/lite/experimental/micro/examples/magic_wand/magic_wand_model_data.h"
#include "tensorflow/lite/experimental/micro/examples/magic_wand/output_handler.h"
#include "tensorflow/lite/experimental/micro/kernels/micro_ops.h"
#include "tensorflow/lite/experimental/micro/micro_error_reporter.h"
#include "tensorflow/lite/experimental/micro/micro_interpreter.h"
#include "tensorflow/lite/experimental/micro/micro_mutable_op_resolver.h"
#include "tensorflow/lite/micro/examples/magic_wand/accelerometer_handler.h"
#include "tensorflow/lite/micro/examples/magic_wand/gesture_predictor.h"
#include "tensorflow/lite/micro/examples/magic_wand/magic_wand_model_data.h"
#include "tensorflow/lite/micro/examples/magic_wand/output_handler.h"
#include "tensorflow/lite/micro/kernels/micro_ops.h"
#include "tensorflow/lite/micro/micro_error_reporter.h"
#include "tensorflow/lite/micro/micro_interpreter.h"
#include "tensorflow/lite/micro/micro_mutable_op_resolver.h"
#include "tensorflow/lite/schema/schema_generated.h"
#include "tensorflow/lite/version.h"

View File

@ -13,8 +13,8 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_LITE_EXPERIMENTAL_MICRO_EXAMPLES_HELLO_WORLD_MAIN_FUNCTIONS_H_
#define TENSORFLOW_LITE_EXPERIMENTAL_MICRO_EXAMPLES_HELLO_WORLD_MAIN_FUNCTIONS_H_
#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_MAIN_FUNCTIONS_H_
#define TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_MAIN_FUNCTIONS_H_
// Initializes all data needed for the example. The name is important, and needs
// to be setup() for Arduino compatibility.
@ -25,4 +25,4 @@ void setup();
// compatibility.
void loop();
#endif // TENSORFLOW_LITE_EXPERIMENTAL_MICRO_EXAMPLES_HELLO_WORLD_MAIN_FUNCTIONS_H_
#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_MAIN_FUNCTIONS_H_

View File

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/micro/examples/magic_wand/output_handler.h"
#include "tensorflow/lite/micro/examples/magic_wand/output_handler.h"
void HandleOutput(tflite::ErrorReporter* error_reporter, int kind) {
// light (red: wing, blue: ring, green: slope)

View File

@ -13,12 +13,12 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_LITE_EXPERIMENTAL_MICRO_EXAMPLES_MAGIC_WAND_OUTPUT_HANDLER_H_
#define TENSORFLOW_LITE_EXPERIMENTAL_MICRO_EXAMPLES_MAGIC_WAND_OUTPUT_HANDLER_H_
#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_OUTPUT_HANDLER_H_
#define TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_OUTPUT_HANDLER_H_
#include "tensorflow/lite/c/common.h"
#include "tensorflow/lite/experimental/micro/micro_error_reporter.h"
#include "tensorflow/lite/micro/micro_error_reporter.h"
void HandleOutput(tflite::ErrorReporter* error_reporter, int kind);
#endif // TENSORFLOW_LITE_EXPERIMENTAL_MICRO_EXAMPLES_MAGIC_WAND_OUTPUT_HANDLER_H_
#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_OUTPUT_HANDLER_H_

View File

@ -13,10 +13,10 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/micro/examples/magic_wand/output_handler.h"
#include "tensorflow/lite/micro/examples/magic_wand/output_handler.h"
#include "tensorflow/lite/experimental/micro/testing/micro_test.h"
#include "tensorflow/lite/experimental/micro/testing/test_utils.h"
#include "tensorflow/lite/micro/testing/micro_test.h"
#include "tensorflow/lite/micro/testing/test_utils.h"
TF_LITE_MICRO_TESTS_BEGIN

View File

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/micro/examples/magic_wand/ring_micro_features_data.h"
#include "tensorflow/lite/micro/examples/magic_wand/ring_micro_features_data.h"
const int g_ring_micro_f9643d42_nohash_4_length = 128;
const int g_ring_micro_f9643d42_nohash_4_dim = 3;

View File

@ -13,11 +13,11 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_LITE_EXPERIMENTAL_MICRO_EXAMPLES_MAGIC_WAND_RING_MICRO_FEATURES_DATA_H_
#define TENSORFLOW_LITE_EXPERIMENTAL_MICRO_EXAMPLES_MAGIC_WAND_RING_MICRO_FEATURES_DATA_H_
#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_RING_MICRO_FEATURES_DATA_H_
#define TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_RING_MICRO_FEATURES_DATA_H_
extern const int g_ring_micro_f9643d42_nohash_4_length;
extern const int g_ring_micro_f9643d42_nohash_4_dim;
extern const float g_ring_micro_f9643d42_nohash_4_data[];
#endif // TENSORFLOW_LITE_EXPERIMENTAL_MICRO_EXAMPLES_MAGIC_WAND_RING_MICRO_FEATURES_DATA_H_
#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_RING_MICRO_FEATURES_DATA_H_

View File

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/micro/examples/magic_wand/slope_micro_features_data.h"
#include "tensorflow/lite/micro/examples/magic_wand/slope_micro_features_data.h"
const int g_slope_micro_f2e59fea_nohash_1_length = 128;
const int g_slope_micro_f2e59fea_nohash_1_dim = 3;

View File

@ -13,11 +13,11 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_LITE_EXPERIMENTAL_MICRO_EXAMPLES_MAGIC_WAND_SLOPE_MICRO_FEATURES_DATA_H_
#define TENSORFLOW_LITE_EXPERIMENTAL_MICRO_EXAMPLES_MAGIC_WAND_SLOPE_MICRO_FEATURES_DATA_H_
#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_SLOPE_MICRO_FEATURES_DATA_H_
#define TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_SLOPE_MICRO_FEATURES_DATA_H_
extern const int g_slope_micro_f2e59fea_nohash_1_length;
extern const int g_slope_micro_f2e59fea_nohash_1_dim;
extern const float g_slope_micro_f2e59fea_nohash_1_data[];
#endif // TENSORFLOW_LITE_EXPERIMENTAL_MICRO_EXAMPLES_MAGIC_WAND_SLOPE_MICRO_FEATURES_DATA_H_
#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_SLOPE_MICRO_FEATURES_DATA_H_

View File

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/micro/examples/magic_wand/accelerometer_handler.h"
#include "tensorflow/lite/micro/examples/magic_wand/accelerometer_handler.h"
// These are headers from Ambiq's Apollo3 SDK.
#include "am_bsp.h" // NOLINT

View File

@ -13,13 +13,13 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/micro/examples/magic_wand/output_handler.h"
#include "tensorflow/lite/micro/examples/magic_wand/output_handler.h"
#include "tensorflow/lite/experimental/micro/tools/make/downloads/AmbiqSuite-Rel2.0.0/boards/SparkFun_TensorFlow_Apollo3_BSP/bsp/am_bsp.h"
#include "tensorflow/lite/experimental/micro/tools/make/downloads/AmbiqSuite-Rel2.0.0/boards/SparkFun_TensorFlow_Apollo3_BSP/examples/example1_edge_test/src/tf_accelerometer/tf_accelerometer.h"
#include "tensorflow/lite/experimental/micro/tools/make/downloads/AmbiqSuite-Rel2.0.0/boards/SparkFun_TensorFlow_Apollo3_BSP/examples/example1_edge_test/src/tf_adc/tf_adc.h"
#include "tensorflow/lite/experimental/micro/tools/make/downloads/AmbiqSuite-Rel2.0.0/mcu/apollo3/am_mcu_apollo.h"
#include "tensorflow/lite/experimental/micro/tools/make/downloads/AmbiqSuite-Rel2.0.0/utils/am_util.h"
#include "tensorflow/lite/micro/tools/make/downloads/AmbiqSuite-Rel2.0.0/boards/SparkFun_TensorFlow_Apollo3_BSP/bsp/am_bsp.h"
#include "tensorflow/lite/micro/tools/make/downloads/AmbiqSuite-Rel2.0.0/boards/SparkFun_TensorFlow_Apollo3_BSP/examples/example1_edge_test/src/tf_accelerometer/tf_accelerometer.h"
#include "tensorflow/lite/micro/tools/make/downloads/AmbiqSuite-Rel2.0.0/boards/SparkFun_TensorFlow_Apollo3_BSP/examples/example1_edge_test/src/tf_adc/tf_adc.h"
#include "tensorflow/lite/micro/tools/make/downloads/AmbiqSuite-Rel2.0.0/mcu/apollo3/am_mcu_apollo.h"
#include "tensorflow/lite/micro/tools/make/downloads/AmbiqSuite-Rel2.0.0/utils/am_util.h"
void HandleOutput(tflite::ErrorReporter* error_reporter, int kind) {
// The first time this method runs, set up our LEDs correctly

View File

@ -2,7 +2,7 @@
# TensorFlow Lite microcontroller example.
load(
"//tensorflow/lite/experimental/micro/testing:micro_test.bzl",
"//tensorflow/lite/micro/testing:micro_test.bzl",
"tflite_micro_cc_test",
)
@ -50,12 +50,12 @@ tflite_micro_cc_test(
],
deps = [
"//tensorflow/lite:schema_fbs_version",
"//tensorflow/lite/experimental/micro:micro_framework",
"//tensorflow/lite/experimental/micro/examples/micro_speech/micro_features:micro_features_test_data",
"//tensorflow/lite/experimental/micro/examples/micro_speech/micro_features:tiny_conv_micro_features_model_data",
"//tensorflow/lite/experimental/micro/kernels:all_ops_resolver",
"//tensorflow/lite/experimental/micro/kernels:micro_ops",
"//tensorflow/lite/experimental/micro/testing:micro_test",
"//tensorflow/lite/micro:micro_framework",
"//tensorflow/lite/micro/examples/micro_speech/micro_features:micro_features_test_data",
"//tensorflow/lite/micro/examples/micro_speech/micro_features:tiny_conv_micro_features_model_data",
"//tensorflow/lite/micro/kernels:all_ops_resolver",
"//tensorflow/lite/micro/kernels:micro_ops",
"//tensorflow/lite/micro/testing:micro_test",
"//tensorflow/lite/schema:schema_fbs",
],
)
@ -107,7 +107,7 @@ cc_library(
deps = [
":simple_model_settings",
"//tensorflow/lite/c:common",
"//tensorflow/lite/experimental/micro:micro_framework",
"//tensorflow/lite/micro:micro_framework",
],
)
@ -122,8 +122,8 @@ tflite_micro_cc_test(
":simple_features_generator_test_data",
":simple_model_settings",
"//tensorflow/lite/c:common",
"//tensorflow/lite/experimental/micro:micro_framework",
"//tensorflow/lite/experimental/micro/testing:micro_test",
"//tensorflow/lite/micro:micro_framework",
"//tensorflow/lite/micro/testing:micro_test",
],
)
@ -138,7 +138,7 @@ cc_library(
deps = [
":simple_model_settings",
"//tensorflow/lite/c:common",
"//tensorflow/lite/experimental/micro:micro_framework",
"//tensorflow/lite/micro:micro_framework",
],
)
@ -153,8 +153,8 @@ tflite_micro_cc_test(
":simple_features_generator_test_data",
":simple_model_settings",
"//tensorflow/lite/c:common",
"//tensorflow/lite/experimental/micro:micro_framework",
"//tensorflow/lite/experimental/micro/testing:micro_test",
"//tensorflow/lite/micro:micro_framework",
"//tensorflow/lite/micro/testing:micro_test",
],
)
@ -168,8 +168,8 @@ cc_library(
],
deps = [
"//tensorflow/lite/c:common",
"//tensorflow/lite/experimental/micro:micro_framework",
"//tensorflow/lite/experimental/micro/examples/micro_speech/micro_features:micro_model_settings",
"//tensorflow/lite/micro:micro_framework",
"//tensorflow/lite/micro/examples/micro_speech/micro_features:micro_model_settings",
],
)
@ -184,8 +184,8 @@ cc_library(
deps = [
":audio_large_sample_test_data",
"//tensorflow/lite/c:common",
"//tensorflow/lite/experimental/micro:micro_framework",
"//tensorflow/lite/experimental/micro/examples/micro_speech/micro_features:micro_model_settings",
"//tensorflow/lite/micro:micro_framework",
"//tensorflow/lite/micro/examples/micro_speech/micro_features:micro_model_settings",
],
)
@ -197,9 +197,9 @@ tflite_micro_cc_test(
deps = [
":audio_provider",
"//tensorflow/lite/c:common",
"//tensorflow/lite/experimental/micro:micro_framework",
"//tensorflow/lite/experimental/micro/examples/micro_speech/micro_features:micro_model_settings",
"//tensorflow/lite/experimental/micro/testing:micro_test",
"//tensorflow/lite/micro:micro_framework",
"//tensorflow/lite/micro/examples/micro_speech/micro_features:micro_model_settings",
"//tensorflow/lite/micro/testing:micro_test",
],
)
@ -212,9 +212,9 @@ tflite_micro_cc_test(
":audio_large_sample_test_data",
":audio_provider_mock",
"//tensorflow/lite/c:common",
"//tensorflow/lite/experimental/micro:micro_framework",
"//tensorflow/lite/experimental/micro/examples/micro_speech/micro_features:micro_model_settings",
"//tensorflow/lite/experimental/micro/testing:micro_test",
"//tensorflow/lite/micro:micro_framework",
"//tensorflow/lite/micro/examples/micro_speech/micro_features:micro_model_settings",
"//tensorflow/lite/micro/testing:micro_test",
],
)
@ -229,9 +229,9 @@ cc_library(
deps = [
":audio_provider",
"//tensorflow/lite/c:common",
"//tensorflow/lite/experimental/micro:micro_framework",
"//tensorflow/lite/experimental/micro/examples/micro_speech/micro_features:micro_features_generator",
"//tensorflow/lite/experimental/micro/examples/micro_speech/micro_features:micro_model_settings",
"//tensorflow/lite/micro:micro_framework",
"//tensorflow/lite/micro/examples/micro_speech/micro_features:micro_features_generator",
"//tensorflow/lite/micro/examples/micro_speech/micro_features:micro_model_settings",
],
)
@ -244,9 +244,9 @@ tflite_micro_cc_test(
":audio_provider",
":feature_provider",
"//tensorflow/lite/c:common",
"//tensorflow/lite/experimental/micro:micro_framework",
"//tensorflow/lite/experimental/micro/examples/micro_speech/micro_features:micro_model_settings",
"//tensorflow/lite/experimental/micro/testing:micro_test",
"//tensorflow/lite/micro:micro_framework",
"//tensorflow/lite/micro/examples/micro_speech/micro_features:micro_model_settings",
"//tensorflow/lite/micro/testing:micro_test",
],
)
@ -261,9 +261,9 @@ cc_library(
deps = [
":audio_provider_mock",
"//tensorflow/lite/c:common",
"//tensorflow/lite/experimental/micro:micro_framework",
"//tensorflow/lite/experimental/micro/examples/micro_speech/micro_features:micro_features_generator",
"//tensorflow/lite/experimental/micro/examples/micro_speech/micro_features:micro_model_settings",
"//tensorflow/lite/micro:micro_framework",
"//tensorflow/lite/micro/examples/micro_speech/micro_features:micro_features_generator",
"//tensorflow/lite/micro/examples/micro_speech/micro_features:micro_model_settings",
],
)
@ -275,10 +275,10 @@ tflite_micro_cc_test(
deps = [
":feature_provider_mock",
"//tensorflow/lite/c:common",
"//tensorflow/lite/experimental/micro:micro_framework",
"//tensorflow/lite/experimental/micro/examples/micro_speech/micro_features:micro_features_test_data",
"//tensorflow/lite/experimental/micro/examples/micro_speech/micro_features:micro_model_settings",
"//tensorflow/lite/experimental/micro/testing:micro_test",
"//tensorflow/lite/micro:micro_framework",
"//tensorflow/lite/micro/examples/micro_speech/micro_features:micro_features_test_data",
"//tensorflow/lite/micro/examples/micro_speech/micro_features:micro_model_settings",
"//tensorflow/lite/micro/testing:micro_test",
],
)
@ -292,8 +292,8 @@ cc_library(
],
deps = [
"//tensorflow/lite/c:common",
"//tensorflow/lite/experimental/micro:micro_framework",
"//tensorflow/lite/experimental/micro/examples/micro_speech/micro_features:micro_model_settings",
"//tensorflow/lite/micro:micro_framework",
"//tensorflow/lite/micro/examples/micro_speech/micro_features:micro_model_settings",
],
)
@ -308,8 +308,8 @@ tflite_micro_cc_test(
deps = [
":recognize_commands",
"//tensorflow/lite/c:common",
"//tensorflow/lite/experimental/micro:micro_framework",
"//tensorflow/lite/experimental/micro/testing:micro_test",
"//tensorflow/lite/micro:micro_framework",
"//tensorflow/lite/micro/testing:micro_test",
],
)
@ -323,7 +323,7 @@ cc_library(
],
deps = [
"//tensorflow/lite/c:common",
"//tensorflow/lite/experimental/micro:micro_framework",
"//tensorflow/lite/micro:micro_framework",
],
)
@ -335,8 +335,8 @@ tflite_micro_cc_test(
deps = [
":command_responder",
"//tensorflow/lite/c:common",
"//tensorflow/lite/experimental/micro:micro_framework",
"//tensorflow/lite/experimental/micro/testing:micro_test",
"//tensorflow/lite/micro:micro_framework",
"//tensorflow/lite/micro/testing:micro_test",
],
)
@ -353,10 +353,10 @@ cc_binary(
":feature_provider",
":recognize_commands",
"//tensorflow/lite:schema_fbs_version",
"//tensorflow/lite/experimental/micro:micro_framework",
"//tensorflow/lite/experimental/micro/examples/micro_speech/micro_features:micro_model_settings",
"//tensorflow/lite/experimental/micro/examples/micro_speech/micro_features:tiny_conv_micro_features_model_data",
"//tensorflow/lite/experimental/micro/kernels:micro_ops",
"//tensorflow/lite/micro:micro_framework",
"//tensorflow/lite/micro/examples/micro_speech/micro_features:micro_model_settings",
"//tensorflow/lite/micro/examples/micro_speech/micro_features:tiny_conv_micro_features_model_data",
"//tensorflow/lite/micro/kernels:micro_ops",
"//tensorflow/lite/schema:schema_fbs",
],
)
@ -374,10 +374,10 @@ cc_binary(
":feature_provider",
":recognize_commands",
"//tensorflow/lite:schema_fbs_version",
"//tensorflow/lite/experimental/micro:micro_framework",
"//tensorflow/lite/experimental/micro/examples/micro_speech/micro_features:micro_model_settings",
"//tensorflow/lite/experimental/micro/examples/micro_speech/micro_features:tiny_conv_micro_features_model_data",
"//tensorflow/lite/experimental/micro/kernels:micro_ops",
"//tensorflow/lite/micro:micro_framework",
"//tensorflow/lite/micro/examples/micro_speech/micro_features:micro_model_settings",
"//tensorflow/lite/micro/examples/micro_speech/micro_features:tiny_conv_micro_features_model_data",
"//tensorflow/lite/micro/kernels:micro_ops",
"//tensorflow/lite/schema:schema_fbs",
],
)

View File

@ -11,12 +11,12 @@ ifneq ($(filter CMSIS,$(ALL_TAGS)),)
-Ithird_party/CMSIS_ext/
CMSIS_PREPROCESSOR_SRCS := \
tensorflow/lite/experimental/micro/examples/micro_speech/CMSIS/hanning.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/CMSIS/sin_1k.cc \
tensorflow/lite/micro/examples/micro_speech/CMSIS/hanning.cc \
tensorflow/lite/micro/examples/micro_speech/CMSIS/sin_1k.cc \
CMSIS_PREPROCESSOR_HDRS := \
tensorflow/lite/experimental/micro/examples/micro_speech/CMSIS/hanning.h \
tensorflow/lite/experimental/micro/examples/micro_speech/CMSIS/sin_1k.h \
tensorflow/lite/micro/examples/micro_speech/CMSIS/hanning.h \
tensorflow/lite/micro/examples/micro_speech/CMSIS/sin_1k.h \
third_party/CMSIS_ext/README.md \
third_party/CMSIS_ext/arm_cmplx_mag_squared_q10p6.h

View File

@ -30,7 +30,7 @@ def to_cc(x, varname, directory='', scale_factor=1):
x = x.astype(int)
x = [str(v) if i % 10 != 0 else '\n ' + str(v) for i, v in enumerate(x)]
cmsis_path = 'tensorflow/lite/experimental/micro/examples/micro_speech/CMSIS'
cmsis_path = 'tensorflow/lite/micro/examples/micro_speech/CMSIS'
xstr = '#include "{}/{}.h"\n\n'.format(cmsis_path, varname)
xstr += 'const int g_{}_size = {};\n'.format(varname, len(x))
xstr += 'const int16_t g_{}[{}] = {{{}}};\n'.format(varname, len(x),
@ -42,7 +42,7 @@ def to_cc(x, varname, directory='', scale_factor=1):
def to_h(_, varname, directory=''):
"""Writes a header file for the table values."""
tf_prepend = 'TENSORFLOW_LITE_EXPERIMENTAL_MICRO_EXAMPLES_MICRO_SPEECH_'
tf_prepend = 'TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_'
xstr = '#ifndef {}{}_H_\n'.format(tf_prepend, varname.upper())
xstr += '#define {}{}_H_\n\n'.format(tf_prepend, varname.upper())
xstr += '#include <cstdint>\n\n'

View File

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/micro/examples/micro_speech/CMSIS/hanning.h"
#include "tensorflow/lite/micro/examples/micro_speech/CMSIS/hanning.h"
const int g_hanning_size = 480;
const int16_t g_hanning[480] = {

View File

@ -13,12 +13,12 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_LITE_EXPERIMENTAL_MICRO_EXAMPLES_MICRO_SPEECH_HANNING_H_
#define TENSORFLOW_LITE_EXPERIMENTAL_MICRO_EXAMPLES_MICRO_SPEECH_HANNING_H_
#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_CMSIS_HANNING_H_
#define TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_CMSIS_HANNING_H_
#include <cstdint>
extern const int g_hanning_size;
extern const int16_t g_hanning[];
#endif
#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_CMSIS_HANNING_H_

View File

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/experimental/micro/examples/micro_speech/CMSIS/sin_1k.h"
#include "tensorflow/lite/micro/examples/micro_speech/CMSIS/sin_1k.h"
const int g_sin_1k_size = 480;
const int16_t g_sin_1k[480] = {

Some files were not shown because too many files have changed in this diff Show More