Public Collections allow you to share a collection of media (videos, audios, images) and intelligence with anyone. When a collection is public:
Anyone with the collection ID can access (read-only) the media within that collection. Anyone can list and use the indexes of this collection and access the scene descriptions. By default, all new collections are private unless explicitly made public. 1. Creating a New Public Collection
When you create a new collection using create_collection function, you can mark it public by setting the is_public parameter to True. This makes the collection immediately accessible to other users (read-only) by sharing the collection ID with them.
public_collection = conn.create_collection(
name="Sample Collection",
description="Sample Collection Description",
is_public=True
)
print(public_collection.is_public) # Should print True
name: (Required) A string specifying the collection’s name. description: (Required) A string describing the collection. is_public: (Optional, boolean) Defaults to False. Set to True to make the collection public. 2. Changing Collection Visibility
You can always toggle visibility of any existing collection. Use make_public() to make any collection public, or make_public() to switch it back to your private collection.
# Make collection private
public_collection.make_private()
print(public_collection.is_public) # Should print False
# Make collection public again
public_collection.make_public()
print(public_collection.is_public) # Should print True
3. Accessing a Public Collection
Any user can access a public collection using its collection ID. Once you have the collection object, you can retrieve videos, audios, or images within it.
# Replace with the actual public collection ID
collection = conn.get_collection("PUBLIC_COLLECTION_ID")
# Retrieve all videos
videos = collection.get_videos()
video = collection.get_video("VIDEO_ID_OF_PUBLIC_COLLECTION")
# Retrieve all audios
audios = collection.get_audios()
audio = collection.get_audio("AUDIO_ID_OF_PUBLIC_COLLECTION")
# Retrieve all images
images = collection.get_images()
image = collection.get_image("IMAGE_ID_OF_PUBLIC_COLLECTION")
Sample Code:
# VideoDB's OCR Benchmark Public Collection
collection = conn.get_collection("c-c0a2c223-e377-4625-94bf-910501c2a31c")
videos = collection.list_videos()
#Stock Market Ticker 01
video = collection.get_video("m-z-0194c27c-f30c-7803-b2ca-8f1026c940a2")
4. Working with Scene Collections and Scene Indexes (Videos)
You can list and retrieve scene collections and scene indexes for a public video.
public_collection = conn.get_collection("PUBLIC_COLLECTION_ID")
video = public_collection.get_video("VIDEO_ID")
# List and retrieve scene collections
scene_collections = video.list_scene_collection()
scene_collection = video.get_scene_collection(
scene_collections[0].get("scene_collection_id")
)
# List and retrieve scene indexes
scene_indexes = video.list_scene_index()
scene_index = video.get_scene_index(scene_indexes[0].get("scene_index_id"))
Sample Code:
# VideoDB's OCR Benchmark Public Collection
collection = conn.get_collection("c-c0a2c223-e377-4625-94bf-910501c2a31c")
# Stock Market Ticker 01
video = collection.get_video("m-z-0194c27c-f30c-7803-b2ca-8f1026c940a2")
scene_collections = video.list_scene_collection()
scene_collection = video.get_scene_collection(
scene_collections[0].get("scene_collection_id")
)
Upcoming Updates:
Copy function to copy the whole collection with it’s indexes. Search using existing spoken and visual indexes on public collections. Get transcription of spoken indexed videos.