Dataloader memory and speed management for big dataset


I was wondering between the two strategies for dataset classes, which one would be the most efficient :

  • In the dataset classe, should I load into memory all the images knowing that I have a RAM of 120 go, and just access them in get item. This keep my GPU memory always around 100% used.
  • Or should I load my images in the get item function, limiting the use of the RAM, but my GPU RAM is cycling between being fully used to a bit less etc…

I implemented both but I don’t know which strategy to choose.