Skip to content

LangSplatV2: Integrate TensorBoard logging with evaluation images#55

Merged
swahtz merged 13 commits intoopenvdb:mainfrom
swahtz:langsplatv2-tensorboard-logging
Feb 13, 2026
Merged

LangSplatV2: Integrate TensorBoard logging with evaluation images#55
swahtz merged 13 commits intoopenvdb:mainfrom
swahtz:langsplatv2-tensorboard-logging

Conversation

@swahtz
Copy link
Contributor

@swahtz swahtz commented Feb 12, 2026

Summary

Integrates TensorBoard logging with evaluation images into the LangSplatV2 training pipeline, following the GARfVDB writer pattern (GaussianSplatSegmentationWriter) and using language-feature-specific visualizations (PCA projections, error heatmaps, feature coverage).

  • Create LangSplatV2Writer + LangSplatV2WriterConfig in langsplatv2/training/langsplatv2_writer.py — duplicates the GARfVDB writer interface (CSV metrics, disk image saving, checkpoints, TensorBoard) without cross-project dependency
  • Add cosine_error_map() visualization utility to langsplatv2/util.py — computes per-pixel 1 - cosine_similarity and maps through the turbo colormap
  • Refactor LangSplatV2Trainer to use the writer — replaces internal _log_metric() / _save_checkpoint() / file management with an injected LangSplatV2Writer instance
  • Add periodic training image logging — PCA of predicted/GT features, feature coverage mask, cosine error heatmap (controlled by new log_test_images config flag)
  • Enhance eval() with full image diagnostics — beauty render, predicted features PCA, GT features PCA, cosine error heatmap, alpha map, and side-by-side comparison composite
  • Update train_langsplatv2.py — accepts io: LangSplatV2WriterConfig parameter and instantiates the writer before training

Fixes #54

Test plan

  • Run python train_langsplatv2.py with default config (no TensorBoard, no images) and verify metrics CSV is written and checkpoints are saved as before
  • Run with --io.use-tensorboard and verify TensorBoard event files are created under tensorboard/
  • Run with --io.save-images --config.log-test-images and verify training images (PCA features, coverage, error heatmap) are saved to images/ at log intervals
  • Run with --use-every-n-as-val 8 and verify evaluation images (beauty render, PCA features, error heatmap, alpha map, comparison) are saved at eval epochs
  • Run with --io.use-tensorboard --io.save-images-to-tensorboard and verify images appear in TensorBoard
  • Load a checkpoint with LangSplatV2Trainer.from_state_dict() and verify the new log_test_images config field is restored correctly

swahtz and others added 6 commits February 12, 2026 22:58
Add a LangSplatV2Writer (following the GARfVDB GaussianSplatSegmentation-
Writer pattern) to handle CSV metrics, disk image saving, checkpoints,
and optional TensorBoard scalars/images.

- Create LangSplatV2Writer + LangSplatV2WriterConfig in
  langsplatv2/training/langsplatv2_writer.py with log_metric(),
  save_image(), and save_checkpoint() methods
- Add cosine_error_map() and _apply_turbo_colormap() visualization
  utilities to langsplatv2/util.py
- Refactor LangSplatV2Trainer to delegate all I/O to the injected
  writer instead of managing files directly
- Add periodic training image logging (PCA of predicted/GT features,
  feature coverage mask, cosine error heatmap) gated by the new
  log_test_images config flag
- Enhance eval() to render beauty image, PCA feature projections,
  cosine error heatmap, alpha map, and side-by-side comparison
- Update train_langsplatv2.py to accept an io: LangSplatV2WriterConfig
  parameter and instantiate the writer before training

Fixes openvdb#54

Signed-off-by: Jonathan Swartz <jonathan@jswartz.info>
Co-authored-by: Cursor <cursoragent@cursor.com>
Add a LangSplatV2Writer (following the GARfVDB GaussianSplatSegmentation-
Writer pattern) to handle CSV metrics, disk image saving, checkpoints,
and optional TensorBoard scalars/images.

- Create LangSplatV2Writer + LangSplatV2WriterConfig in
  langsplatv2/training/langsplatv2_writer.py with log_metric(),
  save_image(), and save_checkpoint() methods
- Add cosine_error_map() and _apply_turbo_colormap() visualization
  utilities to langsplatv2/util.py
- Refactor LangSplatV2Trainer to delegate all I/O to the injected
  writer instead of managing files directly
