Mask_rcnn: TypeError: Axis must be specified when shapes of a and weights differ.

Created on 8 May 2018  路  4Comments  路  Source: matterport/Mask_RCNN

TypeError: Axis must be specified when shapes of a and weights differ.

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)

All 4 comments

@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

Was this page helpful?
0 / 5 - 0 ratings