'Black out a sequence of bounding boxes in a video (pytorch)
I have a video of shape (f, 3, w, h), where f is the number of frames and w, h the dimensions of the video. Additionally, I have bounding boxes in the shape (f, 4), where the 4 entries correspond to the 4 corner positions of the bounding box (x_bottom-left, y_bottom-left, x_top-right, y_top-right).
I want to set all pixels within the bounding boxes for each frame to zero. So my idea is to create a bounding box mask of shape (f, 3, w, h) which is 0 for each pixel within the bounding boxes and 1 otherwise. Then I can simply use an element-wise multiplication. Is there an efficient way to implement these bounding boxes other than creating a tensor of ones and iterating over the 4 bounding box variables?
Thank you for your help!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
