How can I make black a bounding box area of all images?

Hi

A bounding box label exists in the image in tiny image.(X Y H W)
I want to make the bounding box area black. What can I do?

Thank you!

If I understand your use case correctly, you would like to use these coordinates to mask the area in an image?
If so, you could index the input directly and assign the new value to it:

X, Y, H, W, = 1, 2, 3, 3
x = torch.randn(2, 3, 5, 5)

x[:, :, Y:Y+H, X:X+W] = 0.
print(x)