AGT / code /README.md
MRBSTUDIO's picture
Update the inference and evaluation code
2ad60ce verified
|
Raw History Blame Contribute Delete
10.8 kB

AGT: Amodal 4D Reconstruction from Obstructed Driving Videos

arXiv Project Page Weights Dataset

Bodong Bi1*, Nuo Chen2*, Hongyu Xu3, Xiaoqiang Kong2, Baoru Huang4, Anh Nguyen4, Yang Zhou2, Zhiwen Fan2†

1University of Michigan   2Texas A&M University   3General Motors   4University of Liverpool

*Equal contribution   †Corresponding author

AGT reconstructs a complete 4D scene from an obstructed driving video

Overview

AGT reconstructs a complete 4D Gaussian scene from a driving video whose every frame is partly hidden by the hood, the dashboard, windshield reflections or watermarks.

  • Amodal geometry recovery. The occluder mask masks the occluder tokens in the global attention layers, so that the feed-forward model recovers cameras, depth and motion from the obstructed frames in a single pass.
  • Observed appearance reconstruction. The observability of every pixel is computed from this geometry, and appearance is reconstructed only in the observed regions.
  • Generative completion. The unobserved regions are filled by an image diffusion model and optimized into the Gaussian scene.
  • AmodalDrive. The model is trained on AmodalDrive, a paired dataset that composites occluder layers separated from in-the-wild dashcam videos onto clean driving scenes.
AGT pipeline

Installation

git clone https://github.com/phai-lab/AGT.git
cd AGT

Main environment (reconstruction, scene optimization, evaluation):

conda create -n agt python=3.10 -y
conda activate agt
pip install torch==2.4.1 torchvision==0.19.1 --index-url https://download.pytorch.org/whl/cu121
pip install -r requirements.txt
pip install --no-build-isolation --no-binary gsplat gsplat==1.5.3
pip install --no-build-isolation third_party/dggt/third_party/pointops2

Completion environment (generative completion):

conda create -n agt-completion python=3.12 -y
conda activate agt-completion
pip install torch==2.9.1 --index-url https://download.pytorch.org/whl/cu128
pip install -r requirements-completion.txt
Optional environments
  • Mask generation for your own clips: SAM 3 and the Qwen3.5 verifier each run in their own environment. Install SAM 3 by following its repository, and install requirements-masks.txt for the verifier. The verifier runs Qwen/Qwen3.5-35B-A3B locally with vLLM.
  • Benchmark rebuild: requirements-rebuild.txt and a static build of ffmpeg 7.0.2.

Checkpoints

The AGT weights are hosted at MRBSTUDIO/AGT.

hf download MRBSTUDIO/AGT agt_reconstruction.safetensors agt_completion_lora.safetensors --local-dir checkpoints/
hf download zbww/tapip3d tapip3d_final.pth --local-dir checkpoints/
mv checkpoints/tapip3d_final.pth checkpoints/motion_head.pth
File Content Size
agt_reconstruction.safetensors feed-forward reconstruction model 4.9 GB
agt_completion_lora.safetensors LoRA of FLUX.1 Fill used in the generative completion 0.7 GB

FLUX.1-Fill-dev and SegFormer are loaded from the Hugging Face Hub, or from local copies given with --flux and --segformer.

Demo

The example clips of the project page are part of the dataset repository. Run the commands from the repository root.

hf download MRBSTUDIO/AmodalDrive --repo-type dataset --include "examples/*" --local-dir AmodalDrive

python inference.py \
    --case AmodalDrive/examples/real-a \
    --out outputs/real-a \
    --completion-python "$(conda run -n agt-completion which python)"

Add --reconstruction-only to run AGT without generative completion; this needs only the main environment. Outputs are rendered at 518x294.

Inference on your own video

Cut a clip from the video:

python tools/prepare_clip.py --video drive.mp4 --start 12 --out work/export

Generate its occluder mask. SAM 3 proposes regions in the SAM 3 environment, Qwen3.5 verifies them in the verifier environment, and the frames vote in the main environment:

python tools/make_masks.py --export work/export --out work/masks --stage propose
python tools/make_masks.py --export work/export --out work/masks --stage verify
python tools/make_masks.py --export work/export --out work/masks --stage finish

Run AGT:

