Orienter / baselines /gemini-e2e /result2coco.py
stereoid's picture
Add files using upload-large-folder tool
1da285f verified
Raw
History Blame Contribute Delete
505 Bytes
import os
import json
OUTPUT_PATH = './output.json'
result = []
with open(OUTPUT_PATH, 'r') as f:
output = json.load(f)
for img_id, objects in output.items():
for obj in objects:
result.append({
'image_id': int(img_id),
'category_id': obj['name'],
'bbox': [obj['bbox'][0], obj['bbox'][1], obj['bbox'][2], obj['bbox'][3]],
'score': obj['confidence']
})
with open('coco_instances_results.json', 'w') as f:
json.dump(result, f)