报告文档:Zoe Depth Anything 检测器和预处理器类
导入语句
from ..utils import common_annotator_call, create_node_input_types
import comfy.model_management as model_management
这部分代码导入了通用的辅助函数以及模型管理模块,用于处理图像注释和模型的设备管理。
类 ZoeDepthAnythingDetector
的定义
构造函数
def __init__(self, model):
self.model = model
self.device = "cpu"
构造函数接收一个模型对象,并默认将设备设置为 “cpu”。
从预训练模型加载
@classmethod
def from_pretrained(cls, pretrained_model_or_path=DEPTH_ANYTHING_MODEL_NAME,
filename="depth_anything_metric_depth_indoor.pt"):
model_path = custom_hf_download(pretrained_model_or_path, filename, subfolder="checkpoints_metric_depth",
repo_type="space")
conf = get_config("zoedepth", "infer")
model = ZoeDepthAnything.buil