Become a leader in the IoT community!

New DevHeads get a 320-point leaderboard boost when joining the DevHeads IoT Integration Community. In addition to learning and advising, active community leaders are rewarded with community recognition and free tech stuff. Start your Legendary Collaboration now!

Step 1 of 5

CREATE YOUR PROFILE *Required

Change Email
OR
Step 2 of 5

WHAT BRINGS YOU TO DEVHEADS? *Choose 1 or more

Collaboration & Work 🤝
Learn & Grow 📚
Contribute Experience & Expertise 🔧
Step 3 of 5

WHAT'S YOUR INTEREST OR EXPERTISE? *Choose 1 or more

Hardware & Design 💡
Embedded Software 💻
Edge Networking
Step 4 of 5

Personalize your profile

Step 5 of 5

Read & agree to our COMMUNITY RULES

  1. We want this server to be a welcoming space! Treat everyone with respect. Absolutely no harassment, witch hunting, sexism, racism, or hate speech will be tolerated.
  2. If you see something against the rules or something that makes you feel unsafe, let staff know by messaging @admin in the "support-tickets" tab in the Live DevChat menu.
  3. No age-restricted, obscene or NSFW content. This includes text, images, or links featuring nudity, sex, hard violence, or other graphically disturbing content.
  4. No spam. This includes DMing fellow members.
  5. You must be over the age of 18 years old to participate in our community.
  6. Our community uses Answer Overflow to index content on the web. By posting in this channel your messages will be indexed on the worldwide web to help others find answers.
  7. You agree to our Terms of Service (https://www.devheads.io/terms-of-service/) and Privacy Policy (https://www.devheads.io/privacy-policy)
By clicking "Finish", you have read and agreed to the our Terms of Service and Privacy Policy.

Has anyone used TensorFlow Lite Micro with STM32 project recently?

Has anyone used TensorFlow Lite Micro with STM32 project recently? I am trying to do it on my own but I don’t even know what to build and include in my project.There is no good documentation or tutorials for it.

  1. ZacckOsiemo#0000

    You are in luck, we have an engineering session going on with this plus you have @undefined2001 and @wafa_ath who should be very proficient at this.

  2. araki#0000

    Nice, I’ll look forward to it then. I’m doing Harvard TinyML course on edX. It’s good but they’re providing libraries to do everything in their arduino kit. I already have an STM32 board with me so I want to do it myself

  3. wafa_ath#0000

    Hi @.araki_ , can you tell more about the project you are doing

  4. undefined2001#0

    I had the same goal man

  5. araki#0000

    Hi @wafa_ath I have a trained tflite model for keyword spotting. I want to run the inference on my STM32F407 board using tflite micro. I am just learning embedded programming so I am a bit stuck on how to even go about doing this. Most tutorials are outdated. And it is now using bazel build system, am I supposed to build it as a library and link it during my stm project compilation?

  6. ZacckOsiemo#0000

    Ah, can you inlcude the lib and build it with your source? What tutorial are you using

  7. wafa_ath#0000

    So you already trained your model ?

  8. araki#0000

    yep, I have a model. I just want to know how to invoke it from an STM32 project. I’m using STM32CUBE IDE

  9. araki#0000

    I’m trying to follow one from digikey but it is outdated. It was written before tflite-micro repository got separated and the buidsystem seems to be changed too

  10. ZacckOsiemo#0000
  11. ZacckOsiemo#0000
  12. araki#0000

    https://ai.google.dev/edge/litert/microcontrollers/get_started#1_include_the_library_headers

    I was about to follow this as well. This gives information about running it but only if you follow it’s own generated structure. I’ll look into it more. Thanks for the links

  13. ZacckOsiemo#0000

    this should work as well.

  14. wafa_ath#0000

    So fter converting your model to tflite Micro, you also need to convert it to C array. you need to download the TensorFlow Lite Micro source code and integrate it into your STM32 project. see the tutorial @superbike_z sends that should work

  15. araki#0000

    yep, I seem to understand it but I just don’t know how to include the source for those header files.

    https://ai.google.dev/edge/litert/microcontrollers/library#generate_projects_for_other_platforms

    I think this should work but the problem is, there is no “generate_projects” rule in the Makefile

  16. wafa_ath#0000

    Yeah, just grab the tflite-micro source files (like the ones in micro/, schema/, and flatbuffers/include/) and drop them into your STM32 project. Make sure the include paths are set up right, and you’re good to go. Don’t worry about the generate_projects it’s not needed for STM32.

  17. araki#0000

    Ok, I think I got tflite micro integrated into my project. Now I have to actually write error free code. I can’t get the resolver working but that’s for tomorrow. I’m all out of brain juice for today 😅
    I’m new to this so I really appreciate your time and help. Thanks a lot @wafa_ath @superbike_z

  18. wafa_ath#0000

    very welcome , anytime

  19. ZacckOsiemo#0000

    can we see your code please?

  20. araki#0000

    Late reply, but I got it working using the generated file structed by the following command. It also gives example c file so I’m simply following that code.

    python3 tensorflow/lite/micro/tools/project_generation/create_tflm_tree.py \
      -e hello_world \
      -e micro_speech \
      -e person_detection \
      /tmp/tflm-tree
    

    I still have to copy paste additional folders (following the compile errors). But now I’m getting errors from the TFLite library code itself.
    0image.png

  21. ZacckOsiemo#0000

    @undefined2001 is working on this now, perhaps have a call with him.

  22. undefined2001#0

    I almost succeeded just one more step left

  23. undefined2001#0

    I hope after that we can chill

  24. undefined2001#0

    which C++ standard are you using?

CONTRIBUTE TO THIS THREAD

Browse other questions tagged 

Leaderboard

RANKED BY XP

All time
  • 1.
    Avatar
    @Nayel115
    1620 XP
  • 2.
    Avatar
    @UcGee
    650 XP
  • 3.
    Avatar
    @melta101
    600 XP
  • 4.
    Avatar
    @chitour
    600 XP
  • 5.
    Avatar
    @lifegochi
    250 XP
  • 6.
    Avatar
    @Youuce
    180 XP