--- license: cc-by-4.0 pretty_name: Lifelong Drive tags: - video - lifelong-learning - continual-learning - online-learning - video-diffusion - video-prediction - world-models - autonomous-driving - latent-diffusion size_categories: - 1M. Continuous dashcam footage of a 1,675 km drive from Chongqing to Shanghai. The drive spans mountains, cities and tunnels, sunny, cloudy and rainy weather, and other vehicles moving at different speeds: real-world perceptual data from a single correlated and non-stationary stream. The drive is nearly continuous; rare, subtle discontinuities occur where the driver took breaks (the video resumes at the same or a nearby highway location). The repository holds both the 512 x 512 RGB video and the pre-computed Stable Diffusion latents the paper's models were trained on. | | Train stream | Test stream | |---|---|---| | Frames | 1,000,000 | 100,000 | | Source video | 512 x 512, 20 FPS (~13.9 h), `train/LifelongDriveTrain.mp4` | `test/LifelongDriveTest.mp4` | | Latents | 4 x 64 x 64 per frame, 2,000 x 500 frames | 200 x 500 frames | The test stream is the 100,000 frames that follow the train stream in the same video. ## Files ``` train/LifelongDriveTrain.mp4 train/encoded_video/batch_0000.pt … batch_1999.pt test/LifelongDriveTest.mp4 test/encoded_video/batch_0000.pt … batch_0199.pt ``` Each `batch_XXXX.pt` is a `torch.save`d dict covering 500 consecutive frames (`batch_i` = stream frames `i*500 … i*500+499`): | key | shape | dtype | meaning | |---|---|---|---| | `quantized_latents` | (500, 4, 64, 64) | uint8 | per-frame 8-bit quantized VAE latents | | `min_vals` | (500,) | float16 | per-frame dequantization offset | | `scales` | (500,) | float16 | per-frame dequantization scale | Latents were produced by `datasets/stable_diffusion_encoder.py` in the code repository: frames are mapped to [-1, 1], encoded with the SDXL VAE [`madebyollin/sdxl-vae-fp16-fix`](https://huggingface.co/madebyollin/sdxl-vae-fp16-fix) (`latent = vae.encode(x).latent_dist.sample() * 0.13025`), then quantized per frame with `q = round((latent - min) / scale)`, `scale = (max - min) / 255`. ## Loading ```python import torch d = torch.load("train/encoded_video/batch_0000.pt", map_location="cpu") q, lo, sc = d["quantized_latents"], d["min_vals"], d["scales"] latents = q.float() * sc.float()[:, None, None, None] + lo.float()[:, None, None, None] # (500, 4, 64, 64) # optional: decode back to RGB with diffusers from diffusers import AutoencoderKL vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix") rgb = (vae.decode(latents[:4] / 0.13025).sample.clamp(-1, 1) + 1) / 2 # (4, 3, 512, 512) in [0, 1] ``` To use the dataset with the paper's code (it expects the directory at `datasets/drive`): ```bash pip install -U huggingface_hub hf download jason-yoo-108/lifelong-drive --repo-type dataset --local-dir datasets/drive # add --exclude "*.mp4" to skip the video ``` ## Provenance and license The footage comes from the YouTube video ["1674.8 kilometers of long-distance travel across half of China - driving from Chongqing to Shanghai"](https://www.youtube.com/watch?v=-iSewsdMxkg) by 中国街景 ChinaStreetView (2023). It was cropped and downsampled to 512 x 512 at 20 FPS; the first 1,000,000 frames form the train stream and the next 100,000 the test stream (recipe in the `datasets/mp4_to_npy.py` docstring of the code repository). The derived video and latents are released under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) for research use. The underlying footage belongs to its original creator; please credit the source channel when redistributing. ## Citation ```bibtex @article{yoo2024lifelong, title = {Lifelong Learning of Video Diffusion Models From a Single Video Stream}, author = {Yoo, Jason and He, Yingchen and Naderiparizi, Saeid and Green, Dylan and van de Ven, Gido M. and Pleiss, Geoff and Wood, Frank}, journal = {arXiv preprint arXiv:2406.04814}, year = {2024} } ```