Repository navigation
feat(am62dx-edgeai): Add AM62DX EdgeAI documentation #818
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| # General family replacement variables and configuration values for AM62D EdgeAI build | ||
|
|
||
| # This file is processed by Python scripts to define both replacement | ||
| # variable and configuration values for a device family build. | ||
| # For replacement variables, all variables should be listed on a single | ||
| # line, and all the variables should be listed on consecutive lines | ||
| # (i.e. no additional blank lines between the replacement variables). | ||
| # Similarly, all the configuration values should be listed on individual, | ||
| # consecutive lines (with no blank lines between the configuration values). | ||
| # | ||
| # Note that neither replacement variables nor configuration values may contain | ||
| # a colon (i.e. ":") in their name. However, values may contain colons. | ||
|
|
||
| Replacement Variables | ||
| --------------------- | ||
| '__PART_FAMILY_NAME__' : 'AM62Dx' | ||
| '__PART_FAMILY_DEVICE_NAMES__' : 'AM62Dx' | ||
| '__PRODUCT_LINE_NAME__' : 'Sitara MPU' | ||
| '__SDK_FULL_NAME__' : 'Processor SDK Linux EdgeAI AM62Dx' | ||
| '__SDK_SHORT_NAME__' : 'PSDK EdgeAI' | ||
| '__SDK_DOWNLOAD_URL__' : '`AM62D-SDK-Download-page <https://www.ti.com/drr/opn/AM62D-LINUX-RT-RESTRICTED-SDK>`__' | ||
| '__EDGEAI_SDK_VERSION__' : '12.1' | ||
| '__TIDL_VERSION__' : '11_02_18_00' | ||
| '__TIDL_TOOLS_VERSION__' : '11.2.x' | ||
|
|
||
| Configuration Values | ||
| -------------------- | ||
| 'CONFIG_part_family' : 'AM62DX_family' | ||
| 'CONFIG_part_variant' : 'AM62DX' | ||
| 'CONFIG_sdk' : 'SITARA' | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # Project name and HTML title | ||
| project = u'Processor SDK Linux Edge AI for AM62Dx' | ||
| html_title = 'Processor SDK Linux Edge AI for AM62Dx Documentation' | ||
|
|
||
| # The master toctree document. | ||
| master_doc = 'devices/AM62DX/edgeai/index' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| devices/AM62DX/edgeai/index | ||
| devices/AM62DX/edgeai/overview | ||
| devices/AM62DX/edgeai/evm_hardware_setup | ||
| devices/AM62DX/edgeai/out_of_box_demo | ||
| devices/AM62DX/edgeai/models_artifacts_and_setup | ||
| devices/AM62DX/edgeai/linux_audio_inference_app | ||
| devices/AM62DX/edgeai/getting_started_gstreamer | ||
| devices/AM62DX/edgeai/edgeai_model_workflow | ||
| devices/AM62DX/edgeai/model_zoo | ||
| devices/AM62DX/edgeai/model_compile_evaluate | ||
| devices/AM62DX/edgeai/model_inspector | ||
| devices/AM62DX/edgeai/integrating_new_model | ||
| devices/AM62DX/edgeai/performance |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| .. include:: <isonum.txt> | ||
|
|
||
| .. _edgeai-introduction: | ||
|
|
||
| ##################### | ||
| EdgeAI Model Workflow | ||
|
Check warning on line 6 in source/devices/AM62DX/edgeai/edgeai_model_workflow.rst
|
||
| ##################### | ||
|
|
||
| This guide covers the workflow for audio deep-learning (DL) models on the | ||
| |__PART_FAMILY_NAME__| platform, using |__SDK_FULL_NAME__| | ||
| |__EDGEAI_SDK_VERSION__|. It targets embedded developers. You can run, | ||
| compile, evaluate, and benchmark audio models on the AM62D. Run pre-compiled | ||
| artifacts directly on the target. Or use the 64-bit x86 compile-and-evaluate | ||
| workflow. | ||
|
|
||
| Four **reference models** serve as worked examples throughout the guide. The | ||
| workflow is not limited to them: the same compile-evaluate-inspect flow is a | ||
| bring-your-own-model (BYOM) flow that accepts any supported `ONNX | ||
| <https://onnx.ai/>`__ model. The guide will add more reference models over time. | ||
|
|
||
| ******************** | ||
| Development workflow | ||
| ******************** | ||
|
|
||
| The end-to-end path is the same for a reference model or your own model: | ||
|
|
||
| #. **Obtain an ONNX model** - a reference graph shipped with the EdgeAI ModelZoo, | ||
| or your own exported ONNX. | ||
| #. **Compile** it for the C7\ |trade| Neural Processing Unit (NPU) on an x86 host | ||
| (:ref:`Model Compile and Evaluate <edgeai_compile_evaluate>`). | ||
| #. **Evaluate** accuracy or audio-quality metrics on a data set. | ||
| #. **Inspect** the compiled subgraphs and per-layer analysis (:ref:`Model | ||
| Inspector <edgeai_model_inspector>`). | ||
| #. **Run** on the AM62D target using the compiled artifact | ||
| (:ref:`EdgeAI Model Zoo <edgeai_model_zoo>`). | ||
| #. **Benchmark** latency and memory (:ref:`Performance <edgeai_performance>`). | ||
|
|
||
| **************** | ||
| Reference models | ||
| **************** | ||
|
|
||
| Four reference models cover two task families. Each is a worked example of the | ||
| workflow, delivered as an `ONNX <https://onnx.ai/>`__ graph. Three of the four | ||
| run on the C7\ |trade| NPU through the TVM runtime (TVM-RT). | ||
|
|
||
| Audio analysis and classification | ||
| ================================= | ||
|
|
||
| **VGGish11** (model ID ``ac-0101``) | ||
| Audio-clip classification. Input is a log-mel patch of shape ``(1, 1, 64, 126)``; | ||
| output is ``(1, 10)`` class logits plus a ``(1, 512)`` embedding. Runs at 8-bit, | ||
| fully offloaded to the C7\ |trade| NPU via TVM-RT (a single TIDL subgraph). | ||
|
Check warning on line 52 in source/devices/AM62DX/edgeai/edgeai_model_workflow.rst
|
||
|
|
||
| **YAMNet** (model ID ``ac-0201``) | ||
| Audio-event classification. Input is a log-mel patch of shape ``(1, 1, 96, 64)``; | ||
| output is ``(1, 521)`` class scores. Runs at 8-bit, fully offloaded to the | ||
| C7\ |trade| NPU via TVM-RT (a single TIDL subgraph). | ||
|
Check warning on line 57 in source/devices/AM62DX/edgeai/edgeai_model_workflow.rst
|
||
|
|
||
| Both classification models are evaluated on the UrbanSound8K data set. | ||
|
Check warning on line 59 in source/devices/AM62DX/edgeai/edgeai_model_workflow.rst
|
||
|
|
||
| Speech enhancement | ||
| ================== | ||
|
|
||
| **GCRN** (model ID ``ase-0201``) | ||
|
Check warning on line 64 in source/devices/AM62DX/edgeai/edgeai_model_workflow.rst
|
||
| Convolutional-recurrent speech enhancement (noise suppression) over a fixed 4-second | ||
| window. Input and output are complex spectrograms of shape ``(1, 2, 401, 161)``. | ||
| Runs at 16-bit and is offloaded to the C7\ |trade| NPU via TVM-RT | ||
|
Check warning on line 67 in source/devices/AM62DX/edgeai/edgeai_model_workflow.rst
|
||
| (``tidl_offload: true``). | ||
|
|
||
| Both speech-enhancement models are evaluated on the VoiceBank-DEMAND-16k | ||
|
Check warning on line 70 in source/devices/AM62DX/edgeai/edgeai_model_workflow.rst
|
||
| data set. | ||
|
|
||
| .. _edgeai-tvm-tidl: | ||
|
|
||
| ******************** | ||
| TVM + TIDL framework | ||
| ******************** | ||
|
|
||
| The AM62D audio models compile and deploy with **TI TVM**. This is TI's fork | ||
| of the `Apache TVM <https://tvm.apache.org/>`__ deep-learning compiler. The | ||
| target accelerator is the **C7**\ |trade| **NPU** - TI's Neural Processing | ||
| Unit. It combines the **C7x DSP** with the **Matrix Multiplication | ||
| Accelerator (MMA)**. Older documents call this combination *C7x+MMA*. | ||
|
|
||
| TI TVM adds **TIDL** (TI Deep Learning) as an accelerator backend. TIDL | ||
| offloads supported layers to the MMA. TVM generates **C7x DSP** code for any | ||
| layers that are left. The MMA and the C7x DSP together form the C7\ |trade| | ||
| NPU. The result is one deployable artifact. The **entire model runs on the | ||
| C7**\ |trade| **NPU**. | ||
|
|
||
| Compilation runs on an x86 host in three stages: | ||
|
|
||
| #. **Model import** - TVM imports the ONNX graph. | ||
| #. **Partitioning** - the TIDL import API splits the graph into TIDL-supported | ||
| subgraphs and the rest. The TIDL network compiler builds the subgraphs. TVM | ||
| generates C7x DSP code for the rest. | ||
| #. **Artifact generation** - TVM packages both parts into one TVM-RT | ||
| deployable artifact (:file:`deploy_lib.so` + :file:`deploy_graph.json` + | ||
| :file:`deploy_param.params`). | ||
|
|
||
| At run time, the AM62D TVM runtime loads this artifact. It then sends the | ||
| offloaded subgraphs to TIDL-RT on the C7\ |trade| NPU. | ||
|
|
||
| .. figure:: /images/audioai/tvm_tidl_flow.svg | ||
| :width: 80 % | ||
| :align: center | ||
|
|
||
| TVM + TIDL compile-and-deploy flow for the AM62D audio models. Green blocks | ||
| are handled by TIDL; white blocks are handled by TVM. | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be 12.2?