dataeval.models.read_model_metadata

dataeval.models.read_model_metadata(path)

Read and validate an opinionated model-metadata.json file.

Parses the io block of the metadata file and returns its input/output contract as a ModelIOSpec. The interface, color layout, and required shape fields are validated; detection metadata additionally reads the optional box count.

Parameters:
path : str or Path

Path to the model-metadata.json file describing the model contract.

Returns:

Validated, immutable view of the model’s input/output contract.

Return type:

ModelIOSpec

Raises:
  • ValueError – If a required field is missing, or io.interface / io.input.channels holds an unsupported value.

  • FileNotFoundError – If path does not exist.

See also

ModelIOSpec

The returned contract.

Examples

>>> spec = read_model_metadata(classifier_metadata_path)
>>> spec.task
'IMAGE_CLASSIFICATION'
>>> (spec.channels, spec.height, spec.width)
('RGB', 8, 8)
>>> spec.n_classes
4