Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/happyme531/ztu_somemodelruntime_ez_rknn_async/llms.txt

Use this file to discover all available pages before exploring further.

ModelMetadata provides access to key-value metadata embedded in a compiled .rknn model file. You obtain it by calling session.get_modelmeta(). The object is read-only and reflects the metadata that was baked into the model at conversion time using the RKNN Toolkit.

Properties

custom_metadata_map
dict[str, str]
A dictionary of string key-value pairs extracted from the model file. The only key currently populated by the RKNN runtime is "rknn_custom_string", which maps to the custom string that was set when the model was exported.If no custom string was embedded in the model, the dictionary is empty.
meta = session.get_modelmeta()
print(meta.custom_metadata_map)
# {'rknn_custom_string': 'yolov5s-v6.1-640'}

The rknn_custom_string field

The rknn_custom_string is an arbitrary string that model authors can embed during the RKNN Toolkit conversion step. It is stored in the model binary and read back by the RKNN runtime when the model is loaded. Common uses include storing the model name, version, task type, or any other human-readable identifier that should travel with the model file. The field is set at conversion time in the RKNN Toolkit:
# RKNN Toolkit 2 (conversion side — not this library)
rknn.config(custom_string="yolov5s-v6.1-640")
Once a model is compiled, the string cannot be changed without recompiling. If the original model was exported without a custom string, custom_metadata_map will be an empty dict.

Example

import ztu_somemodelruntime_ez_rknn_async as ez

session = ez.InferenceSession("model.rknn")
meta = session.get_modelmeta()

custom = meta.custom_metadata_map.get("rknn_custom_string", "")
if custom:
    print(f"Model identifier: {custom}")
else:
    print("No custom metadata embedded in this model.")
custom_metadata_map uses the same attribute name as onnxruntime.ModelMetadata for compatibility. In ONNX Runtime, this dict holds arbitrary metadata set during model export. In EZ RKNN Async it holds only the rknn_custom_string field, because that is the only free-form metadata the RKNN format supports.

Build docs developers (and LLMs) love