Difix3D

nv-tlabs长期未更新

用单步扩散模型修复 3D 重建中的伪影和缺失细节,提升 NeRF 与高斯泼溅的渲染质量,出自 CVPR 2025 Oral。

[CVPR 2025 Oral & Best Paper Finalist] Difix3D+: Improving 3D Reconstructions with Single-Step Diffusion Models

暂无版本1,305star110fork同步于 2026-11-07 07:30 UTC

怎么上手

由 README 提炼,执行前请确认
git clone https://github.com/nv-tlabs/Difix3D.git
cd Difix3D
pip install -r requirements.txt
硬件要求按 README 说明

README 未说明具体显存要求;快速上手示例用 pipe.to("cuda"),需 NVIDIA GPU 与 CUDA 环境,训练示例使用 bf16 混合精度。

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

用单步扩散模型修复 3D 重建伪影,提升 NeRF 与 3DGS 渲染质量

用单步扩散模型修复 3D 重建中的伪影和缺失细节,提升 NeRF 与高斯泼溅的渲染质量,出自 CVPR 2025 Oral。

核心能力

  • 单步扩散去噪,timesteps 固定为 199 即可出图
  • 支持参考图引导去噪,加载 nvidia/difix_ref 模型
  • 提供 nerfstudio 与 gsplat 的渐进式 3D 微调脚本
  • 渲染后可作为实时后处理进一步锐化新视角
  • 支持 accelerate 单卡与多卡 bf16 训练

容易踩的坑

模型需从 HuggingFace 加载 nvidia/difix 或 nvidia/difix_ref,首次运行要联网下载;本地推理需自行把 model_*.pkl 放进 checkpoints 目录;nerfstudio 与 gsplat 后端需分别按各自仓库说明单独安装。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

0 个版本

暂无 release 数据(可能没有发版,或尚未同步)。

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    Difix3D+

    Difix3D+: Improving 3D Reconstructions with Single-Step Diffusion Models
    Jay Zhangjie Wu*, Yuxuan Zhang*, Haithem Turki, Xuanchi Ren, Jun Gao,
    Mike Zheng Shou, Sanja Fidler, Zan Gojcic†, Huan Ling† (*/† equal contribution/advising)
    CVPR 2025 (Oral)
    Project Page | Paper | Model | Demo

    News

    • [11/06/2025] Code and models are now available! We will present our work at CVPR 2025 (oral, poster). See you in Nashville🎵!

    Setup

    git clone https://github.com/nv-tlabs/Difix3D.git
    cd Difix3D
    pip install -r requirements.txt
    

    Quickstart (diffusers)

    from pipeline_difix import DifixPipeline
    from diffusers.utils import load_image
    
    pipe = DifixPipeline.from_pretrained("nvidia/difix", trust_remote_code=True)
    pipe.to("cuda")
    
    input_image = load_image("assets/example_input.png")
    prompt = "remove degradation"
    
    output_image = pipe(prompt, image=input_image, num_inference_steps=1, timesteps=[199], guidance_scale=0.0).images[0]
    output_image.save("example_output.png")
    

    Optionally, you can use a reference image to guide the denoising process.

    from pipeline_difix import DifixPipeline
    from diffusers.utils import load_image
    
    pipe = DifixPipeline.from_pretrained("nvidia/difix_ref", trust_remote_code=True)
    pipe.to("cuda")
    
    input_image = load_image("assets/example_input.png")
    ref_image = load_image("assets/example_ref.png")
    prompt = "remove degradation"
    
    output_image = pipe(prompt, image=input_image, ref_image=ref_image, num_inference_steps=1, timesteps=[199], guidance_scale=0.0).images[0]
    output_image.save("example_output.png")
    

    Difix: Single-step diffusion for 3D artifact removal

    Training

    Data Preparation

    Prepare your dataset in the following JSON format:

    {
      "train": {
        "{data_id}": {
          "image": "{PATH_TO_IMAGE}",
          "target_image": "{PATH_TO_TARGET_IMAGE}",
          "ref_image": "{PATH_TO_REF_IMAGE}",
          "prompt": "remove degradation"
        }
      },
      "test": {
        "{data_id}": {
          "image": "{PATH_TO_IMAGE}",
          "target_image": "{PATH_TO_TARGET_IMAGE}",
          "ref_image": "{PATH_TO_REF_IMAGE}",
          "prompt": "remove degradation"
        }
      }
    }
    
    Single GPU
    accelerate launch --mixed_precision=bf16 src/train_difix.py \
        --output_dir=./outputs/difix/train \
        --dataset_path="data/data.json" \
        --max_train_steps 10000 \
        --resolution=512 --learning_rate 2e-5 \
        --train_batch_size=1 --dataloader_num_workers 8 \
        --enable_xformers_memory_efficient_attention \
        --checkpointing_steps=1000 --eval_freq 1000 --viz_freq 100 \
        --lambda_lpips 1.0 --lambda_l2 1.0 --lambda_gram 1.0 --gram_loss_warmup_steps 2000 \
        --report_to "wandb" --tracker_project_name "difix" --tracker_run_name "train" --timestep 199
    
    Multipe GPUs
    export NUM_NODES=1
    export NUM_GPUS=8
    accelerate launch --mixed_precision=bf16 --main_process_port 29501 --multi_gpu --num_machines $NUM_NODES --num_processes $NUM_GPUS src/train_difix.py \
        --output_dir=./outputs/difix/train \
        --dataset_path="data/data.json" \
        --max_train_steps 10000 \
        --resolution=512 --learning_rate 2e-5 \
        --train_batch_size=1 --dataloader_num_workers 8 \
        --enable_xformers_memory_efficient_attention \
        --checkpointing_steps=1000 --eval_freq 1000 --viz_freq 100 \
        --lambda_lpips 1.0 --lambda_l2 1.0 --lambda_gram 1.0 --gram_loss_warmup_steps 2000 \
        --report_to "wandb" --tracker_project_name "difix" --tracker_run_name "train" --timestep 199
    

    Inference

    Place the model_*.pkl in the checkpoints directory. You can run inference using the following command:

    python src/inference_difix.py \
        --model_path "checkpoints/model.pkl" \
        --input_image "assets/example_input.png" \
        --prompt "remove degradation" \
        --output_dir "outputs/difix" \
        --timestep 199
    

    Difix3D: Progressive 3D update

    Data Format

    The data should be organized in the following structure:

    DATA_DIR/
    ├── {SCENE_ID}
    │   ├── colmap
    │   │   ├── sparse
    │   │   │   └── 0
    │   │   │       ├── cameras.bin
    │   │   │       ├── database.db
    │   │   │       └── ...
    │   ├── images
    │   │   ├── image_train_000001.png
    │   │   ├── image_train_000002.png
    │   │   ├── ...
    │   │   ├── image_eval_000200.png
    │   │   ├── image_eval_000201.png
    │   │   └── ...
    │   ├── images_2
    │   ├── images_4
    │   └── images_8
    

    nerfstudio

    Setup the nerfstudio environment.

    cd examples/nerfstudio
    pip install -e .
    cd ../..
    

    Run Difix3D finetuning with nerfstudio.

    SCENE_ID=032dee9fb0a8bc1b90871dc5fe950080d0bcd3caf166447f44e60ca50ac04ec7
    DATA=DATA_DIR/${SCENE_ID}
    DATA_FACTOR=4
    CKPT_PATH=CKPR_DIR/${SCENE_ID}/nerfacto/nerfstudio_models/step-000029999.ckpt # Path to the pretrained checkpoint file
    OUTPUT_DIR=outputs/difix3d/nerfacto/${SCENE_ID}
    
    CUDA_VISIBLE_DEVICES=0 ns-train difix3d \
        --data ${DATA} --pipeline.model.appearance-embed-dim 0 --pipeline.model.camera-optimizer.mode off --save_only_latest_checkpoint False --vis viewer \
        --output_dir ${OUTPUT_DIR} --experiment_name ${SCENE_ID} --timestamp '' --load-checkpoint ${CKPT_PATH} \
        --max_num_iterations 30000 --steps_per_eval_all_images 0 --steps_per_eval_batch 0 --steps_per_eval_image 0 --steps_per_save 2000 --viewer.quit-on-train-completion True \
        nerfstudio-data --orientation-method none --center_method none --auto-scale-poses False --downscale_factor ${DATA_FACTOR} --eval_mode filename
    

    gsplat

    Install the gsplat following the instructions in the gsplat repository.

    Run Difix3D finetuning with gsplat.

    SCENE_ID=032dee9fb0a8bc1b90871dc5fe950080d0bcd3caf166447f44e60ca50ac04ec7
    DATA=DATA_DIR/${SCENE_ID}/gaussian_splat
    DATA_FACTOR=4
    CKPT_PATH=CKPT_DIR/${SCENE_ID}/ckpts/ckpt_29999_rank0.pt # Path to the pretrained checkpoint file
    OUTPUT_DIR=outputs/difix3d/gsplat/${SCENE_ID}
    
    CUDA_VISIBLE_DEVICES=0 python examples/gsplat/simple_trainer_difix3d.py default \
        --data_dir ${DATA} --data_factor ${DATA_FACTOR} \
        --result_dir ${OUTPUT_DIR} --no-normalize-world-space --test_every 1 --ckpt ${CKPT_PATH}
    

    Difix3D+: With real-time post-rendering

    Due to the limited capacity of reconstruction methods to represent sharp details, some regions remain blurry. To further enhance the novel views, we use our Difix model as the final post-processing step at render time.

    python src/inference_difix.py \
        --model_path "checkpoints/model.pkl" \
        --input_image "PATH_TO_IMAGES" \
        --prompt "remove degradation" \
        --output_dir "outputs/difix3d+" \
        --timestep 199
    

    Acknowledgements

    Our work is built upon the following projects:

    Shoutout to all the contributors of these projects for their invaluable work that made this research possible.

    License/Terms of Use:

    The use of the model and code is governed by the NVIDIA License. See LICENSE.txt for details. Additional Information: LICENSE.md · stabilityai/sd-turbo at main

    Citation

    @inproceedings{wu2025difix3d+,
      title={DIFIX3D+: Improving 3D Reconstructions with Single-Step Diffusion Models},
      author={Wu, Jay Zhangjie and Zhang, Yuxuan and Turki, Haithem and Ren, Xuanchi and Gao, Jun and Shou, Mike Zheng and Fidler, Sanja and Gojcic, Zan and Ling, Huan},
      booktitle={Proceedings of the Computer Vision and Pattern Recognition Conference},
      pages={26024--26035},
      year={2025}
    }