Repository navigation
Add AM62D Audio AI documentation (OS=edgeai) #813
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
bf06c93
f1bd267
4c1c7d1
6f16447
6cf0df0
0db7cfb
283617c
c0b6471
319271f
db96350
630cb1c
6e9c9ad
0d748a1
95ea7ac
880ba36
0f63803
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 |
|---|---|---|
|
|
@@ -261,6 +261,12 @@ | |
|
|
||
| FAMILY = os.environ.get("DEVFAMILY", "") | ||
| OS = os.environ.get("OS", "") | ||
|
|
||
| # Audio AI docs prefix every shell command with a "$ " prompt symbol; strip it | ||
| # from the copy-button output so copied text is directly runnable. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just use a global regex definition: https://sphinx-copybutton.readthedocs.io/en/latest/use.html#using-regexp-prompt-identifiers
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I kept this scoped to the AM62DX edgeai build on purpose. A global copybutton_prompt_text would change copy behavior for every device doc. |
||
| if OS == "edgeai" and FAMILY == "AM62DX": | ||
| copybutton_prompt_text = "$ " | ||
|
|
||
| try: | ||
| globals().update(importlib.import_module(f"configs.{FAMILY}.{FAMILY}_{OS}_tags").__dict__) | ||
| except ModuleNotFoundError as exc: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| # General family replacement variables and configuration values for AM62D Audio AI 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 Audio AI AM62Dx' | ||
| '__SDK_SHORT_NAME__' : 'PSDK Audio AI' | ||
| '__SDK_DOWNLOAD_URL__' : '`AM62D-SDK-Download-page <https://www.ti.com/drr/opn/AM62D-LINUX-RT-RESTRICTED-SDK>`__' | ||
| '__AUDIOAI_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'Audio AI for AM62D' | ||
| html_title = 'Audio AI for AM62D Documentation' | ||
|
|
||
| # The master toctree document. | ||
| master_doc = 'devices/AM62DX/edgeai/index' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| devices/AM62DX/edgeai/index | ||
| devices/AM62DX/edgeai/introduction | ||
| devices/AM62DX/edgeai/model_zoo | ||
| devices/AM62DX/edgeai/model_compile_evaluate | ||
| devices/AM62DX/edgeai/model_inspect | ||
| devices/AM62DX/edgeai/performance |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| .. _audioai-index: | ||
|
|
||
| ######################################### | ||
| AM62D Audio AI Software Developer's Guide | ||
|
Check warning on line 4 in source/devices/AM62DX/edgeai/index.rst
|
||
| ######################################### | ||
|
|
||
| .. rubric:: Welcome to the AM62D Audio AI/DL Software Developer's Guide | ||
|
|
||
| .. toctree:: | ||
| :maxdepth: 5 | ||
| :numbered: | ||
|
|
||
| introduction | ||
| model_zoo | ||
| model_compile_evaluate | ||
| model_inspect | ||
| performance | ||
|
|
||
| +--------------------------------+--------------------------------------------------------------------------------------------------+ | ||
| | .. Image:: /images/E2e.jpg | For technical support please post your questions at `http://e2e.ti.com <http://e2e.ti.com/>`__. | | ||
|
Check warning on line 20 in source/devices/AM62DX/edgeai/index.rst
|
||
| +--------------------------------+--------------------------------------------------------------------------------------------------+ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,131 @@ | ||
| .. include:: <isonum.txt> | ||
|
Check warning on line 1 in source/devices/AM62DX/edgeai/introduction.rst
|
||
|
|
||
| .. _audioai-introduction: | ||
|
|
||
| ####################### | ||
| Introduction & Overview | ||
|
Check warning on line 6 in source/devices/AM62DX/edgeai/introduction.rst
|
||
| ####################### | ||
|
|
||
| This guide walks through the workflow for developing and deploying audio | ||
| deep-learning (Audio AI/DL) models on the |__PART_FAMILY_NAME__| platform, using | ||
| |__SDK_FULL_NAME__| |__AUDIOAI_SDK_VERSION__|. It is written for embedded | ||
|
Check warning on line 11 in source/devices/AM62DX/edgeai/introduction.rst
|
||
| developers who want to run, compile, evaluate, and benchmark audio models on the | ||
| AM62D - either out of the box on the target with pre-compiled artifacts, or | ||
|
Check warning on line 13 in source/devices/AM62DX/edgeai/introduction.rst
|
||
| through the x86 compile/evaluate workflow. | ||
|
Check warning on line 14 in source/devices/AM62DX/edgeai/introduction.rst
|
||
|
|
||
| Four **reference models** serve as worked examples throughout the guide, but 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. More reference models will be added over time. | ||
|
|
||
| The remaining sections cover: | ||
|
|
||
| - :ref:`Audio AI Model Zoo <audioai-model-zoo>` - out-of-box demos on the AM62D | ||
| target (inference scripts and Jupyter notebooks) using pre-trained models and | ||
| pre-compiled artifacts. | ||
| - :ref:`Model Compile and Evaluate <audioai-compile-evaluate>` - the | ||
| x86 BYOM workflow built on ``edgeai-tidlrunner``: compile a model for the AM62D | ||
| and evaluate accuracy on a dataset. | ||
| - :ref:`Model Inspect <audioai-model-inspect>` - analyze the compiled subgraphs | ||
| and per-layer behavior with Model Inspector. | ||
| - :ref:`Performance benchmark <audioai-performance>` - latency and memory | ||
| methodology with per-model tables. | ||
|
|
||
| ******************** | ||
| 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 AudioAI ModelZoo, | ||
| or your own exported ONNX. | ||
| #. **Compile** it for the C7\ |trade| NPU on an x86 host (:ref:`Model Compile and | ||
| Evaluate <audioai-compile-evaluate>`). | ||
| #. **Evaluate** accuracy or audio-quality metrics on a dataset. | ||
|
Check failure on line 44 in source/devices/AM62DX/edgeai/introduction.rst
|
||
| #. **Inspect** the compiled subgraphs and per-layer analysis (:ref:`Model | ||
| Inspect <audioai-model-inspect>`). | ||
| #. **Run** on the AM62D target using the compiled artifact | ||
| (:ref:`Audio AI Model Zoo <audioai-model-zoo>`). | ||
| #. **Benchmark** latency and memory (:ref:`Performance <audioai-performance>`). | ||
|
|
||
| **************** | ||
| Reference models | ||
| **************** | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Title overhang
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed. Every over/underline in the edgeai pages now has exactly the same length as its title. |
||
| Four reference models are provided across two task families, as worked examples | ||
| of the workflow. Each is delivered as an `ONNX <https://onnx.ai/>`__ graph and, | ||
| except for GTCRN, is offloaded to the C7\ |trade| NPU through the TVM runtime | ||
| (TVM-RT); GTCRN is the one that runs ARM-only. See :ref:`the framework overview | ||
| <audioai-tvm-tidl>` below for what that means. The same flow accepts your own | ||
| ONNX model, and more reference models will be added over time. | ||
|
|
||
| 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). | ||
|
|
||
| **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). | ||
|
|
||
| Both classification models are evaluated on the UrbanSound8K dataset. | ||
|
Check failure on line 75 in source/devices/AM62DX/edgeai/introduction.rst
|
||
|
|
||
| Speech enhancement | ||
| ================== | ||
|
|
||
| **GCRN** (model ID ``ase-0201``) | ||
| 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 | ||
| (``tidl_offload: true``). | ||
|
|
||
| **GTCRN** (model ID ``ase-0100``) | ||
| Grouped temporal convolutional-recurrent speech enhancement. Input and output | ||
| are complex spectrograms of shape ``(1, 257, T, 2)`` with a dynamic time | ||
| dimension ``T``. Runs FP32 on the Arm core through the ONNX runtime | ||
| (``tidl_offload: false``) - it is the only supported model that is **not** | ||
| offloaded to the C7\ |trade| NPU. | ||
|
|
||
| Both speech-enhancement models are evaluated on the VoiceBank-DEMAND-16k | ||
| dataset. | ||
|
Check failure on line 94 in source/devices/AM62DX/edgeai/introduction.rst
|
||
|
|
||
| .. _audioai-tvm-tidl: | ||
|
|
||
| ******************** | ||
| TVM + TIDL framework | ||
| ******************** | ||
|
|
||
| The AM62D audio models are compiled and deployed with **TI TVM**, 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, which | ||
| combines the **C7x DSP** with the **Matrix Multiplication Accelerator (MMA)** | ||
| (referred to as *C7x+MMA* in older documentation). | ||
|
|
||
| TI TVM integrates **TIDL** (TI Deep Learning) as an accelerator backend: | ||
| TIDL-supported layers are offloaded to the MMA, while TVM generates **C7x DSP** | ||
| code for any remaining layers. Because the MMA and the C7x DSP together make up | ||
| the C7\ |trade| NPU, the result is a single deployable artifact in which the | ||
| **entire model runs on the C7**\ |trade| **NPU**. | ||
|
|
||
| Compilation runs on an x86 host and proceeds in stages: | ||
|
|
||
| #. **Model import** - the ONNX graph is imported into TVM. | ||
| #. **Partitioning** - using the TIDL import API, the graph is split into | ||
| TIDL-supported subgraphs (compiled by the TIDL network compiler) and the | ||
| remaining operators (handled by TVM C7x DSP code generation). | ||
| #. **Artifact generation** - both parts are packaged into one TVM-RT deployable | ||
| artifact (``deploy_lib.so`` + ``deploy_graph.json`` + ``deploy_param.params``). | ||
|
|
||
| At run time on the AM62D, the TVM runtime loads the artifact and dispatches 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.
Acronyms are not allowed here
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.
Removed. accept.txt now only adds [Ss]ubgraphs?, logits?, perfsim and venv, which are the only entries Vale flagged. No acronyms.