Please provide the official input format specifications and constraints

During the model conversion pipeline .pt → .tflite → .dla, the input specification requirements may change at each conversion stage. Therefore, the input format used for the original .pt model cannot be directly applied to the .dla model, and a dedicated description of the input format specification for the .dla model is required.

The conversion from .tflite to .dla is performed using the SDK tool:

/neuropilot-sdk-premium-8.0.7-build20250122/neuron_sdk/host/bin/ncc-tflite

Please provide the official input format specifications and constraints defined by this SDK.

Hi Wr.Zeng,

Thanks for reaching out!

For the PyTorch side, the accepted input model format is TorchScript (i.e., a ScriptModule object or file). For more details about the supported model input and output formats, please refer to the Supported Model Input and Output Formats section in the NeuroPilot documentation.

Best,
Jun

The conversion from .pt to .tflite works well and can be verified by our validation script.But when the .tflite model is converted to DLA, the inference output is inaccurate. so we need a dedicated description of the input format specification for the .dla model is require

The conversion from .pt to .tflite works well and can be verified by our validation script.But when the .tflite model is converted to DLA, the inference output is inaccurate. so we need a dedicated description of the input format specification for the .dla model is require

Hi Wr.Zeng,

To help us pinpoint the issue, could you share a bit more about your setup? Specifically:

  • Model data type : Is your TFLite model in FP32, FP16, INT16, or INT8?
  • ncc-tflite compile command : Which options did you use? (e.g., --arch, --relax-fp32, --suppress-input/output)
  • How the inaccuracy is observed:
    • What’s your reference for comparison: the TFLite interpreter output, or the original PyTorch output?
    • Is it a complete mismatch, or just a small numerical deviation?
  • Input data flow — How is the input fed into the DLA? Did you apply the same pre-processing (and quantization scale / zero_point if applicable) as the TFLite model?

Quick note: a quant-8 TFLite → quant-8 DLA conversion via ncc-tflite normally shouldn’t drop much accuracy, so once we know more about your setup, it’ll be easier to figure out where things went off.

Best,
Jun

Thank you for answer. I’m currently using the INT8 quantized model downloaded from here: YOLOv8s Models — IoT AI Hub documentation . Could you let me know what configurations were used for the ncc-tflite compile command? For reference, my current command is: ./neuropilot-sdk-premium-8.0.7-build20250122/neuron_sdk/host/bin/ncc-tflite --arch=mdla5.3,edma3.6 yolov8s_quant.tflite."

Hi Wr.Zeng,

Here is the compile command for generating the DLA from that URL:

./ncc-tflite --arch=mdla5.3,edma3.6 {model.tflite} -o {model.dla}

The NeuroPilot SDK version used is basic-8.0.10-build20251029.

Best,
Jun

Please help me confirm if the following is correct

yolo export model=yolov8s.pt format=torchscript
convert to tflite :

import mtk_converter
import numpy as np

def data_gen():
for i in range(100):
yield [np.random.randn(1, 3, 640, 640).astype(np.float32)]

converter = mtk_converter.PyTorchConverter.from_script_module_file(
‘yolov8s.torchscript’, [[1, 3, 640, 640]],
)
converter.quantize = True
converter.input_value_ranges = [(-1.0, 1.0)]
converter.calibration_data_gen = data_gen
_ = converter.convert_to_tflite(output_file=‘yolov8s_quant.tflite’,tflite_op_export_spec=‘builtin_ignore_version’)

Hi Wr_Zeng,

Your code for converting to TFLite is the same as the AI Hub reference.
You can visit Quant8 Conversion Process for more details.

Best,
Jun

我按那上面来。执行这一步python3 export.py --weights yolov8s.pt --img-size 640 640 --include torchscript最是报错。问AI说yolo export model=yolov8s.pt format=torchscript

I folow Quant8 Conversion Process .but exec the following step:python3 export.py --weights yolov8s.pt --img-size 640 640 --include torchscrip it is alway error. so I ask AI. AI tell me:yolo export model=yolov8s.pt format=torchscript

I user neuropilot-sdk-premium-8.0.7-build20250122 ,is it also OK ?

Hi Wr_Zeng,

