Datasets:
Add 196x196 videos, raw MP4s, metadata, and scripts
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
Files changed (50)
- README.md+30-8
- data/train-00000-of-00010.parquet+2-2
- data/train-00001-of-00010.parquet+2-2
- data/train-00002-of-00010.parquet+2-2
- data/train-00003-of-00010.parquet+2-2
- data/train-00004-of-00010.parquet+2-2
- data/train-00005-of-00010.parquet+2-2
- data/train-00006-of-00010.parquet+2-2
- data/train-00007-of-00010.parquet+2-2
- data/train-00008-of-00010.parquet+2-2
- data/train-00009-of-00010.parquet+2-2
- metadata.jsonlAdded
- scripts/__pycache__/generate_bouncing_balls.cpython-313.pycAdded
- scripts/__pycache__/shard_bouncing_balls.cpython-313.pycAdded
- scripts/generate_bouncing_balls.pyAdded+142
- scripts/requirements.txtAdded+6
- scripts/shard_bouncing_balls.pyAdded+68
- videos/000000.mp4Added+3
- videos/000001.mp4Added+3
- videos/000002.mp4Added+3
- videos/000003.mp4Added+3
- videos/000004.mp4Added+3
- videos/000005.mp4Added+3
- videos/000006.mp4Added+3
- videos/000007.mp4Added+3
- videos/000008.mp4Added+3
- videos/000009.mp4Added+3
- videos/000010.mp4Added+3
- videos/000011.mp4Added+3
- videos/000012.mp4Added+3
- videos/000013.mp4Added+3
- videos/000014.mp4Added+3
- videos/000015.mp4Added+3
- videos/000016.mp4Added+3
- videos/000017.mp4Added+3
- videos/000018.mp4Added+3
- videos/000019.mp4Added+3
- videos/000020.mp4Added+3
- videos/000021.mp4Added+3
- videos/000022.mp4Added+3
- videos/000023.mp4Added+3
- videos/000024.mp4Added+3
- videos/000025.mp4Added+3
- videos/000026.mp4Added+3
- videos/000027.mp4Added+3
- videos/000028.mp4Added+3
- videos/000029.mp4Added+3
- videos/000030.mp4Added+3
- videos/000031.mp4Added+3
- videos/000032.mp4Added+3
23 unmodified lines24252627282930313233343536372 unmodified lines4041424344454647484950515253542 unmodified lines57585960616263647 unmodified lines72737475767723 unmodified lines## Dataset summary- **Videos:** 3,000 MP4 clips, stored as embedded bytes in Parquet- **Shards:** 10 train shards, with 300 videos per shard- **Resolution:** 64 × 64 pixels- **Duration:** 24 frames at 12 fps (2 seconds per clip)- **Variation:** ball color, radius, initial position, horizontal/vertical velocity, and dark background color- **Generation seed:** 42Each video contains one ball moving at constant velocity and bouncing off the four walls. Colors are sampled in HSV space to keep them bright and saturated.## Files2 unmodified linestrain-00000-of-00010.parquet...train-00009-of-00010.parquet```Every shard is self-contained: video bytes and metadata are stored together, so there are no external video paths to resolve.## Columns| Column | Description ||---|---|| `video` | The MP4 video clip, stored as embedded bytes || `color` | Approximate color name || `color_rgb` | Ball color as an RGB triplet || `background_rgb` | Background color as an RGB triplet |2 unmodified lines| `velocity_y` | Initial vertical velocity in pixels/frame || `num_frames` | Number of frames (24) || `fps` | Frames per second (12) || `width` | Frame width (64) || `height` | Frame height (64) |## Usage7 unmodified linesDecoding videos with `datasets` may require `torchcodec`.## LicenseMIT. The videos are synthetically generated and may be used for experimentation, education, and model development.23 unmodified lines242526272829303132333435363738392 unmodified lines4243444546474849505152535455565758596061626364652 unmodified lines68697071727374757 unmodified lines838485868788899091929394959697989923 unmodified lines## Dataset summary- **Videos:** 3,000 MP4 clips- **Resolution:** **196 × 196 pixels**- **Duration:** 24 frames at 12 fps (2 seconds per clip)- **Shards:** 10 Parquet shards, with 300 videos per shard- **Variation:** ball color, radius, initial position, horizontal/vertical velocity, and dark background color- **Generation seed:** 42- **Raw MP4 size:** approximately 15.7 MiB- **Parquet shard size:** approximately 15.9 MiBEach video contains one ball moving at constant velocity and bouncing off the four walls. Colors are sampled in HSV space to keep them bright and saturated. Ball radii and speeds are scaled for the 196 × 196 canvas.## Files2 unmodified linestrain-00000-of-00010.parquet...train-00009-of-00010.parquetvideos/000000.mp4...002999.mp4metadata.jsonlscripts/generate_bouncing_balls.pyshard_bouncing_balls.pyrequirements.txt```The Parquet shards are self-contained: MP4 bytes and metadata are embedded together. The original MP4 files are also included under `videos/` for direct use. `metadata.jsonl` contains one record per raw video, keyed by `file_name`.## Columns| Column | Description ||---|---|| `video` | The MP4 video clip, stored as embedded bytes in Parquet || `color` | Approximate color name || `color_rgb` | Ball color as an RGB triplet || `background_rgb` | Background color as an RGB triplet |2 unmodified lines| `velocity_y` | Initial vertical velocity in pixels/frame || `num_frames` | Number of frames (24) || `fps` | Frames per second (12) || `width` | Frame width (196) || `height` | Frame height (196) |## Usage7 unmodified linesDecoding videos with `datasets` may require `torchcodec`.## Reproduce```bashpip install -r scripts/requirements.txtpython scripts/generate_bouncing_balls.py --count 3000 --output bouncing-ballspython scripts/shard_bouncing_balls.py \--source bouncing-balls \--output sharded \--shards 10```## LicenseMIT. The videos are synthetically generated and may be used for experimentation, education, and model development.
123version https://git-lfs.github.com/spec/v1oid sha256:6688a3ecbe860ac3a4b14cc521a63e4ecc6599851e07e53fa2c5243503d1b1e1size 965983123version https://git-lfs.github.com/spec/v1oid sha256:e3f826a71305e84ea17f7cf91ac8a5559134a964a84e37e726777f4d7e0673cfsize 1613809
123version https://git-lfs.github.com/spec/v1oid sha256:c1cf1aaf69a67986c0656f6377e575cb1a1656fe8fb3bf1111d69d5a29ac467fsize 960779123version https://git-lfs.github.com/spec/v1oid sha256:db8469044335239d4b62cc43dbd8aea5f9f1961273a9ce682618c262784e6c77size 1663063
123version https://git-lfs.github.com/spec/v1oid sha256:c6c4628a0285dc839f48db7a74647b20778ba7363af8f2ae7c616da3eddea103size 991311123version https://git-lfs.github.com/spec/v1oid sha256:dca88eeb4edf3e9f4aea38cf8a22617d42906b05960a0aece3fa72d0940c7c7dsize 1697916
123version https://git-lfs.github.com/spec/v1oid sha256:763887874c9480518300eca307e80ddfe45975d82ef31ba68ebdf91bdbd655e6size 972002123version https://git-lfs.github.com/spec/v1oid sha256:65709cb54e381519f2782e422f464631d7597ff29b862c505da7a21978f8bb18size 1661781
123version https://git-lfs.github.com/spec/v1oid sha256:b64e5c01732dce92e62edef349a0427b9628cd27d420537a2166334c3c9d4dc8size 972635123version https://git-lfs.github.com/spec/v1oid sha256:a1dd10d465224d5bf4856751442b8167dfe3c1459e463c173efa71d3545da1eesize 1620281
123version https://git-lfs.github.com/spec/v1oid sha256:5e58ef8f8fc52c7dbddfc190a3dc815afbc9e9cfc69d03965213d8523e7487bfsize 969715123version https://git-lfs.github.com/spec/v1oid sha256:dbba1764fb5aa7168fad027a7b59351ef0d083dde16d0267c2c1480f859d1747size 1669765
123version https://git-lfs.github.com/spec/v1oid sha256:d8c62bc0b649c4e819fa96646bac86dfa85ae13891586740d253514e556fe6d2size 972376123version https://git-lfs.github.com/spec/v1oid sha256:482be60d8ec001a0acd2bab693f0e32b202206f9a866d2563ad338cedb98048csize 1677184
123version https://git-lfs.github.com/spec/v1oid sha256:1ee5903f1ebc98eb31ad3bf462787c3f0114bf7c9c58cb5d2e1ed07a516148dbsize 960857123version https://git-lfs.github.com/spec/v1oid sha256:751e0c2314d21c1cd3660696a16994d79748d18ef9e2520312e667a22d013600size 1670732
123version https://git-lfs.github.com/spec/v1oid sha256:0a6056ea7ac0a5442acfe75b6cbaace9360082f249af1cc2a48b381b5f92ad9bsize 963689123version https://git-lfs.github.com/spec/v1oid sha256:3541dd7fbd0e8dcf9a14f1e4620658179414dd821c1803f83408edbde4d7bd2esize 1673394
123version https://git-lfs.github.com/spec/v1oid sha256:f298ef53be02cd62404a6c07afacf85406178cb4eef7423c7e9dd14349665861size 974392123version https://git-lfs.github.com/spec/v1oid sha256:0b57e18029368532b1f5fc7c9f4d7e704bdf338cc1e0d5765f95dde7c7002d85size 1673091
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142"""Generate the synthetic bouncing-balls video dataset."""
import argparseimport jsonfrom pathlib import Path
import cv2import imageio.v2 as imageioimport numpy as np
WIDTH = 196HEIGHT = 196FRAMES = 24FPS = 12MIN_RADIUS = 18MAX_RADIUS = 27MIN_SPEED = 6MAX_SPEED = 12
def color_name(h, s, v): degrees = h * 2 if s < 45 and v > 220: return "white" if degrees < 15 or degrees >= 345: return "red" if degrees < 40: return "orange" if degrees < 70: return "yellow" if degrees < 165: return "green" if degrees < 200: return "cyan" if degrees < 250: return "blue" if degrees < 290: return "purple" if degrees < 345: return "pink" return "red"
def make_video(path, rng): radius = int(rng.integers(MIN_RADIUS, MAX_RADIUS + 1)) x = float(rng.uniform(radius, WIDTH - radius)) y = float(rng.uniform(radius, HEIGHT - radius))
def nonzero_velocity(): speed = int(rng.integers(MIN_SPEED, MAX_SPEED + 1)) return float(speed * rng.choice([-1, 1]))
vx = nonzero_velocity() vy = nonzero_velocity() initial_vx, initial_vy = int(vx), int(vy) hue = int(rng.integers(0, 180)) saturation = int(rng.integers(175, 256)) value = int(rng.integers(210, 256)) rgb = cv2.cvtColor( np.uint8([[[hue, saturation, value]]]), cv2.COLOR_HSV2RGB )[0, 0] ball_rgb = [int(c) for c in rgb] bg_rgb = [int(c) for c in rng.integers(8, 33, size=3)]
with imageio.get_writer( path, fps=FPS, codec="libx264", pixelformat="yuv420p", macro_block_size=1, output_params=["-preset", "ultrafast", "-crf", "28"], ) as writer: for _ in range(FRAMES): frame = np.empty((HEIGHT, WIDTH, 3), dtype=np.uint8) frame[:, :] = bg_rgb cv2.circle( frame, (int(round(x)), int(round(y))), radius, ball_rgb, thickness=-1, lineType=cv2.LINE_AA, ) writer.append_data(frame)
x += vx y += vy if x < radius: x = radius + (radius - x) vx = abs(vx) elif x > WIDTH - radius: x = (WIDTH - radius) - (x - (WIDTH - radius)) vx = -abs(vx) if y < radius: y = radius + (radius - y) vy = abs(vy) elif y > HEIGHT - radius: y = (HEIGHT - radius) - (y - (HEIGHT - radius)) vy = -abs(vy)
return { "color": color_name(hue, saturation, value), "color_rgb": ball_rgb, "background_rgb": bg_rgb, "radius": radius, "velocity_x": initial_vx, "velocity_y": initial_vy, "num_frames": FRAMES, "fps": FPS, "width": WIDTH, "height": HEIGHT, }
def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("--count", type=int, default=3000) parser.add_argument("--seed", type=int, default=42) parser.add_argument("--output", type=Path, default=Path("bouncing-balls")) args = parser.parse_args()
videos_dir = args.output / "videos" videos_dir.mkdir(parents=True, exist_ok=True) records = []
for i in range(args.count): filename = f"videos/{i:06d}.mp4" rng = np.random.default_rng(args.seed + i) info = make_video(args.output / filename, rng) records.append({"file_name": filename, **info}) if (i + 1) % 250 == 0 or i + 1 == args.count: print(f"Generated {i + 1}/{args.count} videos", flush=True)
with (args.output / "metadata.jsonl").open("w") as f: for record in records: f.write(json.dumps(record) + "\n")
print(f"Done: {args.count} videos in {args.output}", flush=True)
if __name__ == "__main__": main()123456datasetsimageioimageio-ffmpegnumpyopencv-pythonpyarrow1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768"""Package generated MP4 videos and metadata into Parquet shards."""
import argparseimport jsonimport mathfrom pathlib import Path
from datasets import Dataset, Video
def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("--source", type=Path, default=Path("bouncing-balls")) parser.add_argument("--output", type=Path, default=Path("bouncing-balls-sharded")) parser.add_argument("--shards", type=int, default=10) args = parser.parse_args()
metadata = [ json.loads(line) for line in (args.source / "metadata.jsonl").read_text().splitlines() if line.strip() ] if not metadata: raise ValueError(f"No records found in {args.source / 'metadata.jsonl'}") if args.shards < 1: raise ValueError("--shards must be at least 1")
data_dir = args.output / "data" data_dir.mkdir(parents=True, exist_ok=True) shard_size = math.ceil(len(metadata) / args.shards)
for shard_idx in range(args.shards): start = shard_idx * shard_size shard_metadata = metadata[start:start + shard_size] if not shard_metadata: break
records = [] for record in shard_metadata: video_path = args.source / record["file_name"] records.append({ "video": { "bytes": video_path.read_bytes(), "path": video_path.name, }, **{ key: value for key, value in record.items() if key != "file_name" }, })
shard = Dataset.from_list(records).cast_column("video", Video()) shard_path = data_dir / ( f"train-{shard_idx:05d}-of-{args.shards:05d}.parquet" ) shard.to_parquet(shard_path) print( f"Wrote {shard_path.name}: {len(shard)} videos, " f"{shard_path.stat().st_size / 1024 / 1024:.2f} MiB", flush=True, )
print(f"Created {args.shards} shards in {args.output}", flush=True)
if __name__ == "__main__": main()123version https://git-lfs.github.com/spec/v1oid sha256:81c6887a80292efc0601c31f8da4c8e4e278ac0322cd2cdfb64219fe779f8196size 5626123version https://git-lfs.github.com/spec/v1oid sha256:3ed55c5edabfbfcc6d9bd29c800d2863e8c29786fc39ca099fc2ef1557c03d01size 6621123version https://git-lfs.github.com/spec/v1oid sha256:797e06564b9a08ad48bf70144677c40ccabc8a8f56878afacdd528d7537ada34size 3989123version https://git-lfs.github.com/spec/v1oid sha256:03ab9a9b1e3120ce0db961a4cc99831f740acb1cc98c2951a0ac2e8383576fb2size 6780123version https://git-lfs.github.com/spec/v1oid sha256:4524820f17aef3a362caa31f34f9eac270322f010fce9a52524d4ddd1680e9b9size 3891123version https://git-lfs.github.com/spec/v1oid sha256:62ab381767a8a62c841dbfe2361b0dd39cd81100d10fd1bfc73082eac3604c13size 4800123version https://git-lfs.github.com/spec/v1oid sha256:9449cc91ce962f052267062934f51371a1e66e50d2c5404b995410804f6a73b7size 3337123version https://git-lfs.github.com/spec/v1oid sha256:c53765adc02678427536cbc9ca60896095ec9909d778236d6fc059195d6a0f1asize 3420123version https://git-lfs.github.com/spec/v1oid sha256:09c2f4b58a976120395f488cb23e05e4465c589ccc77a19d9e60ae111b5bd442size 5749123version https://git-lfs.github.com/spec/v1oid sha256:d1025626db4c97cf3014bcd6493b39502a24cbac2e3ad967d1271e7656de6212size 6264123version https://git-lfs.github.com/spec/v1oid sha256:a14c3796fa3c3b2feddecd1d73b64385474d85ec9328f2cdf85e5e61e8a1a1c6size 4756123version https://git-lfs.github.com/spec/v1oid sha256:f3876a201bfe5a7e2029777461563a21c2563ce653f60e9965713b264b1f0c0esize 4219123version https://git-lfs.github.com/spec/v1oid sha256:e8757139b079771088974c04b4ccaea5a1c4ca0460ef6f5c47d1f4a018c50a32size 5773123version https://git-lfs.github.com/spec/v1oid sha256:b7a507cdf25df8782bbcffc86e483663eea3db26940fd65f62119e9058d48daesize 7425123version https://git-lfs.github.com/spec/v1oid sha256:207f33bf15f146ccdfda4abce7cee4af85aa2636f1d3805b8add43aebcdc7ae4size 6752123version https://git-lfs.github.com/spec/v1oid sha256:fd33b38f9d390c1913802c2e5aee607505044321b181cf8d2e65ebccbbb4f116size 3593123version https://git-lfs.github.com/spec/v1oid sha256:894fd57146add8b722be075aa2f572ab51dd3ed746b1383cb89e67efa7e63520size 6867123version https://git-lfs.github.com/spec/v1oid sha256:a74bd65ab0db66fd42dc58b1445bb7bb769f47c652dbc5313bd59295b3dc4990size 3900123version https://git-lfs.github.com/spec/v1oid sha256:a27141f1bc3e13642ab5622a88ac7553bea8268e93fbdc5543833c887befbbe6size 3529123version https://git-lfs.github.com/spec/v1oid sha256:01e0fa3ceeab06f069542e5534bc17cc486547a01a5868714bbf71ba705d5004size 3557123version https://git-lfs.github.com/spec/v1oid sha256:0955d767ec9e1f9e52b0d839d908a57af72f78c031909a4cc9300d306b70c868size 3516123version https://git-lfs.github.com/spec/v1oid sha256:1f67bfb7da6b4f000a50e0cc835cced83b6d3c4ad5d54f76314d99aa4a2b7152size 6782123version https://git-lfs.github.com/spec/v1oid sha256:a809f7bd3fab438e11232f6281c891f5d4d90c314f37e8017aa94e2d28f9e856size 3911123version https://git-lfs.github.com/spec/v1oid sha256:fc12dd77563fd61da3fe09ffb05fd04112bdd747b67429ceecd6cf8bc3f9c36asize 5123123version https://git-lfs.github.com/spec/v1oid sha256:78ac57474398523e482863ed8fef58028c7cfe6204cad80def3fd63148e29c97size 3974123version https://git-lfs.github.com/spec/v1oid sha256:669ccd7c451e3818256375ff40f093ff7a3dd95194f77459b800decfc0c5fff7size 4414123version https://git-lfs.github.com/spec/v1oid sha256:e9d0f149572a678ad445c70743e925f8486a5ac0f6a0936a1a026ca1ae86af30size 6528123version https://git-lfs.github.com/spec/v1oid sha256:875e19d4bf185145f541529c75652bfebef48c463b1440293195b1aee9c67938size 5393123version https://git-lfs.github.com/spec/v1oid sha256:8483cab26736bc7039e395e29cd9f0754f207e3656ef2dce0e618f18fcec8224size 3707123version https://git-lfs.github.com/spec/v1oid sha256:748ebffa2da2b41ac9813abd445a21ea838ec68b6c5fe62d462da981f2f69e00size 5222123version https://git-lfs.github.com/spec/v1oid sha256:7e5056c3dc21fb6d252908946be2148b441d57c21f0210b1a8eb83f43db6f184size 6160123version https://git-lfs.github.com/spec/v1oid sha256:cf38488fcea6c5614095ef76d832d0795f7efd3306b61a10cae6c6bbfa107c4esize 5657123version https://git-lfs.github.com/spec/v1oid sha256:c5eb0b3a999a9f501d7dbcf19f903bc83bf4ae5d35642c72ecfb22812866cceesize 3471README.md+30-8
data/train-00000-of-00010.parquet+2-2
data/train-00001-of-00010.parquet+2-2
data/train-00002-of-00010.parquet+2-2
data/train-00003-of-00010.parquet+2-2
data/train-00004-of-00010.parquet+2-2
data/train-00005-of-00010.parquet+2-2
data/train-00006-of-00010.parquet+2-2
data/train-00007-of-00010.parquet+2-2
data/train-00008-of-00010.parquet+2-2
data/train-00009-of-00010.parquet+2-2
metadata.jsonlAdded
scripts/__pycache__/generate_bouncing_balls.cpython-313.pycAdded
scripts/__pycache__/shard_bouncing_balls.cpython-313.pycAdded
scripts/generate_bouncing_balls.pyAdded+142
scripts/requirements.txtAdded+6
scripts/shard_bouncing_balls.pyAdded+68
videos/000000.mp4Added+3
videos/000001.mp4Added+3
videos/000002.mp4Added+3
videos/000003.mp4Added+3
videos/000004.mp4Added+3
videos/000005.mp4Added+3
videos/000006.mp4Added+3
videos/000007.mp4Added+3
videos/000008.mp4Added+3
videos/000009.mp4Added+3
videos/000010.mp4Added+3
videos/000011.mp4Added+3
videos/000012.mp4Added+3
videos/000013.mp4Added+3
videos/000014.mp4Added+3
videos/000015.mp4Added+3
videos/000016.mp4Added+3
videos/000017.mp4Added+3
videos/000018.mp4Added+3
videos/000019.mp4Added+3
videos/000020.mp4Added+3
videos/000021.mp4Added+3
videos/000022.mp4Added+3
videos/000023.mp4Added+3
videos/000024.mp4Added+3
videos/000025.mp4Added+3
videos/000026.mp4Added+3
videos/000027.mp4Added+3
videos/000028.mp4Added+3
videos/000029.mp4Added+3
videos/000030.mp4Added+3
videos/000031.mp4Added+3
videos/000032.mp4Added+3