Examples¶
KNEO Pi is a powerful single-board computer equipped with a built-in Neural Processing Unit (NPU) designed to accelerate AI and machine learning tasks. It seamlessly integrates with various external modules, making it an ideal solution for developers and makers looking to connect peripherals and components. With its ability to handle computationally intensive applications such as image recognition, data analysis, and real-time decision-making, KNEO Pi delivers faster processing and superior performance for innovative projects.
To help you get started, numerous examples are available. You can download these examples from this site: KNEO Pi Example.
This chapter categorizes the examples into three major sections based on the properties of kneopi-example, guiding you to understand their framework and logic.
Basic System Operation¶
To effectively follow and implement the provided examples, it’s crucial to familiarize yourself with the following concepts:
EDMC
The EDMC is a memory management system designed to allocate and free contiguous physical memory blocks, which are often required for hardware access. It ensures efficient memory handling, particularly for applications that need consistent access to large memory blocks for hardware operations. See more
SSM
Synchronous Shared Memory (SSM) is a mechanism for sharing data between processes or threads in a synchronized manner. This allows efficient data exchange, ensuring seamless communication and preventing data corruption or timing issues. See more
SRB
The Synchronous Ring Buffer (SRB) is specifically designed to share encoded frame data between applications running in the same or different processes. See more
These three basic operations are frequently used in the following chapters. Make sure you fully understand their usage before proceeding.
AI Application¶
In the AI Application examples, the basic workflow consists of three stages: Input, AI Inference, and Display.
Each stage offers various modules. For example, in the Input stage, available modules include Image Files, Webcam, Sensor, and RTSP.
Modules can be interchanged and connected to the next stage to create new AI applications.
KNEO Pi provides two different AI inference frameworks: PLUS and NNM. Additionally, the PLUS framework offers two sets of APIs: C and Python.
As a result, KNEO Pi supports three API sets: PLUS (C Interface), PLUS (Python Interface), and NNM (C Interface). The KNEO Pi-Example categorizes examples based on these API sets.
Important
Please note that, different API sets CAN NOT be mixed used.
These API sets are used to activate the AI inference workflow, which includes three main stages:
-
Data Pre-processing : Prepares and formats data to meet the input requirements of the AI model.
-
Inference : Processes the data through a trained AI model to generate predictions or outputs.
-
Post-Processing : Refines and formats the output data for application use.
Note
These three main stages are performed for one model. If your application flow involves multiple models, these steps will be repeated for each model.
Each framework provides a different way to execute these stages and manage the logic between multiple models.
PLUS¶
The key advantage of PLUS is its extensibility. PLUS uses a USB-based access method for all Kneron AI devices via a virtual USB connection to access the built-in KL730. This means that, in addition to the built-in KL730 of KNEO Pi, other Kneron AI devices can be connected and activated on KNEO Pi through PLUS.
For more details on PLUS API, refer to:
- PLUS C section
- PLUS Python section
Note
To learn more about using PLUS to connect external devices, visit document site
NNM¶
The main advantage of NNM is performance. Since NNM directly accesses the built-in KL730 without a virtual USB connection, it offers faster access speeds compared to PLUS.
Moreover, NNM provides flexibility to optimize both the application flow (between input, inference, and output modules) and the inference flow (among multiple models).
For more details on NNM API, refer to the NNM section.
Hardware Control and Module Integration¶
KNEO Pi offers image processing capabilities, including video input (MIPI interface, etc.), image signal processing, and image codecs (H.264, H.265, and JPEG). These features are integrated into the Video Media Framework (VMF), which provides an easy-to-use Linux-based software framework for rapid development of video applications.
The VMF is comprised with the following modules:
-
VMF_NNM : Neural Network Middleware for managing the Neural Processing Unit (NPU) engine.
-
VMF_VSRC : Video Source module for video input and image signal processing.
-
VMF_VENC : Video Encoder supporting H.264, H.265, and JPEG.
-
VMF_VDEC : Video Decoder for converting H.264, H.265, and JPEG to YUV420 format.
For examples of using VMF with MIPI sensors for video streaming, refer to Video Encoder.