# Model porting best practices ## Export custom YoloV8 model using QAIRT SDK Prerequisites Install the Qualcomm AI Runtime SDK on a host computer with `Python >= 3.10` and `PyTorch >=1.8`. For more details, follow [Install Qualcomm AI Runtime SDK](https://docs.qualcomm.com/doc/80-70030-15B/topic/qairt-install.html). Run the following commands on the host computer. 1. Activate your virtual environment. source /bin/activate Copy to clipboard 2. Install the Ultralytics package and export the ONNX model. pip install ultralytics Copy to clipboard yolo export model=yolov8s.pt imgsz=320 format=onnx opset=11 optimize=True simplify=true Copy to clipboard Procedure 1. Convert the ONNX model to DLC. snpe-onnx-to-dlc -i yolov8s.onnx Copy to clipboard 2. Generate quantized DLC. 1. Prepare the calibration data set. 2. Gather 5-10 images that used during training and save these images in the input directory. 3. Use the `preprocess.py` script to convert `.jpg` images into the RAW files required for quantization. Note In this example, the model uses an input dimension of 320x320. 1. Download the script as follows: wget https://raw.githubusercontent.com/quic/sample-apps-for-qualcomm-linux/refs/heads/main/qualcomm-linux/scripts/preprocess.py Copy to clipboard 2. Run the script with the following options: python preprocess.py 1 0 Copy to clipboard - ``: Folder containing the original images - ``: Folder where the RAW files will be generated 4. Create an `input.txt` file containing the paths to all generated RAW files. The quantization process needs this file. 3. Quantize the model, using `snpe-dlc-quantize` to convert the model to quantized DLC. > > > snpe-dlc-quantize --input_dlc yolov8s.dlc --input_list input.txt > Copy to clipboard ## Run the demo 1. Download the labels file. See [Download model files for Qualcomm Neural Processing SDK](https://docs.qualcomm.com/doc/80-70030-15B/topic/classify-objects-with-default-model.html#download-model-files). 2. On the host device, run the following command: export USER=root Copy to clipboard 3. Push the test video file `/etc/media` on the device. scp