Commit 2caa6646 authored by Sam Tsai's avatar Sam Tsai Committed by Facebook GitHub Bot
Browse files

update for supporting variation of coco-text like datasets

Summary:
1. Add changes to support variation of datasets
2. Fix runner to support torchscript export

Reviewed By: wat3rBro

Differential Revision: D26871461

fbshipit-source-id: ec46f7e0d2c14c9b802aec22d78b2a089e962a2f
parent 5f9e2cc1
......@@ -79,7 +79,7 @@ def convert_coco_text_to_coco_detection_json(
For COCOText see: https://vision.cornell.edu/se3/coco-text-2/
For COCODetection see: http://cocodataset.org/#overview
"""
with open(source_json) as f:
with open(source_json, "r") as f:
coco_text_json = json.load(f)
coco_text_json["annotations"] = list(coco_text_json["anns"].values())
......@@ -115,7 +115,8 @@ def convert_coco_text_to_coco_detection_json(
for x in coco_text_json["images"]:
x["id"] = image_id_remap[x["id"]]
for x in coco_text_json["annotations"]:
x["image_id"] = image_id_remap[x["image_id"]]
if x["image_id"] in image_id_remap:
x["image_id"] = image_id_remap[x["image_id"]]
os.makedirs(os.path.dirname(target_json), exist_ok=True)
with open(target_json, "w") as f:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment