pub struct ModelMetadata {Show 15 fields
pub description: String,
pub author: String,
pub date: String,
pub version: String,
pub license: String,
pub docs: String,
pub task: Task,
pub stride: u32,
pub batch: usize,
pub imgsz: Option<(usize, usize)>,
pub channels: usize,
pub half: bool,
pub names: HashMap<usize, String>,
pub end2end: bool,
pub kpt_shape: Option<(usize, usize)>,
}Expand description
Metadata extracted from an Ultralytics YOLO ONNX model.
This struct contains all the configuration information embedded in the model, including class names, input dimensions, and task type.
Fields§
§description: StringModel description (e.g., “Ultralytics YOLO11n model trained on coco.yaml”).
Model author.
date: StringExport date.
version: StringUltralytics version used for export.
license: StringLicense information.
docs: StringDocumentation URL.
task: TaskThe task this model performs.
stride: u32Model stride (typically 32 for YOLO).
batch: usizeBatch size the model was exported with.
imgsz: Option<(usize, usize)>Input image size as (height, width).
channels: usizeNumber of input channels (typically 3 for RGB).
half: boolWhether the model uses FP16 (half precision).
names: HashMap<usize, String>Class ID to class name mapping.
end2end: boolWhether the model was exported with end-to-end NMS-free output
(YOLO26-style post-NMS output: [B, max_det, 6+extra]).
kpt_shape: Option<(usize, usize)>Pose keypoint shape as (num_keypoints, dims), e.g. (17, 3).
Implementations§
Source§impl ModelMetadata
impl ModelMetadata
Sourcepub fn from_yaml_str(yaml_str: &str) -> Result<Self>
pub fn from_yaml_str(yaml_str: &str) -> Result<Self>
Sourcepub fn num_classes(&self) -> usize
pub fn num_classes(&self) -> usize
Sourcepub fn class_name(&self, class_id: usize) -> Option<&str>
pub fn class_name(&self, class_id: usize) -> Option<&str>
Sourcepub fn model_name(&self) -> String
pub fn model_name(&self) -> String
Extract the model name from the description.
E.g. “Ultralytics YOLO11n model…” -> “YOLO11n”
Returns YOLO if extraction fails.
Trait Implementations§
Source§impl Clone for ModelMetadata
impl Clone for ModelMetadata
Source§fn clone(&self) -> ModelMetadata
fn clone(&self) -> ModelMetadata
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ModelMetadata
impl Debug for ModelMetadata
Auto Trait Implementations§
impl Freeze for ModelMetadata
impl RefUnwindSafe for ModelMetadata
impl Send for ModelMetadata
impl Sync for ModelMetadata
impl Unpin for ModelMetadata
impl UnsafeUnpin for ModelMetadata
impl UnwindSafe for ModelMetadata
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.