Change config_file path in uniformer and change the ckpts location since this is a standalone extension now

This commit is contained in:
Hacker 17082006 2023-02-23 09:42:42 +07:00
parent 532f36d18e
commit 3f93c1ea9b
3 changed files with 4 additions and 4 deletions

View File

@ -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)

View File

@ -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):

View File

@ -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):