File size: 469 Bytes
bd4d522 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
import json
# 打开并加载json文件
with open(
"/mnt/petrelfs/zhuchenglin/LLaVA/playground/data/LLaVA-Pretrain/select_mscoco_200k.json",
"r",
) as f:
data = json.load(f)
# 遍历json数据,修改image地址
for item in data:
item["image"] = "LLaVA-Pretrain/images/" + item["image"]
# 将修改后的数据写回json文件
with open("/mnt/petrelfs/zhuchenglin/LLaVA/playground/data/mscoco_200k.json", "w") as f:
json.dump(data, f, indent=4)
|