File size: 566 Bytes
bd4d522
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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("所有图像已成功生成并保存。")