Commit Graph

5987 Commits

Author SHA1 Message Date
iabdalkader
8ee4a28327 scripts/examples: Update examples. 2024-06-28 16:32:04 +02:00
iabdalkader
40710a3573 ports/stm32: Support setting audio module samples at runtime. 2024-06-28 16:32:04 +02:00
iabdalkader
54104039b4 boards/All: Freeze the ML extension module for boards with ML support. 2024-06-28 16:32:04 +02:00
iabdalkader
b301701050 scripts/libraries: Add ML extensions module.
This module extends the built-in ML module with the Micro Speech
keyword spotter implementation.
2024-06-28 16:32:04 +02:00
iabdalkader
c7228cbb48 modules/py_tf: Refactor TensorFlow module.
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
2024-06-28 16:32:04 +02:00
iabdalkader
13c99c6332 boards/All: Optimize flash/memory usage to support the new TFLM. 2024-06-28 16:32:04 +02:00
iabdalkader
13cc273318 boards/all: Enable built-in TFLM models.
The new built-in model system allows fine-grained control over which models
get built into the firmware image. This patch enables FOMO for all boards
and audio processing models for boards with mics.
2024-06-28 16:32:04 +02:00
iabdalkader
073b161309 modules/py_image: Export py_image_type for use by other modules. 2024-06-28 16:32:04 +02:00
iabdalkader
76a17f81c9 tools/tflite2c.py: Update built-in model generator script.
Add support embedding models conditionally using the index file. Models listed
in `models/index.txt` will be generated with an enable macro, which can be defined
per board in `imlib_config.h` files. Other models in models/ will be built-in by
default.
2024-06-28 16:32:04 +02:00
iabdalkader
491fc1bd06 ports/nrf: Fix build. 2024-06-28 16:32:04 +02:00
iabdalkader
f4c91cbf6c ports/stm32: Update linker script.
Add more GC blocks, and separate the main GC heap from main memory.
2024-06-28 16:32:02 +02:00
iabdalkader
7a62df38e3 ports/stm32: Update port Makefiles to support the new TFLM. 2024-06-28 16:31:42 +02:00
iabdalkader
d51a11edbf ports/mimxrt: Update linker script.
Add more GC blocks, and separate the main GC heap from main memory.
2024-06-28 16:31:39 +02:00
iabdalkader
c79b3aecbb ports/mimxrt: Update port Makefiles to support the new TFLM. 2024-06-28 14:13:46 +02:00
iabdalkader
5e9453974e lib/tflm: Add TFLM submodule.
This submodule replaces the old libtf with a libraries built from
the TFLM upstream. The new libraries are faster and smaller than
the previous libtf.
2024-06-28 14:13:46 +02:00
iabdalkader
d1756b4b61 ports/stm32: Remove the obsolete micro speech C module.
This module no longer works with the updated TFLM since feature generation
has been removed and replaced by another audio preprocessor model. This
module will be replaced with a pure Python module or example.
2024-06-28 14:13:46 +02:00
iabdalkader
d0c85de2fe lib/libtf: Remove obsolete libtf. 2024-06-28 14:13:46 +02:00
iabdalkader
18caf947b9 ports/all: Fix RWX warning in linker scripts. 2024-06-28 14:13:46 +02:00
Ibrahim Abdelkader
235c337da0
Merge pull request #2232 from kwagyeman/kwabena/fix_cache_invalidation_issue
ports: Fix accidental CPU cache invalidation.
2024-06-28 14:09:28 +02:00
Ibrahim Abdelkader
60df3e61fc
Merge pull request #2238 from hasheddan/fix/readme-tensorflow
docs: fix misspelling of tensorflow
2024-06-22 20:05:11 +02:00
Daniel Mangum
104b189020 docs: fix misspelling of tensorflow
Fixes a typo of "TensorFlow" in the README.md.

Signed-off-by: Daniel Mangum <georgedanielmangum@gmail.com>
2024-06-22 12:00:38 -04:00
Ibrahim Abdelkader
8f1d621941
Merge pull request #2237 from openmv/gc_blocks
ports/all: Add support for additional GC blocks.
2024-06-22 17:07:07 +02:00
iabdalkader
112c753bb5 ports/stm32: Add support for additional GC blocks. 2024-06-22 17:02:53 +02:00
iabdalkader
7aa40047a7 ports/mimxrt: Add support for additional GC blocks. 2024-06-22 17:02:23 +02:00
iabdalkader
4dd63ce6e0 ports/nrf: Switch to mp_utils to initialize GC/Stack. 2024-06-22 17:02:23 +02:00
iabdalkader
df3e885d6b ports/rp2: Switch to mp_utils to initialize GC/Stack. 2024-06-22 17:02:23 +02:00
iabdalkader
79019cce0d misc: Add MicroPython GC helper functions. 2024-06-22 17:02:15 +02:00
Ibrahim Abdelkader
1c6a18dd1d
Merge pull request #2236 from kwagyeman/kwabena/improve_image
modules/py_image: Add support for turning lists/tuples into Images.
2024-06-22 16:20:38 +02:00
Kwabena W. Agyeman
7bf5b3fa7e modules/py_image: Add support for turning lists/tuples into Images. 2024-06-21 22:05:11 -07:00
Ibrahim Abdelkader
19f45a4d2b
Merge pull request #2235 from openmv/kwagyeman-kwabena/update_nms_code
modules/py_tf: Refactor TF module.
2024-06-21 10:57:58 +02:00
Kwabena W. Agyeman
7697a84e8f modules/py_tf.c: Remove old methods/functions. 2024-06-21 10:41:09 +02:00
Kwabena W. Agyeman
a4d97c5723 modules/py_tf.c: Fix bug with S128_127 scaling. 2024-06-21 10:41:09 +02:00
Kwabena W. Agyeman
3e37f46db4 modules/py_tf: Remove detect() and segment() in favor of predict(). 2024-06-21 10:41:09 +02:00
Kwabena W. Agyeman
3863c38228 modules/py_tf: Remove classification object. 2024-06-21 10:41:09 +02:00
Kwabena W. Agyeman
54e31b163b modules/py_tf: Merge model output object with model object. 2024-06-21 10:41:04 +02:00
Kwabena W. Agyeman
36610e8530 modules/py_tf: Refactor NMS code into it's own object. 2024-06-21 10:37:38 +02:00
Kwabena W. Agyeman
13ab81c0ee imlib/collections: Add support for moving items between lists. 2024-06-20 14:36:28 -07:00
Ibrahim Abdelkader
8ea5273324
Merge pull request #2233 from kwagyeman/kwabena/fix_broken_py_tf
modules/py_tf: Fix log buffer free-order.
2024-06-20 09:05:02 +02:00
Kwabena W. Agyeman
e3ceea4a6c modules/py_tf: Fix log buffer free-order. 2024-06-19 17:17:20 -07:00
Kwabena W. Agyeman
cc823e2fbb ports: Fix accidental CPU cache invalidation. 2024-06-18 22:04:31 -07:00
Ibrahim Abdelkader
df7df2ba82
Merge pull request #2231 from openmv/py_tf_clean_up_load
modules/py_tf: Refactor py_tf module.
2024-06-16 22:00:56 +02:00
iabdalkader
6c212409ce modules/py_tf: Refactor py_tf module.
- Implement log handler.
- Remove all extra load functions: load, load_builtin_model, and the newly added tf.Model(),
  now all call the same function.
- Remove module-level functions. Code should load the model first, the use model.predict().
  This is a breaking change, but loading models on the fly was never a good feature.
- Model FB memory will be free'd in finalizer. The model's fb_memory is automatically
  free'd when it's delete (i.e., del model).
2024-06-16 17:23:58 +02:00
iabdalkader
51ed29b501 lib/libtf: Update libtf. 2024-06-16 16:42:09 +02:00
Ibrahim Abdelkader
f4031ce16e
Merge pull request #2230 from openmv/root_pointer_fixes
ports/all: Root pointer fixes.
2024-06-15 14:27:51 +02:00
iabdalkader
6373e0d708 ports/stm32: Fix Audio module's root pointers. 2024-06-15 14:24:00 +02:00
iabdalkader
668959d5c0 modules/fir: Fix root pointer usage. 2024-06-15 13:32:24 +02:00
Ibrahim Abdelkader
854afd9915
Merge pull request #2227 from kwagyeman/kwabena/new_tf_method
modules/py_tf: Add generic CNN processing support.
2024-06-12 15:10:09 +02:00
Kwabena W. Agyeman
8c69b09f4f modules/py_tf: Add generic CNN processing support. 2024-06-11 22:11:32 -04:00
Ibrahim Abdelkader
8c8c7dbde1
Merge pull request #2190 from kwagyeman/kwabena/refactor_get_similarity
modules/py_image: Refactor get_similarity() to use draw_image backend.
2024-06-09 14:34:52 +02:00
Ibrahim Abdelkader
d85505cec9
Merge pull request #2225 from openmv/giga_himax
boards/ARDUINO_GIGA: Enable HIMAX sensors.
2024-05-30 20:52:51 +02:00