TransWikia.com

How to use keras.utils.Sequence with multiple files

Data Science Asked by SantoshGupta7 on December 2, 2020

I am looking at the documentation and this guide

https://www.tensorflow.org/api_docs/python/tf/keras/utils/Sequence

https://stanford.edu/~shervine/blog/keras-how-to-generate-data-on-the-fly

And I need to write in

def __len__(self):

and

def __getitem__(self, idx):

Which gets the length of the dataset, and the getting a data sample using a particular index. So I am wondering if this is appropriate to use for multiple files, and if so, are there any best practices for this?

One Answer

The Sequence class from keras works great with multiple files. I've personally created a custom data generator using the Sequence class to load and pre-process multiple files. You should be able to figure it out using this post, I've found it to be very easy to follow the process of creating a custom data generator step by step.

Answered by Oxbowerce on December 2, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP