赞
踩
主要是由于代码是基于tensorflow1.0编写的,目前最新的版本是2.0,版本更新比较大,很多方法已经改名,或者弃用。多数报错为 has no attribute 'xxx'
为确保高版本的TF支持低版本的TF代码,升级脚本加入了 compat.v1 模块。
此模块将以等效的 tf.compat.v1.foo 引用代替表单 tf.foo 的调用。
不过,建议您手动检查此类替代方案,并尽快将其迁移至 tf.* 命名空间(代替 tf.compat.v1.* 命名空间)中的新 API。
还有一些其他模块,新的版本中方法名有所变动
File "/home/mist/1DeepAdverserialRegulariser/ClassFiles/util.py", line 5, in <module>
from skimage.measure import compare_ssim as ssim
模块已经改名
修改/home/mist/1DeepAdverserialRegulariser/ClassFiles/util.py
改为
from skimage.metrics import structural_similarity as ssim
Traceback (most recent call last):
File "Adversarial_Regulariser.py", line 3, in <module>
from ClassFiles.data_pips import LUNA
File "/home/mist/1DeepAdverserialRegulariser/ClassFiles/data_pips.py", line 7, in <module>
from scipy.misc import imresize
ImportError: cannot import name 'imresize' from 'scipy.misc' (/home/mist/anaconda3/lib/python3.8/site-packages/scipy/misc/__init__.py)
imresize已经弃用。使用PIL中的方法代替:
from scipy.misc import imresize
改为
from PIL import Image
def reshape_pic(self, pic):
pic = ut.normalize_image(pic)
pic = imresize(pic, [128, 128]) 这行要修改
pic = ut.scale_to_unit_intervall(pic)
return pic
pic = imresize(pic, [128, 128])
改为
pic = np.array(Image.fromarray(pic).resize((128,128)))
Training Data found: 0
Evaluation Data found: 0
/home/mist/anaconda3/lib/python3.8/site-packages/odl/tomo/backends/skimage_radon.py:144: FutureWarning: 'filter' is a deprecated argument name for `iradon`. It will be removed in version 0.19. Please use 'filter_name' instead.
backproj = iradon(skimage_sinogram.asarray().T, theta,
Traceback (most recent call last):
File "Adversarial_Regulariser.py", line 37, in <module>
experiment = Experiment1(DATA_PATH, SAVES_PATH)
File "/home/mist/1DeepAdverserialRegulariser/ClassFiles/Framework.py", line 120, in __init__
super(AdversarialRegulariser, self).__init__(data_path, saves_path)
File "/home/mist/1DeepAdverserialRegulariser/ClassFiles/Framework.py", line 45, in __init__
self.sess = tf.InteractiveSession()
AttributeError: module 'tensorflow' has no attribute 'InteractiveSession'
从compat.v1 模块引入
self.sess = tf.InteractiveSession()
改为
self.sess = tf.compat.v1.InteractiveSession()
2021-09-15 19:29:35.788948: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1510] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 9649 MB memory: -> device: 0, name: NVIDIA GeForce RTX 2080 Ti, pci bus id: 0000:03:00.0, compute capability: 7.5
Traceback (most recent call last):
File "Adversarial_Regulariser.py", line 37, in <module>
experiment = Experiment1(DATA_PATH, SAVES_PATH)
File "/home/mist/1
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。