Struct VLMVideoCollection
pub struct VLMVideoCollection(/* private fields */);Expand description
VLM Video Collection functionality, to collect data for video search.
Implementations§
§impl VLMVideoCollection
impl VLMVideoCollection
pub fn start_clip(
&mut self,
include_thumbnails: bool,
include_captioning_data: bool,
) -> Result<(), Error>
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>
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::ClipNotYetStartedwhen 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>
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::NotAvailablewhen VLM video collection is not available
pub fn finish_all_collections(&mut self) -> Result<(), Error>
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::NotAvailablewhen VLM video collection is not available