Creating Datasets with Sequences
Deep Lake sequences are a powerful tool for storing temporal annotations such as bounding boxes in each frame of a video.
How to create a dataset with sequences of images and labels
This tutorial is also available as a Colab Notebook
Deep learning with computer vision is increasingly moving in a direction of temporal data, where video frames and their labels are stored as sequences, rather than independent images. Models trained on this data directly account for the temporal information content, rather than making predictions frame-by-frame and then fusing them with non-deep-learning techniques.
Create the Deep Lake Dataset
The first step is to download the dataset Multiple Object Tracking Benchmark. Additional information about this data and its format is in this GitHub Repo.
The dataset has the following folder structure:
data_dir
|_train
|_MOT16_N (Folder with sequence N)
|_det
|_gt (Folder with ground truth annotations)
|_img1 (Folder with images the sequence)
|_00000n.jpg (image of n-th frame in sequence)
|_MOT16_M
....
|_test (same structure as _train)The annotations in gt.txt have the format below, and the last 4 items (conf->z) are not used in the Deep Lake dataset:
Now we're ready to create a Deep Lake Dataset in the ./mot_2016_train folder by running:
Next, let's write code to inspect the folder structure for the downloaded dataset and create a list of folders containing the sequences:
Finally, let's create the tensors by using the sequence[...] htype, iterate through each sequence, and iterate through each frame within the sequence, one-by-one.
Data is appended to sequence[...] htypes using lists. The list contains the whole sample, and the individual elements of the list are the individual data points, such as the image frame, the bounding boxes in a particular frame, etc.
See end of code block below.
This dataset identifies objects by id, where each id represents an instance of an object. However, the id does not identify the class of the object, such person, car, truck, etc. Therefore, the ids were not uploaded as htype = "class_label".
Inspect the Deep Lake Dataset
Let's check out the 10th frame in the 6th sequence in this dataset. A complete visualization of this dataset is available in Activeloop Platform.

Congrats! You just created a dataset using sequences! π
Was this helpful?