AttributeError:模块'tensorflow'没有属性'log'-日志错误

时间:2020-07-28 09:59:16

标签: tensorflow keras cnn

#以推理模式创建模型 使用tf.device(DEVICE)从tensorflow导入keras 导入tensorflow作为tf 模型= modellib.MaskRCNN(mode =“ inference”,model_dir = MODEL_DIR, config = config)`

# load the last best model you trained # weights_path = model.find_last()[1] custom_WEIGHTS_PATH = '/home/unni/my_project_work/car-damage-detection-using-CNN-master/logs/scratch20190612T2046/mask_rcnn_scratch_0013.h5' # Load weights print(“ Loading weights”,custom_WEIGHTS_PATH) model.load_weights(custom_WEIGHTS_PATH,by_name = True)`

这是错误 AttributeError:用户代码中:

/home/unni/my_project_work/car-damage-detection-using-CNN-master/mrcnn/model.py:391 call  *
    roi_level = log2_graph(tf.sqrt(h * w) / (224.0 / tf.sqrt(image_area)))
/home/unni/my_project_work/car-damage-detection-using-CNN-master/mrcnn/model.py:342 log2_graph  *
    return tf.log(x) / tf.log(2.0)

请帮助

1 个答案:

答案 0 :(得分:0)

您正在使用Tensorflow的当前版本,以上代码在较旧的版本中有效。 使用这些代码行,您将很高兴:

!pip install tensorflow==1.15.3

!pip install --no-deps keras==2.2.4