TypeError: Axis must be specified when shapes of a and weights differ.
@Mhaiyang did you happen to find the solution to this issue?
I have solved this issue.
modify self.keras_model.fit_generator() in model.py
validation_data=val_generator to validation_data=next(val_generator)
In my case (using K.ctc_batch_cost()) I had to wrap it with K.mean() so that the loss is scalar to the whole batch.
next(val_generator) will likely use just the first sample all the time.
This happened to me when calling test_generator(). To fix this, I simply looped over test_on_batch() by hand as such:
loss = 0
for _ in range(NUM_OF_BATCHES):
x, y = next(test_generator)
loss += model.test_on_batch(x,y)
Hope this helps
Most helpful comment
I have solved this issue.
modify self.keras_model.fit_generator() in model.py
validation_data=val_generator to validation_data=next(val_generator)