Mask_RCNN icon indicating copy to clipboard operation
Mask_RCNN copied to clipboard

MRCNN-TF2.5 upgrade: Exception has occurred: TypeError unhashable type: 'ListWrapper' when adding loss to keras model

Open lrpalmer27 opened this issue 1 year ago • 2 comments

I am updating MRCNN to work on TF2.5 and am running into this issue:

Exception has occurred: TypeError unhashable type: 'ListWrapper'

coming from: ----------------------------------------------------------

loss_orig = tf.reduce_mean(layer.output, keepdims=True) * self.config.LOSS_WEIGHTS.get(name, 1.) #original loss = tf.reduce_mean(input_tensor=layer.output, keepdims=True) * self.config.LOSS_WEIGHTS.get(name, 1.) #new

print("ref",self.config.LOSS_WEIGHTS.get(name, 1.)) print("ref",loss_orig) print("ref",loss)

self.keras_model.add_loss(loss)

This error happens at the start of training a new model, based on coco weights. I've trained this model before, on the same custom dataset using TF2.0.0, but need to upgrade TF versions such that the training can be pushed to the cloud compute service I am using (they don't let you use TF2.0.0).

I am using py3.7.9, and have taken keras out of the model completely. Up-to-date branch where i am experiencing this issue: https://github.com/lrpalmer27/Mask-RCNN-TF2/tree/python379_implementation

I am unsure why this issue is occurring; has anyone seen this issue before? Thanks in advance for any info/ideas/advice.

lrpalmer27 avatar Nov 02 '23 18:11 lrpalmer27

Hello, @lrpalmer27 I have same error. Did you solve ?

userwatch avatar Jun 05 '24 11:06 userwatch

Hi I was able to run it in colab.

userwatch avatar Jun 14 '24 15:06 userwatch