pub enum Task {
Detect,
Segment,
Pose,
Classify,
Obb,
}Expand description
YOLO model task types.
Each task type corresponds to a different computer vision problem that YOLO models can solve. The task type determines the expected model outputs and post-processing steps.
Variants§
Detect
Object detection. Predicts bounding boxes and class labels for objects in an image.
Segment
Instance segmentation. Predicts bounding boxes, class labels, and pixel-level masks for objects.
Pose
Pose estimation. Predicts bounding boxes and skeletal keypoints for objects (e.g., humans).
Classify
Image classification. Predicts class probabilities for the entire image (no localization).
Obb
Oriented bounding box detection (OBB). Predicts rotated bounding boxes for objects, useful for aerial imagery etc.
Implementations§
Source§impl Task
impl Task
Sourcepub const fn as_str(&self) -> &'static str
pub const fn as_str(&self) -> &'static str
Get the string representation used in ONNX model metadata
(e.g. "detect", "segment").
Sourcepub const fn model_suffix(&self) -> &'static str
pub const fn model_suffix(&self) -> &'static str
ONNX filename suffix for this task, used to construct yolo26n{suffix}.onnx.
use ultralytics_inference::Task;
assert_eq!(Task::Detect.model_suffix(), "");
assert_eq!(Task::Segment.model_suffix(), "-seg");Sourcepub fn default_model(&self) -> String
pub fn default_model(&self) -> String
Default nano YOLO26 model filename for this task.
Used by the CLI to auto-pick a model when --model is omitted but --task is set.
use ultralytics_inference::Task;
assert_eq!(Task::Detect.default_model(), "yolo26n.onnx");
assert_eq!(Task::Segment.default_model(), "yolo26n-seg.onnx");Sourcepub const fn has_boxes(&self) -> bool
pub const fn has_boxes(&self) -> bool
Returns true when the task outputs bounding boxes — namely Detect, Segment, Pose, and Obb.
Sourcepub const fn has_masks(&self) -> bool
pub const fn has_masks(&self) -> bool
Returns true only for the Segment task, which outputs per-instance segmentation masks.
Sourcepub const fn has_keypoints(&self) -> bool
pub const fn has_keypoints(&self) -> bool
Returns true only for the Pose task, which outputs skeletal keypoints.
Trait Implementations§
impl Copy for Task
impl Eq for Task
impl StructuralPartialEq for Task
Auto Trait Implementations§
impl Freeze for Task
impl RefUnwindSafe for Task
impl Send for Task
impl Sync for Task
impl Unpin for Task
impl UnsafeUnpin for Task
impl UnwindSafe for Task
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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.