You don’t need to pass in image names or even provide a list of images when using ImageFolder. It expects images to be in the typical ‘/class1/[images…]’  ‘/class2/[images…
]’ organization on disk so you only need to pass in the directory to create your training and test set (assuming you have separate directories for training and testing).
For example, the root parameter 1 should just be the path to the directory containing each of the class directories.
If you need to manually separate the sets, you can create a new directory structure for each of the classes and move the corresponding images for the test set to the new directories. Separating the images ahead of time is the easiest way to use ImageFolder if you are not doing cross-validation.