Integration with AI
VXG aggregates and pre-processes video for AI and provides the video data in many formats including:
Images on demand and at any sample rate
Clips on demand and of any length
Streaming live and recorded video
VXG integrates with AI engines using a so-called group access token - a string variable that contains all information about a collection of cameras that are assigned to work with this AI.
An AI engine uses the group access token to enumerate cameras and call VXG functions to retrieve data required by the AI engine. It could be images, clips, live or recorded streaming video. Using a group access token you can get access tokens for each individual camera and call functions for each camera individually. At the same time, some functions support operations for a group of cameras and in this case, a group access token is used to perform an operation with a collection of cameras.
Integration steps
Configure which cameras should be processed, this step includes
Creating a group access token.
Adding cameras to the group access token.
Passing the group access token to the AI service. This is just passing a long string from the Cloud VMS to the AI service using any available method (from API to just hardcoding the string).
Retrieving data from channels for AI processing, this step includes
Retrieving individual channel access tokens from the group access token.
Retrieving live or recorded video, clips or images for each channel.
(Optional) Recording metadata generated by AI to the Cloud VMS storage.
Access data from an AI engine
AI engine needs to know a group access token. Using the group access token the AI engine can access data from any camera in the collection that is associated with this particular AI. See How to Work with Channel Groups for samples of how to work with group access tokens.
See How to Get Video, Clips and Images for samples of how to generate images from live video, at any rate, batches of images from video storage, and how to create clips.
For samples of how to work with metadata, please refer to How to Read and Write Metadata
The full API is published in the REST API section.
Sample code
There are many sample codes published on https://github.com/VideoExpertsGroup/
The following sample code - ai_integration.py will show usage of the main required functions:
list_channels_for_lkey - shows all channels for the provided LKey.
create_group_channel - creates a group channel and returns its ID and group access token
add_channel_to_group - adds channels to a group channel.
get_channels_from_group - get channels from a group channel
get_live_urls_for_channels_in_group - retrieve live URLs for channels in a group channel
record_metadata_to_channel - records metadata to a channel
Related documents: