Tensorflow slim resnet_v2() 得到了一个意外的关键字参数 'spatial_squeeze'

Tensorflow slim resnet_v2() got an unexpected keyword argument 'spatial_squeeze'

我正在研究 Tensorflow Slim Resnet_v2 模型。我的tensorflow版本是(1.4.0),python版本是(3.5.4)。我正在使用 2 个标签作为输出进行图像分类。我正在使用 tensorflow Slim resnet_v2 模型进行此分类。当我尝试 运行 以下代码时

predictions,_ = nets.resnet_v2.resnet_v2(x,num_classes=2, is_training=True,
                                      global_pool=True,spatial_squeeze=True)

我收到以下错误。

Traceback (most recent call last):

File "<ipython-input-2-a112bf21d73f>", line 1, in <module>
runfile('D:/Users/apxcm/Mammo_Transfer_learning/inception_fulltrain_azure.py', wdir='D:/Users/apxcm/Mammo_Transfer_learning')

File "D:\Users\apxcm\AppData\Local\Continuum\anaconda3\envs\nnet\lib\site-packages\spyder\utils\site\sitecustomize.py", line 710, in runfile
execfile(filename, namespace)

File "D:\Users\apxcm\AppData\Local\Continuum\anaconda3\envs\nnet\lib\site-packages\spyder\utils\site\sitecustomize.py", line 101, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)

File "D:/Users/apxcm/Mammo_Transfer_learning/inception_fulltrain_azure.py", line 367, in <module>
main()

File "D:/Users/apxcm/Mammo_Transfer_learning/inception_fulltrain_azure.py", line 361, in main
resnet_full_classification()

File "D:/Users/apxcm/Mammo_Transfer_learning/inception_fulltrain_azure.py", line 326, in resnet_full_classification
predictions,_ = nets.resnet_v2.resnet_v2(x,num_classes=2, is_training=True,global_pool=True,spatial_squeeze=True)

TypeError: resnet_v2() got an unexpected keyword argument 'spatial_squeeze'

我交叉检查,tensorflow slim 源代码 (https://github.com/tensorflow/models/blob/master/research/slim/nets/resnet_v2.py) 和第 159 行指出 spatial_squeeze 可用。我不明白为什么我不能使用这个论点。这可能是因为tensorflow版本吗?如果是这样,请告诉我应该使用哪个版本。

请通过将 Resnet 代码直接粘贴到您的系统中或 fork TF slim 库来直接导入库。