Add new functionality for image rectification and depth metadata handling

- Implemented a preview tool for rectifying images with interactive aspect controls in `preview.py`.
- Added tests for depth metadata loading to ensure consistent schema usage in `test_depth_metadata.py`.
- Developed comprehensive tests for cutout calibration processes in `test_cutout_calibration.py`, including stability checks and depth calibration.
- Created tests for frame compositing operations in `test_frame_compositing.py`, ensuring correct handling of depth and transparency.
- Introduced material slot inheritance functionality in `material_slots.py` to manage geometry material assignments.
- Built shared shader nodes for material processing in `shader.py`, including roughness and bump mapping setups.
This commit is contained in:
2026-09-12 19:20:06 +08:00
parent e8268504c2
commit 938d95db0f
175 changed files with 3812 additions and 6864 deletions

View File

@@ -1,21 +1,15 @@
# Upscale
`operators/upscale.py` 从当前 Image Empty 生成 2× 结果并替换原图,支持单图、视频与序列帧。
`operators/upscale.py` 从 Image Empty 或当前 Shader Image Texture 生成 2× 结果。普通媒体支持单图、视频和序列帧。
```mermaid
flowchart TD
A[检查源图长边小于 AI 输入上限] --> B[冻结 Preferences 模型与尺寸设置]
B --> C[准备媒体输入]
C --> D[upscale-image 逐帧处理]
D --> E{所选模型}
E -- Real-ESRGAN 或 SAFMN --> F[256×256 tile 与边缘上下文执行 4× RGB 推理]
E -- PiSA-SR --> G[分阶段生成推理,细节强度 0.7]
F --> H[统一缩放到源图 2×]
G --> H
H --> I[原 Alpha 独立 Lanczos 缩放并回填]
I --> J[写出 upscale 序列并替换 Image]
A[检查源图尺寸并冻结模型设置] --> B[准备媒体输入]
B --> C[upscale-image 逐帧处理]
C --> D[分块执行 4× RGB 推理]
D --> E[统一缩放为源图 2×]
E --> F[原 Alpha 独立 Lanczos 缩放]
F --> G[ImageEditTarget 应用结果并提交 Undo]
```
`server/models/upscale.py` 统一处理输入上限、模型分派和最终 RGB/Alpha 尺寸。`onnx_upscale.py` 处理常规 4× 模型,`onnx_pisa_sr.py` 处理 PiSA-SR。多帧与多 tile 只在最后一次运行请求内存收缩。
Provider 资源错误会释放当前 Upscale Session,并返回降低输入上限或切换 CPU 的提示。响应通过 `common/image.py` 加载、Pack、保留图像共享与帧设置,并提交 Undo。
`server/models/upscale.py` 处理输入上限和最终尺寸,`onnx_upscale.py` 执行 Real-ESRGAN 与 HAT 模型。ModelManager 管理 Session;Provider 资源错误会释放当前 Session 并返回处理建议。