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,84 @@
|
||||
#!/usr/bin/env bash
|
||||
# SUM Parts - final evaluation of the trained checkpoint
|
||||
#
|
||||
# Two passes, because the splits differ in what they can tell you:
|
||||
#
|
||||
# val : labeled (0..12) -> produces real numbers you can quote locally
|
||||
# test : label = -1 everywhere (blind set) -> produces predictions only.
|
||||
# The authors score it; see the README's "send predictions to our
|
||||
# email for local assessment".
|
||||
#
|
||||
# Requires patch_unlabeled_test.sh and patch_val_mode.sh to have run, otherwise
|
||||
# the test pass dies in ConfusionMatrix on the -1 placeholders and mode=val dies
|
||||
# with UnboundLocalError on `epoch`.
|
||||
#
|
||||
# No voxel_max override here on purpose. The cfg already validates with
|
||||
# voxel_max: null (whole tiles), which is what we want for the final number --
|
||||
# training capped it only to keep the allocator inside VRAM. Passing
|
||||
# `dataset.val.voxel_max=null` on the command line does NOT work: it arrives as
|
||||
# the string "null" and crop_pc then compares int >= str.
|
||||
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"
|
||||
OUT="$HOME/sum-parts/runs/final_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"
|
||||
|
||||
CKPT=$(find "$SEG/log/sumv2_triangle" -name '*_ckpt_best.pth' -printf '%T@ %p\n' \
|
||||
| sort -rn | head -1 | cut -d' ' -f2-)
|
||||
[ -n "$CKPT" ] || { echo "error: no checkpoint found" >&2; exit 1; }
|
||||
|
||||
echo "checkpoint: $CKPT"
|
||||
echo "data : $DATA"
|
||||
echo
|
||||
|
||||
cd "$SEG"
|
||||
|
||||
run_mode() {
|
||||
local mode="$1" log="$OUT/${1}.log"
|
||||
echo "=== mode=$mode ==="
|
||||
set +e
|
||||
python -u main.py \
|
||||
--cfg ../../cfgs/sumv2_triangle/pointnet.yaml \
|
||||
mode="$mode" \
|
||||
--pretrained_path "$CKPT" \
|
||||
dataset.common.data_root="$DATA" \
|
||||
wandb.use_wandb=False \
|
||||
val_batch_size=1 \
|
||||
> "$log" 2>&1
|
||||
local rc=$?
|
||||
set -e
|
||||
if [ $rc -eq 0 ]; then
|
||||
echo " ok"
|
||||
else
|
||||
echo " FAILED rc=$rc"
|
||||
tail -12 "$log"
|
||||
fi
|
||||
grep -aE 'val_oa|test_oa|iou per cls|Best ckpt' "$log" | tail -6
|
||||
echo
|
||||
return $rc
|
||||
}
|
||||
|
||||
# val first: this is the number we can actually stand behind locally
|
||||
run_mode val
|
||||
val_rc=$?
|
||||
|
||||
# test: predictions only, no score possible
|
||||
run_mode test
|
||||
test_rc=$?
|
||||
|
||||
echo "=== prediction files ==="
|
||||
find "$SEG/log/sumv2_triangle" -name '*_pred.ply' -newermt '-30 minutes' \
|
||||
-printf '%p (%s bytes)\n' 2>/dev/null | tail -12
|
||||
|
||||
echo
|
||||
echo "logs in $OUT"
|
||||
[ $val_rc -eq 0 ] && echo "FINAL EVAL: val OK" || echo "FINAL EVAL: val FAILED"
|
||||
[ $test_rc -eq 0 ] && echo "FINAL EVAL: test OK" || echo "FINAL EVAL: test FAILED"
|
||||
Reference in New Issue
Block a user