We introduced the TensorFlow platform and fundamentals of neural networks in previous chapters. It is time to embed the trained neural network models to the microcontroller. To do so, we will benefit from TensorFlow Lite as the specialized version of TensorFlow for embedded systems (including microcontrollers). Hence, we will start with its properties. Then, we will show ways of converting TensorFlow and Keras models to TensorFlow Lite format. Model conversion is not sufficient alone to embed the model on a microcontroller. The main reason is the size of TensorFlow Lite model. In other words, the model should be optimized beforehand since microcontrollers have limited flash and RAM size. Therefore, we will cover model optimization via quantization, pruning, and weight clustering. Operations to be performed up to this point will be done on PC. The next step is embedding the final TensorFlow Lite model to the microcontroller. Hence, we will consider necessary steps to be followed for this purpose. Embedding the trained neural network model to the microcontroller can also be done by the STM32Cube.AI platform. We will cover it to provide a second way of embedding a TensorFlow or Keras model to the STM32 microcontroller. Throughout the chapter, we will reconsider the neural network models introduced in Chap. 11 and embed them to the microcontroller. We will also apply the same procedure to the end of chapter applications.

错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

Embedding the Neural Network Model to the Microcontroller

  • Cem Ünsalan,
  • Berkan Höke,
  • Eren Atmaca

摘要

We introduced the TensorFlow platform and fundamentals of neural networks in previous chapters. It is time to embed the trained neural network models to the microcontroller. To do so, we will benefit from TensorFlow Lite as the specialized version of TensorFlow for embedded systems (including microcontrollers). Hence, we will start with its properties. Then, we will show ways of converting TensorFlow and Keras models to TensorFlow Lite format. Model conversion is not sufficient alone to embed the model on a microcontroller. The main reason is the size of TensorFlow Lite model. In other words, the model should be optimized beforehand since microcontrollers have limited flash and RAM size. Therefore, we will cover model optimization via quantization, pruning, and weight clustering. Operations to be performed up to this point will be done on PC. The next step is embedding the final TensorFlow Lite model to the microcontroller. Hence, we will consider necessary steps to be followed for this purpose. Embedding the trained neural network model to the microcontroller can also be done by the STM32Cube.AI platform. We will cover it to provide a second way of embedding a TensorFlow or Keras model to the STM32 microcontroller. Throughout the chapter, we will reconsider the neural network models introduced in Chap. 11 and embed them to the microcontroller. We will also apply the same procedure to the end of chapter applications.