[SIGGRAPH Asia 2026] 4DAnyone: Create Anyone in 4D from a Casual Monocular Video
Use six-view groups consistently across CLI and GUI (#42)
Yudong Jinbd116032e5eb
diff --git a/README.md b/README.mdindex 7131f10..f3db2b5 100644--- a/README.md+++ b/README.md@@ -110,7 +110,7 @@ Run `python inference.py --help` for the full list.- `video_path`: path to the source video.- `output_dir`: output directory for the current clip. Defaults to `data/fdanyone/<clip>`.-- `views_per_layer`: number of evenly spaced views per pitch layer. The total number of views must be divisible by 4 or 6.+- `views_per_layer`: number of evenly spaced views per pitch layer. The total number of views must be divisible by 6.- `layer_pitches`: pitch angles in degrees, one per layer. Positive values place cameras above the subject. Total views are `views_per_layer × len(layer_pitches)`.- `start_yaw`: horizontal angle of the first view, in degrees. Yaw `0` is the front view.- `yaw_span`: horizontal range covered by each camera layer, in degrees.diff --git a/fdanyone/model/conditioning.py b/fdanyone/model/conditioning.pyindex 28891a6..0f7ec81 100644--- a/fdanyone/model/conditioning.py+++ b/fdanyone/model/conditioning.py@@ -13,6 +13,7 @@ from typing import TYPE_CHECKINGfrom fdanyone.config import INFERENCEfrom fdanyone.errors import AssetError, FourDAnyoneError+from fdanyone.views import VIEWS_PER_GROUPif TYPE_CHECKING:from torch import Tensor@@ -347,13 +348,13 @@ def build_pose_feature_cache(if view_plan.enable_rcp:rcp_jobs, rcp_builder = _pose_jobs(skeletons=conditioning.rcp_skeletons,- group_size=view_plan.views_per_group,+ group_size=VIEWS_PER_GROUP,packed_views=1,channels_last=True,)target_jobs, target_builder = _pose_jobs(skeletons=conditioning.target_skeletons,- group_size=view_plan.views_per_group,+ group_size=VIEWS_PER_GROUP,packed_views=2 if view_plan.enable_rcp else 1,channels_last=False,)diff --git a/fdanyone/model/routing.py b/fdanyone/model/routing.pyindex 5da58b3..0ab8d0e 100644--- a/fdanyone/model/routing.py+++ b/fdanyone/model/routing.py@@ -5,6 +5,8 @@ from __future__ import annotationsfrom collections.abc import Sequencefrom typing import TYPE_CHECKING+from fdanyone.views import VIEWS_PER_GROUP+if TYPE_CHECKING:from fdanyone.views import ViewPlan@@ -94,14 +96,14 @@ def routing_steps(if not view_plan.enable_tcr:return 0offset = step_index * tcr_stride- if freeze_after_one_cycle and offset >= view_plan.views_per_group:+ if freeze_after_one_cycle and offset >= VIEWS_PER_GROUP:return 0return offsetreturn tuple(cyclic_groups(camera_order,- view_plan.views_per_group,+ VIEWS_PER_GROUP,step_offset(step_index),)for step_index in range(num_steps)diff --git a/fdanyone/pipeline.py b/fdanyone/pipeline.pyindex d7adf7e..c0f3e2b 100644--- a/fdanyone/pipeline.py+++ b/fdanyone/pipeline.py@@ -192,7 +192,6 @@ def run_pipeline(layer_pitches: list[int],start_yaw: int,yaw_span: int,- views_per_group: int | str,enable_rcp: bool,enable_tcr: bool,enable_turbo: bool,@@ -213,7 +212,6 @@ def run_pipeline(layer_pitches=layer_pitches,start_yaw=start_yaw,yaw_span=yaw_span,- views_per_group=views_per_group,enable_rcp=enable_rcp,enable_tcr=enable_tcr,)diff --git a/fdanyone/run_request.py b/fdanyone/run_request.pyindex b8491ff..49ac57c 100644--- a/fdanyone/run_request.py+++ b/fdanyone/run_request.py@@ -10,9 +10,12 @@ from fdanyone.errors import ConfigurationErrorfrom fdanyone.io import sha256_file, write_jsonREQUEST_FILE = ".4danyone-request.json"+REQUEST_VERSION = 2def read_run_request(directory: str | Path) -> dict | None:+ """Read a request in the current format without changing its arguments."""+path = Path(directory) / REQUEST_FILEif not path.exists() and not path.is_symlink():return None@@ -20,7 +23,7 @@ def read_run_request(directory: str | Path) -> dict | None:if path.is_symlink():raise ValueError("The request must be a regular file")value = json.loads(path.read_text())- if value["version"] != 1 or not isinstance(value["options"], dict):+ if value["version"] != REQUEST_VERSION or not isinstance(value["options"], dict):raise ValueError("Unsupported request format")if not isinstance(value["options"]["video_path"], str) or not isinstance(value["source"], dict):raise ValueError("Invalid source identity")@@ -49,7 +52,7 @@ def save_run_request(directory: str | Path, options: dict, **fields) -> dict:options[key] = str(Path(options[key]).expanduser().resolve())value = {**previous,- "version": 1,+ "version": REQUEST_VERSION,"created_at": previous.get("created_at", datetime.now(timezone.utc).isoformat()),"options": {**options, "video_path": str(source), "output_dir": str(directory.resolve())},"source": identity,diff --git a/fdanyone/space/controls.py b/fdanyone/space/controls.pyindex 27be3ac..cc26de8 100644--- a/fdanyone/space/controls.py+++ b/fdanyone/space/controls.py@@ -9,7 +9,6 @@ from fdanyone.errors import ConfigurationErrorPITCH_PRESETS = ((15,), (15, 0), (30, 15, 0), (30, 15, 0, -15), (45, 30, 15, 0, -15))MAX_LAYERS = len(PITCH_PRESETS)-VIEWS_PER_GROUP = 6_ASSETS = Path(__file__).with_name("assets")SLIDER_HTML = (_ASSETS / "slider.html").read_text()SLIDER_JS = (_ASSETS / "slider.js").read_text()diff --git a/fdanyone/space/form.py b/fdanyone/space/form.pyindex d823d49..de12ac3 100644--- a/fdanyone/space/form.py+++ b/fdanyone/space/form.py@@ -14,7 +14,6 @@ from fdanyone.space.controls import (PITCHES_JS,SLIDER_HTML,SLIDER_JS,- VIEWS_PER_GROUP,describe_gpus,gpu_model,validate_view_count,@@ -190,7 +189,6 @@ class InferenceForm:options.update(gpu_ids=None if values["gpu_ids"] == self.gpus else values["gpu_ids"],target_fps="auto",- views_per_group=VIEWS_PER_GROUP,**{name: values[name] for name in ("enable_rcp", "enable_tcr", "attention_backend")},model_dir=str(self.config.model_dir),gvhmr_root=str(self.config.gvhmr_root),diff --git a/fdanyone/space/settings.py b/fdanyone/space/settings.pyindex 1ae48bd..b3af2be 100644--- a/fdanyone/space/settings.py+++ b/fdanyone/space/settings.py@@ -35,7 +35,6 @@ def validate_options(options: dict) -> None:"layer_pitches","start_yaw","yaw_span",- "views_per_group","enable_rcp","enable_tcr",)diff --git a/fdanyone/views.py b/fdanyone/views.pyindex 4436d66..652ccb9 100644--- a/fdanyone/views.py+++ b/fdanyone/views.py@@ -8,12 +8,11 @@ from dataclasses import dataclassfrom fdanyone.config import CAMERAfrom fdanyone.errors import ConfigurationError-VALID_VIEWS_PER_GROUP = (4, 6)+VIEWS_PER_GROUP = 6MIN_PITCH = -15MAX_PITCH = 45-# RCP uses the canonical proposal cameras seen during training. The resolved-# group size selects a prefix; at most the first four become target references.+# RCP generates six canonical proposal cameras; the first four become target references.RCP_CAMERA_ORDER = (4, 9, 14, 19, 0, 12)@@ -35,7 +34,6 @@ class ViewPlan:layer_pitches: tuple[int, ...]start_yaw: intyaw_span: int- views_per_group: intenable_rcp: boolenable_tcr: bool@@ -49,7 +47,7 @@ class ViewPlan:@propertydef num_groups(self) -> int:- return self.num_target_views // self.views_per_group+ return self.num_target_views // VIEWS_PER_GROUP@propertydef target_views(self) -> tuple[TargetView, ...]:@@ -71,7 +69,7 @@ class ViewPlan:@propertydef rcp_camera_ids(self) -> tuple[int, ...]:- return RCP_CAMERA_ORDER[: self.views_per_group] if self.enable_rcp else ()+ return RCP_CAMERA_ORDER if self.enable_rcp else ()@propertydef is_canonical_target_ring(self) -> bool:@@ -88,7 +86,6 @@ class ViewPlan:"layer_pitches": list(self.layer_pitches),"start_yaw": self.start_yaw,"yaw_span": self.yaw_span,- "views_per_group": self.views_per_group,"enable_rcp": self.enable_rcp,"enable_tcr": self.enable_tcr,}@@ -103,7 +100,6 @@ class ViewPlan:layer_pitches=value["layer_pitches"],start_yaw=value["start_yaw"],yaw_span=value["yaw_span"],- views_per_group=value["views_per_group"],enable_rcp=value["enable_rcp"],enable_tcr=value["enable_tcr"],)@@ -131,36 +127,12 @@ def _layer_pitches(value: object) -> tuple[int, ...]:return pitches-def _group_size(value: int | str, num_target_views: int) -> int:- if isinstance(value, str):- if value.lower() == "auto":- divisors = tuple(size for size in VALID_VIEWS_PER_GROUP if num_target_views % size == 0)- if not divisors:- raise ConfigurationError(f"Total target views ({num_target_views}) must be divisible by 4 or 6.")- return max(divisors)- try:- value = int(value)- except ValueError:- raise ConfigurationError(- f"views_per_group must be 'auto' or one of {VALID_VIEWS_PER_GROUP}, got {value!r}."- ) from None- value = _integer("views_per_group", value)- if value not in VALID_VIEWS_PER_GROUP:- raise ConfigurationError(f"views_per_group must be one of {VALID_VIEWS_PER_GROUP}, got {value!r}.")- if num_target_views % value:- raise ConfigurationError(- f"Total target views ({num_target_views}) must be divisible by views_per_group ({value})."- )- return value--def resolve_view_plan(*,views_per_layer: int = 24,layer_pitches: Sequence[int] = (15,),start_yaw: int = 0,yaw_span: int = 360,- views_per_group: int | str = "auto",enable_rcp: bool = True,enable_tcr: bool = True,) -> ViewPlan:@@ -175,20 +147,21 @@ def resolve_view_plan(yaw_span = _integer("yaw_span", yaw_span)if not 0 < yaw_span <= 360:raise ConfigurationError(f"yaw_span must be between 1 and 360 degrees, got {yaw_span}.")- resolved_group_size = _group_size(views_per_group, views_per_layer * len(pitches))+ total_views = views_per_layer * len(pitches)+ if total_views % VIEWS_PER_GROUP:+ raise ConfigurationError(f"Total target views ({total_views}) must be divisible by {VIEWS_PER_GROUP}.")if not isinstance(enable_rcp, bool):raise ConfigurationError(f"enable_rcp must be True or False, got {enable_rcp!r}.")if not isinstance(enable_tcr, bool):raise ConfigurationError(f"enable_tcr must be True or False, got {enable_tcr!r}.")- # Up to six requested targets are cheaper and clearer to generate directly.- rcp_active = enable_rcp and views_per_layer * len(pitches) > 6+ # One target group is generated directly, without proposal views.+ rcp_active = enable_rcp and total_views > VIEWS_PER_GROUPreturn ViewPlan(views_per_layer=views_per_layer,layer_pitches=pitches,start_yaw=start_yaw,yaw_span=yaw_span,- views_per_group=resolved_group_size,enable_rcp=rcp_active,enable_tcr=enable_tcr,)diff --git a/inference.py b/inference.pyindex bad5c72..bc68c67 100644--- a/inference.py+++ b/inference.py@@ -16,7 +16,6 @@ def inference(layer_pitches: list[int] = [15], # noqa: B006 - normalized without mutationstart_yaw: int = 0,yaw_span: int = 360,- views_per_group: int | str = "auto",enable_rcp: bool = True,enable_tcr: bool = True,enable_turbo: bool = True,@@ -36,18 +35,14 @@ def inference(video_path: Input video; it must contain at least 121 usable frames.output_dir: Output directory for this clip. Defaults to data/fdanyone/<clip>.views_per_layer: Number of evenly spaced yaw views at each pitch.- Total views (this number times the layer count) must be divisible by 4 or 6.+ Total views (this number times the layer count) must be divisible by 6.layer_pitches: Camera pitch for each layer in degrees, for example[-10,15,35]. Positive values place the camera above the subject;each value must be between -15 and 45.start_yaw: First yaw in every layer, in degrees; 0 faces the person.yaw_span: Angular range sampled by each layer, from 1 to 360 degrees.The end angle is excluded so a full ring never duplicates a view.- views_per_group: Maximum target views generated together. auto chooses- 6 when possible and otherwise 4; a manual value must be 4 or 6 and- divide the total view count.- enable_rcp: Use proposal views before generating more than six targets.- The proposal count follows views_per_group.+ enable_rcp: Use six proposal views before generating more than six targets.enable_tcr: Shift view groups cyclically between denoising steps.enable_turbo: Whether to use 4DAnyone-Turbo for accelerated denoising.Disable it to use the base 4DAnyone model.@@ -83,7 +78,6 @@ def inference(layer_pitches=layer_pitches,start_yaw=start_yaw,yaw_span=yaw_span,- views_per_group=views_per_group,enable_rcp=enable_rcp,enable_tcr=enable_tcr,enable_turbo=enable_turbo,