def preprocess(self, im): mean = torch.Tensor([0.485, 0.456, 0.406]) std = torch.Tensor([0.229, 0.224, 0.225]) im = np.asarray(im) im = t.normalize(im, mean, std) im = np.transpose(im, (2, 0, 1)) return im
def preprocess(self, im): mean = torch.DoubleTensor([0.485, 0.456, 0.406]) std = torch.DoubleTensor([0.229, 0.224, 0.225]) # print("mean data type : ", mean.dtype) im = np.asarray(im) im = t.normalize(im, mean, std) im = np.transpose(im, (2, 0, 1)) return im
def preprocess(self, im): mean = np.array([0.485, 0.456, 0.406]) std = np.array([0.229, 0.224, 0.225]) im = np.asarray(im) # normalize im = t.normalize(im, mean, std) # (width, height, channel) to (channel, width, height) im = np.transpose(im, (2, 0, 1)) return im