I have a dataframe of (224 * 224 * 3) columns representing the pixel values of image and last column is the binary classification label. How do i proceed with this data to pass it to a CNN
To do so, better way would be to first convert the dataframe to numpy 3d array, and then use
An even better approach would be to directly read csv file as numpy array instead of dataframe, and then convert it to torch.
hi @Ishvinder , after following your instructions, now i have a tensor of images and a list of label values. How i can use them with dataloader for passing it to cnn or is there any other method without it
Once you have all your data into a tensor, and you want to convert it into a DataLoader if I’m not wrong…
To do so, let’s say you have two tensors, one containing the labels, and other having the image data.
from torch.utils.data import TensorDataset, DataLoader dataset = TensorDataset(tensor_x,tensor_y) dataloader = DataLoader(my_dataset)