 # Bounding box Height and Width error?

In the function `actn_to_bb` in the `pascal_mult.ipynb` notebook the height and width of the bounding box is defined as follows:

``````actn_hw = (actn_bbs[:,2:]/2+1) * anchors[:,2:]
``````

However, should it not be the following instead?

``````actn_hw = 0.5*(actn_bbs[:,2:]+1) * anchors[:,2:]
``````

My reasoning is that `actn_bbs[:,2:]` lies in the range of (-1,1) due to the use of tanh to get this value. Adding 1 changes this to (0,2). Halving this will bring it back to (0,1). i.e. you are modifying the anchor height width by a fraction less than one. In the original implementation, this fraction is in the range of (0.5,1.5) instead.

Hello,

I struggled to understand the geometry of the transformation behind that. So I listened again to the moment where he introduces this transformation. It seems that the factors have to limit the possible values of the center, height and width of the predicted bbox. And not rescale them to a natural interval like [0,1] for the the height and width.
The center can be anywhere from the center of the box to as far as half the size of the grid cell:

``````actn_centers = (actn_bbs[:,:2]/2 * grid_sizes) + anchors[:,:2]
``````

Then the distance is scaled by the grid size and shifted by the ancor center coordinates.

The height and width can scale from half to one and a half time the height and width of the ancor:

``````actn_hw = (actn_bbs[:,2:]/2+1) * anchors[:,2:]
``````

Then it is scaled by the ancor dimensions.

Notice that the center uses as a scaling reference the grid cell size while the width and height use the ancor width and height.

Does that make sense ?