VLMVideoCollection

Struct VLMVideoCollection 

pub struct VLMVideoCollection(/* private fields */);
Expand description

VLM Video Collection functionality, to collect data for video search.

Implementations§

§

impl VLMVideoCollection

pub fn start_clip( &mut self, include_thumbnails: bool, include_captioning_data: bool, ) -> Result<(), Error>

Start a new clip to collect data for the VLM Video Embedder.

The user needs to decide when data collection should start, e.g. when an object is detected or when the camera awakes through a motion event. The VLMVideoCollection then will start collecting the necessary data for the VLM Video Embedder from this point onwards for every call to process_frame, until end_clip is called.

The results will be available when calling end_clip.

If include_thumbnails is true, the collected data can be used for thumbnail generation. If include_captioning_data is true, the result can be used for caption generation. If the only purpose of the data is to do video search with the VLM Video Embedder, then both can be set to false to keep the data size smaller. Accuracy of video search is not affected by this parameter.

This is the clip-based version of video search. As an alternative, a clip-less version is available via set_collection_ready_callback, see docs for that function for more details.

§Errors
  • Error::ClipAlreadyStarted

pub fn end_clip(&mut self) -> Result<ClipData, Error>

Ends the data collection for the clip started with start_clip.

The results are returned as ClipData, which can be stored or processed with VLMVideoEmbedder.

§Errors
  • Error::ClipNotYetStarted when a clip was not started previously, or no frames have been processed, or the clip was already ended before.

pub fn set_collection_ready_callback( &mut self, callback: impl FnMut(ClipData) + 'static, ) -> Result<(), Error>

Register a callback invoked synchronously from process_frame whenever a new collection is ready.

This is the clip-less version of video search, as an alternative to the clip-based version using start_clip and end_clip. A callback is registered that automatically triggers whenever data for video search is ready to be collected. This is driven by internal Plumerai logic rather than a user-defined time interval. In case of clear clip boundaries (e.g. triggered by PIR waking up the camera) it is recommended to use start_clip and end_clip instead. In case of cameras that run 24/7 with no clear clip boundaries, this function is recommended.

The user must call finish_all_collections at end-of-video to flush still-active collections.

The callback is invoked on the calling thread of process_frame (and of finish_all_collections) and may fire zero, one, or multiple times within a single call.

§Arguments
  • callback: A function invoked with the serialized collection data.
§Errors
  • Error::NotAvailable when VLM video collection is not available

pub fn finish_all_collections(&mut self) -> Result<(), Error>

At the end of a video sequence, call this to flush collections. Only to be used in conjunction with set_collection_ready_callback.

§Errors
  • Error::NotAvailable when VLM video collection is not available

Trait Implementations§

§

impl Debug for VLMVideoCollection

§

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

Formats the value using the given formatter. Read more

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> 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, 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.