У меня были проблемы с tenorpack с самого начала, последняя - ошибка подтверждения при вызове функции TrainTowerContext
class TrainTowerContext(BaseTowerContext):
def __init__(self, ns_name, vs_name='', index=0, total=1):
"""
Args:
index (int): index of this tower, only used in training.
total (int): total number of towers to be built.
"""
super(TrainTowerContext, self).__init__(ns_name, vs_name)
self._is_training = True
self.index = int(index)
self.total = int(total)
if self.index > 0:
assert self.total > self.index, "(index, total) = ({}, {})".format(self.index, self.total)
vs = tf.get_variable_scope()
assert vs.name == '', "Cannot nest TrainTowerContext with an existing variable scope!"
if self.has_own_variables:
assert not vs.reuse, \
"Cannot create tower {} under reuse=True!".format(ns_name)
Это ошибка, которая появляется:
Traceback (most recent call last):
File "train_multi_gpu.py", line 161, in <module>
tf.app.run()
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/platform/app.py", line 126, in run
_sys.exit(main(argv))
File "train_multi_gpu.py", line 157, in main
train()
File "train_multi_gpu.py", line 86, in train
optimizer=optimizer, freeze_variable_func=freeze_variable_func)
File "/content/Distilling-Object-Detectors-Shuffledet-master/lib/utils/model_deploy.py", line 350, in deploy
clones = create_clones(config, model_fn, args)
File "/content/Distilling-Object-Detectors-Shuffledet-master/lib/utils/model_deploy.py", line 191, in create_clones
outputs = model_fn(*args, **kwargs)
File "/content/Distilling-Object-Detectors-Shuffledet-master/lib/models/shuffleDet_sup.py", line 74, in model_fn
self._add_forward_graph(student)
File "/content/Distilling-Object-Detectors-Shuffledet-master/lib/models/shuffleDet_sup.py", line 246, in _add_forward_graph
with TowerContext(tf.get_default_graph().get_name_scope(), is_training=mc.IS_TRAINING):#with TowerContext(tf.get_default_graph().get_name_scope(), is_training=mc.IS_TRAINING, index=int(tf.get_default_graph().get_name_scope()[-1])):
File "/usr/local/lib/python3.6/dist-packages/tensorpack/tfutils/tower.py", line 243, in TowerContext
return TrainTowerContext(tower_name, vs_name=vs_name)
File "/usr/local/lib/python3.6/dist-packages/tensorpack/tfutils/tower.py", line 183, in __init__
"Cannot create tower {} under reuse=True!".format(ns_name)
AssertionError: Cannot create tower clone_1 under reuse=True!
Буду признателен за любые указания. Для справки я пытаюсь отфильтровать сеть с произвольным доступом enet и использую этот код: https://github.com/twangnh/Distilling-Object-Detectors-Shuffledet