API overhead is not more than python dataset loader.
It depends on how you write the Custom Dataset.
If you load full data or buffer in init then getitem will be faster.
And if you want to keep RAM free, then load images in getitem