win10环境下deeplabV3报错:module tensorflow._api.v1.compat has no attribute v2

问题:AttributeError: module 'tensorflow._api.v1.compat' has no attribute 'v2'

win10环境下deeplabV3报错:module tensorflow._api.v1.compat has no attribute v2_第1张图片

确实很恶心的问题,本来很久没有涉及了,忽然又要使用。网上也没有一个明确的方法。或者对或者错,乱起八糟。

https://github.com/tensorflow/models/issues/8088

直到看这个受到一些启发,即将以前的版本拿来使用不就欧克了吗!

 

上诉问题的主要愿意是因为版本更新后的问题,目前使用的版本为tensorflow-1.13.1。

好了解决方法:下载这个文件https://github.com/tensorflow/models/archive/v1.13.0.zip 

win10环境下deeplabV3报错:module tensorflow._api.v1.compat has no attribute v2_第2张图片

打开之后为:

win10环境下deeplabV3报错:module tensorflow._api.v1.compat has no attribute v2_第3张图片

在\models-1.13.0\research\deeplab中添加slim中的net文件夹。如下图:

win10环境下deeplabV3报错:module tensorflow._api.v1.compat has no attribute v2_第4张图片

win10环境下deeplabV3报错:module tensorflow._api.v1.compat has no attribute v2_第5张图片

将net文件夹添加进deeplab文件夹中:

win10环境下deeplabV3报错:module tensorflow._api.v1.compat has no attribute v2_第6张图片

其中有些文件是我自己添加的,比如:

这些都是为了deeplab的训练添加的。想知道相关知识,请查看我的其他关于deeplab的博客(不过不喜勿喷就是了,有问题呢,请说出来,互相学习)

添加完了之后,原本feature_extractor.py中。

from nets.mobilenet import mobilenet_v2

这句话将调用你添加的nets文件夹中的内容,而不是本来安装库中的链接库。

即使用原来的版本,解决问题。

 

 

 

你可能感兴趣的:(tensorflow,python,tensorflow,人工智能)