Commit de0829f1 authored by Fu-Chen Chen's avatar Fu-Chen Chen Committed by Facebook GitHub Bot
Browse files

fix bug when checking for invalid bounding boxes

Summary:
The dict `record` might not have keys `"width"` or `"height"`.
This diff check if `"width"` and `"height"` are in the dict `record` before getting the values.

Reviewed By: sstsai-adl

Differential Revision: D29243341

fbshipit-source-id: a1e0e343dd1afcced834c3732e64bb6f372fbd1a
parent 670b4c4a
...@@ -180,7 +180,7 @@ def convert_to_dict_list(image_root, id_map, imgs, anns, dataset_name=None): ...@@ -180,7 +180,7 @@ def convert_to_dict_list(image_root, id_map, imgs, anns, dataset_name=None):
} }
bbox_object = obj.get("bbox", None) bbox_object = obj.get("bbox", None)
if not valid_bbox(bbox_object, record["width"], record["height"]): if "width" in record and "height" in record and (not valid_bbox(bbox_object, record["width"], record["height"])):
num_instances_without_valid_bounding_box += 1 num_instances_without_valid_bounding_box += 1
continue continue
......
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