dataeval.models.ModelIOSpec¶
- class dataeval.models.ModelIOSpec¶
Typed, immutable view of a model-metadata.json input/output contract.
Produced by
read_model_metadata()and consumed bybuild_model_input()and the opinionated predictors to shape and normalize images to the contract a model expects. Instances are frozen (hashable, read-only).- task¶
Declared model interface (
io.interfacein the metadata file).- Type:¶
{“IMAGE_CLASSIFICATION”, “IMAGE_OBJECT_DETECTION”}
- channels¶
Expected input color layout.
"RGB"is 3-channel,"GRAYSCALE"is 1-channel; input images are converted to match.- Type:¶
{“RGB”, “GRAYSCALE”}
- height¶
Expected input height in pixels.
-1marks a variable dimension that callers must override explicitly.
- width¶
Expected input width in pixels.
-1marks a variable dimension that callers must override explicitly.
- n_boxes¶
Number of detection boxes (
io.output.nBoxes);Nonefor classification models.
See also
read_model_metadataParse a metadata file into a
ModelIOSpec.build_model_inputShape images to this contract.
Examples
>>> spec = ModelIOSpec( ... task="IMAGE_CLASSIFICATION", ... channels="RGB", ... height=8, ... width=8, ... batch_size=-1, ... n_classes=4, ... ) >>> spec.channels 'RGB' >>> spec.n_boxes is None True