Yes that looks good 
If creating your Dataset is too slow, you could consider buffering the work done in the __init__ and dump self.imgs_40x, self.imgs_20x and self.imgs_5x into a text file so that you can simply reload them if they exist in the __init__.