nvidia.dali.experimental.dynamic.bbox_paste#

nvidia.dali.experimental.dynamic.bbox_paste(input, /, *, batch_size=None, device=None, ltrb=None, paste_x=None, paste_y=None, ratio)#

Transforms bounding boxes so that the boxes remain in the same place in the image after the image is pasted on a larger canvas.

Corner coordinates are transformed according to the following formula:

(x', y') = (x/ratio + paste_x', y/ratio + paste_y')

Box sizes (if xywh is used) are transformed according to the following formula:

(w', h') = (w/ratio, h/ratio)

Where:

paste_x' = paste_x * (ratio - 1)/ratio
paste_y' = paste_y * (ratio - 1)/ratio

The paste coordinates are normalized so that (0,0) aligns the image to top-left of the canvas and (1,1) aligns it to bottom-right.

Supported backends
  • ‘cpu’

Parameters:

input (Tensor/Batch) – Input to the operator.

Keyword Arguments:
  • ltrb (bool, optional, default = False) – True for ltrb or False for xywh.

  • paste_x (float or Tensor/Batch of float, optional, default = 0.5) – Horizontal position of the paste in image coordinates (0.0 - 1.0).

  • paste_y (float or Tensor/Batch of float, optional, default = 0.5) – Vertical position of the paste in image coordinates (0.0 - 1.0).

  • ratio (float or Tensor/Batch of float) – Ratio of the canvas size to the input size; the value must be at least 1.