from PIL import Image import os import json image_dir = "/mnt/petrelfs/zhuchenglin/LLaVA/playground/data/LLaVA-Pretrain/images" json_filename = "/mnt/petrelfs/zhuchenglin/LLaVA/playground/data/LLaVA-Pretrain/mscoco_gen_200k.json" with open(json_filename, "r") as f: text_data = json.load(f) for text in text_data: subdir = text["image"].split("/")[0] image_path = os.path.join(image_dir, text["image"]) with Image.open(image_path) as img: print(f"Resolution of {image_path}: {img.size}") print("所有图像已成功生成并保存。")