如何将检测到的对象转换为COCO数据集Json

时间:2019-02-26 01:20:31

标签: json python-3.x tensorflow object-detection-api

我遵循https://github.com/tensorflow/models/blob/master/research/object_detection/object_detection_tutorial.ipynb中的对象检测演示:

# Actual detection.
output_dict = run_inference_for_single_image(image_np, detection_graph) 

但是我想将output_dict(从功能run_inference_for_single_image(image_np,detection_graph)的输出)转换为COCO注释JSON类型,以便我可以输入它以在不同的对象检测模型之间进行基准测试。

以下是基准模型的代码:https://github.com/cocodataset/cocoapi/blob/master/PythonAPI/pycocoEvalDemo.ipynb

#initialize COCO detections api
resFile='%s/results/%s_%s_fake%s100_results.json'
resFile = resFile%(dataDir, prefix, dataType, annType)
cocoDt=cocoGt.loadRes(resFile)

但是您需要输入COCO Json类型。

有没有人可以告诉我如何从output_dict转换为COCO Json?

1 个答案:

答案 0 :(得分:0)