Skip to content

Commit

Permalink
Support empty predictions when visualizing results
Browse files Browse the repository at this point in the history
Summary:
This PR fixes a potential error when no predictions found in `tools/visualize_json_results.py`.
Pull Request resolved: facebookresearch#1166

Reviewed By: rbgirshick

Differential Revision: D20888849

Pulled By: ppwwyyxx

fbshipit-source-id: a53d67a7f3ee63070defedb6ca3812d0ae5d6cc9
  • Loading branch information
c1aris authored and facebook-github-bot committed Apr 7, 2020
1 parent 483f775 commit b8f4eeb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/visualize_json_results.py
Expand Up @@ -22,7 +22,7 @@ def create_instances(predictions, image_size):
score = np.asarray([x["score"] for x in predictions])
chosen = (score > args.conf_threshold).nonzero()[0]
score = score[chosen]
bbox = np.asarray([predictions[i]["bbox"] for i in chosen])
bbox = np.asarray([predictions[i]["bbox"] for i in chosen]).reshape(-1, 4)
bbox = BoxMode.convert(bbox, BoxMode.XYWH_ABS, BoxMode.XYXY_ABS)

labels = np.asarray([dataset_id_map(predictions[i]["category_id"]) for i in chosen])
Expand Down

0 comments on commit b8f4eeb

Please sign in to comment.