Skip to main content

ImageAnalysis

Struct ImageAnalysis 

Source
pub struct ImageAnalysis { /* private fields */ }
Available on crate features std or alloc only.
Expand description

Structured single-image VLM output. Construct via an engine’s ImageAnalysisTask::parse (the Task::parse impl) or, for tests/builders, ImageAnalysis::new followed by with_* chains. All fields are private; the accessor surface follows the rest of the crate’s scenesdetect-style getter / with_* / set_* convention.

Detection-array fields (subjects / objects / actions / mood / lighting) are Vec<SmolStr> — flat label lists, no per-detection confidence. Wrapping each label in a Detection { label, confidence } would require a confidence source the VLM can’t reliably provide — VLM self-reported confidence is poorly calibrated, and a hardcoded placeholder is a no-op for both UX and search-time ranking. If a downstream consumer needs per-detection scoring, the practical sources are search-time embedding similarity or scene-aggregation metrics, not VLM self-report.

Implementations§

Source§

impl ImageAnalysis

Source

pub fn new() -> Self

Construct an empty ImageAnalysis (all fields default).

Source

pub fn scene(&self) -> &str

Short scene category (e.g. "office", "airport arrivals hall"). Returns the empty string when the model didn’t classify the scene (SCENE_PROMPT instructs the model to use empty strings for unknown fields). Check scene().is_empty() to test for absence.

Source

pub fn with_scene(self, val: impl Into<SmolStr>) -> Self

Builder-style setter for scene. Pass an empty string to clear.

Source

pub fn set_scene(&mut self, val: impl Into<SmolStr>) -> &mut Self

In-place setter for scene. Pass an empty string to clear.

Source

pub fn description(&self) -> &str

1-2 sentence free-form scene description, or empty when the model produced no description (e.g., on a low-information frame).

Source

pub fn with_description(self, val: impl Into<SmolStr>) -> Self

Builder-style setter for description. Pass an empty string to clear.

Source

pub fn set_description(&mut self, val: impl Into<SmolStr>) -> &mut Self

In-place setter for description. Pass an empty string to clear.

Source

pub fn subjects(&self) -> &[SmolStr]

Distinct people or animals visible in the scene.

Source

pub fn with_subjects(self, val: Vec<SmolStr>) -> Self

Builder-style setter for subjects.

Source

pub fn set_subjects(&mut self, val: Vec<SmolStr>) -> &mut Self

In-place setter for subjects.

Source

pub fn objects(&self) -> &[SmolStr]

Notable, search-relevant objects.

Source

pub fn with_objects(self, val: Vec<SmolStr>) -> Self

Builder-style setter for objects.

Source

pub fn set_objects(&mut self, val: Vec<SmolStr>) -> &mut Self

In-place setter for objects.

Source

pub fn actions(&self) -> &[SmolStr]

Visible actions.

Source

pub fn with_actions(self, val: Vec<SmolStr>) -> Self

Builder-style setter for actions.

Source

pub fn set_actions(&mut self, val: Vec<SmolStr>) -> &mut Self

In-place setter for actions.

Source

pub fn mood(&self) -> &[SmolStr]

Scene-level mood terms.

Source

pub fn with_mood(self, val: Vec<SmolStr>) -> Self

Builder-style setter for mood.

Source

pub fn set_mood(&mut self, val: Vec<SmolStr>) -> &mut Self

In-place setter for mood.

Source

pub fn shot_type(&self) -> &str

One short camera-shot label (e.g. "wide shot", "close-up"), or empty when the model didn’t pick one.

Source

pub fn with_shot_type(self, val: impl Into<SmolStr>) -> Self

Builder-style setter for shot_type. Pass an empty string to clear.

Source

pub fn set_shot_type(&mut self, val: impl Into<SmolStr>) -> &mut Self

In-place setter for shot_type. Pass an empty string to clear.

Source

pub fn lighting(&self) -> &[SmolStr]

Lighting terms.

Source

pub fn with_lighting(self, val: Vec<SmolStr>) -> Self

Builder-style setter for lighting.

Source

pub fn set_lighting(&mut self, val: Vec<SmolStr>) -> &mut Self

In-place setter for lighting.

Source

pub fn tags(&self) -> &[SmolStr]

8-12 short English search tags in lowercase.

Source

pub fn with_tags(self, val: Vec<SmolStr>) -> Self

Builder-style setter for tags.

Source

pub fn set_tags(&mut self, val: Vec<SmolStr>) -> &mut Self

In-place setter for tags.

Trait Implementations§

Source§

impl Clone for ImageAnalysis

Source§

fn clone(&self) -> ImageAnalysis

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ImageAnalysis

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ImageAnalysis

Source§

fn default() -> ImageAnalysis

Returns the “default value” for a type. Read more
Source§

impl PartialEq for ImageAnalysis

Source§

fn eq(&self, other: &ImageAnalysis) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for ImageAnalysis

Source§

impl StructuralPartialEq for ImageAnalysis

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.