Skip to content

Commit

Permalink
Test that person detection example binary can run
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 313275958
Change-Id: Ie128cccabb6e168b85920f72618530e15477a026
  • Loading branch information
petewarden authored and tensorflower-gardener committed May 26, 2020
1 parent c3ded06 commit 1de7105
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
8 changes: 8 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,14 @@ http_archive(
],
)

http_archive(
name = "person_detect_data",
sha256 = "170542270da256994ce24d1e357f6e84a54fdaf7d28ff2b74725a40b70b082cf",
urls = [
"https://storage.googleapis.com/download.tensorflow.org/data/tf_lite_micro_person_data_grayscale_2020_05_24.zip",
],
)

# Required for dependency @com_github_grpc_grpc

load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
Expand Down
8 changes: 7 additions & 1 deletion tensorflow/lite/micro/examples/person_detection/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ cc_library(
cc_library(
name = "person_detect_model_data",
srcs = [
"person_detect_model_data.cc",
"@person_detect_data//:person_detect_model_data",
],
hdrs = [
"person_detect_model_data.h",
Expand Down Expand Up @@ -118,3 +118,9 @@ cc_binary(
"//tensorflow/lite/schema:schema_fbs",
],
)

sh_test(
name = "person_detection_binary_test",
srcs = ["person_detection_binary_test.sh"],
data = [":person_detection"],
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
# Copyright 2020 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.
# ==============================================================================
#
# Bash unit tests for the example binary.

set -e

OUTPUT_LOG_FILE=${TEST_TMPDIR}/output_log.txt

# Needed for copybara compatibility.
SCRIPT_BASE_DIR=/org_"tensor"flow
${TEST_SRCDIR}${SCRIPT_BASE_DIR}/tensorflow/lite/micro/examples/person_detection/person_detection 2>&1 | head > ${OUTPUT_LOG_FILE}

if ! grep -q 'person score' ${OUTPUT_LOG_FILE}; then
echo "ERROR: Expected logs not found in output '${OUTPUT_LOG_FILE}'"
exit 1
fi

echo
echo "SUCCESS: person_detection_binary_test PASSED"

0 comments on commit 1de7105

Please sign in to comment.