Before confirming whether yolo export model=yolov8s.pt format=torchscript is a viable path, could you help clarify a couple of things?

  1. Precondition steps — did you follow them exactly?

    • Cloned the YOLOv5 repo and ran git reset --hard 485da42?
    • Using torch==1.9.0 and torchvision==0.10.0?
    • What’s your Python version and OS?
  2. SDK version — the AI Hub reference uses neuropilot-sdk-basic-8.0.11-build20260211. Your 8.0.7-build20250122 might work, but to rule out version-related accuracy differences in the .tflite → .dla step, I’d recommend aligning with the reference version.

Quick note — yolo export ... (Ultralytics CLI) and python3 export.py ... (YOLOv5 repo at commit 485da42) may produce TorchScript files with different internal structures. Even if yolo export succeeds, the downstream tflite conversion or DLA accuracy could behave differently from the AI Hub reference flow.

Best,
Jun

Ai hub cann’t found neuropilot-sdk-premium-8.0.10-build20251029.only found neuropilot-sdk-basic-8.0.11-build20260211.tar.gz .can you provide download link to me ?

Thanks

Hi Wr_Zeng,

Thanks for the heads-up! The latest version on AI Hub is now neuropilot-sdk-basic-8.0.11-build20260211, which supersedes the 8.0.10-build20251029 version I mentioned earlier. Please use this one as the reference going forward. No separate download link needed.

Since your current SDK is 8.0.7-build20250122, I’d still recommend aligning with the latest 8.0.11 to rule out any SDK-version-related differences during the .tflite → .dla compilation step.

Best,
Jun

1: Cloned the YOLOv5 repo and ran git reset --hard 485da42? ----yes

2: Using torch==1.9.0 and torchvision==0.10.0? ----yes
3:What’s your Python version and OS? ---- python3.7 & ubuntu18.04

(py37) wr.zeng@ubuntu:~/yolov5$ python3 export.py --weights yolov8s.pt --img-size 640 640 --include torchscript
WARNING :warning: ‘ultralytics.yolo.v8’ is deprecated since ‘8.0.136’ and will be removed in ‘8.1.0’. Please use ‘ultralytics.models.yolo’ instead.
WARNING :warning: ‘ultralytics.yolo.utils’ is deprecated since ‘8.0.136’ and will be removed in ‘8.1.0’. Please use ‘ultralytics.utils’ instead.
Note this warning may be related to loading older models. You can update your model to current structure with:
import torch
ckpt = torch.load(“model.pt”) # applies to both official and custom models
torch.save(ckpt, “updated-model.pt”)

export: data=data/coco128.yaml, weights=[‘yolov8s.pt’], imgsz=[640, 640], batch_size=1, device=cpu, half=False, inplace=False, keras=False, optimize=False, int8=False, dynamic=False, simplify=False, opset=17, verbose=False, workspace=4, nms=False, agnostic_nms=False, topk_per_class=100, topk_all=100, iou_thres=0.45, conf_thres=0.25, include=[‘torchscript’]
YOLOv5 :rocket: v7.0-193-g485da422 Python-3.7.16 torch-1.9.0+cu102 CPU

YOLOv8s summary (fused): 168 layers, 11156544 parameters, 0 gradients, 28.6 GFLOPs

PyTorch: starting from yolov8s.pt with output shape (1, 84, 8400) (21.5 MB)

TorchScript: starting export with torch 1.9.0+cu102…
TorchScript: export failure :cross_mark: 0.4s: ‘Detect’ object has no attribute ‘m’
(py37) wr.zeng@ubuntu:~/yolov5$ pip show torch
Name: torch
Version: 1.9.0
Summary: Tensors and Dynamic neural networks in Python with strong GPU acceleration
Home-page: https://pytorch.org/
Author: PyTorch Team
Author-email: packages@pytorch.org
License: BSD-3
Location: /home/wr.zeng/enter/envs/py37/lib/python3.7/site-packages
Requires: typing-extensions
Required-by: thop, torchvision, ultralytics
(py37) wr.zeng@ubuntu:~/yolov5$ pip show torchvision
Name: torchvision
Version: 0.10.0
Summary: image and video datasets and models for torch deep learning
Home-page: GitHub - pytorch/vision: Datasets, Transforms and Models specific to Computer Vision · GitHub
Author: PyTorch Core Team
Author-email: soumith@pytorch.org
License: BSD
Location: /home/wr.zeng/enter/envs/py37/lib/python3.7/site-packages
Requires: numpy, pillow, torch
Required-by: ultralytics
(py37) wr.zeng@ubuntu:~/yolov5$ git log
commit 485da42273839d20ea6bdaf142fd02c1027aba61 (HEAD → master)
Author: Dhruv Nair dhruv.nair@gmail.com

