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, optional, default = [0]) –

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

    如果指定,则驻留在 GPU 或页锁定主机内存中的操作算子的输出将被预先分配,以适应此大小的样本批次。

  • ltrb (bool, optional, default = False) – 对于 ltrb 为 True,对于 xywh 为 False。

  • paste_x (float 或 TensorList of float, optional, default = 0.5) – 粘贴在图像坐标中的水平位置 (0.0 - 1.0)。

  • paste_y (float 或 TensorList of float, optional, default = 0.5) – 粘贴在图像坐标中的垂直位置 (0.0 - 1.0)。

  • preserve (bool, optional, default = False) – 即使操作算子的输出未使用,也阻止将其从图中删除。

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