You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The image format was never changed to RGB. It needs image = image[:, :, ::-1] either before transpose or converting to tensor.
Or are the images grayscale?
For testing, the CommonTestDataset class. I'm assuming the images that cv2.imdecode(...) is loading were already in RGB format? or were they in BGR format as well?
classCommonTestDataset(Dataset):
""" Data processor for model evaluation. Attributes: image_root(str): root directory of test set. image_list_file(str): path of the image list file. crop_eye(bool): crop eye(upper face) as input or not. """def__init__(self, image_root, image_list_file, crop_eye=False):
self.image_root=image_rootself.image_list= []
image_list_buf=open(image_list_file)
line=image_list_buf.readline().strip()
whileline:
self.image_list.append(line)
line=image_list_buf.readline().strip()
self.mean=127.5self.std=128.0self.crop_eye=crop_eyedef__len__(self):
returnlen(self.image_list)
def__getitem__(self, index):
short_image_path=self.image_list[index]
image_path=os.path.join(self.image_root, short_image_path)
image=cv2.imdecode(np.fromfile(image_path, dtype=np.uint8), cv2.IMREAD_UNCHANGED)
#image = cv2.resize(image, (128, 128))ifself.crop_eye:
image=image[:60, :]
image= (image.transpose((2, 0, 1)) -self.mean) /self.stdimage=torch.from_numpy(image.astype(np.float32))
returnimage, short_image_path
Can you please clarify?
The text was updated successfully, but these errors were encountered:
The
ImageDataset
class intrain.py
in conventional training folder:The image format was never changed to RGB. It needs
image = image[:, :, ::-1]
either before transpose or converting to tensor.Or are the images grayscale?
For testing, the
CommonTestDataset
class. I'm assuming the images thatcv2.imdecode(...)
is loading were already in RGB format? or were they in BGR format as well?Can you please clarify?
The text was updated successfully, but these errors were encountered: