Commit 13b4f82e authored by Rodrigo Berriel's avatar Rodrigo Berriel Committed by Francisco Massa

Replace with get_img_info on coco_eval (#411)

parent a694420e
...@@ -75,9 +75,9 @@ def prepare_for_coco_detection(predictions, dataset): ...@@ -75,9 +75,9 @@ def prepare_for_coco_detection(predictions, dataset):
if len(prediction) == 0: if len(prediction) == 0:
continue continue
# TODO replace with get_img_info? img_info = dataset.get_img_info(image_id)
image_width = dataset.coco.imgs[original_id]["width"] image_width = img_info["width"]
image_height = dataset.coco.imgs[original_id]["height"] image_height = img_info["height"]
prediction = prediction.resize((image_width, image_height)) prediction = prediction.resize((image_width, image_height))
prediction = prediction.convert("xywh") prediction = prediction.convert("xywh")
...@@ -113,9 +113,9 @@ def prepare_for_coco_segmentation(predictions, dataset): ...@@ -113,9 +113,9 @@ def prepare_for_coco_segmentation(predictions, dataset):
if len(prediction) == 0: if len(prediction) == 0:
continue continue
# TODO replace with get_img_info? img_info = dataset.get_img_info(image_id)
image_width = dataset.coco.imgs[original_id]["width"] image_width = img_info["width"]
image_height = dataset.coco.imgs[original_id]["height"] image_height = img_info["height"]
prediction = prediction.resize((image_width, image_height)) prediction = prediction.resize((image_width, image_height))
masks = prediction.get_field("mask") masks = prediction.get_field("mask")
# t = time.time() # t = time.time()
...@@ -223,9 +223,9 @@ def evaluate_box_proposals( ...@@ -223,9 +223,9 @@ def evaluate_box_proposals(
for image_id, prediction in enumerate(predictions): for image_id, prediction in enumerate(predictions):
original_id = dataset.id_to_img_map[image_id] original_id = dataset.id_to_img_map[image_id]
# TODO replace with get_img_info? img_info = dataset.get_img_info(image_id)
image_width = dataset.coco.imgs[original_id]["width"] image_width = img_info["width"]
image_height = dataset.coco.imgs[original_id]["height"] image_height = img_info["height"]
prediction = prediction.resize((image_width, image_height)) prediction = prediction.resize((image_width, image_height))
# sort predictions in descending order # sort predictions in descending order
......
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