iMontage: 统一、多功能、高度动态的多对多图像生成

如果图像模型能将多张图片转化为一个连贯的动态视觉宇宙会怎样?🤯 iMontage为图像生成引入了类视频的运动先验,实现丰富的转场效果和一致的多图输出------全部源自您的输入。

点击下方尝试,释放您的想象力!

📦 功能亮点

  • ⚡ 支持灵活输入的高动态、高一致性图像生成
  • 🎛️ 跨异构任务的强指令跟随能力
  • 🌀 类视频的时间连贯性,非视频图像集也适用
  • 🏆 多项任务达到业界顶尖水平

📰 最新动态

  • 2025.11.26 -- iMontage论文Arxiv版本发布
  • 2025.11.26 -- 推理代码与模型权重开源

🛠 安装指南

1. 创建虚拟环境

bash 复制代码
conda create -n iMontage python=3.10
conda activate iMontage

# NOTE Choose torch version compatible with your CUDA
pip install torch==2.6.0+cu126 torchvision==0.21.0+cu126 torchaudio==2.6.0+cu126 https://download.pytorch.org/whl/cu126

# Install Flash Attention 2
# NOTE Also choose the correct version compatible with installed torch
pip install "flash-attn==2.7.4.post1" --no-build-isolation

注意)我们使用FlashAttention-3训练和评估模型,因此使用flash-attn-2时推理质量可能欠佳。

若您使用NVIDIA H100/H800显卡并希望获得模型的最佳性能,可参考FlashAttention-3的官方指南

同时需要替换fastvideo/models/flash_attn_no_pad.py中的代码。

安装完torch和flash attention后,可通过以下命令安装其他依赖:

bash 复制代码
pip install -e .

2. 下载模型权重

bash 复制代码
mkdir ckpts/hyvideo_ckpts

# Downloading hunyuan-video-i2v-720p, may takes 10 minutes to 1 hour depending on network conditions.
huggingface-cli download tencent/HunyuanVideo-I2V --local-dir ./ckpts/hyvideo_ckpts

# Downloading text_encoder from HunyuanVideo-T2V
huggingface-cli download xtuner/llava-llama-3-8b-v1_1-transformers --local-dir ./ckpts/llava-llama-3-8b-v1_1-transformers
python fastvideo/models/hyvideo/utils/preprocess_text_encoder_tokenizer_utils.py --input_dir ckpts/llava-llama-3-8b-v1_1-transformers --output_dir ckpts/hyvideo_ckpts/text_encoder

# Downloading text_encoder_2 from HunyuanVideo-I2V
huggingface-cli download openai/clip-vit-large-patch14 --local-dir ./ckpts/hyvideo_ckpts/text_encoder_2

mkdir ckpts/iMontage_ckpts
# Downloading iMontage dit weights, also might takes some time.
huggingface-cli download Kr1sJ/iMontage --local-dir ./ckpts/iMontage_ckpts

最终的ckpt文件结构应形成为:

code 复制代码
iMontage
  ├──ckpts
  │  ├──hyvideo_ckpts
  │  │  ├──hunyuan-video-i2v-720p
  │  │  │  ├──transformers
  │  │  │  │  ├──mp_rank_00_model_states.pt
  ├  │  │  ├──vae
  │  │  ├──text_encoder_i2v
  │  │  ├──text_encoder_2
  │  ├──iMontage_ckpts
  │  │  ├──diffusion_pytorch_model.safetensors
  │ ...

🚀 推理

安装完环境并下载预训练权重后,让我们从推理示例开始。请注意,我们的模型目前仅支持 ≤4个输入≤4个输出

🔹 示例

运行以下命令:

bash 复制代码
bash scripts/inference.sh

在这个示例中,我们使用以下方式进行推理:

bash 复制代码
--prompt assets/prompt.json

该JSON文件包含六个代表性任务,包括:

  • 图像编辑

  • 角色参考生成(CRef)

  • CRef + 视觉信号

  • 风格参考生成(SRef)

  • 多视图生成

  • 故事板生成

每个条目都指定了任务类型、指令提示、输入参考图像、输出分辨率和期望生成的帧数。

运行脚本将自动处理JSON中的所有任务,并将结果保存在输出目录下。

