I am building a VAE loading huge dataset. The input data is 3D binary voxel data having the dimension like (batch_size, 48 , 48, 48). To load the data one by one in training, I build a generator as follows
class DataGenerator(keras.utils.Sequence):
def __init__(self, x_set, y_set, batch_size):
self.x = x_set # path for each dataset
self.y = y_set
self.batch_size = batch_size
def __len__(self):
return len(self.x) #batch size = data[0]
def __getitem__(self, idx):
batch_x = self.x[idx]
return np.load(batch_x).astype("float32"), None
After I tried to train the model, I got the error message like:
NotImplementedError: When subclassing the `Model` class, you should implement a `call` method.
But after tried again, somehow the model is running. Could anyone help me how to solve this problem?
And another question here, because this is not the classification problem and there is no label, I need to put just some x_test dataset without y values for validation, but I am getting errors like:
~\anaconda3\lib\site-packages\tensorflow\python\keras\engine\training.py in fit(self, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, steps_per_epoch, validation_steps, validation_batch_size, validation_freq, max_queue_size, workers, use_multiprocessing)
857
858 # Run validation.
--> 859 if validation_data and self._should_eval(epoch, validation_freq):
860 val_x, val_y, val_sample_weight = (
861 data_adapter.unpack_x_y_sample_weight(validation_data))
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
Please give a comment if someone has an experience to conduct the validation for this situation.
Thanks!!