Untitled
unknown
python
4 years ago
545 B
1
Indexable
class Custom_Generator(tf.keras.utils.Sequence): def __init__(self, dataset_path, batch_size): self.dataset_path = dataset_path self.batch_size = batch_size def __len__(self): return (np.ceil(100 / float(self.batch_size))).astype(np.int) def __getitem__(self, idx): path = self.dataset_path + '/batch_' + str(idx * self.batch_size) + '.npy' batch_data = np.load(path) batch_X, batch_y = batch_data[0], batch_data[1] return batch_X, batch_y
Editor is loading...