任务类型 输入 提示 输出
image_editing Change the material of the lava to silver.
cref Confucius from the first image, Moses from the second...
conditioned_cref depth
sref (empty)
multiview 1. Shift left; 2. Look up; 3. Zoom out.
storyboard Vintage film: 1. Hepburn carrying the yellow bag...

🔹 运行自定义任务

如需使用自己的图像进行推理,您需要创建一个JSON文件并按如下格式添加条目:

code 复制代码
"0" :
    {
        "task_type": "image_editing",
        "prompts" : "Change the material of the lava to silver.",
        "images" : [
            "assets/images/llava.png"
        ],
        "height" : 416,
        "width" : 640,
        "output_num" : 1
    }

所有任务的说明可以总结为:

任务类型 描述 输入 注意事项/技巧
image_editing Edit the input image according to the instruction (material, style, object change, etc.). 1 image Prompt should clearly describe what to change. Best to align output size with input image size.
cref Generate an output using multiple character reference images. ≥ 1 images Order of reference images matters. Prompt should specify who from which image. Best results with 2--4 reference images.
conditioned_cref Generate an output using multi images and a vision signal control map (depth, canny, openpose). ≥ 1 image Only support depth, canny, openpose, prompt should be one of these three word. Put control map image in the first image.
sref Apply the style/features of the reference images to generate a new image. 2 images Leave prompts empty if only using style; model will infer style from input images. Put style reference image in the second place.
multiview Generate multiple viewpoints of the same scene. 1 image Prompt should contain step-by-step view changes (e.g., "move left", "look up", "zoom out"). output_num must match number of described views. NOTE Might generate unsatisfying results, please try with different prompts and seed.
storyboard Generate a sequence of frames forming a short story based on references. ≥ 1 images Prompts should be enumerated (1, 2, 3...), and start with the story style word (Vintage file, Japanese anime, etc.). Use reference images to anchor characters or props. Output resolution often wider for cinematic style.

💖 致谢

我们衷心感谢开源社区为这项工作提供的坚实基础。

特别鸣谢以下项目提供的模型、数据集和宝贵见解:

  • HunyuanVideo-T2VHunyuanVideo-I2V------提供了基础生成模型设计与代码
  • FastVideo------贡献了关键组件和支撑我们开发的开源工具

这些贡献对我们的研究产生了深远影响,并帮助塑造了iMontage的设计。


📝 引用声明

如果您发现iMontage对您的研究或应用有所帮助,请考虑为仓库点亮⭐星标并引用我们的论文:

复制代码
@article{fu2025iMontage,
  title={iMontage: Unified, Versatile, Highly Dynamic Many-to-many Image Generation}, 
  author={Zhoujie Fu and Xianfang Zeng and Jinghong Lan and Xinyao Liao and Cheng Chen and Junyi Chen and Jiacheng Wei and Wei Cheng and Shiyu Liu and Yunuo Chen and Gang Yu and Guosheng Lin},
  journal={arXiv preprint arXiv:2511.20635},
  year={2025},   
}
相关推荐
weixin_4199369218 小时前
告别繁琐抽帧!Gemini API 原生视频分析赋能具身智能,自动化标注效率提升 10 倍。国内直接用!
人工智能·gemini
程序员威哥18 小时前
超图建模重构实时检测:YOLOv13 HyperACE 机制深度解析与性能实测(完整可运行・原理 + 实战 + 对比)
人工智能
computersciencer19 小时前
用最小二乘法求解多元一次方程模型的参数
人工智能·机器学习·最小二乘法
AI营销实验室19 小时前
原圈科技AI CRM系统深度解析:告别单点智能,构建AI协同作战体系
大数据·人工智能
njsgcs19 小时前
gru 记忆是记当前episode的内容吗
人工智能
竹君子19 小时前
AI知识库(2)豆包AI手机介绍
人工智能
飞哥数智坊19 小时前
一起看看开发一个活动平台,国产和国际模型各自表现如何?
人工智能·ai编程·trae
LDG_AGI19 小时前
【机器学习】深度学习推荐系统(二十六):X 推荐算法多模型融合机制详解
人工智能·分布式·深度学习·算法·机器学习·推荐算法
huazi-J19 小时前
Datawhale Happy-LLM 课程 task 1和2:NLP基础概念
人工智能·自然语言处理·大模型·llm·datawhale
WuChao_JMUer19 小时前
YOLO26 on RDK S100P 端侧部署技术报告
人工智能·算法·yolo·rdk