Skip to content Skip to sidebar Skip to footer

Loading Data From Custom Data-loader In Pytorch Only If The Data Specifies A Certain Condition

I have a CSV file with filename in the first column and a label for the filename in the second column. I also have a third column, which specifies something about the data (whether

Solution 1:

You get that error because the dataloader has to return something. Here are three solutions:

  1. There is a libary called nonechucks which lets you create dataloaders in which you can skip samples.
  2. Usually you could preprocess/clean your data and kick the unwanted samples out.
  3. You could return some indicator that the sample is unwanted, for example
if"y":
    return data, target
else:
    return -1

And then you could check in your train loop if the "data" is -1 and skip the iteration. I hope this was helpful :)

Post a Comment for "Loading Data From Custom Data-loader In Pytorch Only If The Data Specifies A Certain Condition"