LangSplatV2: Integrate TensorBoard logging with evaluation images#55
Merged
swahtz merged 13 commits intoopenvdb:mainfrom Feb 13, 2026
Merged
LangSplatV2: Integrate TensorBoard logging with evaluation images#55swahtz merged 13 commits intoopenvdb:mainfrom
swahtz merged 13 commits intoopenvdb:mainfrom
Conversation
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>
Contributor
There was a problem hiding this comment.
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
LangSplatV2WriterandLangSplatV2WriterConfigclasses 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
LangSplatV2Trainerto 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_imagesconfig 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_mapto 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.
open_vocabulary_segmentation/langsplatv2/langsplatv2/scene_transforms/multi_scale_sam_masks.py
Outdated
Show resolved
Hide resolved
open_vocabulary_segmentation/langsplatv2/langsplatv2/scene_transforms/multi_scale_sam_masks.py
Outdated
Show resolved
Hide resolved
open_vocabulary_segmentation/langsplatv2/langsplatv2/training/dataset.py
Show resolved
Hide resolved
open_vocabulary_segmentation/langsplatv2/langsplatv2/training/langsplatv2_writer.py
Outdated
Show resolved
Hide resolved
open_vocabulary_segmentation/langsplatv2/langsplatv2/training/trainer.py
Outdated
Show resolved
Hide resolved
open_vocabulary_segmentation/langsplatv2/langsplatv2/scene_transforms/multi_scale_sam_masks.py
Show resolved
Hide resolved
open_vocabulary_segmentation/langsplatv2/langsplatv2/scene_transforms/multi_scale_sam_masks.py
Show resolved
Hide resolved
…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>
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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).LangSplatV2Writer+LangSplatV2WriterConfiginlangsplatv2/training/langsplatv2_writer.py— duplicates the GARfVDB writer interface (CSV metrics, disk image saving, checkpoints, TensorBoard) without cross-project dependencycosine_error_map()visualization utility tolangsplatv2/util.py— computes per-pixel1 - cosine_similarityand maps through the turbo colormapLangSplatV2Trainerto use the writer — replaces internal_log_metric()/_save_checkpoint()/ file management with an injectedLangSplatV2Writerinstancelog_test_imagesconfig flag)eval()with full image diagnostics — beauty render, predicted features PCA, GT features PCA, cosine error heatmap, alpha map, and side-by-side comparison compositetrain_langsplatv2.py— acceptsio: LangSplatV2WriterConfigparameter and instantiates the writer before trainingFixes #54
Test plan
python train_langsplatv2.pywith default config (no TensorBoard, no images) and verify metrics CSV is written and checkpoints are saved as before--io.use-tensorboardand verify TensorBoard event files are created undertensorboard/--io.save-images --config.log-test-imagesand verify training images (PCA features, coverage, error heatmap) are saved toimages/at log intervals--use-every-n-as-val 8and verify evaluation images (beauty render, PCA features, error heatmap, alpha map, comparison) are saved at eval epochs--io.use-tensorboard --io.save-images-to-tensorboardand verify images appear in TensorBoardLangSplatV2Trainer.from_state_dict()and verify the newlog_test_imagesconfig field is restored correctly