Custom_MaskRCNN icon indicating copy to clipboard operation
Custom_MaskRCNN copied to clipboard

Issue while trying to train model

Open SamvdVoort opened this issue 4 years ago • 1 comments

So I have followed the Medium article and am trying to train the model on a custom dataset of floorplans. After working around some issues I found I am finally ready to train.

However, now I run into a new problem which I can not seem to fix myself. When trying to train on a custom dataset, I get the following error:

Traceback (most recent call last): File "custom.py", line 391, in <module> train(model) File "custom.py", line 222, in train layers='heads') File "C:\...\Custom_MaskRCNN-master\mrcnn\model.py", line 2356, in train self.compile(learning_rate, self.config.LEARNING_MOMENTUM) File "C:\...\Custom_MaskRCNN-master\mrcnn\model.py", line 2201, in compile self.keras_model.add_metric(loss, name) AttributeError: 'Model' object has no attribute 'add_metric'

This comes right after the model should start training, stating that it is starting at epoch 0. We are kind of at a loss, as we have been struggling to use this model for a couple of hours now.

If anybody knows a solution that would be very much appreciated.

SamvdVoort avatar Dec 27 '20 13:12 SamvdVoort

For the next person struggling with this.

This thread on Stackoverflow resolved it for me.

TL;DR:

  1. Use tf version 1.3.0, keras version 2.0.8.
  2. Comment out this line, replace with <self.keras_model.metric_tensors.append(loss)>. This makes the code run.

sadhoss avatar Jul 13 '21 19:07 sadhoss