Overview
In this guide, we’ll walk through the steps to upload your 2D video data to Nucleus. Nucleus supportsVideoScenes, which are either mp4 videos or sequences of DatasetItems where each DatasetItem represents a video frame.
- Create a
DatasetforVideoScenes - Grant Scale access to your data
- Create
VideoScenesfrom video files - Create video
DatasetItemsif you are uploading a video as an array of images - Create
VideoScenesfromDatasetItems - Upload
VideoScenestoDataset
Creating a Dataset
Get started by creating a new Dataset to which to upload your video data. In order to create a Dataset to which you can upload VideoScenes you need to set the is_scene flag to True during creation.
Create a Dataset
Granting Scale Access to Your Data
If you are using non-public cloud storage for your images or videos, then you need to make sure your remote data is accessible to Scale by following this guide.Creating VideoScenes from video files
We can create a VideoScene directly from a video mp4 file by providing the video url to the video_location parameter. We can skip uploading video data to Scale using privacy mode by following this guide. Note: privacy mode is only available to enterprise customers.
Creating Video DatasetItems if you are uploading a video as an array of images
Alternatively, we can create a VideoScene from an array of DatasetItems, each representing a frame of a video, via API. This step should be skipped if you are uploading videos directly as mp4 files.
When uploading items via API, you’ll first need to construct DatasetItem payloads. The best way to do so is using the Python SDK’s DatasetItem constructor, which takes in a few parameters:
Create DatasetItems
Creating VideoScenes from DatasetItems
After creating DatasetItems for each frame, you can string up to 3000 frames together into a VideoScene. For longer sequences, consider reducing the frame rate or splitting videos into shorter sequences.
Create a VideoScene
VideoScene. The add_item method allows you to add or update items in the sequence by index. These methods can only be used if you created your VideoScene from an array of images.
Update a VideoScene
Uploading VideoScenes to Nucleus
We’ll upload to the Dataset created earlier in this guide. You can always retrieve a Dataset by its dataset ID. You can list all of your datasets’ IDs using NucleusClient.datasets, or extract one from the Nucleus dashboard’s URL upon clicking into the Dataset.
Get existing Dataset
Dataset.append.
Upload VideoScenes to Dataset
True, your upload will overwrite any existing scene or item-level metadata for any collisions on reference_id.