Sony's Developer World forum

    • Home
    • Forum guidelines

    Upcoming maintenance 

     

    Dear Customers and Partners.

    This website will be undergoing scheduled maintenance on June 14, 2023. Please be aware there may be disruption to the developer portal website and associated services during the scheduled maintenance period.

    This upgrade is essential to ensure the continued performance, reliability, and security of Developer World.

    We apologize for any inconvenience.

     

     

    Spresense SDK - Tensorflow : Flatbuffers missing

    Spresense
    3
    24
    6636
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    This topic has been deleted. Only users with topic management privileges can see it.
    • K
      KamilTomaszewski DeveloperWorld last edited by

      @Arco

      I think the problem may be that TensorFlow doesn't support building on Mac.

      Could you please try to build this example on any target: https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/micro/examples/hello_world
      Follow the instructions from the README.

      Arco 1 Reply Last reply Reply Quote
      • Arco
        Arco @KamilTomaszewski last edited by

        @KamilTomaszewski

        I can see ( from build logs ) that tensorflow sources are build successfully. The output builds can be found in

        /spresense/externals/tensorflow/tensorflow-372e7eef27e03adabceb4c7ca41d366776573a73/tensorflow/lite/micro/tools/make/gen/spresense_cortex-m4_micro
        

        however when use this includes in my project :

        #include "tensorflow/lite/micro/all_ops_resolver.h"
        #include "tensorflow/lite/micro/micro_error_reporter.h"
        #include "tensorflow/lite/micro/micro_interpreter.h"
        #include "tensorflow/lite/schema/schema_generated.h"
        #include "tensorflow/lite/version.h"
        

        I am getting error mentioned above.

        In SDK Config I set 'Spresense SDK' -> 'Externals' -> 'Tensorflow lite micro' to 'Y'.

        Also in Makefile of my application ( command ) I set

        # C++ compiler flags
        CXXFLAGS = -std=c++11
        

        To avoid those

        error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
        #error This file requires compiler and library support \
        

        Is there anything that I forgot ? ( I don't think that problem is with TensorFlow and Mac ).

        Thanks

        frustrated. and sad.

        1 Reply Last reply Reply Quote
        • K
          KamilTomaszewski DeveloperWorld last edited by

          @Arco

          Since you are trying to recreate Tensorflow demo called :"micro_speech", can you try to run these commands:

          spresense/sdk$ make distclean
          spresense/sdk$ ./tools/config.py examples/tf_example_micro_speech
          spresense/sdk$ make
          

          This will allow you to build and run "micro_speech" demo on Spresense. Flash .spk, open nuttx shell and run this command:

          nsh> tf_example
          

          I would like to first check if you can successfully run it. Please let me know.

          Arco 1 Reply Last reply Reply Quote
          • Arco
            Arco @KamilTomaszewski last edited by Arco

            @KamilTomaszewski

            tf_example_micro_speech was successfully build -> flashed -> launched ( working correctly ) on my Spresense.

            frustrated. and sad.

            1 Reply Last reply Reply Quote
            • K
              KamilTomaszewski DeveloperWorld last edited by

              @Arco Thank you for your confirmation.

              The problem is that the compiler doesn't have the path given where the flatbuffers library is. Even if you add it, you will encounter other errors. This is because there are two build systems. The first is NuttX which has its own implementations of standard libraries. The second is TensorFlow which uses the standard libraries from the compiler. When you try to build something with TensorFlow on NuttX then you have compatibility problems with standard libraries.

              If you want to create a new application then you must include it in the TensorFlow system build. Then, in the NuttX application, call functions like in this example:
              https://github.com/sonydevworld/spresense/blob/master/examples/tf_example

              It is currently not possible to call TensorFlow functions directly from the NuttX application. This is only temporary because we are working to make it possible. This is the first SDK release that has allowed the TensorFlow examples to run on Spresense and unfortunately has some limitations.

              I am sorry for the inconvenience.
              Best Regards,
              Kamil Tomaszewski

              1 Reply Last reply Reply Quote
              • Arco
                Arco last edited by

                @KamilTomaszewski Thank for your help I own you one 🙂

                Do you think that another solutions like CircuitPython or MicroEJ would be better for using TensorFlow ?

                Thank you again

                frustrated. and sad.

                1 Reply Last reply Reply Quote
                • K
                  KamilTomaszewski DeveloperWorld last edited by

                  @Arco You're welcome. 🙂

                  Unfortunately, TensorFlow is currently only supported on the NuttX SDK.

                  Arco 1 Reply Last reply Reply Quote
                  • Arco
                    Arco @KamilTomaszewski last edited by

                    Hello @KamilTomaszewski

                    after a while I came back to this issue.
                    I tried to create new project inside of /spresense/examples (same as tf_examples). I was following whole structure of tf_examples from Makefile, Kconfig to creating configuration files in /spresense/sdk/examples/.

                    I have launched ( hlasove_povely is name of the project )

                    $ tools/config.py hlasove_povely
                    

                    and after that

                    $ make
                    

                    But I am getting this output :

                    make[6]: *** No rule to make target `context'.  Stop.
                    make[5]: *** [hlasove_povely_context] Error 2
                    make[4]: *** [../examples/_context] Error 2
                    make[3]: *** [/Users/arcius/C++/Sony-Spresense/spresense/sdk/apps/.._context] Error 2
                    make[2]: *** [context_serialize] Error 2
                    make[1]: *** [context] Error 2
                    make: *** [all] Error 2
                    

                    Am I something missing thanks

                    frustrated. and sad.

                    S 2 Replies Last reply Reply Quote
                    • Arco
                      Arco last edited by

                      Right now after calling :

                      tools/config.py hlasove_povely
                      

                      the response is :

                      make[6]: *** No rule to make target `preconfig'.  Stop.
                      make[5]: *** [Kconfig] Error 2
                      make[4]: *** [../examples/_preconfig] Error 2
                      make[3]: *** [preconfig] Error 2
                      make[2]: *** [Kconfig] Error 2
                      make[1]: *** [apps_preconfig] Error 2
                      make: *** [olddefconfig] Error 2
                      Post process failed. 512
                      Try 'make distclean' first.
                      

                      (I tried 'make distclean' but didn't help)

                      Thanks

                      frustrated. and sad.

                      1 Reply Last reply Reply Quote
                      • K
                        KamilTomaszewski DeveloperWorld last edited by

                        Hi @Arco

                        Do you include in your Makefile: include $(APPDIR)/Application.mk

                        The error could be because it is missing.

                        1 Reply Last reply Reply Quote
                        • Arco
                          Arco last edited by Arco

                          @KamilTomaszewski
                          Yes I do.

                          Makefile :

                          -include $(TOPDIR)/Make.defs
                          -include $(SDKDIR)/Make.defs
                          
                          PROGNAME = $(CONFIG_EXAMPLES_HLASOVE_POVELY_PROGNAME)
                          PRIORITY = $(CONFIG_EXAMPLES_HLASOVE_POVELY_PRIORITY)
                          STACKSIZE = $(CONFIG_EXAMPLES_HLASOVE_POVELY_STACKSIZE)
                          MODULE = $(CONFIG_EXAMPLES_HLASOVE_POVELY)
                          
                          MAINSRC = hlasove_povely_main.c
                          
                          include $(APPDIR)/Application.mk
                          

                          Make.defs :

                          ifneq ($(CONFIG_EXAMPLES_HLASOVE_POVELY),y)
                          CONFIGURED_APPS += hlasove_povely
                          endif
                          

                          Kconfig :

                          config EXAMPLES_HLASOVE_POVELY
                          	tristate "Tensorflow Example app"
                          	default n
                          	---help---
                          		Enable the NuttX command line application for executing example of
                          		Tensorflow lite micro.
                          
                          if EXAMPLES_HLASOVE_POVELY
                          
                          config EXAMPLES_HLASOVE_POVELY_PROGNAME
                          	string "Program name"
                          	default "hlasove_povely"
                          	---help---
                          		This is the name of the program that will be use when the NSH ELF
                          		program is installed.
                          
                          config EXAMPLES_HLASOVE_POVELY_PRIORITY
                          	int "hlasove_povely task priority"
                          	default 100
                          
                          config EXAMPLES_HLASOVE_POVELY_STACKSIZE
                          	int "hlasove_povely stack size"
                          	default 32768
                          
                          endif
                          

                          frustrated. and sad.

                          1 Reply Last reply Reply Quote
                          • K
                            KamilTomaszewski DeveloperWorld last edited by

                            Hi @Arco

                            Could you try to create a new example using this command:

                            sdk$ ./tools/mkcmd.py hlasove_povely

                            Arco 1 Reply Last reply Reply Quote
                            • Arco
                              Arco @KamilTomaszewski last edited by

                              @KamilTomaszewski

                              Response is :

                              hlasove_povely already exists
                              

                              frustrated. and sad.

                              1 Reply Last reply Reply Quote
                              • K
                                KamilTomaszewski DeveloperWorld last edited by

                                @Arco

                                Delete or move your old example out of sdk and create a new one using this command.

                                1 Reply Last reply Reply Quote
                                • K
                                  KamilTomaszewski DeveloperWorld last edited by

                                  @Arco Another thing I noticed in your example is incorrect code in Make.defs:

                                  ifneq ($(CONFIG_EXAMPLES_HLASOVE_POVELY),y)
                                  CONFIGURED_APPS += hlasove_povely
                                  endif
                                  

                                  It should be:

                                  ifeq ($(CONFIG_EXAMPLES_HLASOVE_POVELY),y)
                                  CONFIGURED_APPS += hlasove_povely
                                  endif
                                  

                                  ifneq -> ifeq

                                  Arco 1 Reply Last reply Reply Quote
                                  • Arco
                                    Arco @KamilTomaszewski last edited by

                                    Thanks @KamilTomaszewski, you saved me once again ! 🙂
                                    Have a nice day ! ( make is working )

                                    frustrated. and sad.

                                    1 Reply Last reply Reply Quote
                                    • S
                                      suburban-daredevil @Arco last edited by suburban-daredevil

                                      Hey @arco

                                      I am trying to create a new Tensorflow lite micro application based on image classification similar to the (/spresense/examples/tflmrt_lenet application) and deploy it on Spresense. Could you please share the steps to be followed to create the application?

                                      Any kind of help is highly appreciated

                                      Thanks in advance

                                      1 Reply Last reply Reply Quote
                                      • S
                                        suburban-daredevil @Arco last edited by

                                        @arco said in Spresense SDK - Tensorflow : Flatbuffers missing:

                                        Hello @KamilTomaszewski

                                        after a while I came back to this issue.
                                        I tried to create new project inside of /spresense/examples (same as tf_examples). I was following whole structure of tf_examples from Makefile, Kconfig to creating configuration files in /spresense/sdk/examples/.

                                        I have launched ( hlasove_povely is name of the project )

                                        $ tools/config.py hlasove_povely
                                        

                                        and after that

                                        $ make
                                        

                                        But I am getting this output :

                                        make[6]: *** No rule to make target `context'.  Stop.
                                        make[5]: *** [hlasove_povely_context] Error 2
                                        make[4]: *** [../examples/_context] Error 2
                                        make[3]: *** [/Users/arcius/C++/Sony-Spresense/spresense/sdk/apps/.._context] Error 2
                                        make[2]: *** [context_serialize] Error 2
                                        make[1]: *** [context] Error 2
                                        make: *** [all] Error 2
                                        

                                        Am I something missing thanks

                                        Can you share the structure (the make, kconfig and so on..) (or any link/resource that mentions it) that you followed (which you have mentioned here) ?

                                        Thanks

                                        1 Reply Last reply Reply Quote
                                        • First post
                                          Last post
                                        Developer World
                                        Copyright © 2021 Sony Group Corporation. All rights reserved.
                                        • Contact us
                                        • Legal