我克隆了https://github.com/matterport/Mask_RCNN.git并尝试运行demo.ipynb
用这两行,
# Create model object in inference mode.
model = modellib.MaskRCNN(mode="inference", model_dir=MODEL_DIR, config=config)
# Load weights trained on MS-COCO
model.load_weights(COCO_MODEL_PATH, by_name=True)
我遇到以下错误
~\Desktop\Neuer Ordner\Mask RCNN\Mask_RCNN-master\mrcnn\model.py in log2_graph(x)
339 def log2_graph(x):
340 """Implementation of Log2. TF doesn't have a native implementation."""
--> 341 return tf.log(x) / tf.log(2.0)
342
343
AttributeError: module 'tensorflow' has no attribute 'log'
我遵循了https://github.com/matterport/Mask_RCNN/issues/1797的解决方案例如将tensorflow的版本控制降至1.13.1并使用tf.math.log()。但是没有任何帮助。
我也尝试运行一些日志功能。但是它返回了结果!我不知道问题出在哪里。
>>> z=tf.log(x)
>>> with tf.Session() as sess: print(z.eval())
...
[ -inf -0.6931472 0. 1.609438 ]
您可以使用tensorflow版本1.14.0通过安装此命令!pip install'tensorflow == 1.14.0',然后重新启动运行系统
通过运行此命令确保使用张量流版本为1.14
导入张量流]
print(tensorflow。版本
)