pytorch torchvision.ops.roi_align 示例

import torchvision
import torch

input_ = torch.rand(3, 128, 24, 96) #[b,c,h,w]

bbox = [[0,0.1,0.15,0.4,0.6],
        [0,0.1,0.15,0.4,0.6],
[1,0.01,0.15,0.4,0.6],
[1,0.1,0.25,0.7,0.6],
[2,0.01,0.14,0.5,0.6],
[2,0.1,0.45,0.4,0.6],
[2,0.01,0.45,0.12,0.6],
[0,0.01,0.25,0.15,0.6]]

bbox_1 = torch.tensor(bbox)#[8,5]

#[8,128,7,7]
roi = torchvision.ops.roi_align(input=input_, boxes=bbox_1,
                                        output_size=(7, 7))

posted @ 2022-11-26 22:43  无左无右  阅读(167)  评论(0编辑  收藏  举报