nvidia.dali.fn.bbox_paste#

nvidia.dali.fn.bbox_paste(__input, /, *, bytes_per_sample_hint=[0], ltrb=False, paste_x=0.5, paste_y=0.5, preserve=False, ratio, device=None, name=None)#

转换边界框,以便在图像粘贴到更大的画布后,框在图像中保持在相同的位置。

角坐标根据以下公式进行变换

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

框大小(如果使用 xywh)根据以下公式进行变换

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

其中

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

粘贴坐标已标准化,以便 (0,0) 将图像与画布的左上角对齐,而 (1,1) 将其与右下角对齐。

支持的后端
  • ‘cpu’

参数:

__input (TensorList) – 运算符的输入。

关键字参数:
  • bytes_per_sample_hint (int 或 list of int, 可选, 默认值 = [0]) –

    每个样本的输出大小提示(以字节为单位)。

    如果指定,则将预先分配位于 GPU 或页面锁定主机内存中的运算符输出,以适应此大小的样本批次。

  • ltrb (bool, 可选, 默认值 = False) – ltrb 为 True,xywh 为 False。

  • paste_x (float 或 TensorList of float, 可选, 默认值 = 0.5) – 图像坐标中粘贴的水平位置 (0.0 - 1.0)。

  • paste_y (float 或 TensorList of float, 可选, 默认值 = 0.5) – 图像坐标中粘贴的垂直位置 (0.0 - 1.0)。

  • preserve (bool, 可选, 默认值 = False) – 即使运算符的输出未使用,也阻止从图中删除该运算符。

  • ratio (floatTensorList of float) – 画布大小与输入大小之比;该值必须至少为 1。