Support empty predictions when visualizing results
Summary:
This PR fixes a potential error when no predictions found in `tools/visualize_json_results.py`.
Pull Request resolved:
@@ -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])
