Hi @jiehanw
I solved the issue. I used replicator generated bbox .npy data.
In the tutorial, it was written like this:
def colorize_bbox_2d(rgb_path, data, id_to_labels, file_path):
rgb_img = Image.open(rgb_path)
colors = [data_to_colour(bbox["semanticId"]) for bbox in data]
fig, ax = plt.subplots(figsize=(10, 10))
ax.imshow(rgb_img)
for bbox_2d, color, index in zip(data, colors, range(len(data))): #this one is the issue
labels = id_to_labels[str(index)]
rect = patches.Rectangle(
xy=(bbox_2d["x_min"], bbox_2d["y_min"]),
width=bbox_2d["x_max"] - bbox_2d["x_min"],
height=bbox_2d["y_max"] - bbox_2d["y_min"],
edgecolor=color,
linewidth=2,
label=labels,
fill=False,
)
ax.add_patch(rect)
plt.legend(loc="upper left")
plt.savefig(file_path)
I changed the for loop part into:
for bbox in data:
id = bbox["semanticId"]
color = data_to_colour(id)
labels = id_to_labels[str(id)]
rect = patches.Rectangle(
xy=(bbox["x_min"], bbox["y_min"]),
width=bbox["x_max"] - bbox["x_min"],
height=bbox["y_max"] - bbox["y_min"],
edgecolor=color,
linewidth=2,
label=labels,
fill=False,
)
ax.add_patch(rect)
and it works properly :D
Thank you for helping me out :D