nRF Connect (v1.8) Tensorflow Example cannot build

I setup the VS Code on Windows with

- nRF Connect (3.10.0) 

- nRF Connect SDK v1.8.0 with the Toolchain Manager (0.10.3)

started the blinky example (works) and then started the tensorflow zephyr/samples/modules/tflite-micro/hello_world

but it didn't work -> After I checked for similar problems I found, that tensorflow is not in the name-allowlist in west.yml.

What I tried: 

- added tensorflow to the name-allowlist in west.yml

  name-allowlist:
      - tensorflow
      - tflite-micro

- added repos in west.yml

    # Tensorflow
    - name: tensorflow
      repo-path: tensorflow
      path: modules/lib/tensorflow
      revision: dc70a45a7cc12c25726a32cd91b28be59e7bc596
      remote: zephyrproject
    - name: tflite-micro
      repo-path: tflite-micro
      path: modules/lib/tflite-micro
      revision: d30cdac11bff4df6f50bae1a14753b76bde8e4d3
      remote: zephyrproject

- run `west update`

But still the config is not working 

and I can't edit Kconfig in VSCode (value cannot be changed)

because Direct Dependencies: (=n) ?

and the build fails

Building tfliteexample
west build --build-dir c:\Nordic\test\tfliteexample\build c:\Nordic\test\tfliteexample --pristine --board nrf52840dk_nrf52840 -- -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=On -DNCS_TOOLCHAIN_VERSION:STRING="NONE" -DBOARD_ROOT:STRING="c:/Nordic/test/anotherMeshTest" -DCONFIG_DEBUG_OPTIMIZATIONS:STRING="y" -DCONFIG_DEBUG_THREAD_INFO:STRING="y" -DCONF_FILE:STRING="c:/Nordic/test/tfliteexample/prj.conf"

-- west build: generating a build system
Including boilerplate (Zephyr base): C:/Users/<username>/ncs/v1.8.0/zephyr/cmake/app/boilerplate.cmake
-- Application: C:/Nordic/test/tfliteexample
-- Zephyr version: 2.7.0 (C:/Users/<username>/ncs/v1.8.0/zephyr), build: v2.7.0-ncs1
-- Found Python3: C:/Users/<username>/ncs/v1.8.0/toolchain/opt/bin/python.exe (found suitable exact version "3.8.2") found components: Interpreter 
-- Found west (found suitable version "0.12.0", minimum required is "0.7.1")
-- Board: nrf52840dk_nrf52840
-- Cache files will be written to: C:/Users/<username>/ncs/v1.8.0/zephyr/.cache
-- Found dtc: C:/Users/<username>/ncs/v1.8.0/toolchain/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
-- Found toolchain: gnuarmemb (c:/Users/<username>/ncs/v1.8.0/toolchain/opt)
-- Found BOARD.dts: C:/Users/<username>/ncs/v1.8.0/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts
-- Generated zephyr.dts: C:/Nordic/test/tfliteexample/build/zephyr/zephyr.dts
-- Generated devicetree_unfixed.h: C:/Nordic/test/tfliteexample/build/zephyr/include/generated/devicetree_unfixed.h
-- Generated device_extern.h: C:/Nordic/test/tfliteexample/build/zephyr/include/generated/device_extern.h
-- Including generated dts.cmake file: C:/Nordic/test/tfliteexample/build/zephyr/dts.cmake
Parsing C:/Users/<username>/ncs/v1.8.0/zephyr/Kconfig
C:/Users/<username>/ncs/v1.8.0/zephyr/scripts/kconfig/kconfig.py: C:\Nordic\test\tfliteexample\build\Kconfig\Kconfig.modules:44: Could not open 'C:\Users\<username>\ncs\v1.8.0\zephyr\' (in 'osource "$(ZEPHYR_TENSORFLOW_KCONFIG)"') (ENOENT: No such file or directory)
CMake Error at C:\Users\<username>\ncs\v1.8.0\zephyr\cmake\kconfig.cmake:270 (message):
  command failed with return code: 1
