--- license: mit pretty_name: Bouncing Balls task_categories: - video-classification tags: - synthetic - video - bouncing-balls - physics - colorful - multi-object - collision - webdataset size_categories: - 1K.mp4`, for example `000000.mp4`. Metadata is not duplicated inside the tar files; use `metadata.jsonl` or the Parquet version for the ball annotations. For a VideoSAUR-style configuration, the shard patterns are: ```text dataset.train_shards=/path/to/bouncing-balls/wds/train/bouncing-balls-train-{000000..000008}.tar dataset.val_shards=/path/to/bouncing-balls/wds/val/bouncing-balls-val-{000000..000002}.tar ``` With the Python `webdataset` package: ```python import webdataset as wds train = wds.WebDataset( "wds/train/bouncing-balls-train-{000000..000008}.tar" ) val = wds.WebDataset( "wds/val/bouncing-balls-val-{000000..000002}.tar" ) ``` ## Columns | Column | Description | |---|---| | `video` | The MP4 video clip, stored as embedded bytes in Parquet | | `num_balls` | Number of balls in the clip (3, 4, or 5) | | `colors` | Color names for the balls | | `background_rgb` | Background color as an RGB triplet | | `balls` | Per-ball color, RGB, radius, initial position, and initial velocity | | `num_frames` | Number of frames (24) | | `fps` | Frames per second (12) | | `width` | Frame width (196) | | `height` | Frame height (196) | Each entry in `balls` has: ```text color: string color_rgb: [int, int, int] radius: int initial_position: [x, y] initial_velocity: [vx, vy] ``` ## Usage ```python from datasets import load_dataset ds = load_dataset("jimchen2/bouncing-balls", split="train") print(ds) print(ds[0]["num_balls"]) print(ds[0]["balls"]) ``` Decoding videos with `datasets` may require `torchcodec`. ## Reproduce ```bash pip install -r scripts/requirements.txt # Generate the raw videos and metadata python scripts/generate_bouncing_balls.py \ --count 3000 \ --output bouncing-balls # Create Parquet shards python scripts/shard_bouncing_balls.py \ --source bouncing-balls \ --output sharded \ --shards 10 # Create WebDataset train/val tar shards python scripts/shard_bouncing_balls_wds.py \ --source bouncing-balls \ --output bouncing-balls/wds ``` ## License MIT. The videos are synthetically generated and may be used for experimentation, education, and model development.