Files
nbrightandClaude Opus 5 609d9a6972 Add SUM Parts reproduction and Seosan Myeongcheon application pipeline
Reproduces the SUM Parts (CVPR 2025) face-labeling benchmark on a single
consumer GPU, then applies it to drone-photogrammetry road survey meshes.

Verified on RTX 3060 12GB / WSL2 Ubuntu 22.04 / CUDA 11.8 / torch 2.0.1:
- CUDA extensions build (pointnet2_batch, pointops, chamfer_dist, emd,
  subsampling)
- PointNet 100 epochs reaches mIoU 17.19, matching the paper's reported 15.1
- OBJ -> PLY conversion round-trips through the model and yields per-point
  predictions

Four upstream source patches, all idempotent, originals preserved:
- numpy aliases removed in 1.24 (np.long etc.) and collections ABCs moved in
  python 3.10
- the blind test split ships label = -1, which crashed ConfusionMatrix
- mode=val referenced `epoch` before assignment

Documents the traps that cost the most time, including VRAM overflow silently
falling back to host RAM on WSL2 (25-100x slowdown, no OOM) and the colour
scale mismatch between r/g/b float32 and red/green/blue uint8.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-21 10:29:25 +09:00

75 lines
2.3 KiB
Bash

#!/usr/bin/env bash
# SUM Parts - pipeline smoke test
#
# Goal is NOT accuracy. Goal is proving the whole chain survives:
# ply load -> grid subsample -> cuda ops -> forward -> backward -> val
# Uses the lightest model (pointnet) and 1 epoch. Expect garbage mIoU.
#
# Usage:
# bash smoke_train.sh # pointnet, 1 epoch
# bash smoke_train.sh pointnext-xl 2 # other cfg / epoch count
set -euo pipefail
CONDA_ROOT="$HOME/miniconda3"
ENV_NAME="sumparts"
REPO="$HOME/sum-parts/semantic_segmentation/PointNeXt_bundle"
CFG="${1:-pointnet}"
EPOCHS="${2:-1}"
source "$CONDA_ROOT/etc/profile.d/conda.sh"
conda activate "$ENV_NAME"
export CUDA_HOME="$CONDA_PREFIX"
export PATH="$CUDA_HOME/bin:$PATH"
# main.py imports wandb at module scope, so the package must exist even with
# wandb.use_wandb=False. Disabled mode keeps it from asking for a login.
export WANDB_MODE=disabled
export WANDB_SILENT=true
cd "$REPO/examples/segmentation"
# Two constraints squeeze BS from both sides, and both fail confusingly:
#
# too large -> the loader drops the last partial batch, so a single tile with
# the cfg's batch_size (6 for pointnet) yields ZERO batches. The confusion
# matrix is then never populated and cm.all_metrics() dies on
# AttributeError: 'int' object has no attribute 'diag'
#
# too small -> BatchNorm1d refuses a batch of 1 while training:
# ValueError: Expected more than 1 value per channel when training,
# got input size torch.Size([1, 512])
#
# So: BS=2 (the BatchNorm floor), and LOOP repeats the tile enough times to fill
# whole batches.
LOOP="${3:-4}"
BS="${BS:-2}"
LOG="${LOG:-/tmp/sumparts_smoke.log}"
echo "=== smoke train: cfg=$CFG epochs=$EPOCHS loop=$LOOP bs=$BS ==="
echo "log: $LOG"
# Capture both streams to a file. Tracebacks were getting lost when this ran
# under a wrapper that only kept stdout, which made crashes look silent.
set +e
python -u main.py \
--cfg "../../cfgs/sumv2_triangle/${CFG}.yaml" \
mode=train \
epochs="$EPOCHS" \
wandb.use_wandb=False \
dataset.train.loop="$LOOP" \
batch_size="$BS" \
val_batch_size=1 \
val_freq=1 \
> "$LOG" 2>&1
rc=$?
set -e
echo "=== exit=$rc | last 30 lines ==="
tail -30 "$LOG"
[ "$rc" -eq 0 ] && echo "SMOKE DONE" || echo "SMOKE FAILED (rc=$rc)"
exit "$rc"