python3 -c ‘import mtk_converter; print(mtk_converter.version)’
8.16.0

neuropilot-sdk: neuropilot-sdk-basic-8.0.11-build20260211

Ubuntu 24.04 :the same issue

(py37) wr.zeng@ubuntu:~/neuropilot-sdk-basic-8.0.11-build20260211/yolov5$ python3 export.py --weights yolov8s.pt --img-size 640 640 --include torchscript
WARNING :warning: ‘ultralytics.yolo.v8’ is deprecated since ‘8.0.136’ and will be removed in ‘8.1.0’. Please use ‘ultralytics.models.yolo’ instead.
WARNING :warning: ‘ultralytics.yolo.utils’ is deprecated since ‘8.0.136’ and will be removed in ‘8.1.0’. Please use ‘ultralytics.utils’ instead.
Note this warning may be related to loading older models. You can update your model to current structure with:
import torch
ckpt = torch.load(“model.pt”) # applies to both official and custom models
torch.save(ckpt, “updated-model.pt”)

export: data=data/coco128.yaml, weights=[‘yolov8s.pt’], imgsz=[640, 640], batch_size=1, device=cpu, half=False, inplace=False, keras=False, optimize=False, int8=False, dynamic=False, simplify=False, opset=17, verbose=False, workspace=4, nms=False, agnostic_nms=False, topk_per_class=100, topk_all=100, iou_thres=0.45, conf_thres=0.25, include=[‘torchscript’]
YOLOv5 :rocket: v7.0-193-g485da422 Python-3.7.16 torch-1.9.0+cu102 CPU

YOLOv8s summary (fused): 168 layers, 11156544 parameters, 0 gradients, 28.6 GFLOPs

PyTorch: starting from yolov8s.pt with output shape (1, 84, 8400) (21.5 MB)

TorchScript: starting export with torch 1.9.0+cu102…
TorchScript: export failure :cross_mark: 1.2s: Inplace update to inference tensor outside InferenceMode is not allowed.You can make a clone to get a normal tensor before doing inplace update.See https://github.com/pytorch/rfcs/pull/17 for more details.
(py37) wr.zeng@ubuntu:~/neuropilot-sdk-basic-8.0.11-build20260211/yolov5$ python3 -c ‘import mtk_converter; print(mtk_converter.version)’
8.16.0

Hi Jun :

it is still error :the following is log & config

python 3.10.19 torch 1.13.0 torchvison 0.14.0 ultralytics 8.0.111 numpy 1.26.0 opencv-python 4.10.0.84

(yolov8) ubuntu@ubuntu:~/neuropilot/yolov5$ python3 export.py --weights yolov8s.pt --img-size 640 640 --include torchscript
/home/ubuntu/neuropilot/yolov5/utils/general.py:34: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
import pkg_resources as pkg
export: data=data/coco128.yaml, weights=[‘yolov8s.pt’], imgsz=[640, 640], batch_size=1, device=cpu, half=False, inplace=False, keras=False, optimize=False, int8=False, dynamic=False, simplify=False, opset=17, verbose=False, workspace=4, nms=False, agnostic_nms=False, topk_per_class=100, topk_all=100, iou_thres=0.45, conf_thres=0.25, include=[‘torchscript’]
YOLOv5  v7.0-193-g485da422 Python-3.10.19 torch-2.12.1+cu130 CPU

