天天看点

成功解决AttributeError: module tensorflow.image has no attribute resize

解决方法

   b4 = Lambda(lambda x: tf.image.resize(x, size_before[1:3],   # 20200529 本文件内此后代码均直接替代!b4 = Lambda(lambda x: tf.compat.v1.image.resize(x, size_before[1:3],

                                                   method='bilinear', align_corners=True))(b4)

替换为

#     b4 = Lambda(lambda x: tf.compat.v1.image.resize(x, size_before[1:3],  

#                                                     method='bilinear', align_corners=True))(b4)

   b4 = Lambda(lambda x: tf.image.resize_bilinear(x, size_before[1:3],   # 20200529 本文件内此后代码均直接替代!b4 = Lambda(lambda x: tf.compat.v1.image.resize(x, size_before[1:3],

                                                   align_corners=True))(b4)

哈哈,大功告成!

继续阅读