Back to Tasmota

ESP-NN

lib/libesp32_ml/tf_lite_esp32/src/esp-nn/README.md

15.4.02.7 KB
Original Source

ESP-NN

The library contains optimised NN (Neural Network) functions for various Espressif chipsets.

  • Supported platforms:

    • TensorFlow Lite Micro (TFLite Micro). Repo can be found here
  • Supported ESP chipsets include:

    • ESP32-S3 (Assembly versions optimised to benefit from vector instructions of ESP32-S3)
    • ESP32 (Generic optimisations)
    • ESP32-C3 (Generic optimisations)

Performance

Kernelwise performance for s8 versions:

  • Kernelwise performance on ESP32-S3 chip

    • Numbers are ticks taken for kernel to execute
    • Chip config: 240MHz, SPI: QPI 80MHz, Data cache: 64KB
    FunctionANSI CESP32-S3 OptOpt RatioData infoMemory
    elementwise_add320397871193.68size = 1615External
    elementwise_mul125958442392.85size = 1615External
    convolution466301242867510.88input(10,10), filter(64x1x1x64)External
    convolution301014324339.28input(8,8), filter(16x1x1x16)External
    convolution211541810209232.07input(10,10), filter(64x3x3x3)External
    depthwise conv11900622032785.85input (18, 18), pad(0,0), stride(1,1) filter: 1x3x3x16External
    depthwise conv8370721823354.59input (12, 12), pad(1,1), stride(1,1) filter: 8x5x5x4External
    max pool485714767476.33input(16,16), filter (1x3x3x16)Internal
    avg pool5414621605803.37input(16,16), filter (1x3x3x16)Internal
    fully connected1585395471.66len: 265, ch = 3Internal
    prelu (relu6)1947227347.12size, 1615Internal

Configuration

  • To configure, please use idf.py menuconfig and under ESP-NN select NN_OPTIMIZATIONS

  • There are two options presented:

    • Optimized versions
    • ANSI C
  • Default selection is for Optimized versions. For ESP32-S3, assembly versions are automatically selected, whereas for other chipsets (viz., ESP32, ESP32-C3), generic optimisations are selected.

  • For debugging purposes, you may want to select ANSI C reference versions.

Contributing

If you encounter an issue with ESP-NN, or wish to submit a feature request, please use the Issues section on the Github.

For general questions related to this library, please use the esp32.com forum.

Copyrights and License

All original source code in this repository is Copyright (C) 2020-2021 Espressif Systems. This source code is licensed under the Apache License 2.0 as described in the file LICENSE.