深度学习Pytorch实现的CenterNet目标检测图像处理要点
图片调整大小:
resized_image = cv2.resize(image, (new_width, new_height))
图片归一化:
inp_image = ((inp_image / 255. - self.mean) / self.std).astype(np.float32) images = inp_image.transpose(2, 0, 1).reshape(1, 3, inp_height, inp_width)
其中标准化和均值
self.mean = np.array(opt.mean, dtype=np.float32).reshape(1, 1, 3) self.std = np.array(opt.std, dtype=np.float32).reshape(1, 1, 3)