INNER CODE UNIT · Python

input_image

FoundationVision/Liquid · data_process/convert_imagepair_cc512.py:25

    input_image = ori_image.resize((int(Width/factor),int(Height/factor)), PIL.Image.LANCZOS)
    resize_width, resize_height = input_image.size   # Get dimensions

    left = (resize_width - tgt_width)//2
    top = (resize_height - tgt_height)//2
    right = (resize_width + tgt_width)//2
    bottom = (resize_height + tgt_height)//2
    # Crop the center of the image
    input_image = input_image.crop((left, top, right, bottom))
    return input_image

def process_item(data,image_tokenizer):
    image_path = data['image_path']
    try:
        ori_image = Image.open(image_path).convert("RGB")
    except:
        print('load error', image_path)
        return None

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…