Merge pull request #1 from NiggoJaecha/controlnet-annotator (WIP)

Fix Openpose and Segmentation
This commit is contained in:
Fannovel16 2023-02-23 09:31:15 +07:00 committed by GitHub
commit 85163a3991
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 7 deletions

View File

@ -14,12 +14,15 @@ 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(call_result) is tuple:
for i in range(len(call_result)):
call_result[i] = HWC3(call_result[i])
else:
call_result = HWC3(call_result)
return call_result
if type(annotator_callback) is openpose.OpenposeDetector:
return (HWC3(call_result[0]),call_result[1])
# if type(call_result) is tuple:
# for i in range(len(call_result)):
# call_result[i] = HWC3(call_result[i])
# else:
# call_result = HWC3(call_result)
return HWC3(call_result)
class CannyEdgePreprocesor:
@classmethod

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), "uniformer", "exp", "upernet_global_small", "config.py")
config_file = os.path.join(os.path.dirname(annotator_ckpts_path).replace("models", "custom_nodes/annotator"), "uniformer", "exp", "upernet_global_small", "config.py")
self.model = init_segmentor(config_file, modelpath).cuda()
def __call__(self, img):