| import os | |
| from tensorboard.backend.event_processing.event_accumulator import EventAccumulator | |
| target_dir = "/root/autodl-tmp/SplatAtlas/outputs/2dgs_barn" | |
| tb_files = [os.path.join(target_dir, f) for f in os.listdir(target_dir) if "events.out.tfevents" in f] | |
| if not tb_files: | |
| print("No events found.") | |
| exit() | |
| ea = EventAccumulator(tb_files[0]) | |
| ea.Reload() | |
| # 检查几个关键标量的值 | |
| interesting_scalars = [ | |
| 'train/loss', | |
| 'train/num_gaussians', | |
| 'train/peak_vram_GB', | |
| 'train/grad_cos_sim' | |
| ] | |
| print(f"{'Metric':<25} | {'Last Value':<15} | {'Step':<10}") | |
| print("-" * 55) | |
| for tag in interesting_scalars: | |
| if tag in ea.Tags().get('scalars', []): | |
| events = ea.Scalars(tag) | |
| if events: | |
| last_event = events[-1] | |
| print(f"{tag:<25} | {last_event.value:<15.6f} | {last_event.step:<10}") | |
| # 检查直方图是否有数据点 | |
| print("\nHistogram Status:") | |
| for tag in ea.Tags().get('histograms', []): | |
| hist_events = ea.Histograms(tag) | |
| print(f" - {tag:<30}: {len(hist_events)} snapshots recorded") | |