s23dr
hoho22k
research-only
non-commercial

S23DR 2026 Winning Solution πŸ”₯

Project Page (Interactive 3D Demo & Paper): WireDiT (WACV 2027)

This repository contains the winning solution πŸ† for the S23DR 2026 roof wireframe reconstruction challenge. The task is to recover a structured 3D roof wireframe from scene reconstruction inputs: COLMAP geometry, camera information, depth-derived cues, and semantic/gestalt image signals. The final submission predicts the wireframe vertices, edges, and classifications expected by the Hugging Face competition interface.

The full technical writeup is included as S23DR_2026_writeup_final.pdf.

Challenge 🏠

S23DR 2026 evaluates how well a system can reconstruct clean, metric 3D roof structure from noisy multi-view scene data. This is harder than ordinary dense reconstruction because the output is not just a point cloud or mesh: it must be a compact graph of meaningful roof vertices and edges. Good submissions need both geometric accuracy and topological consistency.

The competition uses a custom score reported through HSS, with supporting F1 and IoU diagnostics during local validation. In practice, strong performance depends on recovering the important roof junctions and line segments while avoiding spurious vertices and broken topology.

Approach βš™οΈ

The solution treats roof wireframe recovery as a generative structured prediction problem. It builds a fixed-size scene representation from COLMAP points, camera tokens, depth-unprojected points, RGB, and semantic/gestalt cues, then predicts the roof graph with a trained diffusion model.

The final system uses:

  • A first-stage wireframe diffusion model for coarse vertex and edge prediction.
  • A second-stage refinement model focused around the first-stage roof hull.
  • Online preprocessing that mirrors the training-time scene construction.
  • Inference-time ensembling over multiple random trajectories.
  • Lightweight candidate ranking and medoid/confidence selection to improve stability.

This combination was designed to handle the main failure modes of the challenge: noisy reconstruction points, missing roof evidence, duplicate or unstable vertices, and topology that changes under small sampling perturbations.

Repository Contents πŸ“¦

  • S23DR_2026_writeup_final.pdf - final solution writeup.
  • script.py - competition entry point used for local sanity checks and submission inference.
  • models/ - diffusion, denoising, scene encoding, and stage-2 model components.
  • data/ - preprocessing and dataset utilities for scene and stage-2 inputs.
  • test_checkpoint*.pth - trained checkpoints used by the submitted system (test_checkpoint.pth stage 1, test_checkpoint_stage2.pth stage 2).
  • building3d_tallinn.pth - the single-stage model trained on the Building3D Tallinn subset (see Building3D).
  • building3d/ - Building3D data preparation, evaluation, test-time augmentation, fusion and submission export.
  • train.py, train_stage2.py, trainer.py, config_utils.py, configs/ - training (see Training).
  • scripts/ - the two passes that build the stage-2 training cache.
  • wrong_train_scenes.json - HoHo training scenes with unusable ground truth, left out of training: per scene the id, an issue label, the approximate offset in metres and the HSS, plus how the scenes were selected.
  • tests/ - unit tests (synthetic data only; uv run --group dev pytest).
  • ensemble_ranker*.npz - saved lightweight ensemble selector/ranker artifacts.
  • eval.slurm and eval_cpu.slurm - validation scripts for GPU and CPU runs.
  • tools/ - inference benchmark and preprocessing equivalence checks used for the speed numbers below; export_checkpoint.py strips a training checkpoint down to a release checkpoint.
  • pyproject.toml and uv.lock - pinned environment (Python 3.13, PyTorch 2.11, CUDA 12.8).
  • LICENSE, NOTICE - licences of the code and of each set of weights.
  • DIARY_2026_05.md - experiment notes and debugging history.

Running πŸš€

Download the repository. The checkpoints are Git LFS files, so a plain git clone without git-lfs leaves only small pointer files and the script then fails while loading the checkpoint:

git lfs install
git clone https://huggingface.co/jskvrna/2026_s23dr
# or, without git-lfs:
hf download jskvrna/2026_s23dr --local-dir 2026_s23dr

Set up the environment with uv (Linux only; about 7.5 GB) and prefix the commands below with uv run:

uv sync

The sanity check reads the gated dataset usm3d/hoho22k_2026_trainval from the Hugging Face Hub: accept its terms on the dataset page and log in once with hf auth login, otherwise the script stops with a GatedRepoError (401).

For a quick local sanity check on validation samples (streams only the first --sanity_n samples of the validation shards of the gated usm3d/hoho22k_2026_trainval dataset into cache/, about 13 MB for --sanity_n 1, reused offline later; --sanity_n 0 downloads all shards, about 1.9 GB; pass --sanity_data_dir to use a local copy):

python script.py --sanity --sanity_n 1

For the normal competition-style inference path:

python script.py --params params.json --output submission.json

The script resolves checkpoints from CLI flags, environment variables, params.json, or the committed defaults:

python script.py --ckpt test_checkpoint.pth --stage2_ckpt test_checkpoint_stage2.pth

These two commands expect the competition server layout: they read the dataset shards from /tmp/data (*public*/**/*.tar as validation, *private*/**/*.tar as test). If /tmp/data does not exist, the script downloads the dataset named in params.json, which is the gated competition test set. Pass --data_dir <dir> to run on a local copy with the same layout.

On SLURM (the scripts run the sanity check through uv run; add your cluster's partition and module loads):

sbatch -p <gpu partition> eval.slurm
sbatch -p <cpu partition> eval_cpu.slurm

The sanity check caches dataset samples under cache/. The dataset is gated and must not be redistributed, so cache/, *.tar, submission.json and candidate dumps (ensemble_candidates*.jsonl, which hold per-sample ids, scores and features) are in .gitignore; do not commit them, nor anything written to a custom --sanity_cache_dir, --output or benchmark output directory.

Inference Speed ⚑

Throughput of the full pipeline (tar reading, preprocessing, both diffusion stages, ensemble selection) on the 170 validation scenes. One sample is the complete method: a 16-member ensemble with 50 + 50 sampling steps.

Hardware Setting Samples/s 170 scenes, total
H200 default 5.1 44 s
H200 --batch_samples 8 14.8 24 s
H200 exact fp32 1.9 99 s
H200 original release (before the speed-up) 0.39 448 s
A100 40 GB default 3.6 63 s
A100 40 GB --batch_samples 8 9.3 36 s
CPU, 32 cores (EPYC 7543) --device cpu 0.09 30 min

Samples/s is the steady rate in the middle of the run; the totals include about 10 s of start-up (15 s on the A100).

  • Default: bf16 + TF32 inference, one scene per GPU batch, about 3 GB of GPU memory. Over 32 paired seeds its validation HSS is 1.0009Γ— that of exact fp32 (95 % interval 0.9998–1.0020).
  • --batch_samples N: more scenes per GPU batch; about 11 GB of GPU memory at 8 and 20 GB at 16.
  • --compile: torch.compile for the denoiser; pays off only on runs of several hundred scenes.
  • Exact fp32: --no-encoder_bf16 --no-denoiser_bf16 --no-tf32 reproduces the original release numerically (same wireframe topology on 99.4–100 % of validation scenes).
  • --seed: predictions are seeded per scene, so a fixed command on a fixed GPU type is bit-reproducible. With bf16, changing the batch size or the GPU type changes individual predictions about as much as changing the seed, while the mean scores stay the same.
  • --n_workers: preprocessing worker processes (default: up to 8, about 1 GB of RAM each); two already keep the GPU busy at the default batch size.

A scene whose preprocessing fails gets an empty prediction and the script exits with code 1 after writing the submission.

Output βœ…

The generated submission.json contains one prediction per sample with:

  • order_id
  • wf_vertices
  • wf_edges

These fields match the S23DR 2026 submission schema in params.json.

Building3D

WireDiT was also trained on the Tallinn subset of Building3D (airborne LiDAR roofs). The model is single-stage: one global diffusion pass per building, no stage 2, and a yaw-rotation ensemble at test time.

building3d_tallinn.pth: 16.2 M parameters (d_model 256, 8 heads, 8 denoiser layers, 1,024 pooled scene tokens, 64 vertex slots), 8,192 input points carrying XYZ, RGB, NIR and intensity, a 10-octave Fourier encoding (pos_enc_dim 60) and an MLP edge head (width 256). It was trained for 1,000 epochs (final step 114,000; the released weights are the last epoch) on 4 GPUs with a global batch of 256, learning rate 5.8e-4 and bf16; configs/building3d_tallinn.yaml holds the full setting. The architecture is read from the checkpoint, so the tools below take no model flags.

Data

The dataset repository Building3D/Building3D is gated: request access on its page and run hf auth login once. Then:

uv run python -m building3d.fetch --dst datasets/building3d

This downloads only Tallinn-Roof_point_cloud&Wireframe.zip (2.0 GB; 10.7 GB extracted), the one archive the tools read; the repository's other Tallinn archives (dense point clouds, building meshes, about 29 GB extracted) are not needed. It leaves datasets/building3d/extracted/Tallinn/{train,test}/xyz/*.xyz (x y z r g b nir intensity) and train/wireframe/*.obj; the test split has no wireframes. Each building is rotated from Z-up to the model's Y-up frame and normalised by its median and 95th-percentile radius. Training holds out a deterministic 10 % of the train split (train_val, chosen by a hash of the building id), so --val_frac 0.1 --val_seed 0 below must stay as they are to evaluate on the buildings the model did not see. Buildings without a wireframe file or with an empty one are left out (the tools print how many).

Local evaluation on the held-out split

One sample per building on the held-out split (the test wireframes are not public); an edge is kept when its pairwise adjacency probability exceeds --edge_thresh:

uv run torchrun --standalone --nproc_per_node=1 -m building3d.eval --ckpt building3d_tallinn.pth \
    --raw_root datasets/building3d/extracted/Tallinn --val_frac 0.1 --val_seed 0 \
    --n_sample_steps 50 --precision fp32 --validity_thresh 0 --edge_thresh 0.5 --seed 0

The same pipeline as the test submission below (64 yaw members, fused) on the held-out split:

uv run python -m building3d.tta_dump --ckpt building3d_tallinn.pth \
    --raw_root datasets/building3d/extracted/Tallinn --split train_val --val_frac 0.1 --val_seed 0 \
    --n_yaw 64 --n_sample_steps 20 --precision fp32 --seed 0 --out_dir dumps/tallinn_val_m64
uv run python -m building3d.score_dump --dump_dir dumps/tallinn_val_m64 --raw_root datasets/building3d/extracted/Tallinn \
    --n_yaw 64 --cluster_eps 0.04 --vote_frac 0.5 --edge_thresh 0.5 --edge_vote_frac 0.6 --valid_thresh -0.5

Expected results with building3d_tallinn.pth on the 3,271 held-out buildings, to check a set-up (they vary in the third decimal with the seed and the GPU):

ACO (m) CP CR CF1 EP ER EF1
single sample, 50 steps, fp32 (building3d.eval, mean of 3 seeds) 0.231 0.869 0.873 0.871 0.695 0.738 0.716
64 yaw members fused, submission settings (tta_dump + score_dump) 0.162 0.950 0.858 0.902 0.858 0.745 0.798

The metrics (building3d/metrics.py) are an independent re-implementation; the upstream repository geospatial-lab/Building3D has no licence file, and none of its code is included. They are numerically identical to the implementation used during development (maximum absolute difference 0 on all seven metrics and all raw counts, over 2,009 synthetic cases and 6,542 real prediction/ground-truth pairs). Corner matching follows the upstream evaluator as of commit 0ac12a1 (2024-02-14): Hungarian matching within 0.1 of the roof radius (the largest distance of the roof points from their mean), predicted corners without an edge not counted. ACO is the mean offset of the matched corners in metres (that evaluator reports it in the units of its input; the two agree after de-normalising by the roof radius). Corner counts and ACO agree with that version on the held-out buildings except 7, where it drops ground-truth corners by a coordinate-sum filter. An edge counts when both endpoints are matched and the matched pair is a ground-truth edge; that upstream version tests the indices before re-mapping (an upstream bug), so edge counts intentionally differ from it. The current upstream evaluator (commit 4fa0108, 2024-04-12) is a different protocol, with edges matched by Hungarian assignment on a line distance and every predicted corner counted. On the same fused held-out predictions it scores 3,267 of the 3,271 buildings (it raises an error on the 4 whose predicted edges match no ground-truth edge) and gives EP 0.909 / ER 0.791 / EF1 0.846 and CP 0.959 / CR 0.869 / CF1 0.912 / ACO 0.168 (its offsets de-normalised per building to metres). Local numbers are therefore a validation signal, stricter on edges, and are not comparable with the server numbers in the paper; test-set metrics and WED come only from the organisers' server.

Test-set submission

The Tallinn results in the WireDiT paper (WED 0.216, ACO 0.17, CP 0.97, CR 0.84, CF1 0.90, EP 0.91, ER 0.75, EF1 0.82) were scored by the official Building3D evaluation server on the 3,472-building Tallinn test set. They cannot be reproduced locally: the test wireframes are not public, and WED is computed only by the server. The submission was made in two steps, first sampling every test building under 64 yaw rotations (GPU), then fusing the 64 predictions per building and writing the ZIP the server expects (CPU):

uv run python -m building3d.tta_dump --ckpt building3d_tallinn.pth \
    --raw_root datasets/building3d/extracted/Tallinn --split test \
    --n_yaw 64 --n_sample_steps 20 --precision fp32 --seed 0 \
    --out_dir dumps/tallinn_test_m64
uv run python -m building3d.export_submission --dump_dir dumps/tallinn_test_m64 \
    --test_xyz_dir datasets/building3d/extracted/Tallinn/test/xyz \
    --output_dir submissions/tallinn/obj --zip submissions/tallinn.zip \
    --n_yaw 64 --cluster_eps 0.04 --vote_frac 0.5 --edge_thresh 0.5 --edge_vote_frac 0.6 \
    --valid_thresh -0.5 --subset Tallinn --checkpoint building3d_tallinn.pth

These are the recorded settings of that submission: 64 yaw members, 20 sampling steps, full float32 (no autocast, no TF32), corner clustering radius 0.04, corner vote 0.5, edge probability 0.5, edge vote 0.6, validity logit βˆ’0.5. No horizontal flip was used and the seed was 0; these two are inferred (no record of either survives). tta_dump takes --shard i --n_shards N to split the buildings over several processes or GPUs and --micro_batch to lower memory; the submission most likely sampled all 64 members of a building in one batch (the default; not recorded). Sampling is stochastic and depends on the GPU type, so a rerun gives a statistically equivalent, not a byte-identical, ZIP. The export writes the manifest next to the ZIP with the ZIP's stem (submissions/tallinn.manifest.json): settings, counts and SHA-256.

Dumps, caches and submissions contain dataset-derived data; datasets/, dumps/ and submissions/ are in .gitignore.

Training

Every option of the training scripts is in the YAML config (no hidden defaults); a flag of the same name overrides it. --batch_size is per GPU. Checkpoints (step_*.pt, best.ckpt on the selection metric, final.pt) go to paths.ckpt_dir and embed all options as args; --resume <ckpt> continues a run, --finetune <ckpt> starts a new schedule from its weights, --eval_only <ckpt> runs the inline evaluation once, and --wandb_project <name> logs to Weights & Biases (install wandb separately). The configs reproduce the settings stored in the released checkpoints. Training runs on GPUs through torchrun; the released models used 4.

python -m tools.export_checkpoint --input <final.pt> --output <name>.pth [--sanitize|--no-sanitize] turns a training checkpoint into a release checkpoint: model weights and the architecture / data / training-setup options only, without optimizer state, paths or logging settings.

S23DR

  1. Build the stage-1 cache (CPU, one call per shard, parallel over --shard_index). The builder reads the dataset tars from the datasets download cache in cache/downloads (as written by datasets.load_dataset("usm3d/hoho22k_2026_trainval", cache_dir="cache/")):

    uv run python -m data.dataset --config configs/s23dr_stage1.yaml --split train --shard_index 0 --total_shards 1
    uv run python -m data.dataset --config configs/s23dr_stage1.yaml --split validation --shard_index 0 --total_shards 1
    
  2. Train stage 1:

    uv run torchrun --standalone --nproc_per_node=4 train.py --config configs/s23dr_stage1.yaml
    
  3. Build the stage-2 cache: run the frozen stage-1 model over both cache splits (GPU), then crop the raw points around each prediction (CPU):

    uv run python -m scripts.precompute_stage1_wireframes --ckpt test_checkpoint.pth --no-sanitize \
        --cache_dir cache/ --split train --n_sample_steps 50 --validity_thresh 0 --amp bf16 --seed 0
    uv run python -m scripts.precompute_stage2_scenes --cache_dir cache/ --split train --naming_suffix v2 --seed 0 --jobs 4
    

    (and the same for --split validation). --no-sanitize states how the released stage-1 checkpoint was trained; checkpoints written by train.py record it.

  4. Train stage 2:

    uv run torchrun --standalone --nproc_per_node=4 train_stage2.py --config configs/s23dr_stage2.yaml --finetune <stage-2 base checkpoint>
    

Not reproducible from this release: test_checkpoint_stage2.pth is a fine-tune (learning rate 1e-5, 1,000 epochs) of an earlier stage-2 run whose settings were not recorded, and its v2 cache also left out the training scenes on which stage 1 scored HSS < 0.1, from a per-scene score file that is not part of the release. Both S23DR configs leave out the scenes listed in wrong_train_scenes.json (data.exclude_ids; HoHo training scenes with misaligned or unusable ground truth, found by an HSS < 0.05 screen and manual review), as the paper describes; the args stored in the released checkpoints do not record this. Set it to null to keep every scene.

Building3D

uv run python -m building3d.data --root datasets/building3d/extracted/Tallinn --out_dir datasets/building3d/cache_Tallinn \
    --split train --k_verts 64 --val_frac 0.1 --val_seed 0
uv run torchrun --standalone --nproc_per_node=4 train.py --config configs/building3d_tallinn.yaml

The cache keeps every point of a building (b3d_v2); each epoch draws 8,192 of them after a random 10 % point dropout, together with yaw, flip and per-axis scale augmentation. The released run did no inline evaluation (eval.n: 0); --eval_n <N> enables it on train_val with the Building3D metrics (eval.select_metric: b3d_mean_f1), computed on the cached points rather than the raw files, so building3d.eval is the reference.

Tests

uv run --group dev pytest

Unit tests on synthetic data (no dataset, no GPU): the Building3D metrics on hand-checked cases, fusion, submission export, data loading and augmentation, model construction and checkpoint export.

License

Code in this repository is licensed under Apache-2.0 (LICENSE).

Model weights/checkpoints are not covered by the Apache license (see NOTICE):

  • S23DR/HoHo weights (test_checkpoint*.pth) are licensed under CC-BY-NC-4.0 and are provided for non-commercial academic research and S23DR/HoHo challenge reproducibility.
  • Building3D weights (building3d_tallinn.pth) are licensed under CC-BY-NC-SA-4.0. They were trained on the Tallinn subset of Building3D; please cite Building3D (below) when using them.

These weights were trained using the gated HoHo/S23DR and Building3D datasets. This repository does not redistribute the datasets, dataset links, cached features, labels, samples, or artifacts intended to reconstruct the datasets. Access to and use of the original datasets remain governed by the official S23DR/HoHo Data License Agreement and the Building3D terms. The one dataset-derived file here, wrong_train_scenes.json, lists the excluded HoHo training scenes (id, issue label, approximate offset in metres and HSS per scene, and the selection method).

Citation

@inproceedings{wang2023building3d,
  title     = {{Building3D}: An Urban-Scale Dataset and Benchmarks for Learning Roof Structures from Point Clouds},
  author    = {Wang, Ruisheng and Huang, Shangfeng and Yang, Hongxin},
  booktitle = {Proceedings of the IEEE/CVF International Conference on Computer Vision},
  pages     = {20076--20086},
  year      = {2023}
}
Downloads last month
36
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Datasets used to train jskvrna/2026_s23dr