Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

https://github.com/jhuangBU/gsdeformer-code
21 May 2026, 06:31:33 UTC
  • Code
  • Branches (1)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/heads/main
    No releases to show
  • 707fda0
  • /
  • compile_quant_quality_results.py
Raw File Download Save again
Take a new snapshot of a software origin

If the archived software origin currently browsed is not synchronized with its upstream version (for instance when new commits have been issued), you can explicitly request Software Heritage to take a new snapshot of it.

Use the form below to proceed. Once a request has been submitted and accepted, it will be processed as soon as possible. You can then check its processing state by visiting this dedicated page.
swh spinner

Processing "take a new snapshot" request ...

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
  • revision
  • snapshot
origin badgecontent badge
swh:1:cnt:a541122a4cd39fc2a620ec05f7274e42a1e5d5b5
origin badgedirectory badge
swh:1:dir:707fda0a4042745751136cd51ca2c0bc48da42ca
origin badgerevision badge
swh:1:rev:2eb7f6d3bf60cacd4f3969a9d68949cb3a34da95
origin badgesnapshot badge
swh:1:snp:fd22f80b54ad40aa01ea8be83f3828c1228d614f

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
  • revision
  • snapshot
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
Tip revision: 2eb7f6d3bf60cacd4f3969a9d68949cb3a34da95 authored by jhuangBU on 10 May 2026, 11:43:06 UTC
doc: revise README
Tip revision: 2eb7f6d
compile_quant_quality_results.py
#!/usr/bin/env python3
"""
Script to compile evaluation results from multiple methods into a pandas table.
"""

import json
import pandas as pd
from pathlib import Path

BASE_DIR = Path("/root/intelpa-2/cagegaussian")

METHODS = {
    "deforming_nerf": BASE_DIR / "existing_methods/deforming_nerf/output",
    "frosting": BASE_DIR / "existing_methods/frosting/output",
    "games": BASE_DIR / "existing_methods/gaussian_mesh_splatting/output",
    "sugar": BASE_DIR / "existing_methods/sugar/output",
    "ours": BASE_DIR / "gs3d/output",
}

METRICS = ["SSIM", "PSNR", "LPIPS"]


def discover_scenes():
    """Discover all scene names from existing eval directories."""
    scenes = set()
    for method_name, output_dir in METHODS.items():
        for eval_dir in output_dir.glob("eval_*"):
            if eval_dir.is_dir():
                scene_name = eval_dir.name.replace("eval_", "")
                scenes.add(scene_name)
    return sorted(scenes)


def load_results(method_name, output_dir, scene_name):
    """Load results.json for a given method and scene."""
    results_path = output_dir / f"eval_{scene_name}" / "results.json"
    if not results_path.exists():
        return None

    with open(results_path, "r") as f:
        data = json.load(f)

    # The JSON has a nested structure with a method-specific key
    # Extract the first (and typically only) entry
    if data:
        inner_data = next(iter(data.values()))
        return inner_data
    return None


def compile_results():
    """Compile all results into a pandas DataFrame."""
    scenes = discover_scenes()
    print(f"Discovered scenes: {scenes}")

    rows = []
    for method_name, output_dir in METHODS.items():
        for scene_name in scenes:
            results = load_results(method_name, output_dir, scene_name)
            if results:
                row = {
                    "method": method_name,
                    "scene": scene_name,
                }
                for metric in METRICS:
                    row[metric] = results.get(metric)
                rows.append(row)
            else:
                print(f"Warning: No results found for {method_name}/{scene_name}")

    df = pd.DataFrame(rows)
    return df


def get_best_method(scene_df, metric):
    """Get the best method for a metric (higher is better for SSIM/PSNR, lower for LPIPS)."""
    if metric == "LPIPS":
        best_idx = scene_df[metric].idxmin()
    else:
        best_idx = scene_df[metric].idxmax()
    return scene_df.loc[best_idx, "method"]


def main():
    df = compile_results()

    print("\n=== Full Results Table ===")
    print(df.to_string(index=False))

    # Print per-scene results with best method highlighted
    scenes = df["scene"].unique()
    for scene in sorted(scenes):
        print(f"\n{'='*60}")
        print(f"Scene: {scene}")
        print("=" * 60)
        scene_df = df[df["scene"] == scene].copy()
        scene_df = scene_df.set_index("method")[METRICS]
        print(scene_df.to_string())

        # Find best method for each metric
        print("\nBest methods:")
        for metric in METRICS:
            if metric == "LPIPS":
                best_method = scene_df[metric].idxmin()
                best_value = scene_df[metric].min()
            else:
                best_method = scene_df[metric].idxmax()
                best_value = scene_df[metric].max()
            print(f"  {metric}: {best_method} ({best_value:.4f})")

    # Compute mean across scenes for each method
    print(f"\n{'='*60}")
    print("Average Metrics by Method (across all scenes)")
    print("=" * 60)
    avg_df = df.groupby("method")[METRICS].mean()
    print(avg_df.to_string())

    # Find best method for each metric on average
    print("\nBest methods (average):")
    for metric in METRICS:
        if metric == "LPIPS":
            best_method = avg_df[metric].idxmin()
            best_value = avg_df[metric].min()
        else:
            best_method = avg_df[metric].idxmax()
            best_value = avg_df[metric].max()
        print(f"  {metric}: {best_method} ({best_value:.4f})")

    # Save to CSV
    output_path = BASE_DIR / "compiled_results_quant_quality.csv"
    df.to_csv(output_path, index=False)
    print(f"\nResults saved to {output_path}")

    return df


if __name__ == "__main__":
    main()

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API