| import torchvision.transforms as transforms |
| import util.functional as F |
| import numpy as np |
| from skimage import color |
|
|
| im_mean = (124, 116, 104) |
|
|
| im_normalization = transforms.Normalize( |
| mean=[0.485, 0.456, 0.406], |
| std=[0.229, 0.224, 0.225] |
| ) |
|
|
| inv_im_trans = transforms.Normalize( |
| mean=[-0.485/0.229, -0.456/0.224, -0.406/0.225], |
| std=[1/0.229, 1/0.224, 1/0.225]) |
|
|
| |
| |
| |
| inv_lll2rgb_trans = transforms.Normalize( |
| mean=[-1, 0, 0], |
| std=[1/50., 1/110., 1/110.]) |
|
|
| im_rgb2lab_normalization = transforms.Normalize( |
| mean=[50, 0, 0], |
| std=[50, 110, 110]) |
|
|
| class ToTensor(object): |
| def __init__(self): |
| pass |
|
|
| def __call__(self, inputs): |
| return F.to_mytensor(inputs) |
|
|
| class RGB2Lab(object): |
| def __init__(self): |
| pass |
|
|
| def __call__(self, inputs): |
| |
| |
|
|
| |
| return np.float32(color.rgb2lab(inputs)) |