tflite-micro/tensorflow/lite/micro/examples/person_detection
2026-05-26 22:55:55 +00:00
..
testdata
utils Clean-up unused bzl load (#3576) 2026-05-26 22:55:55 +00:00
BUILD build(bazel): replace cc_* with tflm_cc_* in remaining TFLM code (#2768) 2024-11-15 05:08:54 +00:00
detection_responder.cc
detection_responder.h
detection_responder_test.cc [T2] Refactor Group 3 (#3370) 2026-02-03 17:28:07 +00:00
image_provider.cc
image_provider.h
image_provider_test.cc [T2] Refactor Group 3 (#3370) 2026-02-03 17:28:07 +00:00
main.cc
main_functions.cc
main_functions.h
Makefile.inc
model_settings.cc
model_settings.h
person_detection_binary_test.sh Clean-up shebang (#3356) 2026-01-26 14:07:28 -08:00
person_detection_test.cc [T2] Refactor Group 3 (#3370) 2026-02-03 17:28:07 +00:00
README.md
training_a_model.md

Person detection example

This example shows how you can use Tensorflow Lite to run a 250 kilobyte neural network to recognize people in images.

Table of contents

Run the tests on a development machine

make -f tensorflow/lite/micro/tools/make/Makefile third_party_downloads
make -f tensorflow/lite/micro/tools/make/Makefile test_person_detection_test

You should see a series of files get compiled, followed by some logging output from a test, which should conclude with ~~~ALL TESTS PASSED~~~. If you see this, it means that a small program has been built and run that loads a trained TensorFlow model, runs some example images through it, and got the expected outputs. This particular test runs images with a and without a person in them, and checks that the network correctly identifies them.

To understand how TensorFlow Lite does this, you can look at person_detection_test.cc.

Additional makefile targets

make -f tensorflow/lite/micro/tools/make/Makefile person_detection
make -f tensorflow/lite/micro/tools/make/Makefile person_detection_bin
make -f tensorflow/lite/micro/tools/make/Makefile run_person_detection

The run_person_detection target will produce continuous output similar to the following:

person score:-72 no person score 72

Training your own model

You can train your own model with some easy-to-use scripts. See training_a_model.md for instructions.