Skip to content

Add BEAST3D model: ERayZer with DINOv3 tokenizer, GT cameras, frustum…#56

Merged
themattinthehatt merged 3 commits into
paninski-lab:mainfrom
PPWangyc:beast3d-model
Jun 25, 2026
Merged

Add BEAST3D model: ERayZer with DINOv3 tokenizer, GT cameras, frustum…#56
themattinthehatt merged 3 commits into
paninski-lab:mainfrom
PPWangyc:beast3d-model

Conversation

@PPWangyc

Copy link
Copy Markdown
Collaborator

… 3DGS

Port multi-view BEAST3D into the beast repo as a full-parity ERayZer subclass, following docs/developer_guide.md.

Shared, opt-in changes (erayzer behavior unchanged, verified):

  • gaussians_renderer: add camera_frustum_constraint + opt-in frustum_constraint kwarg; capture render_alphas (was discarded) so mask loss has real alphas; accept bg_color=None.
  • erayzer_model: add _tokenize_images / _sample_background / _prepare_target subclass hooks to forward; thread frustum_constraint/backgrounds into Renderer; expose render_alphas/pixel_mask outputs.

BEAST3D (beast/models/beast3d/):

  • frozen DINOv3 tokenizer with ImageNet normalization (the DinoV3 wrapper omits it)
  • GT cameras via _resolve_cameras; pose branch disabled with encoder_n_layer=0
  • frustum-constrained render, random-background compositing, masked alpha loss
  • registry + config dispatch (Beast3DBeastConfig) + train.py MultiViewDataModule routing with use_mask=True

Config: configs/multiview/beast3d.yaml (reference template). The machine-specific cheese3d fine-tune config (data_dir + init_checkpoint) is kept local and gitignored, alongside erayzer_cheese3d_ft.yaml.

Tests: tests/models/beast3d/ (19 CPU unit tests + 1 gsplat-gated integration test); renderer + base-ERayZer regression tests. ruff + pyright clean.

… 3DGS

Port multi-view BEAST3D into the beast repo as a full-parity ERayZer subclass,
following docs/developer_guide.md.

Shared, opt-in changes (erayzer behavior unchanged, verified):
- gaussians_renderer: add camera_frustum_constraint + opt-in frustum_constraint
  kwarg; capture render_alphas (was discarded) so mask loss has real alphas;
  accept bg_color=None.
- erayzer_model: add _tokenize_images / _sample_background / _prepare_target
  subclass hooks to forward; thread frustum_constraint/backgrounds into Renderer;
  expose render_alphas/pixel_mask outputs.

BEAST3D (beast/models/beast3d/):
- frozen DINOv3 tokenizer with ImageNet normalization (the DinoV3 wrapper omits it)
- GT cameras via _resolve_cameras; pose branch disabled with encoder_n_layer=0
- frustum-constrained render, random-background compositing, masked alpha loss
- registry + config dispatch (Beast3DBeastConfig) + train.py MultiViewDataModule
  routing with use_mask=True

Config: configs/multiview/beast3d.yaml (reference template). The machine-specific
cheese3d fine-tune config (data_dir + init_checkpoint) is kept local and gitignored,
alongside erayzer_cheese3d_ft.yaml.

Tests: tests/models/beast3d/ (19 CPU unit tests + 1 gsplat-gated integration
test); renderer + base-ERayZer regression tests. ruff + pyright clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Jun 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.79412% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.51%. Comparing base (56ef9a6) to head (eba3773).

Files with missing lines Patch % Lines
beast/rendering/gaussians_renderer.py 92.00% 2 Missing ⚠️
beast/models/beast3d/beast3d_model.py 98.55% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #56      +/-   ##
==========================================
+ Coverage   86.03%   86.51%   +0.48%     
==========================================
  Files          51       55       +4     
  Lines        4890     5022     +132     
==========================================
+ Hits         4207     4345     +138     
+ Misses        683      677       -6     
Files with missing lines Coverage Δ
beast/config.py 100.00% <100.00%> (ø)
beast/models/beast3d/__init__.py 100.00% <100.00%> (ø)
beast/models/beast3d/beast3d_config.py 100.00% <100.00%> (ø)
beast/models/beast3d/beast3d_train.py 100.00% <100.00%> (ø)
beast/models/erayzer/erayzer_model.py 89.35% <100.00%> (+1.19%) ⬆️
beast/models/registry.py 100.00% <100.00%> (ø)
beast/train.py 99.26% <100.00%> (ø)
beast/models/beast3d/beast3d_model.py 98.55% <98.55%> (ø)
beast/rendering/gaussians_renderer.py 43.41% <92.00%> (+3.25%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

The lint job runs pyright over beast + tests; three type errors in
test_beast3d_model.py failed it:
- _resolve_cameras(None, ...) — img_tokens is typed Tensor; the GT-camera
  override ignores it, so pass a throwaway torch.empty(0) instead of None.
- mask.shape on the Tensor|None return of _prepare_target — assert mask is not
  None first to narrow the type.

Test-only change; behavior unchanged. ruff + full-project pyright now clean,
19 beast3d unit tests pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@themattinthehatt themattinthehatt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PPWangyc great PR! I left a couple minor comments, after you fix those I'll merge

Comment thread tests/models/beast3d/test_beast3d_model.py
# ---------------------------------------------------------------------------


class TestBeast3DModelConfig:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: can you move this to tests/test_config.py? (I'll probably change the organization of these config files at some point, but for now I want to keep them all together)

Per review on PR paninski-lab#56:
- Move TestBeast3DModelConfig from tests/models/beast3d/test_beast3d_model.py
  to tests/test_config.py, keeping all config-schema tests together.
- Add a get_beast_config_class('beast3d') dispatcher test alongside the erayzer
  one while the config tests are consolidated.

The integration test was already gated with @requires_gsplat_cuda on the
test_integration_basic method. Test-only change; ruff + pyright clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@themattinthehatt themattinthehatt merged commit 6f3859e into paninski-lab:main Jun 25, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants