Open kkbandaru opened 10 months ago
def image_resizer(image_p):
image = Image.open(image_path)
width, height = image.size
new_width = (width // 8) * 8
new_height = (height // 8) * 8
if new_width != width or new_height != height:
image = image.resize((new_width, new_height))
image = image.convert("RGB")
return image
image = image_resizer(image_path)
mask_image = image_resizer(mask_img_path)
example_image = image_resizer(example_image_path)
I revised the code this way and it worked for me
def image_resizer(image_p): image = Image.open(image_path) width, height = image.size new_width = (width // 8) * 8 new_height = (height // 8) * 8 if new_width != width or new_height != height: image = image.resize((new_width, new_height)) image = image.convert("RGB") return image image = image_resizer(image_path) mask_image = image_resizer(mask_img_path) example_image = image_resizer(example_image_path)
I revised the code this way and it worked for me
Can you provide me the full code for my reference?The size of my picture is 681*1024, and after I modify it with your code, it still gives the error "RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 44 but got size 43 for tensor number 1 in the list."
Why the input images are 512 x 512, can i give any image of any size