Fixed accessing of colour list

Signed-off-by: Jim Martens <github@2martens.de>
This commit is contained in:
2019-07-02 11:28:49 +02:00
parent f2c718540a
commit 1191761149

View File

@ -364,7 +364,7 @@ def visualise(args: argparse.Namespace) -> None:
output_path = f"{args.output_path}/visualise/{args.trajectory}" output_path = f"{args.output_path}/visualise/{args.trajectory}"
annotation_file_train = f"{args.coco_path}/annotations/instances_train2014.json" annotation_file_train = f"{args.coco_path}/annotations/instances_train2014.json"
_, _, cats_to_names, _ = coco_utils.get_coco_category_maps(annotation_file_train) cats_to_classes, _, cats_to_names, _ = coco_utils.get_coco_category_maps(annotation_file_train)
colors = pyplot.cm.hsv(np.linspace(0, 1, 81)).tolist() colors = pyplot.cm.hsv(np.linspace(0, 1, 81)).tolist()
@ -389,7 +389,7 @@ def visualise(args: argparse.Namespace) -> None:
ymin = bbox[1] ymin = bbox[1]
xmax = bbox[2] xmax = bbox[2]
ymax = bbox[3] ymax = bbox[3]
color = colors[int(instance['coco_id'])] color = colors[cats_to_classes[int(instance['coco_id'])]]
label = f"{cats_to_names[int(instance['coco_id'])]}" label = f"{cats_to_names[int(instance['coco_id'])]}"
current_axis.add_patch( current_axis.add_patch(
pyplot.Rectangle((xmin, ymin), xmax - xmin, ymax - ymin, color=color, fill=False, linewidth=2)) pyplot.Rectangle((xmin, ymin), xmax - xmin, ymax - ymin, color=color, fill=False, linewidth=2))