- Add periodic training image logging (PCA of predicted/GT features,
  feature coverage mask, cosine error heatmap) gated by the new
  log_test_images config flag
- Enhance eval() to render beauty image, PCA feature projections,
  cosine error heatmap, alpha map, and side-by-side comparison
- Update train_langsplatv2.py to accept an io: LangSplatV2WriterConfig
  parameter and instantiate the writer before training

Fixes openvdb#54

Signed-off-by: Jonathan Swartz <jonathan@jswartz.info>
Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Jonathan Swartz <jonathan@jswartz.info>
Co-authored-by: Cursor <cursoragent@cursor.com>
…rmalize loss by fraction of the whole image

Refactored SAM2 mask generation to be more in line with LangSplatV2 pipeline by using its semantic size levels and not generating our own

Signed-off-by: Jonathan Swartz <jonathan@jswartz.info>
…oard-logging' into langsplatv2-tensorboard-logging

Signed-off-by: Jonathan Swartz <jonathan@jswartz.info>
Signed-off-by: Jonathan Swartz <jonathan@jswartz.info>
Signed-off-by: Jonathan Swartz <jonathan@jswartz.info>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request successfully integrates TensorBoard logging and evaluation image generation into the LangSplatV2 training pipeline, following the established GARfVDB writer pattern. The implementation adds comprehensive visualization capabilities including PCA feature projections, error heatmaps, and evaluation diagnostics.

Changes:

  • Created LangSplatV2Writer and LangSplatV2WriterConfig classes to handle CSV metrics, disk image saving, checkpoints, and optional TensorBoard logging
  • Added visualization utilities: pca_projection_fast, calculate_pca_projection, cosine_error_map, and _apply_turbo_colormap
  • Refactored LangSplatV2Trainer to replace internal file I/O with the injected writer instance
  • Added periodic training image logging (PCA features, coverage masks, error heatmaps) controlled by log_test_images config flag
  • Enhanced evaluation to render and save beauty images, feature PCA projections, error heatmaps, alpha maps, and comparison composites
  • Updated preprocessing to use multi-crop SAM2 generation with cross-crop NMS
  • Added defensive bounds checking in build_feature_map to handle out-of-range seg_map indices
  • Modified loss computation to use mask fraction scaling for gradient consistency with the original implementation

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
train_langsplatv2.py Integrates writer instantiation and passes it to trainer instead of separate save_path/run_name parameters
langsplatv2/util.py Adds PCA projection and cosine error visualization utilities copied from GARfVDB pattern
langsplatv2/training/trainer.py Refactors to use writer for all I/O, adds image logging methods for training and evaluation
langsplatv2/training/langsplatv2_writer.py New writer class following GARfVDB pattern for metrics, images, checkpoints, and TensorBoard
langsplatv2/training/dataset.py Adds bounds checking for seg_map indices to prevent indexing errors
langsplatv2/training/init.py Exports new writer classes
langsplatv2/loss.py Updates loss to use mask fraction scaling and adds cosine_loss_valid metric
langsplatv2/config.py Adds log_test_images flag and new SAM2 configuration parameters
langsplatv2/init.py Exports LangSplatV2WriterConfig
langsplatv2/scene_transforms/multi_scale_sam_masks.py Implements multi-crop SAM2 generation with cross-crop NMS
README.md Documents new training features, outputs, and preprocessing pipeline

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

swahtz and others added 7 commits February 13, 2026 18:07
…nsforms/multi_scale_sam_masks.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Jonathan Swartz <jonathan@jswartz.info>
Signed-off-by: Jonathan Swartz <jonathan@jswartz.info>
Signed-off-by: Jonathan Swartz <jonathan@jswartz.info>
…trainer.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Jonathan Swartz <jonathan@jswartz.info>
…langsplatv2_writer.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Jonathan Swartz <jonathan@jswartz.info>
Signed-off-by: Jonathan Swartz <jonathan@jswartz.info>
This update introduces warning logs to notify when pixels with segmentation map indices exceed the expected range, enhancing debugging capabilities during dataset processing.

Signed-off-by: Jonathan Swartz <jonathan@jswartz.info>
@swahtz swahtz merged commit d939c9f into openvdb:main Feb 13, 2026
8 checks passed
@swahtz swahtz deleted the langsplatv2-tensorboard-logging branch February 13, 2026 05:36
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.

LangSplatV2: Integrate TensorBoard logging with evaluation images

1 participant