PyTorch - loading images without sub folders
First of all I wanted to say that I am new to PyTorch, so i apologize in advice if the level of my questions is not that high.
I was wondering if you can help me with something (I actually have 2 questions). The story behind them: I am working on image classification. My test data is divided into sub folders based on their labels and I am loading them via DataLoader.

First question:
1) Is it true that if you have trained your model with specific batch sized, testing it with other sizes will affect the accuracy?
2) Is there a way to load and use the model with test data located in a single folder (without sub folders). DataLoader needs sub folders as far as i know.

Thank you in advance!


It depends if you're using operations that depend on other items in the batch. If you're using things like batch normalization it may, but in general if your network processes batch items separately, it doesn't.
If you check the documentation of torch.utils.data.Dataset, you will see that a dataset essentially only requires the __len__ and __getitem__ methods, where the former says how many items the dataset contains and the latter gets the ith item - be it an image and a label, an image and its segmentation mask, or other things. There is nothing stopping you from writing a custom Dataset. I suggest you take a look at source code of DatasetFolder and modify it according to your needs.

