nvidia.dali.fn.bbox_paste

nvidia.dali.fn.bbox_paste(*inputs, **kwargs)

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 (TensorList) – Input to the operator.

Keyword Arguments:
  • ratio (float or TensorList of float) – Ratio of the canvas size to the input size; the value must be at least 1.

  • bytes_per_sample_hint (int or list of int, optional, default = [0]) –

    Output size hint, in bytes per sample.

    If specified, the operator’s outputs residing in GPU or page-locked host memory will be preallocated to accommodate a batch of samples of this size.

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

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

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

  • preserve (bool, optional, default = False) – Prevents the operator from being removed from the graph even if its outputs are not used.

  • seed (int, optional, default = -1) –

    Random seed.

    If not provided, it will be populated based on the global seed of the pipeline.