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>
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
#!/usr/bin/env bash
|
||||
# SUM Parts - score the trained model on the classes this project actually needs
|
||||
#
|
||||
# Runs the sliding-window test() path over the VAL split (which has real labels,
|
||||
# unlike the blind test split), then re-scores the predictions after merging
|
||||
# SUM's 13 fine classes down to building / vegetation / vehicle / ground.
|
||||
set -uo pipefail
|
||||
|
||||
CONDA_ROOT="$HOME/miniconda3"
|
||||
SEG="$HOME/sum-parts/semantic_segmentation/PointNeXt_bundle/examples/segmentation"
|
||||
DATA="$HOME/sum-parts/data/face_labeling/texsp_pcl"
|
||||
SCRIPTS="/mnt/d/MYCLAUDE_PROJECT/sum-parts-test/scripts"
|
||||
OUT="$HOME/sum-parts/runs/coarse_eval"
|
||||
|
||||
source "$CONDA_ROOT/etc/profile.d/conda.sh"
|
||||
conda activate sumparts
|
||||
export WANDB_MODE=disabled WANDB_SILENT=true CUDA_HOME="$CONDA_PREFIX"
|
||||
export PYTORCH_CUDA_ALLOC_CONF="garbage_collection_threshold:0.7,max_split_size_mb:128"
|
||||
|
||||
mkdir -p "$OUT"
|
||||
cd "$SEG"
|
||||
|
||||
CKPT=$(find "$SEG/log/sumv2_triangle" -name '*_ckpt_best.pth' -printf '%T@ %p\n' \
|
||||
| sort -rn | head -1 | cut -d' ' -f2-)
|
||||
echo "checkpoint: $(basename "$CKPT")"
|
||||
|
||||
# test() writes prediction plys and slides over whole tiles; point it at val so
|
||||
# there is ground truth to score against.
|
||||
#
|
||||
# TEST_VOXEL_MAX matters more than it looks. PointNet max-pools ONE global
|
||||
# feature over whatever it is handed, so the number of points per forward pass
|
||||
# is part of the model's operating point, not a neutral batching knob. Training
|
||||
# used 64000-point crops; the cfg's test default (null) feeds ~350k-point chunks
|
||||
# and the predictions collapse toward the majority class. Set it to 64000 to
|
||||
# make inference match training.
|
||||
TEST_VOXEL_MAX="${TEST_VOXEL_MAX:-}"
|
||||
VM_ARG=()
|
||||
[ -n "$TEST_VOXEL_MAX" ] && VM_ARG=(dataset.test.voxel_max="$TEST_VOXEL_MAX")
|
||||
|
||||
echo "=== inference over val split (sliding window) ==="
|
||||
echo " test voxel_max: ${TEST_VOXEL_MAX:-null (cfg default)}"
|
||||
python -u main.py \
|
||||
--cfg ../../cfgs/sumv2_triangle/pointnet.yaml \
|
||||
mode=test \
|
||||
--pretrained_path "$CKPT" \
|
||||
dataset.common.data_root="$DATA" \
|
||||
dataset.test.split=val \
|
||||
"${VM_ARG[@]}" \
|
||||
wandb.use_wandb=False \
|
||||
> "$OUT/infer.log" 2>&1
|
||||
rc=$?
|
||||
if [ $rc -ne 0 ]; then
|
||||
echo " FAILED rc=$rc"
|
||||
tail -15 "$OUT/infer.log"
|
||||
exit $rc
|
||||
fi
|
||||
grep -aE 'test_oa|iou per cls' "$OUT/infer.log" | tail -4
|
||||
|
||||
VIS=$(dirname "$(dirname "$CKPT")")/visualization
|
||||
echo
|
||||
echo "=== predictions in $VIS ==="
|
||||
ls -1 "$VIS" | grep -c '_pred.ply' || true
|
||||
|
||||
echo
|
||||
echo "=== re-scoring at project granularity ==="
|
||||
python "$SCRIPTS/coarse_eval.py" --pred-dir "$VIS" --gt-dir "$DATA/val" \
|
||||
| tee "$OUT/coarse.txt"
|
||||
|
||||
echo
|
||||
echo "logs in $OUT"
|
||||
Reference in New Issue
Block a user