Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -89,6 +89,12 @@ def _cleanup_stale_tmp() -> None:
|
|
| 89 |
|
| 90 |
_cleanup_stale_tmp()
|
| 91 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
DAVIS_PALETTE = np.array([
|
| 93 |
[ 0, 0, 0], [128, 0, 0], [ 0, 128, 0], [128, 128, 0],
|
| 94 |
[ 0, 0, 128], [128, 0, 128], [ 0, 128, 128], [128, 128, 128],
|
|
@@ -102,6 +108,33 @@ DEFAULT_ALPHA = 0.55
|
|
| 102 |
DEFAULT_CRF = 18
|
| 103 |
THUMB_W, THUMB_H = 427, 240 # 16:9 thumbnails (half of 854×480 DAVIS frames)
|
| 104 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
# ── Dataset download ───────────────────────────────────────────────────────────
|
| 106 |
|
| 107 |
HF_CACHE_REPO = "emirkisa/DAVIS-2017-480p-mp4" # pre-encoded MP4s
|
|
@@ -838,7 +871,51 @@ def build_ui():
|
|
| 838 |
""")
|
| 839 |
|
| 840 |
# ──────────────────────────────────────────────────────────────
|
| 841 |
-
# Tab 5 ·
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 842 |
# ──────────────────────────────────────────────────────────────
|
| 843 |
with gr.TabItem("ℹ️ About"):
|
| 844 |
gr.Markdown(f"""
|
|
|
|
| 89 |
|
| 90 |
_cleanup_stale_tmp()
|
| 91 |
|
| 92 |
+
_REPO_ROOT = Path(__file__).resolve().parents[2]
|
| 93 |
+
PROCESSED_DAVIS_DIR = Path(os.environ.get(
|
| 94 |
+
"PROCESSED_DAVIS_DIR",
|
| 95 |
+
str(_REPO_ROOT / "data" / "processed" / "DAVIS"),
|
| 96 |
+
))
|
| 97 |
+
|
| 98 |
DAVIS_PALETTE = np.array([
|
| 99 |
[ 0, 0, 0], [128, 0, 0], [ 0, 128, 0], [128, 128, 0],
|
| 100 |
[ 0, 0, 128], [128, 0, 128], [ 0, 128, 128], [128, 128, 128],
|
|
|
|
| 108 |
DEFAULT_CRF = 18
|
| 109 |
THUMB_W, THUMB_H = 427, 240 # 16:9 thumbnails (half of 854×480 DAVIS frames)
|
| 110 |
|
| 111 |
+
# ── VC experiment subset ───────────────────────────────────────────────────────
|
| 112 |
+
# Canonical 10-pair evaluation set defined in exp_016/config_davis.yaml and
|
| 113 |
+
# reused verbatim in exp_018 and exp_019.
|
| 114 |
+
# Taxonomy axes: context (similar/different) · category · movement
|
| 115 |
+
VC_SUBSET: list[tuple[str, list[tuple[str, str]]]] = [
|
| 116 |
+
("Class 1 — similar context · similar category · similar movement", [
|
| 117 |
+
("blackswan", "mallard-water"),
|
| 118 |
+
]),
|
| 119 |
+
("Class 2 — similar context · similar category · different movement", [
|
| 120 |
+
("paragliding-launch", "paragliding"),
|
| 121 |
+
("motocross-bumps", "motocross-jump"),
|
| 122 |
+
("mallard-fly", "mallard-water"),
|
| 123 |
+
]),
|
| 124 |
+
("Class 5 — different context · similar category · similar movement", [
|
| 125 |
+
("car-roundabout", "bus"),
|
| 126 |
+
("car-turn", "car-shadow"),
|
| 127 |
+
("lucia", "hike"),
|
| 128 |
+
("breakdance-flare", "breakdance"),
|
| 129 |
+
]),
|
| 130 |
+
("Class 6 — different context · similar category · different movement", [
|
| 131 |
+
("longboard", "kite-surf"),
|
| 132 |
+
]),
|
| 133 |
+
("Class 8 — different context · different category · different movement", [
|
| 134 |
+
("blackswan", "boat"),
|
| 135 |
+
]),
|
| 136 |
+
]
|
| 137 |
+
|
| 138 |
# ── Dataset download ───────────────────────────────────────────────────────────
|
| 139 |
|
| 140 |
HF_CACHE_REPO = "emirkisa/DAVIS-2017-480p-mp4" # pre-encoded MP4s
|
|
|
|
| 871 |
""")
|
| 872 |
|
| 873 |
# ──────────────────────────────────────────────────────────────
|
| 874 |
+
# Tab 5 · VC Subset
|
| 875 |
+
# ──────────────────────────────────────────────────────────────
|
| 876 |
+
with gr.TabItem("🔬 VC Subset"):
|
| 877 |
+
gr.Markdown(
|
| 878 |
+
"### DAVIS VC Experiment Subset — 10 Pairs\n"
|
| 879 |
+
"Canonical evaluation set used across **exp_016 / exp_018 / exp_019**. \n"
|
| 880 |
+
"Each clip is `data/processed/DAVIS/<seq>/2s.mp4` — 48 frames @ 24 fps. \n\n"
|
| 881 |
+
"**Class taxonomy** (context · category · movement):\n\n"
|
| 882 |
+
"| Class | Context | Category | Movement | # Pairs |\n"
|
| 883 |
+
"|-------|---------|----------|----------|---------|\n"
|
| 884 |
+
"| 1 | similar | similar | similar | 1 |\n"
|
| 885 |
+
"| 2 | similar | similar | different | 3 |\n"
|
| 886 |
+
"| 3 | similar | different | similar | 0 |\n"
|
| 887 |
+
"| 4 | similar | different | different | 0 |\n"
|
| 888 |
+
"| 5 | different | similar | similar | 4 |\n"
|
| 889 |
+
"| 6 | different | similar | different | 1 |\n"
|
| 890 |
+
"| 7 | different | different | similar | 0 |\n"
|
| 891 |
+
"| 8 | different | different | different | 1 |"
|
| 892 |
+
)
|
| 893 |
+
|
| 894 |
+
def _vc_label(seq: str) -> str:
|
| 895 |
+
if seq not in ALL_SEQUENCES:
|
| 896 |
+
return seq
|
| 897 |
+
r = DF[DF["sequence"] == seq].iloc[0]
|
| 898 |
+
return f"{seq} [{r['frames']}f · {r['n_objects']}obj]"
|
| 899 |
+
|
| 900 |
+
for _cls_label, _pairs in VC_SUBSET:
|
| 901 |
+
gr.Markdown(f"---\n#### {_cls_label}")
|
| 902 |
+
for _start_seq, _end_seq in _pairs:
|
| 903 |
+
_s_path = PROCESSED_DAVIS_DIR / _start_seq / "2s.mp4"
|
| 904 |
+
_e_path = PROCESSED_DAVIS_DIR / _end_seq / "2s.mp4"
|
| 905 |
+
with gr.Row():
|
| 906 |
+
gr.Video(
|
| 907 |
+
value=str(_s_path) if _s_path.exists() else None,
|
| 908 |
+
label=f"start · {_vc_label(_start_seq)}",
|
| 909 |
+
autoplay=True, loop=True, height=280,
|
| 910 |
+
)
|
| 911 |
+
gr.Video(
|
| 912 |
+
value=str(_e_path) if _e_path.exists() else None,
|
| 913 |
+
label=f"end · {_vc_label(_end_seq)}",
|
| 914 |
+
autoplay=True, loop=True, height=280,
|
| 915 |
+
)
|
| 916 |
+
|
| 917 |
+
# ──────────────────────────────────────────────────────────────
|
| 918 |
+
# Tab 6 · About
|
| 919 |
# ──────────────────────────────────────────────────────────────
|
| 920 |
with gr.TabItem("ℹ️ About"):
|
| 921 |
gr.Markdown(f"""
|