Hi,
My dataset frame and label sizes are below what i want to understand is how to make label(y)size = torch.Size([ ]) currently the code outputs Frame(x) shape :: torch.Size([32, 3, 224, 224]) Label(y) shape :: torch.Size([32])
This is my code:
def getitem(self, idx):
if torch.is_tensor(idx):
idx = idx.tolist()
frames = []
for fr in range(idx, idx+self.seq_len): # frames from idx to idx+seq_len
img_name = os.path.join(self.frames_list.iloc[fr, 0]) # path to image
image = Image.open(img_name)
image = image.resize((self.img_width, self.img_height))
if self.transform:
image = self.transform(image)
frames.append(image)
frames = torch.stack(frames)
frames = frames.permute(0, 1, 2, 3)
frames = torch.squeeze(frames, dim=1)
frames = (frames-torch.mean(frames))/torch.std(frames)*255
lab = np.array(self.frames_list.iloc[idx:idx + self.seq_len, 1])
labels = torch.tensor(lab, dtype=torch.float)
#labels = torch.empty(lab, dtype=torch.float)
#labels = torch.zeros(lab, dtype=torch.float)
sample = (frames, labels)
return sample