def create_operators(self):
     size = 224
     img_mean = [0.485, 0.456, 0.406]
     img_std = [0.229, 0.224, 0.225]
     img_scale = 1.0 / 255.0
     decode_op = utils.DecodeImage()
     resize_op = utils.ResizeImage(resize_short=256)
     crop_op = utils.CropImage(size=(size, size))
     normalize_op = utils.NormalizeImage(scale=img_scale,
                                         mean=img_mean,
                                         std=img_std)
     totensor_op = utils.ToTensor()
     return [decode_op, resize_op, crop_op, normalize_op, totensor_op]
示例#2
0
def create_operators(interpolation=1):
    size = 224
    img_mean = [0.485, 0.456, 0.406]
    img_std = [0.229, 0.224, 0.225]
    img_scale = 1.0 / 255.0

    resize_op = utils.ResizeImage(resize_short=256,
                                  interpolation=interpolation)
    crop_op = utils.CropImage(size=(size, size))
    normalize_op = utils.NormalizeImage(scale=img_scale,
                                        mean=img_mean,
                                        std=img_std)
    totensor_op = utils.ToTensor()

    return [resize_op, crop_op, normalize_op, totensor_op]