Skip to content

Commit 2396abd

Browse files
fredrecAdityaHPatwardhan
authored andcommitted
Fix build for ESP person detector example (#2)
1 parent 7e6a7c7 commit 2396abd

File tree

3 files changed

+33
-5
lines changed

3 files changed

+33
-5
lines changed

tensorflow/lite/micro/examples/person_detection/esp/Makefile.inc

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,27 @@ tensorflow/lite/micro/examples/person_detection/esp/app_camera_esp.c
55
ESP_PERSON_DETECTION_HDRS := \
66
tensorflow/lite/micro/examples/person_detection/esp/app_camera_esp.h
77

8-
CCFLAGS += -Wno-nonnull
9-
CXXFLAGS += -Wno-return-type -Wno-strict-aliasing
108
person_detection_SRCS += $(ESP_PERSON_DETECTION_SRCS)
119
person_detection_HDRS += $(ESP_PERSON_DETECTION_HDRS)
1210
MAIN_SRCS += $(ESP_PERSON_DETECTION_SRCS)
13-
GRAYSCALE_SRCS := tensorflow/lite/micro/tools/make/downloads/person_model_grayscale/person_detect_model_data.cc
14-
person_detection_SRCS := $(filter-out $(GRAYSCALE_SRCS), $(person_detection_SRCS))
15-
MICROLITE_CC_SRCS += $(GRAYSCALE_SRCS)
11+
12+
# ESP specific flags and files
13+
CCFLAGS += -Wno-nonnull
14+
CXXFLAGS += -Wno-return-type -Wno-strict-aliasing
15+
ESP_PROJECT_FILES += \
16+
sdkconfig.defaults \
17+
main/Kconfig.projbuild
18+
19+
# Remap downloaded model files as if they were in tensorflow/lite/micro/examples/..
20+
MODEL_DOWNLOADS_DIR := tensorflow/lite/micro/tools/make/downloads/person_model_grayscale
21+
MODEL_EXAMPLES_DIR := tensorflow/lite/micro/examples/person_detection/person_model_grayscale
22+
person_detection_SRCS := $(patsubst $(MODEL_DOWNLOADS_DIR)/%,$(MODEL_EXAMPLES_DIR)/%,$(person_detection_SRCS))
23+
24+
# Custom rule to transform downloaded model files
25+
$(PRJDIR)person_detection/esp-idf/main/person_model_grayscale/%: $(MODEL_DOWNLOADS_DIR)/%
26+
@mkdir -p $(dir $@)
27+
@python tensorflow/lite/micro/tools/make/transform_source.py \
28+
--platform=esp \
29+
--is_example_source \
30+
--source_path="$(patsubst $(MODEL_DOWNLOADS_DIR)/%,$(MODEL_EXAMPLES_DIR)/%,$<)" \
31+
< $< > $@

tensorflow/lite/micro/tools/make/helper_functions.inc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,10 @@ $(PRJDIR)$(2)/esp-idf/LICENSE: LICENSE
293293
@mkdir -p $$(dir $$@)
294294
@cp $$< $$@
295295

296+
$(PRJDIR)$(2)/esp-idf/%: tensorflow/lite/micro/examples/$(2)/esp/%
297+
@mkdir -p $$(dir $$@)
298+
@cp $$< $$@
299+
296300
$(PRJDIR)$(2)/esp-idf/main/%.cc: tensorflow/lite/micro/examples/$(2)/%.cc
297301
@mkdir -p $$(dir $$@)
298302
@python tensorflow/lite/micro/tools/make/transform_source.py \
@@ -309,6 +313,14 @@ $(PRJDIR)$(2)/esp-idf/main/%.h: tensorflow/lite/micro/examples/$(2)/%.h
309313
--source_path="$$<" \
310314
< $$< > $$@
311315

316+
$(PRJDIR)$(2)/esp-idf/main/%.h: tensorflow/lite/micro/examples/$(2)/%.h
317+
@mkdir -p $$(dir $$@)
318+
@python tensorflow/lite/micro/tools/make/transform_source.py \
319+
--platform=esp \
320+
--is_example_source \
321+
--source_path="$$<" \
322+
< $$< > $$@
323+
312324
$(PRJDIR)$(2)/esp-idf/main/%: tensorflow/lite/micro/examples/$(2)/%
313325
@mkdir -p $$(dir $$@)
314326
@cp $$< $$@

0 commit comments

Comments
 (0)