Traceback (most recent call last):
File “/home/ubuntu/neuropilot/yolov5/export.py”, line 863, in
main(opt)
File “/home/ubuntu/neuropilot/yolov5/export.py”, line 858, in main
run(**vars(opt))
File “/home/ubuntu/anaconda3/envs/yolov8/lib/python3.10/site-packages/torch/utils/_contextlib.py”, line 124, in decorate_context
return func(*args, **kwargs)
File “/home/ubuntu/neuropilot/yolov5/export.py”, line 736, in run
model = attempt_load(weights, device=device, inplace=True, fuse=True) # load FP32 model
File “/home/ubuntu/neuropilot/yolov5/models/experimental.py”, line 79, in attempt_load
ckpt = torch.load(attempt_download(w), map_location=‘cpu’) # load
File “/home/ubuntu/anaconda3/envs/yolov8/lib/python3.10/site-packages/torch/serialization.py”, line 1578, in load
raise pickle.UnpicklingError(_get_wo_message(str(e))) from None
_pickle.UnpicklingError: Weights only load failed. This file can still be loaded, to do so you have two options, do those steps only if you trust the source of the checkpoint.
(1) In PyTorch 2.6, we changed the default value of the weights_only argument in torch.load from False to True. Re-running torch.load with weights_only set to False will likely succeed, but it can result in arbitrary code execution. Do it only if you got the file from a trusted source.
(2) Alternatively, to load with weights_only=True please check the recommended steps in the following error message.
WeightsUnpickler error: Unsupported global: GLOBAL ultralytics.nn.tasks.DetectionModel was not an allowed global by default. Please use torch.serialization.add_safe_globals([ultralytics.nn.tasks.DetectionModel]) or the torch.serialization.safe_globals([ultralytics.nn.tasks.DetectionModel]) context manager to allowlist this global if you trust this class/function.

Check the documentation of torch.load to learn more about types accepted by default with weights_only Redirecting… .

(yolov8) ubuntu@ubuntu:~/neuropilot/yolov5$ pip show torch torchvision ultralytics opencv-python

Name: torch
Version: 1.13.0
Summary: Tensors and Dynamic neural networks in Python with strong GPU acceleration
Home-page: https://pytorch.org/
Author: PyTorch Team
Author-email: packages@pytorch.org
License: BSD-3
Location: /home/ubuntu/anaconda3/envs/yolov8/lib/python3.10/site-packages
Requires: nvidia-cublas-cu11, nvidia-cuda-nvrtc-cu11, nvidia-cuda-runtime-cu11, nvidia-cudnn-cu11, typing-extensions
Required-by: thop, torchvision, ultralytics, ultralytics-thop

Name: torchvision

Version: 0.14.0
Summary: image and video datasets and models for torch deep learning
Home-page: GitHub - pytorch/vision: Datasets, Transforms and Models specific to Computer Vision · GitHub
Author: PyTorch Core Team
Author-email: soumith@pytorch.org
License: BSD
Location: /home/ubuntu/anaconda3/envs/yolov8/lib/python3.10/site-packages
Requires: numpy, pillow, requests, torch, typing-extensions
Required-by: ultralytics

Name: ultralytics

Version: 8.0.111
Summary: Ultralytics YOLOv8 for SOTA object detection, multi-object tracking, instance segmentation, pose estimation and image classification.
Home-page: GitHub - ultralytics/ultralytics: Ultralytics YOLO26, YOLO11, YOLOv8 — object detection, instance segmentation, semantic segmentation, image classification, pose estimation, object tracking · GitHub
Author: Ultralytics
Author-email: hello@ultralytics.com
License: AGPL-3.0
Location: /home/ubuntu/anaconda3/envs/yolov8/lib/python3.10/site-packages
Requires: matplotlib, opencv-python, pandas, Pillow, psutil, PyYAML, requests, scipy, seaborn, torch, torchvision, tqdm
Required-by:

Name: opencv-python
Version: 4.10.0.84
Summary: Wrapper package for OpenCV python bindings.
Home-page: GitHub - opencv/opencv-python: Automated CI toolchain to produce precompiled opencv-python, opencv-python-headless, opencv-contrib-python and opencv-contrib-python-headless packages. · GitHub
Author:
Author-email:
License: Apache 2.0
Location: /home/ubuntu/anaconda3/envs/yolov8/lib/python3.10/site-packages
Requires: numpy
Required-by: ultralytics
(yolov8) ubuntu@ubuntu:~/neuropilot/yolov5$ pip show numpy
Name: numpy
Version: 1.26.

(yolov8) ubuntu@ubuntu:~/neuropilot/yolov5$ python3 --version
Python 3.10.19