Call Stack (most recent call first):
  C:\Users\<username>\ncs\v1.8.0\zephyr\cmake\app\boilerplate.cmake:546 (include)
  C:\Users\<username>\ncs\v1.8.0\zephyr\share\zephyr-package\cmake\ZephyrConfig.cmake:24 (include)
  C:\Users\<username>\ncs\v1.8.0\zephyr\share\zephyr-package\cmake\ZephyrConfig.cmake:35 (include_boilerplate)
  c:\Nordic\test\tfliteexample\build\CMakeLists.txt:3 (find_package)


-- Configuring incomplete, errors occurred!
FATAL ERROR: command exited with status 1: 'c:\Users\<username>\ncs\v1.8.0\toolchain\opt\bin\cmake.EXE' '-DWEST_PYTHON=c:\Users\<username>\ncs\v1.8.0\toolchain\opt\bin\python.exe' '-Bc:\Nordic\test\tfliteexample\build' '-Sc:\Nordic\test\tfliteexample' -GNinja -DBOARD=nrf52840dk_nrf52840 -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=On -DNCS_TOOLCHAIN_VERSION:STRING=NONE -DBOARD_ROOT:STRING=c:/Nordic/test/anotherMeshTest -DCONFIG_DEBUG_OPTIMIZATIONS:STRING=y -DCONFIG_DEBUG_THREAD_INFO:STRING=y -DCONF_FILE:STRING=c:/Nordic/test/tfliteexample/prj.conf
The terminal process terminated with exit code: 1.

  • Hi

    I assume you mean Zephyr version 3.1?

    no the "nRF Connect for Desktop". I assume it is the most recent version. 

    I would recommend you to try our Edge Impulse samples instead.

    We already have the full setup and training done on Tensorflow, also the export for tflite-micro. I assumed the example project for tensorflow would work... 

    For our project I need to run inference of a tensorflow model (already exists) within a mesh network (done with S140 softdevice). 

  • RK01 said:
    no the "nRF Connect for Desktop". I assume it is the most recent version. 

    Ah, I see. Yes that is the newest version.

    Tensorflow isn't supported on NCS right out-of-the-box unfortunately, Edge Impulse is. If you want to use Tensorflow however, I think you would have to use the upstream version of Zephyr. Take a look at this case for further details. The customer in that case is struggling with somewhat the same issue as you.

    RK01 said:
    For our project I need to run inference of a tensorflow model (already exists) within a mesh network (done with S140 softdevice). 

    Could you expand on this? Do you want to run this application on a mesh node, in a network of other nodes based on the S140 SD?

    Regards,

    Elfving

  • Tensorflow isn't supported on NCS right out-of-the-box unfortunately, Edge Impulse is. If you want to use Tensorflow however, I think you would have to use the upstream version of Zephyr. Take a look at this case for further details. The customer in that case is struggling with somewhat the same issue as you.

    OK, I suspected something like this and I alread looked at this responses. Instead of installing the upstream Zephyr and then the whole nRF stuff (mesh) stopps working I thought adding the repos to the west.yml would fix that. 

    Could you expand on this? Do you want to run this application on a mesh node, in a network of other nodes based on the S140 SD?

    We developing an application for gathering data (current, voltages, temperatur, etc. of solar panels) then running an inference on these data. Multiple of these measurement nodes are in a mesh network, where weather data, data/time are distributed to the nodes and results of the inference back to the master (and to the cloud).

    So we need bluetooth mesh and tensorflow inference on a nRF52840.

  • Hello,

    RK01 said:
    So we need bluetooth mesh and tensorflow inference on a nRF52840.

    I see. Well I should mention that Softdevice and S140 is a part of the nRF5SDK, while the support for Edge Impulse and way to get Tensorflow working is a part of the nRF Connect SDK, and they are mutually exclusive. Maybe I am misunderstanding you, but it seems to me that you should look into getting the mesh part of the application working with NCS instead of SD.

    Regards,

    Elfving

Related