How to construct a bounding box?


what should be passed in? Docs and code doesn’t say anything other than a tensor. But what should the points of the tensor be? Center point, width, height? Top left, bottom right? Something else?


It’s pointed out right here:

Bounding boxes are expected to come as tuple with an array/tensor of shape (n,4) or as a list of lists with four elements and a list of corresponding labels. Unless you change the defaults in PointScaler (see later on), coordinates for each bounding box should go from 0 to width/height, with the following convention: x1, y1, x2, y2 where (x1,y1) is your top-left corner and (x2,y2) is your bottom-right corner.

Note: We use the same convention as for points with x going from 0 to width and y going from 0 to height.

You could also have a look here where I go through generating bounding boxes from class activation maps.

1 Like

Ahh, I was looking at the Block (which was what I found through google). Didn’t think it would have it’s own tensor wrapper as well. Thanks!

(Btw thanks for your image regression notebook. But I think I found an issue with using flip on the cat images here: Flipping and image regression with keypoints - #2 by Matsemann )

Thanks! Always nice with practical examples to look at!

1 Like