🐛 Fix padding (#2547)

pull/2548/head
Chenlei Hu 2024-01-22 21:16:37 +00:00 committed by GitHub
parent e5adb1697d
commit 2b44ac8d6b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 2 deletions

View File

@ -186,14 +186,15 @@ def unload_mlsd():
model_depth_anything = None
def depth_anything(img, colored:bool = True, **kwargs):
def depth_anything(img, res:int = 512, colored:bool = True, **kwargs):
img, remove_pad = resize_image_with_pad(img, res)
global model_depth_anything
if model_depth_anything is None:
with Extra(torch_handler):
from annotator.depth_anything import DepthAnythingDetector
device = devices.get_device_for("controlnet")
model_depth_anything = DepthAnythingDetector(device)
return model_depth_anything(img, colored=colored), True
return remove_pad(model_depth_anything(img, colored=colored)), True
def unload_depth_anything():