D
DreamLake

Examples

Chunk & Batch Processing

import dreamlake as dl
 
video = dl.load_video("v-BV1bW411n7fY9x01")
 
# Split a 10s clip into 200ms segments
clip = video[0.0:10.0]
chunks = clip.chunk(0.200)
 
# VideoArray — supports fancy indexing
print(len(chunks))                    # 50
 
# First frame of each chunk as a batch tensor
first_frames = chunks[:, 0]
arr = first_frames.numpy()
print(arr.shape)                      # (50, 1, H, W, 3)
 
# Feed directly to a model
# emb = model(chunks[:, 0].tensor().to('cuda'))
 
# Full batch
batch = chunks.numpy()
print(batch.shape)                    # (50, N, H, W, 3)