Skip to content

Commit

Permalink
[doc] fixed indices in obj detection example (huggingface#26343)
Browse files Browse the repository at this point in the history
fixed indexes in obj detection example
  • Loading branch information
MKhalusova authored and EduardoPach committed Nov 18, 2023
1 parent 401ca17 commit e7f3a6e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/source/en/tasks/object_detection.md
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit e7f3a6e

Please sign in to comment.