AI Agent工程化实践:任务编排、可验证推理与工业级观测循环
2026/6/16 15:10:13
github: https://github.com/QwenLM/Qwen-Image-Layered?tab=readme-ov-file
huggingface 应用:
https://huggingface.co/spaces/Qwen/Qwen-Image-Layered
Qwen-Image-Layered 是一个专注于图像分层分解与编辑的仓库,核心功能是将输入图像分解为多个带透明通道(RGBA)的图层,从而支持对每个图层进行独立操作(如重新着色、替换内容、缩放等),实现高保真且一致的图像编辑。
编辑第一层:
编辑第二层:
编辑第三层(修改OCR字符):
删除层:
resize尺寸:
移动obj:
Qwen-Image-Layered/ ├── LICENSE # Apache License 2.0 许可证 ├── README.md # 项目说明、快速开始及使用指南 ├── assets/ │ └── test_images/ # 测试用例图像 └── src/ ├── app.py # 启动图像分解与PPTX导出的Gradio界面 └── tool/ └── edit_rgba_image.py # 启动图层编辑的Gradio界面环境准备:
transformers>=4.51.3(支持 Qwen2.5-VL)diffusers和python-pptx:pipinstallgit+https://github.com/huggingface/diffusers pipinstallpython-pptx快速开始(代码示例):
fromdiffusersimportQwenImageLayeredPipelineimporttorchfromPILimportImage pipeline=QwenImageLayeredPipeline.from_pretrained("Qwen/Qwen-Image-Layered")pipeline=pipeline.to("cuda",torch.bfloat16)image=Image.open("assets/test_images/1.png").convert("RGBA")inputs={"image":image,"generator":torch.Generator(device='cuda').manual_seed(777),"true_cfg_scale":4.0,"negative_prompt":" ","num_inference_steps":50,"layers":4,"resolution":640,"cfg_normalize":True,"use_en_prompt":True,}withtorch.inference_mode():output=pipeline(**inputs)fori,layerinenumerate(output.images[0]):layer.save(f"layer_{i}.png")# 保存分解后的图层可视化界面部署:
python src/app.pypython src/tool/edit_rgba_image.py项目采用Apache License 2.0,允许自由使用、复制、修改和分发,但需保留原始版权信息和许可证说明。
更多细节可参考仓库的 Research Paper、Blog 或 Demo。