Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TFLu: Port TFL detection postprocess operator #43566

Merged
merged 24 commits into from Dec 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
17130a8
TFLu: Port TFL detection postprocess operator
mansnils Mar 25, 2020
a9a4c04
TFLu: detection_pp: review comments and fixes
mansnils Oct 1, 2020
02a75ae
TFLu: Add support for Renode test for Stm32f4 target
mansnils Oct 6, 2020
e51cec1
Merge remote-tracking branch origin/upstream/master
mansnils Oct 16, 2020
171fbda
TFLu: Remove support for unknown output dims for detecion_pp
mansnils Oct 16, 2020
0dae721
Merge remote-tracking branch origin/upstream/master
mansnils Nov 9, 2020
2618be9
TFlu: update detection_pp with from review comments
mansnils Nov 9, 2020
705dc54
TFLu: Fix micro_intepreter_test with ppd
mansnils Nov 11, 2020
8b6c6c8
TFLu: remove ununsed function in ppd
mansnils Nov 11, 2020
5491648
Fix a few remaining issues.
advaitjain Nov 11, 2020
aad2426
fix the char vs unsigned char discrepancy.
advaitjain Nov 12, 2020
69b5065
TFLu: Correct name of readme file
mansnils Nov 17, 2020
3965737
TFLu: fix ci_sanity test
mansnils Nov 18, 2020
6714af7
Merge remote-tracking branch 'upstream/master' into detection_postpro…
advaitjain Nov 19, 2020
b35d3ee
Fix internal errors.
advaitjain Nov 19, 2020
0bc6594
Fix ci_sanity.sh check
mansnils Nov 19, 2020
82eeda3
Merge remote-tracking branch 'upstream/master' into detection_postpro…
advaitjain Nov 24, 2020
f9bc114
Fix hello world example
mansnils Nov 24, 2020
b4c2f8c
Merge remote-tracking branch 'upstream/master' into detection_postpro…
advaitjain Nov 30, 2020
044641a
Merge remote-tracking branch 'upstream/master' into detection_postpro…
advaitjain Nov 30, 2020
f73a4d4
Merge remote-tracking branch 'upstream/master' into detection_postpro…
advaitjain Dec 1, 2020
c914fde
Merge remote-tracking branch 'upstream/master' into detection_postpro…
advaitjain Dec 2, 2020
170b7b9
Merge remote-tracking branch 'upstream/master' into detection_postpro…
advaitjain Dec 2, 2020
cb32af9
Update arena size for hello_world and small cleanup in hello_world_test.
advaitjain Dec 2, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions tensorflow/lite/micro/all_ops_resolver.cc
Expand Up @@ -29,6 +29,7 @@ AllOpsResolver::AllOpsResolver() {
AddCos();
AddDepthwiseConv2D();
AddDequantize();
AddDetectionPostprocess();
AddEqual();
AddEthosU();
AddFloor();
Expand Down
16 changes: 3 additions & 13 deletions tensorflow/lite/micro/examples/hello_world/hello_world_test.cc
Expand Up @@ -46,25 +46,15 @@ TF_LITE_MICRO_TEST(LoadModelAndPerformInference) {
// This pulls in all the operation implementations we need
tflite::AllOpsResolver resolver;

// Create an area of memory to use for input, output, and intermediate arrays.

// Minimum arena size, at the time of writing. After allocating tensors
// you can retrieve this value by invoking interpreter.arena_used_bytes().
const int model_arena_size = 754;
/* Extra headroom for model + alignment + future interpreter changes */
const int extra_arena_size = 554 + 16 + 100;
const int tensor_arena_size = model_arena_size + extra_arena_size;
uint8_t tensor_arena[tensor_arena_size];
constexpr int kTensorArenaSize = 2000;
uint8_t tensor_arena[kTensorArenaSize];

// Build an interpreter to run the model with
tflite::MicroInterpreter interpreter(
model, resolver, tensor_arena, tensor_arena_size, &micro_error_reporter);
model, resolver, tensor_arena, kTensorArenaSize, &micro_error_reporter);
// Allocate memory from the tensor_arena for the model's tensors
TF_LITE_MICRO_EXPECT_EQ(interpreter.AllocateTensors(), kTfLiteOk);

// Alert for substantial increase in arena size usage.
TF_LITE_MICRO_EXPECT_LE(interpreter.arena_used_bytes(),
model_arena_size + 100);
// Obtain a pointer to the model's input tensor
TfLiteTensor* input = interpreter.input(0);

Expand Down
8 changes: 1 addition & 7 deletions tensorflow/lite/micro/examples/hello_world/main_functions.cc
Expand Up @@ -33,13 +33,7 @@ TfLiteTensor* input = nullptr;
TfLiteTensor* output = nullptr;
int inference_count = 0;

// Create an area of memory to use for input, output, and intermediate arrays.
// Minimum arena size, at the time of writing. After allocating tensors
// you can retrieve this value by invoking interpreter.arena_used_bytes().
const int kModelArenaSize = 754;
// Extra headroom for model + alignment + future interpreter changes.
const int kExtraArenaSize = 554 + 16 + 100;
const int kTensorArenaSize = kModelArenaSize + kExtraArenaSize;
constexpr int kTensorArenaSize = 2000;
uint8_t tensor_arena[kTensorArenaSize];
} // namespace

Expand Down
28 changes: 28 additions & 0 deletions tensorflow/lite/micro/kernels/BUILD
Expand Up @@ -104,6 +104,7 @@ cc_library(
"comparisons.cc",
"concatenation.cc",
"dequantize.cc",
"detection_postprocess.cc",
"elementwise.cc",
"floor.cc",
"l2norm.cc",
Expand Down Expand Up @@ -167,6 +168,7 @@ cc_library(
"//tensorflow/lite/kernels/internal:types",
"//tensorflow/lite/micro:memory_helpers",
"//tensorflow/lite/micro:micro_utils",
"@flatbuffers",
mansnils marked this conversation as resolved.
Show resolved Hide resolved
] + select({
"//conditions:default": [],
":xtensa_hifimini": [
Expand Down Expand Up @@ -219,6 +221,32 @@ tflite_micro_cc_test(
],
)

cc_library(
name = "flexbuffers_generated_data",
srcs = [
"flexbuffers_generated_data.cc",
],
hdrs = [
"flexbuffers_generated_data.h",
],
)

tflite_micro_cc_test(
name = "detection_postprocess_test",
srcs = [
"detection_postprocess_test.cc",
],
deps = [
":flexbuffers_generated_data",
":kernel_runner",
"//tensorflow/lite/c:common",
"//tensorflow/lite/kernels/internal:tensor",
"//tensorflow/lite/micro:test_helpers",
"//tensorflow/lite/micro/testing:micro_test",
"@flatbuffers",
mansnils marked this conversation as resolved.
Show resolved Hide resolved
],
)

tflite_micro_cc_test(
name = "fully_connected_test",
srcs = [
Expand Down