#!/usr/bin/env bash # SUM Parts - inspect label values in the test split # # test() crashed in ConfusionMatrix.update with # RuntimeError: bincount only supports 1-d non-negative integral inputs # which means true*num_classes + pred went negative, non-integral, or 2-D. # Check what the files actually contain. set -uo pipefail DATA="${1:-$HOME/sum-parts/data/face_labeling/texsp_pcl}" source "$HOME/miniconda3/etc/profile.d/conda.sh" conda activate sumparts python - "$DATA" <<'PY' import sys from pathlib import Path import numpy as np from plyfile import PlyData root = Path(sys.argv[1]) print(f"root: {root}\n") for split in ("test", "train"): files = sorted((root / split).glob("*.ply")) print(f"=== {split}: {len(files)} files ===") for f in files: v = PlyData.read(str(f))["vertex"] props = [p.name for p in v.properties] if "label" not in props: print(f" {f.name:<34} NO LABEL FIELD props={props}") continue lab = np.asarray(v["label"]) u = np.unique(lab) neg = int((lab < 0).sum()) flag = "" if neg: flag += f" NEGATIVE x{neg}" if u.max() > 12: flag += f" OUT-OF-RANGE max={u.max()}" if not np.issubdtype(lab.dtype, np.integer): flag += f" NON-INTEGER dtype={lab.dtype}" print(f" {f.name:<34} n={len(lab):>8,} dtype={str(lab.dtype):<8} " f"range=[{u.min()},{u.max()}] uniq={len(u)}{flag}") print() PY