From 3f93c1ea9b5ce3b168169266dfb064143b083178 Mon Sep 17 00:00:00 2001 From: Hacker 17082006 Date: Thu, 23 Feb 2023 09:42:42 +0700 Subject: [PATCH] Change config_file path in uniformer and change the ckpts location since this is a standalone extension now --- custom_nodes/annotator/__init__.py | 4 ++-- custom_nodes/annotator/uniformer/__init__.py | 2 +- custom_nodes/annotator/util.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/custom_nodes/annotator/__init__.py b/custom_nodes/annotator/__init__.py index 730e7507f..0dae1b28a 100644 --- a/custom_nodes/annotator/__init__.py +++ b/custom_nodes/annotator/__init__.py @@ -15,9 +15,9 @@ def img_tensor_to_np(img_tensor): def common_annotator_call(annotator_callback, tensor_image, *args): call_result = annotator_callback(img_tensor_to_np(tensor_image), *args) if type(annotator_callback) is openpose.OpenposeDetector: - return (HWC3(call_result[0]),call_result[1]) + return (HWC3(call_result[0]), call_result[1]) if type(annotator_callback) is midas.MidasDetector(): - return (HWC3(call_result[0]),HWC3(call_result[1])) + return (HWC3(call_result[0]), HWC3(call_result[1])) return HWC3(call_result) diff --git a/custom_nodes/annotator/uniformer/__init__.py b/custom_nodes/annotator/uniformer/__init__.py index bd20c5722..fadcbe370 100644 --- a/custom_nodes/annotator/uniformer/__init__.py +++ b/custom_nodes/annotator/uniformer/__init__.py @@ -14,7 +14,7 @@ class UniformerDetector: if not os.path.exists(modelpath): from basicsr.utils.download_util import load_file_from_url load_file_from_url(checkpoint_file, model_dir=annotator_ckpts_path) - config_file = os.path.join(os.path.dirname(annotator_ckpts_path).replace("models", "custom_nodes/annotator"), "uniformer", "exp", "upernet_global_small", "config.py") + config_file = os.path.join(os.path.dirname(__file__), "exp", "upernet_global_small", "config.py") self.model = init_segmentor(config_file, modelpath).cuda() def __call__(self, img): diff --git a/custom_nodes/annotator/util.py b/custom_nodes/annotator/util.py index e53399d91..1405ffd57 100644 --- a/custom_nodes/annotator/util.py +++ b/custom_nodes/annotator/util.py @@ -3,7 +3,7 @@ import cv2 import os -annotator_ckpts_path = os.path.join(os.path.dirname(__file__), "../../models/annotators") +annotator_ckpts_path = os.path.join(os.path.dirname(__file__), "ckpts") def HWC3(x):