Introduction to the modules

TM NPU MicroPython

Product
SIMACTIC S7-1500 TM NPU 2.0
Language
en-US
Category
Manual

The inbuilt TM NPU MicroPython interpreter provides specifically created modules which allow access to the module interfaces and functionalities such as communication with the PLC, access to the camera, initialization and running of the inference.

The TM NPU MicroPython modules are listed in the order they would be used in for realizing a typical classification or object detection application. When creating the MicroPython script, this order can be rearranged and altered as required by the actual application.

  • For communication between the CPU and TM NPU via the process image, for example in order to trigger functions within the MicroPython application. The PLC_COMMUNICATION module can be used.

  • The TM NPU's SD card as well as the FTP server can be accessed using the npufs module, which allows access to the module's file system. This includes read and write access to the module's SD Card, as well as a potentially connected FTP Server with the module's inbuilt FTP Client. This can be used for saving images to the SD Card or the FTP Server, or downloading updated Neural networks for example.

  • The camera module is available for grabbing a (raw) image from the connected camera for further processing .

  • The (raw) image from the camera can be modified and prepared as input for the neural network using the vid_pipeline module, which supports with scaling, format conversion, etc.

  • The received output frame from the vid_pipeline module can be used as input for an initialized neural network. With the help of the neural_network module a neural network (blob file) e.g. from the SD Card or an FTP Server can be initialized, provided with a frame and executed. The neural network makes use of the hardware accelerator automatically and returns results of the neural network. These can either be used by the MicroPython application or be sent back to the PLC again via the process image.

Beside these TM NPU specific modules, a range of standard MicroPython functions are also available and can be applied. Please refer to Chapter 5 "Supported modules on TM NPU" for a list of supported Micropython functions as well as possible restrictions.Hotspot-Text.