Skip to content

Commit

Permalink
fill out non-existent height and width from the image (facebookresear…
Browse files Browse the repository at this point in the history
…ch#249)

Summary:
hi, all:
  To ensure detected bboxes always remap to the original image size,  fill out non-existent height and width from the image in function detectron2/data/detection_utils.py.
  Thanks.
Pull Request resolved: facebookresearch#249

Differential Revision: D18340933

Pulled By: ppwwyyxx

fbshipit-source-id: 4a749f4a3810afb07a0f2fd9789f7757b3164afd
  • Loading branch information
gaosiqi authored and facebook-github-bot committed Nov 7, 2019
1 parent b98cd55 commit cd3a0f9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions detectron2/data/detection_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ def check_image_size(dataset_dict, image):
"mismatch (W,H), got {}, expect {}".format(image_wh, expected_wh)
)

# To ensure bbox always remap to original image size
if "width" not in dataset_dict:
dataset_dict["width"] = image.shape[1]
if "height" not in dataset_dict:
dataset_dict["height"] = image.shape[0]

def transform_proposals(dataset_dict, image_shape, transforms, min_box_side_len, proposal_topk):
"""
Expand Down

0 comments on commit cd3a0f9

Please sign in to comment.