Spaces:
Sleeping
Sleeping
hejunwang commited on
Commit Β·
92ce024
1
Parent(s): 72284a2
add the video generation part
Browse files
src/tasks/__init__.py
CHANGED
|
@@ -5,10 +5,12 @@
|
|
| 5 |
from typing import Dict
|
| 6 |
|
| 7 |
from src.tasks.base import TaskPlugin
|
|
|
|
| 8 |
from src.tasks.task_future_prediction import TASK as TASK_FUTURE_PRED
|
| 9 |
from src.tasks.property_estimation import TASKS as TASKS_PROPERTY_EST
|
| 10 |
|
| 11 |
TASKS: Dict[str, TaskPlugin] = {
|
|
|
|
| 12 |
**TASKS_PROPERTY_EST,
|
| 13 |
TASK_FUTURE_PRED.name: TASK_FUTURE_PRED,
|
| 14 |
}
|
|
|
|
| 5 |
from typing import Dict
|
| 6 |
|
| 7 |
from src.tasks.base import TaskPlugin
|
| 8 |
+
from src.tasks.video_generation import TASKS as TASKS_VIDEO_GEN
|
| 9 |
from src.tasks.task_future_prediction import TASK as TASK_FUTURE_PRED
|
| 10 |
from src.tasks.property_estimation import TASKS as TASKS_PROPERTY_EST
|
| 11 |
|
| 12 |
TASKS: Dict[str, TaskPlugin] = {
|
| 13 |
+
**TASKS_VIDEO_GEN,
|
| 14 |
**TASKS_PROPERTY_EST,
|
| 15 |
TASK_FUTURE_PRED.name: TASK_FUTURE_PRED,
|
| 16 |
}
|
src/tasks/video_generation/__init__.py
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Task: Video Generation (scene-level).
|
| 2 |
+
|
| 3 |
+
Per-scene metrics: PSNR / SSIM / LPIPS / PMF . The evaluator is initialized on CPU by
|
| 4 |
+
default; export ``PHYS_METRIC_DEVICE=cuda`` to opt in to GPU when one is
|
| 5 |
+
available to the worker.
|
| 6 |
+
"""
|
| 7 |
+
from __future__ import annotations
|
| 8 |
+
|
| 9 |
+
from functools import partial
|
| 10 |
+
|
| 11 |
+
from src.tasks.base import TaskPlugin
|
| 12 |
+
from .utils import _evaluate_scene, _validate_scene, resolve_gt_dir, resolve_inference_dir
|
| 13 |
+
|
| 14 |
+
TASK_VIDEO_GEN_STATIC = TaskPlugin(
|
| 15 |
+
name="videoGeneration_static",
|
| 16 |
+
display_name="Video Generation on Static Camera",
|
| 17 |
+
description="Given first frame and caption, generate a physical plausible video on a static camera. " \
|
| 18 |
+
"Metrics: PSNR / SSIM / LPIPS / PMF.",
|
| 19 |
+
expected_scene_layout=(
|
| 20 |
+
"```\n"
|
| 21 |
+
"<scene_id>.zip\n"
|
| 22 |
+
"βββ CineCamera_n/\n"
|
| 23 |
+
"β βββ rgb/\n"
|
| 24 |
+
"β βββ ...\n"
|
| 25 |
+
"β βββ 0075.jpg\n"
|
| 26 |
+
"β βββ ...\n"
|
| 27 |
+
"\n"
|
| 28 |
+
"```"
|
| 29 |
+
),
|
| 30 |
+
validate_scene_fn=partial(_validate_scene, subset="static"),
|
| 31 |
+
evaluate_scene_fn=partial(_evaluate_scene, subset="static"),
|
| 32 |
+
resolve_gt_dir_fn=resolve_gt_dir,
|
| 33 |
+
resolve_inference_dir_fn=resolve_inference_dir,
|
| 34 |
+
primary_metric="pmf",
|
| 35 |
+
higher_is_better=True,
|
| 36 |
+
leaderboard_columns=["psnr", "ssim", "lpips", "pmf"],
|
| 37 |
+
)
|
| 38 |
+
|
| 39 |
+
TASK_VIDEO_GEN_MOVING = TaskPlugin(
|
| 40 |
+
name="videoGeneration_moving",
|
| 41 |
+
display_name="Video Generation on Moving Dataset",
|
| 42 |
+
description="Given first frame and caption, generate a physical plausible video a static camera. " \
|
| 43 |
+
"Metrics: PSNR / SSIM / LPIPS / PMF.",
|
| 44 |
+
expected_scene_layout=(
|
| 45 |
+
"```\n"
|
| 46 |
+
"<scene_id>.zip\n"
|
| 47 |
+
"βββ CineCamera_Moving/\n"
|
| 48 |
+
" βββ rgb/\n"
|
| 49 |
+
"β βββ ...\n"
|
| 50 |
+
"β βββ 0075.jpg\n"
|
| 51 |
+
"β βββ ...\n"
|
| 52 |
+
"\n"
|
| 53 |
+
"```"
|
| 54 |
+
),
|
| 55 |
+
validate_scene_fn=partial(_validate_scene, subset="moving"),
|
| 56 |
+
evaluate_scene_fn=partial(_evaluate_scene, subset="moving"),
|
| 57 |
+
resolve_gt_dir_fn=resolve_gt_dir,
|
| 58 |
+
resolve_inference_dir_fn=resolve_inference_dir,
|
| 59 |
+
primary_metric="pmf",
|
| 60 |
+
higher_is_better=True,
|
| 61 |
+
leaderboard_columns=["psnr", "ssim", "lpips", "pmf"],
|
| 62 |
+
)
|
| 63 |
+
|
| 64 |
+
TASKS = {
|
| 65 |
+
TASK_VIDEO_GEN_STATIC.name: TASK_VIDEO_GEN_STATIC,
|
| 66 |
+
TASK_VIDEO_GEN_MOVING.name: TASK_VIDEO_GEN_MOVING,
|
| 67 |
+
}
|