Files
hfut-bishe/doc/models.md
2026-04-07 20:55:30 +08:00

90 lines
2.2 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 后端模型处理
当前后端主要围绕四类模型提供服务:深度估计、语义分割、图像补全和动画生成。
前端通过 GET /models 获取模型列表和参数配置,用来动态生成 UI推理接口分别为
POST /depth
POST /segment
POST /inpaint
POST /animate
## 一、深度估计
输入一张 RGB 图像,输出每个像素的相对深度,用于后续的分层和视差计算。
这一部分是整个伪3D效果的基础深度质量直接决定最终效果上限。
模型:
* ZoeDepthhttps://github.com/isl-org/ZoeDepth.git
* Depth Anything v2https://github.com/DepthAnything/Depth-Anything-V2.git
* MiDaShttps://github.com/isl-org/MiDaS.git
* DPThttps://github.com/isl-org/DPT.git
接口说明
HTTPPOST /depth
请求体DepthRequest
实现models_depth.py 中的 run_depth_inference
## 二、语义分割
对图像进行像素级分区,用于辅助分层(天空 / 山 / 地面 / 建筑等)。
在伪3D流程中这一步主要解决一个问题
哪里可以拆开,哪里必须保持整体
模型:
* Mask2Formerhttps://github.com/facebookresearch/Mask2Former.git
* SAMhttps://github.com/facebookresearch/segment-anything.git
接口说明
HTTPPOST /segment
请求体SegmentRequest
实现models_segmentation.py 中的 run_segmentation_inference
## 三、图像补全
在进行视差变换或分层后,图像中会出现“空洞区域”,需要通过生成模型进行补全。
这一部分主要影响最终画面的“真实感”。
模型:
* SDXL Inpaintinghttps://github.com/AyushUnleashed/sdxl-inpaint.git
* ControlNethttps://github.com/lllyasviel/ControlNet.git
接口说明
HTTPPOST /inpaint
请求体InpaintRequest
实现models_inpaint.py 中的 run_inpaint_inference
## 四、动画生成
通过文本提示词生成短动画GIF用于从静态描述快速预览动态镜头效果。
这部分当前接入 AnimateDiff并通过统一后端接口对外提供调用能力。
模型:
* AnimateDiffhttps://github.com/guoyww/animatediff.git
接口说明
HTTPPOST /animate
请求体AnimateRequest
实现:`python_server/model/Animation/animation_loader.py` + `python_server/server.py` 中的 `animate`