I cannot draw bounding box correctly
I can't draw the bounding box correctly.
img = Image.open(&quot;/content/drive/MyDrive/58125_000893_Sideline_frame298.jpg&quot;).convert('RGB')
convert_tensor = torchvision.transforms.ToTensor()

img=convert_tensor(img)
width=15
top=456
height=16
left=1099
img=img*255
boxs=[left,top,top+width,left+height]
print(boxs)
boxs=torch.tensor(boxs,dtype=torch.int)
a=torch.tensor(img,dtype=torch.uint8)
a=torchvision.utils.draw_bounding_boxes(image=a,boxes=boxs.unsqueeze(0),width=2,colors=(0,0,255))
a=a.permute(1,2,0)
plt.imshow(a)
plt.show()


I need to draw a bounding box to the player's helmet. But bounding was drawn in a different location. I get bounding attributes from CSV files. Can someone help me fix this issue?

You are using a top-left coordinate system while PyTorch uses x: horizontal left-&gt;right and y: vertical bottom-&gt;top. The bonding box provided to torchvision.utils.draw_bounding_boxes is defined as (xmin, ymin, xmax, ymax).
Your mapping should therefore be:
xmin = left
ymin = top + height
xmax = left + width
ymax = top

