The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.
TypeScript ai-videocomfyuicreative-toolsgenerative-aiideogramimage-generationimage-to-3dimage-to-videoltx-videominimax-h3nextjsopen-sourceopen-weightsqwen-imagetext-to-imagevideo-generationwan
Evaluation: a splat suite puts Idol 3D's Best and Quick against TripoSplat on the orbit video, with the photo crop on photos and the splat file's haze measured
Claude3acf994a9a45
diff --git a/scripts/eval/cases/case.schema.json b/scripts/eval/cases/case.schema.jsonindex 24981028..1d8616a8 100644--- a/scripts/eval/cases/case.schema.json+++ b/scripts/eval/cases/case.schema.json@@ -544,7 +544,8 @@"palette","background","separation",- "wer"+ "wer",+ "splat"]}},@@ -556,6 +557,13 @@"type": "string","pattern": "^[a-z0-9][a-z0-9-]*$"},+ "styleModel": {+ "type": "string",+ "enum": [+ "clip",+ "dinov2"+ ]+ },"timeoutSeconds": {"default": 1800,"type": "number",@@ -727,6 +735,14 @@"op": {"type": "string"},+ "tags": {+ "minItems": 1,+ "type": "array",+ "items": {+ "type": "string",+ "pattern": "^[a-z0-9][a-z0-9-]*$"+ }+ },"params": {"type": "object","properties": {@@ -1294,7 +1310,8 @@"palette","background","separation",- "wer"+ "wer",+ "splat"]}},diff --git a/scripts/eval/cases/splat.json b/scripts/eval/cases/splat.jsonnew file mode 100644index 00000000..6afa64c9--- /dev/null+++ b/scripts/eval/cases/splat.json@@ -0,0 +1,142 @@+{+ "$schema": "./case.schema.json",+ "suite": "splat",+ "title": "Splat · one object from one picture",+ "description": "Image to 3D → Splat on your GPU: Idol 3D at Best and at Quick look against TripoSplat as it ships, on the same pictures and seeds (docs/research/idol-9.md §9 idol-3). Idol's quality lead is the vendor's own table (§3), so this run measures it. The orbit video is what is scored and reviewed blind: style is the orbit's frames against the input picture with DINOv2 (how much of the object survives every angle), temporal is how smoothly it turns, aesthetic is the LAION predictor, and splat reads the saved file for the share of nearly transparent Gaussians (Idol's haze, §2.4). The .spz is kept with each job. Inputs are your own pictures in local/splat/ (never committed): generated product renders, product photos (the photo crop runs on these), a figurine, a stylised character, a realistic person (a made-up one or someone who agreed), thin parts and glass or chrome. The cloud has no Idol run here: triposplat-cloud is fal's TripoSplat as Fuobe ships it in the cloud, a reference for the haze and the price only (a .ply without an orbit).",+ "original": ["oss-idol", "oss-triposplat"],+ "kind": "video",+ "decides": "Three defaults, each changed by a person in a reviewed commit after one open run of every variant on a GPU (the GPU, its driver and ComfyUI's version recorded with the numbers; docs/research/idol-9.md, Results). (1) Splat mode's open default (MODELS_3D.splat.open in src/lib/av/model3d.ts, TripoSplat first today): Idol 3D goes first only if idol-best, against triposplat-today, scores at least as well on style in at least 8 of the 11 cases, gives up no more than 0.15 aesthetic, 0.002 warp and 0.004 drift on the suite's means, and takes at least 55 % of the non-tie blind ratings with at least 6 per case. Idol's Best samples 50 Euler steps at cfg 4 where TripoSplat ships 20 dpmpp_2m at cfg 3, so a win may be the settings rather than the weights: TripoSplat at Idol's sampler can't run yet (its graph doesn't take a sampler), and it is the next run before Idol goes first. (2) Idol's Quick look (IDOL_PRESETS.quick): 20 dpmpp_2m steps and 65,536 Gaussians stay while idol-quick is within 0.02 style of idol-best on the suite's mean and idol-best takes no more than 70 % of their non-tie ratings; otherwise the next run tries 30 steps or 131,072 Gaussians. (3) The photo crop (on for uploads today): it stays on only if idol-photo-crop scores at least as well as idol-best on style in at least 2 of the 3 photo cases and takes at least 55 % of their non-tie ratings; otherwise it starts off. The splat metric's haze says whether TripoSplat's files carry Idol's haze too (the splat viewer's opacity cut-off, idol-4). Demo runs decide nothing.",+ "targets": {+ "open": { "models": ["oss-idol", "oss-triposplat"], "op": "splat" },+ "demo": { "models": ["oss-idol", "oss-triposplat"], "op": "splat" }+ },+ "defaults": {+ "seeds": [1001, 2002, 3003],+ "metrics": ["style", "temporal", "aesthetic", "splat"],+ "styleModel": "dinov2",+ "timeoutSeconds": 3600,+ "candidate": "idol-best"+ },+ "variants": {+ "idol-best": {+ "description": "Idol 3D at Best: Idol's reference settings (50 Euler steps, cfg 4, 262,144 Gaussians)",+ "engines": ["open", "demo"],+ "models": { "open": ["oss-idol"] },+ "extra": { "steps": 50, "sampler": "euler", "cfg": 4, "numGaussians": 262144 }+ },+ "idol-quick": {+ "description": "Idol 3D at Quick look: 20 dpmpp_2m steps, cfg 4, 65,536 Gaussians",+ "engines": ["open", "demo"],+ "models": { "open": ["oss-idol"] },+ "extra": { "steps": 20, "sampler": "dpmpp_2m", "cfg": 4, "numGaussians": 65536 }+ },+ "triposplat-today": {+ "description": "TripoSplat as it ships (its graph's defaults: 20 dpmpp_2m steps, cfg 3, 262,144 Gaussians)",+ "engines": ["open", "demo"],+ "models": { "open": ["oss-triposplat"] }+ },+ "idol-photo-crop": {+ "description": "Idol 3D at Best with the photo crop (the looser crop Idol uses for photos), on the photo cases",+ "engines": ["open", "demo"],+ "tags": ["photo"],+ "models": { "open": ["oss-idol"] },+ "extra": { "steps": 50, "sampler": "euler", "cfg": 4, "numGaussians": 262144, "photoCrop": true, "cropMode": "real" }+ },+ "triposplat-cloud": {+ "description": "TripoSplat on fal (tripo3d/triposplat), the cloud's splat today: a reference for the haze, the time and the price (a .ply, no orbit to score or review)",+ "engines": ["cloud"],+ "models": { "cloud": ["triposplat"] }+ }+ },+ "cases": [+ {+ "id": "splat/bottle",+ "title": "A generated render of a bottle",+ "inputs": { "images": ["local/splat/bottle.png"] },+ "demoInputs": { "images": ["fixtures/start-frame.png"] },+ "references": "local/splat/bottle.png",+ "tags": ["render", "product"]+ },+ {+ "id": "splat/sneaker",+ "title": "A generated render of a sneaker",+ "inputs": { "images": ["local/splat/sneaker.png"] },+ "demoInputs": { "images": ["fixtures/start-frame.png"] },+ "references": "local/splat/sneaker.png",+ "tags": ["render", "product"]+ },+ {+ "id": "splat/headphones",+ "title": "A generated render of headphones",+ "inputs": { "images": ["local/splat/headphones.png"] },+ "demoInputs": { "images": ["fixtures/start-frame.png"] },+ "references": "local/splat/headphones.png",+ "tags": ["render", "product", "thin"]+ },+ {+ "id": "splat/photo-mug",+ "title": "A product photo of a mug",+ "inputs": { "images": ["local/splat/photo-mug.jpg"] },+ "demoInputs": { "images": ["fixtures/end-frame.png"] },+ "references": "local/splat/photo-mug.jpg",+ "tags": ["photo", "product"]+ },+ {+ "id": "splat/photo-bag",+ "title": "A product photo of a handbag",+ "inputs": { "images": ["local/splat/photo-bag.jpg"] },+ "demoInputs": { "images": ["fixtures/end-frame.png"] },+ "references": "local/splat/photo-bag.jpg",+ "tags": ["photo", "product"]+ },+ {+ "id": "splat/figurine",+ "title": "A photo of a figurine on a table",+ "inputs": { "images": ["local/splat/figurine.jpg"] },+ "demoInputs": { "images": ["fixtures/end-frame.png"] },+ "references": "local/splat/figurine.jpg",+ "tags": ["photo", "figurine"]+ },+ {+ "id": "splat/character",+ "title": "A stylised character, full body",+ "inputs": { "images": ["local/splat/character.png"] },+ "demoInputs": { "images": ["fixtures/character/drawn-face-1.png"] },+ "references": "local/splat/character.png",+ "tags": ["render", "character"]+ },+ {+ "id": "splat/person",+ "title": "A realistic person, full body on a plain background",+ "inputs": { "images": ["local/splat/person.png"] },+ "demoInputs": { "images": ["fixtures/character/drawn-face-2.png"] },+ "references": "local/splat/person.png",+ "tags": ["render", "person"],+ "note": "A made-up person (generated), or a photo of someone who agreed; photos of real people stay in local/ and are never committed."+ },+ {+ "id": "splat/chair",+ "title": "A chair with thin legs",+ "inputs": { "images": ["local/splat/chair.png"] },+ "demoInputs": { "images": ["fixtures/start-frame.png"] },+ "references": "local/splat/chair.png",+ "tags": ["render", "thin"]+ },+ {+ "id": "splat/plant",+ "title": "A potted plant with thin leaves",+ "inputs": { "images": ["local/splat/plant.png"] },+ "demoInputs": { "images": ["fixtures/start-frame.png"] },+ "references": "local/splat/plant.png",+ "tags": ["render", "thin"]+ },+ {+ "id": "splat/glass-chrome",+ "title": "A glass perfume bottle with a chrome cap",+ "inputs": { "images": ["local/splat/glass-chrome.png"] },+ "demoInputs": { "images": ["fixtures/start-frame.png"] },+ "references": "local/splat/glass-chrome.png",+ "tags": ["render", "glass"]+ }+ ]+}diff --git a/scripts/eval/eval.mjs b/scripts/eval/eval.mjsindex a63fad76..f70caa0f 100644--- a/scripts/eval/eval.mjs+++ b/scripts/eval/eval.mjs@@ -18,7 +18,7 @@ import { writeReport } from "./lib/report.mjs";import { serveReview, writeReview } from "./lib/review.mjs";import { DEFAULT_CLOUD_CAP, money, runEval } from "./lib/run.mjs";import { connect } from "./lib/server.mjs";-import { listRuns, readJsonl, resolveRun } from "./lib/store.mjs";+import { listRuns, readJson, readJsonl, resolveRun } from "./lib/store.mjs";const list = (v) => (v ? String(v).split(",").map((s) => s.trim()).filter(Boolean) : undefined);const num = (v, name) => {@@ -160,7 +160,9 @@ const root = (values, env) => resultsDir(env, values.out);async function score(dir, v, ctx) {if (v["no-metrics"]) return null;ctx.note("Scoring the outputs…");- const r = await scoreRun(dir, { metrics: v.metrics, device: v.device, clipModel: v["clip-model"], styleModel: v["style-model"], identityModel: v["identity-model"], faceDetector: v["face-detector"], commercialOnly: v["commercial-only"], force: v.force, log: ctx.note, env: ctx.env });+ // The suite's own style embedder (defaults.styleModel, kept in run.json) unless --style-model names one.+ const styleModel = v["style-model"] ?? readJson(path.join(dir, "run.json"))?.styleModel;+ const r = await scoreRun(dir, { metrics: v.metrics, device: v.device, clipModel: v["clip-model"], styleModel, identityModel: v["identity-model"], faceDetector: v["face-detector"], commercialOnly: v["commercial-only"], force: v.force, log: ctx.note, env: ctx.env });if (!r.ok) ctx.note(`Not scored: ${r.reason}. Timing and cost are in the report; pnpm eval:report ${path.basename(dir)} scores it later.`);return r;}diff --git a/scripts/eval/lib/metric-info.mjs b/scripts/eval/lib/metric-info.mjsindex 7ebc5c48..3865d7b3 100644--- a/scripts/eval/lib/metric-info.mjs+++ b/scripts/eval/lib/metric-info.mjs@@ -37,6 +37,8 @@ export const METRIC_INFO = {werTranscript: { label: "WER, the job's transcript", better: "lower", unit: "0–1", tie: 0.02, digits: 3 },bgDiff: { label: "Background change vs the source", better: "lower", unit: "0–1", tie: 0.002, digits: 4 },bgPsnr: { label: "Background PSNR vs the source", better: "higher", unit: "dB", tie: 0.3, digits: 1 },+ haze: { label: "Splat haze", better: "lower", unit: "share under opacity 0.05", tie: 0.01, digits: 3 },+ gaussians: { label: "Gaussians", better: "none", unit: "count", tie: 0, digits: 0 },seconds: { label: "Time", better: "lower", unit: "s (wall clock)", tie: 0.5, digits: 1 },costUsd: { label: "Cost", better: "lower", unit: "US$", tie: 0.0005, digits: 4 },vramGb: { label: "Peak memory", better: "lower", unit: "GB", tie: 0.1, digits: 2 },diff --git a/scripts/eval/lib/plan.mjs b/scripts/eval/lib/plan.mjsindex 9e234b61..bb18e586 100644--- a/scripts/eval/lib/plan.mjs+++ b/scripts/eval/lib/plan.mjs@@ -108,6 +108,7 @@ export function expandJobs(suite, opts) {let skip = null;if (kase.engines && !kase.engines.includes(engine)) skip = `runs on ${kase.engines.join(" / ")} only`;else if (variant.engines && !variant.engines.includes(engine)) skip = `the ${variantName} variant runs on ${variant.engines.join(" / ")} only`;+ else if (variant.tags && !variant.tags.some((t) => kase.tags?.includes(t))) skip = `the ${variantName} variant runs on cases tagged ${variant.tags.join(" or ")} only`;else if (!target && !variant.models && !kase.models && !kase.variantModels?.[variantName]) skip = `${suite.suite} has no ${engine} target`;else if (!modelId) skip = `none of ${candidates.join(", ")} is on this Fuobe`;else if (missing.length) skip = `missing local input${missing.length > 1 ? "s" : ""} ${missing.join(", ")} (see scripts/eval/README.md → Your own inputs)`;diff --git a/scripts/eval/lib/run.mjs b/scripts/eval/lib/run.mjsindex 42edba18..583579f2 100644--- a/scripts/eval/lib/run.mjs+++ b/scripts/eval/lib/run.mjs@@ -264,6 +264,7 @@ export async function runEval(opts, io) {filters,variants: summary.variants,...(suite.defaults.candidate && { candidate: suite.defaults.candidate }),+ ...(suite.defaults.styleModel && { styleModel: suite.defaults.styleModel }),variantInfo: Object.fromEntries(summary.variants.map((v) => [v, suite.variants?.[v]?.description ?? ""])),maxUsd: Number.isFinite(maxUsd) ? maxUsd : null,estimateUsd: estimate,diff --git a/scripts/eval/lib/schema.mjs b/scripts/eval/lib/schema.mjsindex fa230453..745d909a 100644--- a/scripts/eval/lib/schema.mjs+++ b/scripts/eval/lib/schema.mjs@@ -5,7 +5,7 @@import { z } from "zod";export const ENGINES = /** @type {const} */ (["demo", "open", "cloud"]);-export const METRICS = /** @type {const} */ (["clip", "aesthetic", "style", "identity", "temporal", "lipsync", "continuity", "palette", "background", "separation", "wer"]);+export const METRICS = /** @type {const} */ (["clip", "aesthetic", "style", "identity", "temporal", "lipsync", "continuity", "palette", "background", "separation", "wer", "splat"]);const Slug = z.string().regex(/^[a-z0-9][a-z0-9-]*$/, "lower-case letters, digits and dashes");const CaseId = z.string().max(120).regex(/^[a-z0-9][a-z0-9._-]*(\/[a-z0-9][a-z0-9._-]*)*$/, "lower-case words joined by - . _ and /");@@ -144,6 +144,8 @@ const Variant = zengines: z.array(z.enum(ENGINES)).min(1).optional(),/** The op this variant's models run (a cleaner beside the splitters: enhance-voice), over the case's and the target's. */op: z.string().optional(),+ /** The cases this variant runs on: those with one of these tags (the splat suite's photo crop runs on photos only). The others skip it. */+ tags: z.array(Slug).min(1).optional(),params: Params.optional(),extra: Json.optional(),/** Send this variant through a studio route instead of /api/generations (the case's own submit wins). */@@ -231,6 +233,8 @@ export const SuiteSchema = zvariant: Slug.optional(),/** The variant the promote rule judges and the blind review pairs with the others (default: recipe, else the first). */candidate: Slug.optional(),+ /** The style metric's embedder for this suite's runs (pnpm eval:run / report --style-model overrides it): dinov2 compares pictures without words. */+ styleModel: z.enum(["clip", "dinov2"]).optional(),timeoutSeconds: z.number().positive().default(1800),}).strict()@@ -270,6 +274,10 @@ export const SuiteSchema = zfor (const k of ["variant", "candidate"]) {if (s.defaults[k] && !variants.includes(s.defaults[k])) ctx.addIssue({ code: "custom", path: ["defaults", k], message: `no variant ${s.defaults[k]} (have ${variants.join(", ")})` });}+ // A variant limited to tags must find at least one case with them.+ for (const [name, v] of Object.entries(s.variants ?? {})) {+ if (v.tags && !s.cases.some((c) => v.tags.some((t) => c.tags?.includes(t)))) ctx.addIssue({ code: "custom", path: ["variants", name, "tags"], message: `no case is tagged ${v.tags.join(" or ")}` });+ }});/** The {{tokens}} a route body template names (scripts/eval/lib/media.mjs fillTemplate). */diff --git a/scripts/eval/metrics/fuobe_metrics/registry.py b/scripts/eval/metrics/fuobe_metrics/registry.pyindex 56721bd6..39ff55da 100644--- a/scripts/eval/metrics/fuobe_metrics/registry.py+++ b/scripts/eval/metrics/fuobe_metrics/registry.py@@ -20,6 +20,8 @@ FAMILIES = {# the job's own transcript when its graph transcribes (Qwen3-ASR in the dub's first step)."wer": ["wer", "werInput", "werTranscript"],"background": ["bgDiff", "bgPsnr"],+ # A splat file's nearly transparent share (opacity under 0.05) and its count (the splat suite).+ "splat": ["haze", "gaussians"],}METRICS = {@@ -57,6 +59,8 @@ METRICS = {"werTranscript": {"label": "WER, the job's transcript", "better": "lower", "unit": "word error rate 0–1"},"bgDiff": {"label": "Background change vs the source", "better": "lower", "unit": "mean abs error 0–1 on the frame's outer ring"},"bgPsnr": {"label": "Background PSNR vs the source", "better": "higher", "unit": "dB on the frame's outer ring"},+ "haze": {"label": "Splat haze", "better": "lower", "unit": "share of Gaussians under opacity 0.05"},+ "gaussians": {"label": "Gaussians", "better": "none", "unit": "count in the splat file"},}# Weights, each pinned to a Hugging Face revision. "commercial" says whether the model itself may be useddiff --git a/scripts/eval/metrics/fuobe_metrics/score.py b/scripts/eval/metrics/fuobe_metrics/score.pyindex d8088c0c..0570f080 100644--- a/scripts/eval/metrics/fuobe_metrics/score.py+++ b/scripts/eval/metrics/fuobe_metrics/score.py@@ -19,6 +19,7 @@ import numpy as npfrom . import mathsfrom . import separation as sep+from . import splatfrom .media import audio_channels, audio_track, have_ffmpeg, images_of, kind_of, video_frames, video_windowfrom .models import MODELS, Aesthetic, Asr, Clip, Dino, Faces, Missing, device_offrom .registry import FAMILIES@@ -55,10 +56,13 @@ def palette_of(job: dict) -> np.ndarray:def media_outputs(run_dir: pathlib.Path, job: dict) -> list[pathlib.Path]:- """The job's picture or clip outputs (masks, first frames and other helpers left out)."""+ """The job's picture or clip outputs (masks, first frames and other helpers left out). A preview still that comes+ with a clip (Idol's clean graph renders the input view beside its orbit) is a helper too: the clip is scored."""+ outs = job.get("outputs", [])+ with_clip = any(o.get("kind") == "video" for o in outs)out = []- for o in job.get("outputs", []):- if o.get("role") in {"mask", "first-frame", "depth"}:+ for o in outs:+ if o.get("role") in {"mask", "first-frame", "depth"} or (with_clip and o.get("role") == "preview" and o.get("kind") == "image"):continuep = run_dir / o["file"]if p.exists() and kind_of(p) in {"image", "video"}:@@ -66,6 +70,11 @@ def media_outputs(run_dir: pathlib.Path, job: dict) -> list[pathlib.Path]:return out+def splat_outputs(run_dir: pathlib.Path, job: dict) -> list[pathlib.Path]:+ """The job's 3D files (the splat suite reads the splat among them)."""+ return [run_dir / o["file"] for o in job.get("outputs", []) if o.get("kind") == "model3d" and (run_dir / o["file"]).exists()]++# Stem names as the providers write them (src/server/generations.ts STEM_ALIASES), folded to the suite's four.STEMS = {"voice": "voice", "vocals": "voice", "speech": "voice", "target": "voice", "dialogue": "voice",@@ -134,7 +143,7 @@ def input_file(job: dict) -> pathlib.Path | None:def fingerprint(run_dir: pathlib.Path, job: dict, config: dict) -> str:h = hashlib.sha256(json.dumps(config, sort_keys=True).encode())- for p in media_outputs(run_dir, job) + list(audio_outputs(run_dir, job).values()) + [pathlib.Path(r) for r in job.get("references", [])]:+ for p in media_outputs(run_dir, job) + splat_outputs(run_dir, job) + list(audio_outputs(run_dir, job).values()) + [pathlib.Path(r) for r in job.get("references", [])]:try:st = p.stat()h.update(f"{p}|{st.st_size}|{int(st.st_mtime)}".encode())@@ -322,6 +331,18 @@ class Scorer:return {"_note": "no source frames in the case's range"}return {"bgDiff": round(d["mae"], 5), "bgPsnr": round(d["psnr"], 2)}+ def m_splat(self, job, outs):+ files = splat_outputs(self.run_dir, job)+ if not files:+ return {"_note": "no 3D file in the result"}+ why = []+ for f in files:+ try:+ return splat.haze(splat.opacities(f))+ except splat.NotASplat as e:+ why.append(f"{f.name}: {e}")+ return {"_note": "no splat file to read (" + "; ".join(why) + ")"}+def m_lipsync(self, job, outs):clips = [o for o in outs if kind_of(o) == "video"]if not clips:diff --git a/scripts/eval/metrics/fuobe_metrics/splat.py b/scripts/eval/metrics/fuobe_metrics/splat.pynew file mode 100644index 00000000..3b4ef811--- /dev/null+++ b/scripts/eval/metrics/fuobe_metrics/splat.py@@ -0,0 +1,93 @@+"""Gaussian splat files (the splat suite): how many Gaussians a .spz or .ply holds, and the share that is nearly+transparent (opacity under 0.05), the haze Idol is known for (docs/research/idol-9.md §2.4). numpy only.++The two formats ComfyUI's SplatToFile3D writes (comfy_extras/nodes_gaussian_splat.py):+- .spz (Niantic), gzip-wrapped: a 16-byte header (magic "NGSP", version, count, SH degree, fractional bits, flags,+ reserved), then the positions (version 1: float16 x 3; versions 2 and 3: 24-bit fixed point x 3), then one alpha+ byte per Gaussian (opacity x 255).+- .ply (3DGS): a text header, then binary little-endian vertices with a logit `opacity` property.+"""++from __future__ import annotations++import gzip+import pathlib+import struct++import numpy as np++HAZE_OPACITY = 0.05+SPZ_MAGIC = 0x5053474E # "NGSP"+PLY_TYPES = {+ "char": "i1", "uchar": "u1", "short": "i2", "ushort": "u2", "int": "i4", "uint": "u4", "float": "f4", "double": "f8",+ "int8": "i1", "uint8": "u1", "int16": "i2", "uint16": "u2", "int32": "i4", "uint32": "u4", "float32": "f4", "float64": "f8",+}+++class NotASplat(ValueError):+ """The file isn't a splat this module reads (a GLB, a .ksplat, an ASCII .ply, an unknown .spz version)."""+++def spz_opacities(data: bytes) -> np.ndarray:+ raw = gzip.decompress(data)+ if len(raw) < 16 or struct.unpack_from("<I", raw, 0)[0] != SPZ_MAGIC:+ raise NotASplat("not an .spz (bad magic)")+ version, n = struct.unpack_from("<II", raw, 4)+ per_point = {1: 6, 2: 9, 3: 9}.get(version)+ if per_point is None:+ raise NotASplat(f".spz version {version} isn't read here (1-3 are)")+ off = 16 + n * per_point+ if len(raw) < off + n:+ raise NotASplat(".spz is cut short")+ return np.frombuffer(raw, np.uint8, count=n, offset=off).astype(np.float32) / 255.0+++def ply_opacities(data: bytes) -> np.ndarray:+ end = data.find(b"end_header\n")+ if not data.startswith(b"ply") or end < 0:+ raise NotASplat("not a .ply")+ body = end + len(b"end_header\n")+ lines = data[:end].decode("ascii", "replace").splitlines()+ if "format binary_little_endian 1.0" not in [ln.strip() for ln in lines]:+ raise NotASplat("only binary little-endian .ply is read here")+ props: list[tuple[str, str]] = []+ count = 0+ seen: list[str] = []+ for ln in lines:+ p = ln.split()+ if not p:+ continue+ if p[0] == "element":+ seen.append(p[1])+ if p[1] == "vertex":+ count = int(p[2])+ elif p[0] == "property" and seen[-1:] == ["vertex"]:+ if p[1] == "list":+ raise NotASplat("the .ply's vertices have list properties")+ if p[1] not in PLY_TYPES:+ raise NotASplat(f"the .ply has a property type {p[1]} this doesn't read")+ props.append((p[2], "<" + PLY_TYPES[p[1]]))+ if seen[:1] != ["vertex"]:+ raise NotASplat("the .ply's first element isn't its vertices")+ names = [n for n, _ in props]+ if "opacity" not in names:+ raise NotASplat("the .ply has no opacity (a point cloud, not a splat)")+ arr = np.frombuffer(data, np.dtype(props), count=count, offset=body)+ logit = arr["opacity"].astype(np.float64)+ return (1.0 / (1.0 + np.exp(-logit))).astype(np.float32)+++def opacities(path: str | pathlib.Path) -> np.ndarray:+ """Each Gaussian's opacity (0-1), read by content rather than by name (a run may save an .spz under .bin)."""+ data = pathlib.Path(path).read_bytes()+ if data[:2] == b"\x1f\x8b":+ return spz_opacities(data)+ if data[:3] == b"ply":+ return ply_opacities(data)+ raise NotASplat("not an .spz or .ply")+++def haze(op: np.ndarray, threshold: float = HAZE_OPACITY) -> dict:+ """The count and the share of nearly transparent Gaussians."""+ n = int(op.size)+ return {"gaussians": n, "haze": round(float((op < threshold).mean()) if n else 0.0, 4)}diff --git a/scripts/eval/metrics/tests/test_splat.py b/scripts/eval/metrics/tests/test_splat.pynew file mode 100644index 00000000..295c1703--- /dev/null+++ b/scripts/eval/metrics/tests/test_splat.py@@ -0,0 +1,98 @@+"""The splat metric (the splat suite): the share of nearly transparent Gaussians in an .spz or a 3DGS .ply, read by+content, and what the scorer does with a run's 3D files and a clean graph's preview still. numpy only; the files are+written here from the formats' layouts (docs/research/idol-9.md §2.1, §2.4)."""++import argparse+import gzip+import pathlib+import struct++import numpy as np+import pytest++from fuobe_metrics import score, splat++# 10 Gaussians: 4 under opacity 0.05 (the haze), 6 above it.+OPACITY = np.array([0.0, 0.01, 0.03, 0.049, 0.06, 0.2, 0.5, 0.8, 0.95, 1.0], np.float32)+++def spz(opacity: np.ndarray, version: int = 2) -> bytes:+ n = len(opacity)+ head = struct.pack("<IIIBBBB", splat.SPZ_MAGIC, version, n, 0, 12, 0, 0)+ pos = bytes(n * (6 if version == 1 else 9))+ alpha = np.round(opacity * 255).clip(0, 255).astype(np.uint8).tobytes()+ rest = bytes(n * 9) # colour, scale and rotation bytes, unread+ return gzip.compress(head + pos + alpha + rest)+++def ply(opacity: np.ndarray) -> bytes:+ n = len(opacity)+ names = ["x", "y", "z", "f_dc_0", "f_dc_1", "f_dc_2", "opacity", "scale_0", "scale_1", "scale_2", "rot_0", "rot_1", "rot_2", "rot_3"]+ rows = np.zeros(n, dtype=[(k, "<f4") for k in names])+ op = opacity.astype(np.float64).clip(1e-6, 1 - 1e-6)+ rows["opacity"] = np.log(op / (1 - op))+ head = f"ply\nformat binary_little_endian 1.0\nelement vertex {n}\n" + "".join(f"property float {k}\n" for k in names) + "end_header\n"+ return head.encode() + rows.tobytes()++[email protected]("version", [1, 2, 3])+def test_spz_haze(tmp_path, version):+ f = tmp_path / "a.spz"+ f.write_bytes(spz(OPACITY, version))+ assert splat.haze(splat.opacities(f)) == {"gaussians": 10, "haze": 0.4}+++def test_ply_haze_and_a_file_saved_under_another_name(tmp_path):+ f = tmp_path / "a.bin"+ f.write_bytes(ply(OPACITY))+ op = splat.opacities(f)+ assert np.allclose(op, OPACITY, atol=1e-5)+ assert splat.haze(op) == {"gaussians": 10, "haze": 0.4}+++def test_what_isnt_a_splat(tmp_path):+ glb = tmp_path / "m.glb"+ glb.write_bytes(b"glTF" + bytes(16))+ with pytest.raises(splat.NotASplat):+ splat.opacities(glb)+ future = tmp_path / "v9.spz"+ future.write_bytes(gzip.compress(struct.pack("<IIIBBBB", splat.SPZ_MAGIC, 9, 1, 0, 12, 0, 0) + bytes(64)))+ with pytest.raises(splat.NotASplat, match="version 9"):+ splat.opacities(future)+ points = tmp_path / "points.ply"+ points.write_bytes(b"ply\nformat binary_little_endian 1.0\nelement vertex 1\nproperty float x\nend_header\n" + bytes(4))+ with pytest.raises(splat.NotASplat, match="no opacity"):+ splat.opacities(points)+ assert splat.haze(np.array([], np.float32)) == {"gaussians": 0, "haze": 0.0}+++def scorer(run_dir):+ s = score.Scorer(argparse.Namespace(device="cpu"))+ s.run_dir = run_dir+ return s+++def test_the_scorer_reads_the_splat_among_a_runs_files(tmp_path):+ out = tmp_path / "outputs" / "j"+ out.mkdir(parents=True)+ (out / "0-splat.spz").write_bytes(spz(OPACITY))+ (out / "1-turntable.mp4").write_bytes(b"")+ job = {"id": "j", "outputs": [{"file": "outputs/j/0-splat.spz", "kind": "model3d", "role": "splat"}, {"file": "outputs/j/1-turntable.mp4", "kind": "video", "role": "turntable"}]}+ assert scorer(tmp_path).m_splat(job, []) == {"gaussians": 10, "haze": 0.4}+ # The demo's splat is a GLB: noted, not scored.+ (out / "demo.glb").write_bytes(b"glTF" + bytes(16))+ demo = {"id": "d", "outputs": [{"file": "outputs/j/demo.glb", "kind": "model3d"}]}+ assert "no splat file" in scorer(tmp_path).m_splat(demo, [])["_note"]+ assert "no 3D file" in scorer(tmp_path).m_splat({"id": "x", "outputs": []}, [])["_note"]+++def test_a_preview_still_beside_a_clip_isnt_scored(tmp_path):+ out = tmp_path / "outputs" / "j"+ out.mkdir(parents=True)+ for name in ("orbit.mp4", "seen.png"):+ (out / name).write_bytes(b"")+ clip = {"file": "outputs/j/orbit.mp4", "kind": "video", "role": "turntable"}+ still = {"file": "outputs/j/seen.png", "kind": "image", "role": "preview"}+ assert score.media_outputs(tmp_path, {"outputs": [clip, still]}) == [pathlib.Path(tmp_path / clip["file"])]+ # A preview that is the result itself (no clip beside it) is still scored.+ assert score.media_outputs(tmp_path, {"outputs": [still]}) == [pathlib.Path(tmp_path / still["file"])]diff --git a/src/server/providers/mock.ts b/src/server/providers/mock.tsindex 6ac145ad..a0fb106c 100644--- a/src/server/providers/mock.ts+++ b/src/server/providers/mock.ts@@ -321,8 +321,11 @@ function demoOutputs(op: Operation | undefined, kind: MediaKind, prompt: string,if (kind === "image") return [depth];return [{ url: "sample:demo-model.glb", kind: "model3d", contentType: "model/gltf-binary", meta: { demo: true, format: "glb", scene: true, role: "scene" } }, depth];}- case "splat":- return [{ url: "sample:demo-model.glb", kind: "model3d", contentType: "model/gltf-binary", meta: { demo: true, format: "glb", splat: true } }];+ // An open splat graph also renders its orbit video (role turntable), as the real ones do; fal's splat is the file alone.+ case "splat": {+ const splat: DemoOutput = { url: "sample:demo-model.glb", kind: "model3d", contentType: "model/gltf-binary", meta: { demo: true, format: "glb", splat: true } };+ return meta.orbit ? [splat, { url: "sample:demo-turntable.mp4", kind: "video", contentType: "video/mp4", meta: { demo: true, role: "turntable" } }] : [splat];+ }case "rig-3d":return [{ url: "sample:demo-model.glb", kind: "model3d", contentType: "model/gltf-binary", meta: { demo: true, format: "glb", rigged: true } }];// Hi3D's refine: the demo mesh, geometry only as the real one is.@@ -457,6 +460,8 @@ export const mockProvider: ProviderAdapter = {threeStems: route.op === "separate-audio" && route.endpoint === "separate-soundtrack-dbs",// DBS graph C (soundtrack-remix-dbs): one remixed track.remix: route.op === "separate-audio" && route.endpoint === "soundtrack-remix-dbs",+ // An open splat (image-to-splat-*): the splat and its orbit video.+ orbit: route.op === "splat" && route.provider === "comfyui",},payload: { demo: true, ...input },};diff --git a/tests/eval-harness.test.ts b/tests/eval-harness.test.tsindex a7914c85..220c0fb8 100644--- a/tests/eval-harness.test.ts+++ b/tests/eval-harness.test.ts@@ -474,6 +474,52 @@ describe("the runner on the demo provider", () => {]);});+ it("runs the splat suite: Idol 3D's Best and Quick against TripoSplat on the orbit video, the photo crop on photos only", async () => {+ const r = await cli(["run", "--suite", "splat", "--engine", "demo", "--cases", "splat/photo-mug,splat/bottle", "--seeds", "1001", "--variants", "all", "--no-metrics"]);+ expect(r.code, r.stderr).toBe(0);+ const runDir = path.join(results, runIdFrom(r.stderr));+ expect(JSON.parse(fs.readFileSync(path.join(runDir, "run.json"), "utf8"))).toMatchObject({ suite: "splat", kind: "video", candidate: "idol-best", styleModel: "dinov2" });+ const rows = store.latestJobs(runDir);+ const done = rows.filter((x) => x.status === "succeeded");+ expect(done.map((x) => `${x.caseId} ${x.variant}`).sort()).toEqual(+ ["idol-best", "idol-quick", "idol-photo-crop", "triposplat-today"].map((v) => `splat/photo-mug ${v}`).concat(["idol-best", "idol-quick", "triposplat-today"].map((v) => `splat/bottle ${v}`)).sort(),+ );+ // The splat file is kept and the orbit video comes with it: that is what the scorer and the blind review read.+ for (const row of done) expect((row.outputs as { kind: string; role?: string }[]).map((o) => [o.kind, o.role ?? null])).toEqual([["model3d", null], ["video", "turntable"]]);+ expect(rows.filter((x) => x.status === "skipped").map((x) => [x.caseId, x.variant, x.skip])).toEqual(+ expect.arrayContaining([+ ["splat/bottle", "idol-photo-crop", "the idol-photo-crop variant runs on cases tagged photo only"],+ ["splat/bottle", "triposplat-cloud", "the triposplat-cloud variant runs on cloud only"],+ ]),+ );+ const suite = cases.loadSuite("splat") as unknown as { decides: string };+ expect(suite.decides).toMatch(/MODELS_3D\.splat\.open.*IDOL_PRESETS\.quick.*photo crop/s);+ type Job = { variant: string; skip?: string; request: { modelId: string; op?: string; params: { extra?: Record<string, unknown> } } };+ const all = ["idol-best", "idol-quick", "triposplat-today", "idol-photo-crop", "triposplat-cloud"];+ const open = plan.expandJobs(suite, { engine: "open", variants: all, cases: ["splat/photo-mug"], seeds: [1], exists: () => true }) as unknown as Job[];+ expect(open.map((j) => [j.variant, j.request.modelId, j.request.op, j.request.params.extra ?? null, j.skip ?? null])).toEqual([+ ["idol-best", "oss-idol", "splat", { steps: 50, sampler: "euler", cfg: 4, numGaussians: 262144 }, null],+ ["idol-quick", "oss-idol", "splat", { steps: 20, sampler: "dpmpp_2m", cfg: 4, numGaussians: 65536 }, null],+ ["triposplat-today", "oss-triposplat", "splat", null, null],+ ["idol-photo-crop", "oss-idol", "splat", { steps: 50, sampler: "euler", cfg: 4, numGaussians: 262144, photoCrop: true, cropMode: "real" }, null],+ ["triposplat-cloud", "oss-idol", "splat", null, "the triposplat-cloud variant runs on cloud only"],+ ]);+ // No Idol on the cloud: only fal's TripoSplat runs there, as itself.+ const cloud = plan.expandJobs(suite, { engine: "cloud", variants: ["triposplat-cloud", "idol-best"], cases: ["splat/bottle"], seeds: [1], exists: () => true }) as unknown as Job[];+ expect(cloud.map((j) => [j.variant, j.request.modelId, j.skip ?? null])).toEqual([+ ["triposplat-cloud", "triposplat", null],+ ["idol-best", "", "the idol-best variant runs on open / demo only"],+ ]);+ // Idol's presets in the suite are the ones the page sends.+ const { IDOL_PRESETS } = await import("@/lib/av/model3d");+ expect(open[0].request.params.extra).toEqual(IDOL_PRESETS.best);+ expect(open[1].request.params.extra).toEqual(IDOL_PRESETS.quick);+ // A variant limited to tags no case has is refused.+ const bad = path.join(dir, "bad-tags.json");+ fs.writeFileSync(bad, JSON.stringify({ suite: "bad-tags", title: "x", description: "x", original: "x", kind: "video", targets: { demo: { models: ["x"] } }, variants: { a: {}, b: { tags: ["photo"] } }, cases: [{ id: "x/1", title: "x", inputs: { images: ["fixtures/start-frame.png"] } }] }));+ expect(() => cases.loadSuite(bad)).toThrow(/variants\.b\.tags: no case is tagged photo/);+ });+it("runs Fuobe Cinema's Director and camera-move cases, and plans its cloud variants", async () => {const r = await cli(["run", "--suite", "cinema", "--engine", "demo", "--cases", "cinema/director-noir,cinema/move-dolly-in", "--no-metrics"]);expect(r.code, r.stderr).toBe(0);