# Model Conversion

## Overview

To deploy your custom models on Luxonis devices, it's essential to convert them from their initial frameworks (such as PyTorch,
TFLite, etc.) into a format compatible with the RVC Platform you aim to run them on. The conversion process involves the following
steps:

 1. Prepare the model source;
 2. Prepare calibration data (optional);
 3. Convert the model to one of the RVC compiled formats.

## Preparation

### Model Source

The model of interest should be prepared in one of the following formats:

 * ONNX (.onnx),
 * OpenVINO IR (.xml and .bin), or
 * TensorFlow Lite (.tflite).

It's advised to convert the model to ONNX as it opens up the most options at conversion for the appropriate RVC Platform. Please
check the [Conversion to ONNX](https://docs.luxonis.com/software-v3/ai-inference/conversion/onnx-conversion.md) section for more
information.

> Models already converted for the RVC platform cannot be reused as conversion sources. To migrate between RVC platforms, you must
use the original model (e.g. Pytorch or ONNX) and re-convert it. If the original source is unavailable, you can look for (similar)
models in public repositories such as:
> - [PINTO Model ZOO](https://github.com/PINTO0309/PINTO_model_zoo)
> - [ONNX Model ZOO](https://github.com/onnx/models)
> - [Hugging Face](https://huggingface.co/models)

### Calibration Data

Calibration data is used to guide the model quantization. You can read more about the process on the
[Concepts](https://docs.luxonis.com/software-v3/ai-inference/conversion/concepts.md) page. If you do not plan to quantize your
model during conversion, you can skip this step.

## Conversion for RVC Platform

Once the model source and calibration data are prepared, you can proceed with conversion for the RVC Platform you aim to utilize
(RVC compiled format). We have prepared tools that support both online and offline conversion. Online conversion particularly
convinient as it requires no system preparation and can be done in a few clicks. Offline conversion runs on your system and is
useful in settings with limited internet access or for integrating the conversion into your workflow. Additionally, to allow full
customability, we explain steps for manual conversion.

 * Online conversion:
   * [HubAI](https://docs.luxonis.com/software-v3/ai-inference/conversion/rvc-conversion/online/hubai.md) (recommended) -
     conversion for all RVC platforms,
   * [BlobConverter](https://docs.luxonis.com/software-v3/ai-inference/conversion/rvc-conversion/online/blobconverter.md) (legacy)
     - conversion for RVC2 and RVC3 platforms.
   * [YOLO Simplified Conversion](https://docs.luxonis.com/software-v3/ai-inference/conversion/rvc-conversion/online/yolo.md)
     (legacy) - conversion of YOLO models for RVC2 and RVC3 platforms.
 * Offline conversion:
   * [ModelConverter](https://docs.luxonis.com/software-v3/ai-inference/conversion/rvc-conversion/offline/modelconverter.md)
     (recommended) - conversion for all RVC platforms,
   * Manual conversion for
     [RVC2/RVC3](https://docs.luxonis.com/software-v3/ai-inference/conversion/rvc-conversion/offline/openvino.md) and
     [RVC4](https://docs.luxonis.com/software-v3/ai-inference/conversion/rvc-conversion/offline/snpe.md) platforms.

## Tutorials

We have prepared a few tutorials to help you get started with the conversion process using the [HubAI
SDK](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk.md) for online conversion. To check them out, please visit the
[Tutorials](https://docs.luxonis.com/software-v3/ai-inference/conversion/tutorials.md) page.
