huggingface / controlnet_aux

Apache License 2.0
398 stars 86 forks source link

mismatch in tensor size for MidasDetector #17

Closed arisha07 closed 1 year ago

arisha07 commented 1 year ago

I am new to using this package, so not sure if I am doing the right thing: Here is my code - (Running on CPU)

from controlnet_aux import MidasDetector
from PIL import Image

depth_estimator = MidasDetector.from_pretrained("lllyasviel/ControlNet")

image_file = "<loaction.png>"
img = Image.open(image_file)
depth_map, i = depth_estimator(img)

After running I get a runtime error - RuntimeError: The size of tensor a (1505) must match the size of tensor b (1473) at non-singleton dimension 1

Please let me know if there is something that I am missing here. Thank you !

jinwonkim93 commented 1 year ago

@arisha07 Have you tried resizing img? check https://github.com/patrickvonplaten/controlnet_aux/issues/2

arisha07 commented 1 year ago

Thanks that worked !