Skip to content

maximilianfeldthusen/MicroControllerC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 

Repository files navigation

Documentation

MicroControllerC

Explanation

Example in C that uses TensorFlow Lite for Microcontrollers to run a simple CNN model for image classification on an embedded system. (Keep in mind that you'll need to supply the actual model data via the cnn_model_data.h header, which must define the byte array cnn_model_data containing your TensorFlow Lite model.)
  • Header Inclusions:
    All necessary standard libraries (stdio.h for I/O, stdint.h for fixed-width types) and TensorFlow Lite for Microcontrollers headers are included. The cnn_model_data.h header is assumed to contain your model’s data as a C array.

  • Tensor Arena:
    A fixed-size tensor arena is defined. This arena provides the memory needed by the TensorFlow Lite interpreter during inference.

  • Op Resolver:
    The micro op resolver is used to register only the operations required by your CNN. This helps keep the binary size small. You can register additional ops as needed.

  • Model and Interpreter Setup:
    The model is loaded from the embedded data, and its schema version is verified. The interpreter is then set up with the allocated tensor arena, and space is allocated for all tensors.

  • Input Population and Model Invocation:
    For demonstration purposes, the input tensor is filled with a constant value. In practice, you would replace this with actual sensor or image data. The model is then executed, and the output is printed.

About

Example in C that uses TensorFlow Lite for Microcontrollers to run a simple CNN model for image classification on an embedded system.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages