File size: 3,918 Bytes
7c61ee6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# Supplementary experiments for the paper:
#  (1) category holdout (4 folds over 13 categories), (2) val CFG sweep for the final model,
#  (3) 4 test seeds for the final model, (4) MinD-3D on training objects (our val split), (5) eval robustness.
source /home/hubin/venvs/trellis/bin/activate
cd /home/hubin/trellis_work
O=/home/hubin/trellis_work/outputs/supp
F=/home/hubin/trellis_work/outputs/ft/frozen_0001
M=/home/hubin/hf_upload/926_meshes/mind3d_trellis2/meshes
VAL=/home/hubin/trellis_work/outputs/valsel/val_ids.txt
VTOK=$F/sub0001/val/coef_rescaled/tokens.npy
TTOK=$F/sub0001/test/coef_rescaled/tokens.npy
EV="env OMP_NUM_THREADS=8 OPENBLAS_NUM_THREADS=8 MKL_NUM_THREADS=8 python eval_shape.py"

# (4) MinD-3D on 99 training objects, one shard per GPU
mkdir -p $O/mind3d_trainobj
(cd /home/hubin/MinD-3D && source /home/hubin/venvs/mind3d/bin/activate && for g in 0 1; do
   CUDA_VISIBLE_DEVICES=$g python gen_testset_mind3d.py --test_list $VAL --out_dir $O/mind3d_trainobj \
     --shard $g --num_shards 2 > $O/mind3d_trainobj_w$g.log 2>&1 &
 done; wait; echo MIND3D_DONE) &
P_MIND3D=$!

# (1) category-holdout training, 2 folds per GPU
for f in 0 1 2 3; do
  CATS=$(python -c "import json;print(','.join(json.load(open('$O/cat_folds.json'))[$f]))")
  CUDA_VISIBLE_DEVICES=$((f % 2)) python mapper/train_ft.py --k 16 --subjects 0001 --n_train_blocks 0 --freeze_patch \
    --select mse --holdout_cats $CATS --out_dir $O/holdout_f$f > $O/holdout_f$f.log 2>&1 &
done

# (2) + (3): val CFG sweep (20 / 50 exist from round 10) and 4 test seeds, one shard per GPU
for C in 30 75 100; do d=$O/val_cfg$C; mkdir -p $d; ln -sf $VTOK $d/tokens.npy; done
d=$O/test_seeds; mkdir -p $d; ln -sf $TTOK $d/tokens.npy
for w in 0 1; do
  (for C in 30 75 100; do
     CUDA_VISIBLE_DEVICES=$w python gen_from_tokens.py --test_ids $VAL --variant_dirs $O/val_cfg$C --cfg $C \
       --shard $w --num_shards 2 > $O/gen_val_cfg${C}_w$w.log 2>&1
   done
   CUDA_VISIBLE_DEVICES=$w python gen_from_tokens.py --variant_dirs $O/test_seeds --cfg 50 --n_samples 4 \
     --shard $w --num_shards 2 > $O/gen_test_seeds_w$w.log 2>&1) &
done
# wait for training + these generations (not MinD-3D)
while pgrep -f "train_ft.py .*outputs/supp" > /dev/null || pgrep -f "gen_from_tokens.py .*outputs/supp" > /dev/null; do sleep 30; done
echo TRAIN_GEN1_DONE

# evaluate val sweep and test seeds on CPU while the holdout generation runs on GPU
for C in 30 75 100; do $EV --gen_dir $O/val_cfg$C/meshes --test_list $VAL --out $O/val_cfg$C/metrics.json > $O/val_cfg$C/eval.log 2>&1 & done
for j in "" _s1 _s2 _s3; do
  $EV --gen_dir $O/test_seeds/meshes$j --out $O/test_seeds/metrics$j.json > $O/test_seeds/eval$j.log 2>&1 &
done

mkdir -p $O/holdout_ours $O/holdout_gt16
python mapper/supp_tokens.py > $O/supp_tokens.log 2>&1
for w in 0 1; do
  CUDA_VISIBLE_DEVICES=$w python gen_from_tokens.py --variant_dirs $O/holdout_ours $O/holdout_gt16 --cfg 50 \
    --shard $w --num_shards 2 > $O/gen_holdout_w$w.log 2>&1 &
done
while pgrep -f "gen_from_tokens.py .*holdout" > /dev/null; do sleep 20; done
echo HOLDOUT_GEN_DONE
for v in holdout_ours holdout_gt16; do $EV --gen_dir $O/$v/meshes --out $O/$v/metrics.json > $O/$v/eval.log 2>&1 & done

# (5) robustness: 24 azimuths x 2 up-axes + rigid ICP, CD only
mkdir -p $O/robust
for m in mind3d_official ft_frozen_sub01_k16_cfg50 valsel_sub01_ridge_k64_rescaled_cfg50 \
         valsel_sub01_v2ens5_clsmean_resid_cfg50 diag_category_mean diag_pca16 oracle_gt_image; do
  $EV --gen_dir $M/$m --out $O/robust/$m.json --n_az 24 --icp --no_emd > $O/robust/$m.log 2>&1 &
done
CUDA_VISIBLE_DEVICES=0 python ident_eval.py --out_dir $O/ident \
  --methods holdout_ours=$O/holdout_ours/meshes holdout_gt16=$O/holdout_gt16/meshes > $O/ident.log 2>&1 &
wait $P_MIND3D
$EV --gen_dir $O/mind3d_trainobj/meshes --test_list $VAL --out $O/mind3d_trainobj/metrics.json > $O/mind3d_trainobj/eval.log 2>&1
wait
echo SUPP_DONE