# NVIDIA TAO

## Overview

NVIDIA TAO (Train, Adapt, and Optimize) is a powerful AI toolkit designed to simplify and accelerate the development of deep
learning models for computer vision, speech, and natural language processing. Built on NVIDIA's cutting-edge AI frameworks, TAO
enables developers to fine-tune pre-trained models with minimal coding, reducing the need for large datasets and extensive
machine-learning expertise. By leveraging transfer learning and model pruning, TAO streamlines the AI development pipeline, making
it accessible for enterprises looking to deploy high-performance AI applications efficiently. You can learn more about the toolkit
in their [official documentation](https://developer.nvidia.com/tao-toolkit).

In addition to the toolkit they also provide a NCG Catalog which amongst things like collections, containers, and helm charts also
offers a vast Model Zoo for many different use cases. You can explore all the models
[here](https://catalog.ngc.nvidia.com/models?filters=&orderBy=weightPopularDESC&query=&page=&pageSize=).

## Usage

> For a complete step-by-step guide, check out our
> [NVIDIA TAO model conversion
tutorial](https://github.com/luxonis/depthai-ml-training/blob/main/conversion/nvidia_tao_conversion.ipynb)
> .

TAO Toolkit allows you to train a custom model. For detailed guidance, refer to the [official
documentation](https://developer.nvidia.com/tao-toolkit-get-started) and explore various hands-on
[tutorials](https://github.com/NVIDIA/tao_tutorials/tree/main/notebooks/tao_launcher_starter_kit). Once training is complete,
you'll have a .tlt model file, which needs to be converted to the ONNX format. Below is an example of how to export a
re-identification model:

```bash
tao model re_identification export \
 -e $USER_EXPERIMENT_DIR/media/experiment_market1501_resnet.yaml \
    results_dir=$USER_EXPERIMENT_DIR \
 encryption_key=$KEY \
    export.checkpoint=$USER_EXPERIMENT_DIR/resnet50_market1501_aicity156.tlt \
 export.onnx_file=$USER_EXPERIMENT_DIR/resnet50_market1501_aicity156.onnx
```

> The flags used may be different in your case.

After exporting, you should have an ONNX file. From here, follow the steps outlined in the [RVC Conversion
section](https://docs.luxonis.com/software-v3/ai-inference/conversion/rvc-conversion.md). Alternatively, you can refer to our
[ONNX conversion tutorial](https://github.com/luxonis/ai-tutorials/blob/main/conversion/onnx_conversion.ipynb) for a detailed
walkthrough.

If you prefer not to train your own model, you can use a pre-trained model from the TAO Model Zoo. Many of these models are
already available in ONNX format, allowing you to skip the conversion step and proceed directly with preparing the model for
deployment on an RVC device.
