Instructions to use FudanCVL/OcclusionFormer with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use FudanCVL/OcclusionFormer with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("FudanCVL/OcclusionFormer", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps
- Draw Things
- DiffusionBee
|
|
OcclusionFormer: Arranging Z-Order for Layout-Grounded Image Generation |
Fudan University
ICML 2026
β Corresponding Author
π₯ News
- [2026/05/18] Release inference code, model weights and SA-Z dataset.
- [2026/05/18] Release OcclusionFormer open-source package in this repository.
- [2026/4/30] OcclusionFormer is accepted to ICML 2026.
π Introduction
OcclusionFormer addresses a core challenge in layout-to-image generation: when multiple bounding boxes overlap, standard methods often produce entangled textures and incorrect front/back ordering.
From the paper, OcclusionFormer introduces explicit Z-order modeling for layout-grounded generation by:
- decoupling instance generation,
- arranging occlusion order with a volume-rendering-inspired transmittance mechanism,
- and enforcing spatial precision with a queried alignment objective.
The paper also introduces SA-Z, a large-scale dataset with explicit occlusion order and amodal supervision for occlusion-aware layout generation.
π§ Key Features
- SA-Z Dataset Curation: Enriches layout annotations with instance captions, explicit occlusion order, and amodal signals.

- Occlusion-Aware DiT Framework: Models Z-order dependencies explicitly rather than mixing overlapping instances implicitly.
- Instance Decoupling + Volumetric Composition: Improves robustness on dense overlap scenes by composing instances with transmittance-based ordering.
- Queried Alignment Mechanism: Improves spatial faithfulness and local semantic consistency.

π» Quick Start
- Environment setup
cd OcclusionFormer
conda create -n OcclusionFormer python=3.11 -y
conda activate OcclusionFormer
- Install requirements
pip install --upgrade -r requirements.txt
- Download checkpoint
https://huggingface.co/FudanCVL/OcclusionFormer
- Run Streamlit demo
streamlit run demo_occlusionformer.py
- Run CLI inference
python inference_occlusionformer.py \
--model_path /path/to/FLUX.1-dev \
--ckpt_path /path/to/occlusionformer_checkpoint_dir \
--layout_json ./examples/livingroom.json \
--output_dir ./outputs_occlusionformer \
--enable_layout \
--overwrite
Batch inference with a directory of JSON layouts:
python inference_occlusionformer.py \
--model_path /path/to/FLUX.1-dev \
--ckpt_path /path/to/occlusionformer_checkpoint_dir \
--layout_dir ./examples \
--output_dir ./outputs_occlusionformer \
--enable_layout \
--overwrite
β TODO
- Organize and update the Amodal annotation on Hugging Face.
π Repository Scope
This folder provides a standalone inference/demo package:
demo_occlusionformer.py: Streamlit demo UIinference_occlusionformer.py: CLI inferencesrc/occlusionformer/: OcclusionFormer core modulessrc/utils.py,src/transformer_utils.py: required utility modulesexamples/: example layout JSON filesrequirements.txt: runtime dependencies
βοΈ Inference Notes
- The demo and CLI follow the current project preprocessing logic and compose prompts using global prompt + instance captions.
- Layout control is enabled via
--enable_layout(or disabled with--disable_layout). - Outputs include generated images and layout overlays for visualization.
π Acknowledgement
This work is built on many amazing research works and open-source projects. We thank the authors for sharing!
π Citation
@inproceedings{li2026occlusionformer,
title={OcclusionFormer: Arranging Z-Order for Layout-Grounded Image Generation},
author={Li, Ziye and Ding, Henghui},
booktitle={ICML},
year={2026}
}
- Downloads last month
- -