def __getitem__(self, idx): image = Image.open( os.path.join(self._configs["data_path"], self._stage, self._pixels[idx])) # print(image.size) # pixels = self._pixels[idx] # pixels = list(map(int, pixels.split(" "))) image = np.asarray(image).reshape(48, 48) image = image.astype(np.uint8) image = cv2.resize(image, self._image_size) image = np.dstack([image] * 3) if self._stage == "train": image = seg(image=image) if self._stage == "test" and self._tta == True: images = [seg(image=image) for i in range(self._tta_size)] # images = [image for i in range(self._tta_size)] images = list(map(self._transform, images)) # target = self._emotions.iloc[idx].idxmax() return images import torch image = self._transform(image) target = np.argmax(self._emotions.iloc[idx].values ) #self._emotions.iloc[idx]#.idxmax() return image, target
def __getitem__(self, idx): image_path, label = self._data[idx] image_path = os.path.join(self._configs['data_path'], image_path) image = cv2.imread(image_path) image = cv2.resize(image, self._image_size) if self._stage == 'train': image = seg(image=image) if self._stage == 'test' and self._tta == True: images = [seg(image=image) for i in range(self._tta_size)] images = list(map(self._transform, images)) return images, expression image = self._transform(image) return image, label
def __getitem__(self, idx): path = self._path_list[idx] image = cv2.imread(self._configs['data_path'] + '/' + path) image = cv2.resize(image, (224, 224)) if self._stage == 'train': image = seg(image=image) if self._stage == 'test' and self._tta == True: images = [seg(image=image) for i in range(self._tta_size)] images = list(map(self._transform, images)) target = self._emotions.iloc[idx].idxmax() return images, target image = self._transform(image) target = self._emotions.iloc[idx].idxmax() return image, target
def __getitem__(self, idx): data = self._data[idx] data = cv2.imread(data) image = cv2.resize(data,self._image_size) image = image.astype(np.uint8) if self._stage == 'train': image = seg(image=image) if self._stage == 'test' and self._tta == True: images = [seg(image=image) for i in range(self._tta_size)] # images = [image for i in range(self._tta_size)] images = list(map(self._transform, images)) target = int(self._data[idx].split(os.path.sep)[-2]) return images, target image = self._transform(image) target = int(self._data[idx].split(os.path.sep)[-2]) return image, target
def __getitem__(self, idx): image_name, image, label = self._data[idx] image = cv2.resize(image, self._image_size) assert image.shape[2] == 3 assert label <= 7 and label >= 0 if self._stage == "train": image = seg(image=image) return self._transform(image), label
def __getitem__(self, idx): pixels = self._pixels[idx] pixels = list(map(int, pixels.split(" "))) image = np.asarray(pixels).reshape(48, 48) image = image.astype(np.uint8) image = cv2.resize(image, self._image_size) image = np.dstack([image] * 3) if self._stage == "train": image = seg(image=image) if self._stage == "test" and self._tta == True: images = [seg(image=image) for i in range(self._tta_size)] # images = [image for i in range(self._tta_size)] images = list(map(self._transform, images)) target = self._emotions.iloc[idx].idxmax() return images, target image = self._transform(image) target = self._emotions.iloc[idx].idxmax() return image, target
def __getitem__(self, idx): image_name = self._image_name[idx] image_path = self._configs["data_path"] + "/" + image_name image = cv2.imread(image_path) image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) image = cv2.resize(image, self._image_size) image = np.dstack([image] * 3) if self._stage == "train": image = seg(image=image) if self._stage == "test" and self._tta == True: images = [seg(image=image) for i in range(self._tta_size)] # images = [image for i in range(self._tta_size)] images = list(map(self._transform, images)) target = self._emotions.iloc[idx].idxmax() return images, target image = self._transform(image) target = self._emotions.iloc[idx].idxmax() return image, target