HAHAHA97 commited on
Commit
28c5be0
·
1 Parent(s): 69a65f8

combine subtasks

Browse files
app.py CHANGED
@@ -84,6 +84,12 @@ def _make_submit_handler(task_names: list[str]):
84
  user_dataset: str,
85
  profile: Optional[gr.OAuthProfile],
86
  ):
 
 
 
 
 
 
87
  owner_username = _profile_username(profile)
88
  result = submit_task(
89
  display_name=display_name,
@@ -113,6 +119,71 @@ def _dataframe(
113
  )
114
 
115
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  TASK_GROUPS = [
117
  {
118
  "slug": "video_generation",
@@ -175,16 +246,14 @@ TASK_GROUPS = [
175
  "Reinitialized Simulation Rendering, and Novel View Synthesis. "
176
  "Abbreviations: N=newtonian, NN=non-newtonian, E=elastic, P=plasticine, S=sand."
177
  ),
178
- "expected_layout": TASKS["propertyEstimation_propertyEstimation"].expected_scene_layout,
179
  "ranking": (
180
- "- Excel-style summary cells are shown for the material-specific columns.\n"
181
- "- `S φ` follows the raw `mean + std` convention from the Excel total table.\n"
182
- "- Other material-parameter columns follow their configured scaling rules."
183
  ),
184
  "tasks": [
185
- "propertyEstimation_propertyEstimation",
186
- "propertyEstimation_reinitializedRendering",
187
- "propertyEstimation_novelViewSynthesis",
188
  ],
189
  "meta_line": (
190
  "Subtasks: MPM Parameter Estimation · Reinitialized Simulation Rendering · Novel View Synthesis"
@@ -417,10 +486,30 @@ def _render_subtasks(task_names: list[str], page_title: str) -> None:
417
  elem_classes="leaderboard-table",
418
  max_height=380,
419
  )
420
- gr.Button("Refresh Leaderboard", size="sm", elem_classes="secondary-action").click(
421
- fn=lambda k=task_name: _safe_lb(k),
422
- outputs=leaderboard,
 
 
 
 
 
 
423
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
424
  with gr.Accordion("Submission History", open=False, elem_classes="info-panel"):
425
  history_df = _empty_history_df(task_name)
426
  history = _dataframe(
 
84
  user_dataset: str,
85
  profile: Optional[gr.OAuthProfile],
86
  ):
87
+ if task_name not in TASKS:
88
+ if len(task_names) == 1:
89
+ task_name = task_names[0]
90
+ else:
91
+ display_to_name = {TASKS[name].display_name: name for name in task_names}
92
+ task_name = display_to_name.get(task_name, task_name)
93
  owner_username = _profile_username(profile)
94
  result = submit_task(
95
  display_name=display_name,
 
119
  )
120
 
121
 
122
+ def _property_material_groups() -> list[tuple[str, list[str]]]:
123
+ task = TASKS.get("propertyEstimation")
124
+ specs = getattr(task, "excel_summary_specs", {}) if task else {}
125
+ columns = list(specs.keys()) if isinstance(specs, dict) else []
126
+ return [
127
+ ("Newtonian", [col for col in columns if col.startswith("N ")]),
128
+ ("Non-Newtonian", [col for col in columns if col.startswith("NN ")]),
129
+ ("Elastic", [col for col in columns if col.startswith("E ")]),
130
+ ("Plasticine", [col for col in columns if col.startswith("P ")]),
131
+ ("Sand", [col for col in columns if col.startswith("S ")]),
132
+ ]
133
+
134
+
135
+ def _metric_sort_value(value) -> float:
136
+ if value is None:
137
+ return float("inf")
138
+ text = str(value).strip()
139
+ if not text or text.lower() == "nan":
140
+ return float("inf")
141
+ try:
142
+ return float(text.split("+", 1)[0])
143
+ except ValueError:
144
+ return float("inf")
145
+
146
+
147
+ def _property_material_df(leaderboard_df: pd.DataFrame, material_columns: list[str]) -> pd.DataFrame:
148
+ base_columns = ["#", "Team", *material_columns, "Scenes", "Updated At", "Submission"]
149
+ if leaderboard_df.empty:
150
+ return pd.DataFrame(columns=base_columns)
151
+ available_columns = [col for col in base_columns if col in leaderboard_df.columns]
152
+ rows = leaderboard_df[available_columns].copy()
153
+ metric_columns = [col for col in material_columns if col in rows.columns]
154
+ if metric_columns:
155
+ sort_col = metric_columns[0]
156
+ rows = rows.sort_values(
157
+ by=sort_col,
158
+ key=lambda series: series.map(_metric_sort_value),
159
+ na_position="last",
160
+ ).reset_index(drop=True)
161
+ if "#" in rows.columns:
162
+ rows["#"] = rows.index + 1
163
+ return rows
164
+
165
+
166
+ def _property_material_dfs(leaderboard_df: pd.DataFrame) -> list[pd.DataFrame]:
167
+ return [
168
+ _property_material_df(leaderboard_df, material_columns)
169
+ for _title, material_columns in _property_material_groups()
170
+ ]
171
+
172
+
173
+ def _render_property_material_tables(leaderboard_df: pd.DataFrame) -> list[gr.Dataframe]:
174
+ tables: list[gr.Dataframe] = []
175
+ for title, material_columns in _property_material_groups():
176
+ gr.Markdown(f"**{title} parameter leaderboard**")
177
+ tables.append(
178
+ _dataframe(
179
+ value=_property_material_df(leaderboard_df, material_columns),
180
+ elem_classes="leaderboard-table",
181
+ max_height=260,
182
+ )
183
+ )
184
+ return tables
185
+
186
+
187
  TASK_GROUPS = [
188
  {
189
  "slug": "video_generation",
 
246
  "Reinitialized Simulation Rendering, and Novel View Synthesis. "
247
  "Abbreviations: N=newtonian, NN=non-newtonian, E=elastic, P=plasticine, S=sand."
248
  ),
249
+ "expected_layout": TASKS["propertyEstimation"].expected_scene_layout,
250
  "ranking": (
251
+ "- Ranking uses `rendering_pmf`, the mean of novel-view PMF and reinitialized-rendering PMF.\n"
252
+ "- Parameter-estimation metrics are shown as Excel-style material-specific summary cells.\n"
253
+ "- Novel and reinitialized rendering are evaluated with PSNR, SSIM, LPIPS, and PMF."
254
  ),
255
  "tasks": [
256
+ "propertyEstimation",
 
 
257
  ],
258
  "meta_line": (
259
  "Subtasks: MPM Parameter Estimation · Reinitialized Simulation Rendering · Novel View Synthesis"
 
486
  elem_classes="leaderboard-table",
487
  max_height=380,
488
  )
489
+ material_tables = (
490
+ _render_property_material_tables(leaderboard_df)
491
+ if task_name == "propertyEstimation"
492
+ else []
493
+ )
494
+ refresh_leaderboard = gr.Button(
495
+ "Refresh Leaderboard",
496
+ size="sm",
497
+ elem_classes="secondary-action",
498
  )
499
+ if material_tables:
500
+ def _reload_property_leaderboards(k=task_name):
501
+ df = _safe_lb(k)
502
+ return [df, *_property_material_dfs(df)]
503
+
504
+ refresh_leaderboard.click(
505
+ fn=_reload_property_leaderboards,
506
+ outputs=[leaderboard, *material_tables],
507
+ )
508
+ else:
509
+ refresh_leaderboard.click(
510
+ fn=lambda k=task_name: _safe_lb(k),
511
+ outputs=leaderboard,
512
+ )
513
  with gr.Accordion("Submission History", open=False, elem_classes="info-panel"):
514
  history_df = _empty_history_df(task_name)
515
  history = _dataframe(
src/display/css_html_js.py CHANGED
@@ -423,6 +423,12 @@ button.primary:hover,
423
  box-shadow: none !important;
424
  }
425
 
 
 
 
 
 
 
426
  .empty-task-note {
427
  width: 100% !important;
428
  max-width: 100% !important;
 
423
  box-shadow: none !important;
424
  }
425
 
426
+ .data-table th,
427
+ .data-table [role="columnheader"] {
428
+ font-size: 14px !important;
429
+ line-height: 1.25 !important;
430
+ }
431
+
432
  .empty-task-note {
433
  width: 100% !important;
434
  max-width: 100% !important;
src/tasks/property_estimation/__init__.py CHANGED
@@ -40,72 +40,60 @@ EXCEL_SUMMARY_SPECS = {
40
 
41
 
42
  TASK = TaskPlugin(
43
- name="propertyEstimation_propertyEstimation",
44
- display_name="Physical Property Estimation",
45
  description=(
46
  "Predict MPM material parameters and initial velocity. "
47
- "This track covers MPM Parameter Estimation, Reinitialized Simulation Rendering, "
48
- "and Novel View Synthesis. "
49
  "Abbreviations: N=newtonian, NN=non-newtonian, E=elastic, P=plasticine, S=sand."
50
  ),
51
  expected_scene_layout=(
52
  "```\n"
53
  "<scene_id>.zip\n"
54
- "|-- prediction.json\n"
55
- "`-- initvelocity.json # {\"vx\": float, \"vy\": float, \"vz\": float}\n"
 
 
 
 
 
56
  "```"
57
  ),
58
  validate_scene_fn=validate_scene,
59
  evaluate_scene_fn=evaluate_scene,
60
  load_gt_scene_fn=load_gt_scene,
61
- primary_metric="overall_error",
62
- higher_is_better=False,
63
  leaderboard_columns=[
 
 
 
 
 
 
 
 
 
64
  "overall_error",
65
  *EXCEL_SUMMARY_SPECS.keys(),
66
  ],
67
  )
68
 
69
  TASK.excel_summary_specs = EXCEL_SUMMARY_SPECS
70
- TASK.column_display_names = {"overall_error": "overall"}
71
-
72
- TASK_PROPERTY_NOVEL_VIEW = TaskPlugin(
73
- name="propertyEstimation_novelViewSynthesis",
74
- display_name="Novel View Synthesis",
75
- description="Evaluate novel-view rendering quality with PSNR / SSIM / LPIPS / PMF.",
76
- expected_scene_layout=(
77
- "```\n"
78
- "<scene_id>.zip\n"
79
- "|-- novel/\n"
80
- "| |-- CineCamera_1/rgb/0000.jpg\n"
81
- "| `-- CineCamera_8/rgb/0000.jpg\n"
82
- "`-- reinit/\n"
83
- "```\n"
84
- "The same ZIP is shared by the Properties Estimation rendering subtasks."
85
- ),
86
- validate_scene_fn=validate_scene,
87
- evaluate_scene_fn=evaluate_scene,
88
- load_gt_scene_fn=load_gt_scene,
89
- primary_metric="pmf",
90
- higher_is_better=True,
91
- leaderboard_columns=["psnr", "ssim", "lpips", "pmf"],
92
- )
93
-
94
- TASK_PROPERTY_REINIT = TaskPlugin(
95
- name="propertyEstimation_reinitializedRendering",
96
- display_name="Reinitialized Simulation Rendering",
97
- description="Evaluate reinitialized-simulation rendering quality with PSNR / SSIM / LPIPS / PMF.",
98
- expected_scene_layout=TASK_PROPERTY_NOVEL_VIEW.expected_scene_layout,
99
- validate_scene_fn=validate_scene,
100
- evaluate_scene_fn=evaluate_scene,
101
- load_gt_scene_fn=load_gt_scene,
102
- primary_metric="pmf",
103
- higher_is_better=True,
104
- leaderboard_columns=["psnr", "ssim", "lpips", "pmf"],
105
- )
106
 
107
  TASKS = {
108
  TASK.name: TASK,
109
- TASK_PROPERTY_NOVEL_VIEW.name: TASK_PROPERTY_NOVEL_VIEW,
110
- TASK_PROPERTY_REINIT.name: TASK_PROPERTY_REINIT,
111
  }
 
40
 
41
 
42
  TASK = TaskPlugin(
43
+ name="propertyEstimation",
44
+ display_name="Properties Estimation",
45
  description=(
46
  "Predict MPM material parameters and initial velocity. "
47
+ "This task jointly evaluates MPM Parameter Estimation, Reinitialized Simulation "
48
+ "Rendering, and Novel View Synthesis. "
49
  "Abbreviations: N=newtonian, NN=non-newtonian, E=elastic, P=plasticine, S=sand."
50
  ),
51
  expected_scene_layout=(
52
  "```\n"
53
  "<scene_id>.zip\n"
54
+ "`-- property_estimation/\n"
55
+ " |-- materials_configs.json\n"
56
+ " |-- initvelocity.json # {\"vx\": float, \"vy\": float, \"vz\": float}\n"
57
+ " |-- novel/\n"
58
+ " | `-- CineCamera_*/rgb/<frame>.jpg\n"
59
+ " `-- reinit/\n"
60
+ " `-- CineCamera_*/rgb/<frame>.jpg\n"
61
  "```"
62
  ),
63
  validate_scene_fn=validate_scene,
64
  evaluate_scene_fn=evaluate_scene,
65
  load_gt_scene_fn=load_gt_scene,
66
+ primary_metric="rendering_pmf",
67
+ higher_is_better=True,
68
  leaderboard_columns=[
69
+ "rendering_pmf",
70
+ "novel_pmf",
71
+ "reinit_pmf",
72
+ "novel_psnr",
73
+ "novel_ssim",
74
+ "novel_lpips",
75
+ "reinit_psnr",
76
+ "reinit_ssim",
77
+ "reinit_lpips",
78
  "overall_error",
79
  *EXCEL_SUMMARY_SPECS.keys(),
80
  ],
81
  )
82
 
83
  TASK.excel_summary_specs = EXCEL_SUMMARY_SPECS
84
+ TASK.column_display_names = {
85
+ "rendering_pmf": "rendering pmf",
86
+ "novel_pmf": "novel pmf",
87
+ "reinit_pmf": "reinit pmf",
88
+ "novel_psnr": "novel psnr",
89
+ "novel_ssim": "novel ssim",
90
+ "novel_lpips": "novel lpips",
91
+ "reinit_psnr": "reinit psnr",
92
+ "reinit_ssim": "reinit ssim",
93
+ "reinit_lpips": "reinit lpips",
94
+ "overall_error": "param overall",
95
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
 
97
  TASKS = {
98
  TASK.name: TASK,
 
 
99
  }