Creating Video Datasets
Get started with video datasets using Deep Lake.
Last updated
Get started with video datasets using Deep Lake.
Last updated
Video datasets are becoming increasingly common in Computer Vision applications. This tutorial demonstrates how to convert a simple video classification dataset into Deep Lake format. Uploading videos in Deep Lake is nearly identical as uploading images, aside from minor differences in sample compression that are described below.
When using Deep Lake with videos, make sure to install it using one of the following options:
pip3 install "deeplake[av]"
pip3 install "deeplake[all]"
The first step is to download the small dataset below called running walking.
The dataset has the following folder structure:
Now that you have the data, let's create a Deep Lake Dataset in the ./running_walking_deeplake
folder by running:
Next, let's inspect the folder structure for the source dataset ./running_walking
to find the class names and the files that need to be uploaded to the Deep Lake dataset.
Finally, let's create the tensors and iterate through all the images in the dataset in order to populate the data in Deep Lake.
They key difference between video
and image
htypes
is that Deep Lake does not explicitly perform compression for videos. The sample_compression
input in the create_tensor
function is used to verify that the compression of the input video file to deeplake.read()
matches the sample_compression
parameter. If there is a match, the video is uploaded in compressed format. Otherwise, an error is thrown.
Images have a slightly different behavior, because the input image files are stored and re-compressed (if necessary) to the sample_compression
format.
In order for Activeloop Platform to correctly visualize the labels, class_names
must be a list of strings, where the numerical labels correspond to the index of the label in the list.
Let's check out the first frame in the second sample from this dataset.
Congrats! You just created a video classification dataset! 🎉