python inference.py --export work/export --mask-dir work/masks --out outputs/my_clip \
    --completion-python "$(conda run -n agt-completion which python)"

The output directory holds the rendered frames and depth of every clip.

Evaluation

Build the benchmark first, see Dataset. Both commands use the precomputed occluder masks of AmodalDrive.

AGT without completion:

python -m agt.recon.reconstruct render --inputs AmodalDrive/exports/test --out outputs/test_feedforward \
    --masks dataset --data-root AmodalDrive
python eval/score.py --config configs/eval/test_waymo.json --data-root AmodalDrive \
    --export AmodalDrive/exports/test --method outputs/test_feedforward --out scores/test_feedforward

AGT (the method directory is <out>/final):

python inference.py --export AmodalDrive/exports/test --masks dataset --data-root AmodalDrive \
    --out outputs/test_full --completion-python "$(conda run -n agt-completion which python)"
python eval/score.py --config configs/eval/test_waymo.json --data-root AmodalDrive \
    --export AmodalDrive/exports/test --method outputs/test_full/final --out scores/test_full

--clips ID ... restricts inference.py to a subset of the export. configs/eval/val_waymo.json scores the validation export.

Dataset

AmodalDrive provides the occluder layers, the pairing tables, the splits, the occluder masks and the example clips.

hf download MRBSTUDIO/AmodalDrive --repo-type dataset --local-dir AmodalDrive

Download the Waymo Open Dataset v2.0.1, then run the scripts below to build the composed validation and test data. They preprocess the scenes, compute the labels used by the scorer, and compose and export the clips.

python tools/build_waymo_scenes.py --data-root AmodalDrive --waymo-root WAYMO --split val --split test \
    --ffmpeg /path/to/ffmpeg --ffprobe /path/to/ffprobe
python tools/make_labels.py depth --data-root AmodalDrive --waymo-root WAYMO --split val --split test
python tools/make_labels.py sky --data-root AmodalDrive --waymo-root WAYMO --split val --split test
python tools/make_labels.py visibility --data-root AmodalDrive --dggt-checkpoint checkpoints/model_latest_waymo.pt \
    --split val --split test
python tools/export_clips.py --data-root AmodalDrive --split val --out AmodalDrive/exports/val
python tools/export_clips.py --data-root AmodalDrive --split test --protocol full --out AmodalDrive/exports/test

WAYMO is the parquet download (<split>/<component>/<segment>.parquet, splits validation, testing and testing_location). The visibility label uses the depth of the released DGGT Waymo checkpoint, downloaded from xiaomi-research/dggt.

Code Structure

AGT/
β”œβ”€β”€ inference.py            runs AGT on an example case, a new clip or a benchmark export
β”œβ”€β”€ agt/
β”‚   β”œβ”€β”€ masks/              occluder mask generation with a pluggable verifier
β”‚   β”œβ”€β”€ prepare/            clip export from a video
β”‚   β”œβ”€β”€ model/              model construction, masked attention and observability
β”‚   β”œβ”€β”€ recon/              feed-forward reconstruction and rendering
β”‚   β”œβ”€β”€ completion/         render completion
β”‚   β”œβ”€β”€ refine/             scene optimization
β”‚   β”œβ”€β”€ data/               AmodalDrive reader with on-the-fly composition
β”‚   β”œβ”€β”€ dataset/            scene preprocessing and label generation
β”‚   └── eval/               scorer
β”œβ”€β”€ eval/score.py           scoring entry
β”œβ”€β”€ tools/                  clip preparation, mask generation, benchmark rebuild
β”œβ”€β”€ configs/                model, completion, scene optimization, mask, dataset and evaluation settings
└── third_party/dggt/       the DGGT files used by this code

Citation

@misc{bi2026agt,
  title  = {AGT: Amodal 4D Reconstruction from Obstructed Driving Videos},
  author = {Bi, Bodong and Chen, Nuo and Xu, Hongyu and Kong, Xiaoqiang and Huang, Baoru and Nguyen, Anh and Zhou, Yang and Fan, Zhiwen},
  year   = {2026},
  note   = {arXiv preprint, coming soon}
}

Acknowledgements

This code builds on the following projects. We thank their authors.

License

  • Code: Apache License 2.0, see LICENSE. Vendored third-party code keeps its own license, see NOTICE.
  • Weights and dataset: CC BY-NC 4.0.