Skip to main content

Module schema

Module schema 

Source
Expand description

Schema v2 metadata types for EdgeFirst model configuration.

Schema v2 introduces a two-layer output model that separates the logical contract (what the model produces semantically) from the physical realization (what tensors the converter emitted). Each entry in the top-level SchemaV2::outputs array is a LogicalOutput. A logical output either IS a physical tensor (when the converter did not split it further) or contains a outputs array of PhysicalOutput children that realize it.

§Example — YOLOv8 detection, flat (TFLite)

use edgefirst_decoder::schema::SchemaV2;

let json = r#"{
  "schema_version": 2,
  "outputs": [
    {
      "name": "boxes", "type": "boxes",
      "shape": [1, 64, 8400],
      "dshape": [{"batch": 1}, {"num_features": 64}, {"num_boxes": 8400}],
      "encoding": "dfl", "decoder": "ultralytics", "normalized": true,
      "dtype": "int8",
      "quantization": {"scale": 0.00392, "zero_point": 0, "dtype": "int8"}
    },
    {
      "name": "scores", "type": "scores",
      "shape": [1, 80, 8400],
      "dshape": [{"batch": 1}, {"num_classes": 80}, {"num_boxes": 8400}],
      "decoder": "ultralytics", "score_format": "per_class",
      "dtype": "int8",
      "quantization": {"scale": 0.00392, "zero_point": 0, "dtype": "int8"}
    }
  ]
}"#;

let schema: SchemaV2 = serde_json::from_str(json).unwrap();
assert_eq!(schema.schema_version, 2);
assert_eq!(schema.outputs.len(), 2);

Structs§

InputSpec
Input tensor specification.
LogicalOutput
Logical output: the semantic contract the model exposes.
PhysicalOutput
Physical output: a concrete tensor produced by the converter.
Quantization
Quantization parameters for a quantized tensor.
SchemaV2
Root of the edgefirst.json schema v2 metadata.

Enums§

Activation
Activation function applied to or required by a physical tensor.
BoxEncoding
Box encoding for boxes logical outputs.
DType
Quantized or floating-point data type.
DecoderKind
Decoder framework for a logical output.
DecoderVersion
YOLO architecture version for Ultralytics decoders.
LogicalType
Semantic type of a logical output.
NmsMode
HAL NMS mode.
PhysicalType
Semantic type of a physical output.
ScoreFormat
Score format for scores logical outputs.
Stride
FPN stride. Square(s) means (s, s); Rect(sx, sy) supports non-square inputs.

Constants§

MAX_SUPPORTED_SCHEMA_VERSION
Highest schema_version this parser accepts. Files with a higher version are rejected rather than silently parsed against the wrong grammar.