Skip to content

Commit

Permalink
Update misc.py
Browse files Browse the repository at this point in the history
fix targets_to bug
  • Loading branch information
wjn922 authored Jan 27, 2023
1 parent 9c8f237 commit e40f70b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions util/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,8 +539,8 @@ def targets_to(targets: List[Dict[str, Any]], device):
"original_id",
]
"""
dataset_name = targets[0]["dataset_name"]
if dataset_name in ["refcoco", "refcoco+", "refcocog"]:
if "dataset_name" in targets[0]:
# for ["refcoco", "refcoco+", "refcocog"] evaluation
return [{k: v.to(device) for k, v in t.items() if k not in ["caption", "dataset_name", "original_id"]} for t in targets]
else:
return [{k: v.to(device) for k, v in t.items() if k not in ["caption", "dataset_name", "original_id", "image_id"]} for t in targets]
Expand Down

0 comments on commit e40f70b

Please sign in to comment.