Repository navigation
Expand file tree
/
Copy pathrun_benchmarks.sh
More file actions
39 lines (36 loc) · 1.9 KB
/
Copy pathrun_benchmarks.sh
File metadata and controls
39 lines (36 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
# Score part-segmentation checkpoints on the zero-shot benchmarks (h-IoU = harmonic mean of base and
# novel ("unbase") mIoU, object given), one after the other on one GPU.
#
# bash run_benchmarks.sh # all three, released PartCATSeg checkpoints
# bash run_benchmarks.sh voc ade # a subset
# TAG=hops WEIGHTS_voc=output/x/model_final.pth CFG_voc=configs/zero_shot/x.yaml bash run_benchmarks.sh voc
#
# Results: output/benchmarks/<TAG>/<benchmark>/log.txt; summarise with
# pixi run python summarize_benchmarks.py output/benchmarks/<TAG>
# Refuses to start while another process holds the GPU (shared server); FORCE=1 overrides.
set -euo pipefail
cd "$(dirname "$0")"
source ./pixi_setup.sh
TAG=${TAG:-partcatseg_released}
declare -A CFG=([voc]=configs/zero_shot/partcatseg_voc.yaml
[ade]=configs/zero_shot/partcatseg_ade.yaml
[partimagenet]=configs/zero_shot/partcatseg_partimagenet.yaml)
declare -A WEIGHTS=([voc]=weights/partcatseg_voc.pth
[ade]=weights/partcatseg_ade.pth
[partimagenet]=weights/partcatseg_partimagenet_seg.pth)
benchmarks=("$@"); [ ${#benchmarks[@]} -gt 0 ] || benchmarks=(voc ade partimagenet)
busy=$(nvidia-smi --query-compute-apps=pid,used_memory --format=csv,noheader)
if [ -n "$busy" ] && [ "${FORCE:-0}" != 1 ]; then
echo "GPU is in use by other processes; not starting (FORCE=1 to override):"; echo "$busy"; exit 1
fi
for b in "${benchmarks[@]}"; do
cfg_var="CFG_$b"; w_var="WEIGHTS_$b"
cfg=${!cfg_var:-${CFG[$b]}}; w=${!w_var:-${WEIGHTS[$b]}}
out=output/benchmarks/$TAG/$b
[ -f "$w" ] || { echo "=== $b: checkpoint $w missing, skipped"; continue; }
echo "=== $b: $w ($cfg) -> $out [$(date +%H:%M)]"
pixi run --frozen python train_net.py --num-gpus 1 --config-file "$cfg" --eval-only \
MODEL.WEIGHTS "$w" OUTPUT_DIR "$out"
done
echo "=== done [$(date +%H:%M)]"