Interesting! I think you can still apply the approach of saving the spectrogram results as images in compressed files, then loading them using PIL. I don’t know how much accuracy you would lose by compressing that data, but it’s always a tradeoff…
That’s the approach taken in this blog post 32 in the beginning. The second part of the post shows on-the-fly FFT generation during training, which might also be a valid approach, if you have the original files available?
I don’t know how fast the on-the-fly FFT generation is, but the compressed image method is guaranteed to be faster than loading raw numpy arrays.