关于affine transform中scale和center的疑问
Closed this issue · 1 comments
Psilym commented
作者您好,
最近在研究snake网络的代码实现,发现datasets生成过程中所使用的augmentation函数中(snake_coco_utils.augment)做了affine_transform,而get_affine_transform()函数使用的scale为np.array([input_w, input_h]),而center为np.array([width // 2, height // 2]),为什么不使用scale = np.array([width, height])呢?这里center和scale不是对应的原图信息么?
input_w, input_h = input_scale
if split != 'train':
center = np.array([width // 2, height // 2])
scale = np.array([width, height])
x = 32
input_w = (int(width / 1.) | (x - 1)) + 1
input_h = (int(height / 1.) | (x - 1)) + 1
scale = np.array([input_w, input_h])
# input_w, input_h = (width + x - 1) // x * x, (height + x - 1) // x * x
# input_w, input_h = int((width / 0.5 + x - 1) // x * x), int((height / 0.5 + x - 1) // x * x)
# input_w, input_h = 512, 512
trans_input = data_utils.get_affine_transform(center, scale, 0, [input_w, input_h])
inp = cv2.warpAffine(img, trans_input, (input_w, input_h), flags=cv2.INTER_LINEAR)
希望得到您的解答,
感谢。
pengsida commented
这里想做数据增强,所以没有输入原图像的信息。