File size: 3,361 Bytes
f393a8b | 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 | """Train/eval input mismatch probe (2026-11-02): GT steps always take augment_inputs (augment_probability 1); eval
(head.eval) never does. Compare, on one eval window at dense s1, the clean-path head inputs (points, pixel footprint)
with the augment-path GT rows (noise / floaters off): relative point offset, footprint ratio, and which pixels differ.
python probe_aug_path.py"""
import json, sys
import torch
from omegaconf import OmegaConf
sys.argv += ['--out', '/workspace/free3d_multik_hr/overfit/probe_aug_path.json']
W = '/workspace/free3d_multik_hr'
cfg = OmegaConf.load(W + '/config.yaml'); cfg.run.out_dir = W + '/overfit/scratch_probe'
cfg.gaussian.free3d.noise_fraction = 0.; cfg.gaussian.free3d.floater_fraction = 0.; cfg.gaussian.free3d.multik.cap_mode = 'fixed'
g = cfg.gaussian_train; g.target_strides = [1]; g.source_strides = [1]; g.max_gaussians = 1 << 20; g.relational_render.query_budget = 1 << 20
g.dense_crop.enabled = False; g.density_mixture.enabled = False
from arrow_train.qc import train_free3d_gt as TF, train_broad_refiner as B
from arrow_train import free3d_gaussians as F3
model, T, _, _, _ = TF.setup(cfg); head = model.gaussian_head
head.load_state_dict(torch.load(W + '/init_from.pt', map_location='cpu', weights_only=False)['head'], strict=False)
TF.install_teacher(cfg); policies = json.load(open(cfg.free3d_pretrain.policies)); runner = T.GaussianStep(model, cfg)
evalcfg = OmegaConf.create(OmegaConf.to_container(cfg)); evalcfg.data.order = cfg.free3d_pretrain.eval_order
loader = iter(B.make_loader(evalcfg, evaluation=True))
while True:
raw = next(loader)
if not raw.get('_load_failed') and raw['dataset'] == 'hypersim':break
sample = B.apply_tier(cfg, B.tensor_tree(raw, 'cuda'), policies['hypersim'])
CAP = {}
orig = F3.augment_inputs
def wrap(settings, context, stages, embedding, points_r, *args, **kw):
out = orig(settings, context, stages, embedding, points_r, *args, **kw)
CAP.update(points_r=points_r.detach().float(), pfp=context['pixel_footprint'].detach().float().clone(), xy=args[1].detach(), frames=args[0].detach())
if out is not None:CAP.update(new=out['points'].detach().float(), pfp_new=out['context']['pixel_footprint'][:len(points_r)].detach().float())
return out
F3.augment_inputs = wrap
import arrow_train.gaussian_train as GT
head.train()
with torch.no_grad():
torch.manual_seed(0); TF.GT_cache_clear()
_, part = runner(dict(sample, _training_step=4000, _training_micro=0, _free3d_gt_only=True, _free3d_no_augment=False))
p, q = CAP['points_r'], CAP['new']; z = q[:, 2].abs().clamp_min(1e-6)
rel = (p - q).norm(dim=-1) / z
fr = CAP['pfp_new'] / CAP['pfp'].clamp_min(1e-12)
xy = CAP['xy'].float()
res = dict(n=len(p), rel_offset_median=float(rel.median()), rel_offset_p90=float(rel.quantile(.9)), rel_offset_max=float(rel.max()),
frac_rel_gt_1e3=float((rel > 1e-3).float().mean()), footprint_ratio_median=float(fr.median()), footprint_ratio_p10=float(fr.quantile(.1)),
footprint_ratio_p90=float(fr.quantile(.9)), xy_frac=[float((xy - xy.floor()).mean()), float(xy.min()), float(xy.max())],
offset_vec_median=[float(v) for v in (p - q).median(0).values],
psnr_aug=float(part.get('gs_relational_base_psnr', -1)), relerr_logged=float(part.get('gs_free3d_aug_pred_gt_relerr', -1)))
print('PROBE', json.dumps(res), flush=True)
|