mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
This patch decouples the MicroPython TF module from the TensorFlow library, allowing support for more DL/ML libraries and engines in the future. The ML backend has been completely redesigned; the model object can now be passed directly to the backend, allowing it to initialize the model internally. Additionally, the backend's state/memory is now persistent (surviving across invocations), which improves inference speed by around 20% and supports models that require persistent memory, such as LSTM. Finally, the ML module has been mostly rewritten to handle model input/output shapes and data properly, and to support models with multiple outputs
41 lines
1.1 KiB
Makefile
41 lines
1.1 KiB
Makefile
# Add OpenMV common modules.
|
|
OMV_MOD_DIR := $(USERMOD_DIR)
|
|
SRC_USERMOD += $(wildcard $(OMV_MOD_DIR)/*.c)
|
|
SRC_USERMOD_CXX += $(wildcard $(OMV_MOD_DIR)/*.cpp)
|
|
|
|
# Add OpenMV port-specific modules.
|
|
OMV_PORT_MOD_DIR := $(OMV_MOD_DIR)/../ports/$(PORT)/modules
|
|
SRC_USERMOD += $(wildcard $(OMV_PORT_MOD_DIR)/*.c)
|
|
SRC_USERMOD_CXX += $(wildcard $(OMV_PORT_MOD_DIR)/*.cpp)
|
|
|
|
# Extra module flags.
|
|
CFLAGS_USERMOD += \
|
|
-I$(OMV_MOD_DIR) \
|
|
-I$(OMV_PORT_MOD_DIR) \
|
|
-Wno-float-conversion
|
|
|
|
CXXFLAGS_USERMOD += \
|
|
$(CFLAGS_USERMOD) \
|
|
-std=c++11 \
|
|
-fno-rtti \
|
|
-fno-exceptions \
|
|
-fno-use-cxa-atexit \
|
|
-nodefaultlibs \
|
|
-fno-unwind-tables \
|
|
-fpermissive \
|
|
-fno-threadsafe-statics \
|
|
-fmessage-length=0 \
|
|
$(filter-out -std=gnu99,$(CFLAGS))
|
|
|
|
# Add CubeAI module if enabled.
|
|
ifeq ($(MICROPY_PY_CUBEAI), 1)
|
|
SRC_USERMOD += $(OMV_MOD_DIR)/../../stm32cubeai/py_st_nn.c
|
|
endif
|
|
|
|
ifeq ($(MICROPY_PY_ULAB), 1)
|
|
# NOTE: overrides USERMOD_DIR
|
|
# Workaround to build and link ulab.
|
|
USERMOD_DIR := $(USERMOD_DIR)/ulab/code
|
|
include $(USERMOD_DIR)/micropython.mk
|
|
endif
|