Adds STATUS.md as the handoff document: benchmark numbers, the bare-earth
metrics that actually matter for this project, the Korean-data domain gap that
retraining will not fix, and what to do on the 24 GB machine.
The memory problem was in how a prediction's colours were turned back into
class indices. Every consumer built an (N, 13, 3) float64 temporary:
d = ((rgb[:, None, :] - COLOR_MAP[None, :, :]) ** 2).sum(axis=2)
That is ~250 MB of intermediates per 800k-point tile, several live at once, and
a full 4.7M-point block pushes it into gigabytes. main.py writes exact palette
entries, so an exact hash lookup resolves nearly every point with no large
temporary; only leftovers fall back to a chunked distance search. Peak RSS on a
470k-point tile drops to 61 MB. Extracted to sumparts_palette.py and shared by
coarse_eval.py and split_by_class.py.
Also from this round:
- patch_cm_mutation.sh: ConfusionMatrix.update() rewrote the caller's pred
tensor in place, folding every ignore_index point into class num_classes-1.
test() saves its visualization from that same tensor afterwards, so an
unlabelled tile came out 100% wall and the model looked degenerate when it
was not.
- patch_class_mask.sh: SUMPARTS_MASK_CLASSES drops known-absent classes from
the argmax. Measured on Seosan and it does not help - the runner-up for
"water" is "wall", not "terrain" - but the experiment is worth keeping.
- split_by_class.py now writes .ply alongside .obj. A vertex-only OBJ has zero
faces and most viewers render nothing, which is why the first export looked
broken.
- verify_outputs.sh reads exported files back with a parser, so "here are your
files" can be checked rather than asserted.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
72 lines
2.6 KiB
Bash
72 lines
2.6 KiB
Bash
#!/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"
|
|
|
|
# The cfg has to match the architecture that wrote the checkpoint. Hardcoding
|
|
# pointnet.yaml here meant a PointVector checkpoint loaded into the wrong model:
|
|
# RuntimeError: Error(s) in loading state_dict for BaseSeg
|
|
source "$SCRIPTS/resolve_ckpt.sh"
|
|
|
|
# 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/${CKPT_CFG}.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"
|