Interface IONNXMetadataImportCallbackReceiver
Interface for receiving callbacks for metadata during ONNX import.
Namespace: Unity.InferenceEngine
Assembly: Unity.InferenceEngine.ONNX.Editor.dll
Syntax
[MovedFrom("Unity.Sentis")]
public interface IONNXMetadataImportCallbackReceiver
Remarks
Implement this interface to import metadata from the ONNX model to Inference Engine.
The ONNX import calls the OnMetadataImported
method to capture the ONNXModelMetadata.
Examples
// Class to read and store the metadata from the ONNX file
public class MyMetadataCallbackHandler : IONNXMetadataImportCallbackReceiver
{
public ONNXModelMetadata Metadata { get; private set; }
// Callback for metadata import. Member Metadata is of type ONNXModelMetadata.
public void OnMetadataImported(AssetImportContext ctx, ONNXModelMetadata metadata)
{
Metadata = metadata;
}
}
Methods
OnMetadataImported(AssetImportContext, ONNXModelMetadata)
This method is called when metadata is loaded during ONNX import, before the model is serialized.
Declaration
void OnMetadataImported(AssetImportContext ctx, ONNXModelMetadata metadata)
Parameters
Type | Name | Description |
---|---|---|
AssetImportContext | ctx | The context of the current import process. |
ONNXModelMetadata | metadata | The metadata fields of the imported ONNX file. |
Remarks
Interface for handling metadata during the import process. It provides a way to store metadata for later access and optionally create additional assets using the AssetImportContext. in a way that it can be accessed later. The AssetImportContext is provided to so that additional assets can be created and added to the import context, if necessary. Note that the model itself is not available in the AssetImportContext at this point.