[doc] fixed indices in obj detection example (#26343)

fixed indexes in obj detection example
This commit is contained in:
Maria Khalusova 2023-09-22 10:29:27 -04:00 committed by GitHub
parent c3ecf2d95d
commit dcbfd93d7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -136,8 +136,8 @@ To get an even better understanding of the data, visualize an example in the dat
>>> label2id = {v: k for k, v in id2label.items()}
>>> for i in range(len(annotations["id"])):
... box = annotations["bbox"][i - 1]
... class_idx = annotations["category"][i - 1]
... box = annotations["bbox"][i]
... class_idx = annotations["category"][i]
... x, y, w, h = tuple(box)
... draw.rectangle((x, y, x + w, y + h), outline="red", width=1)
... draw.text((x, y), id2label[class_idx], fill="white")