尝试重新训练tensorflow模型时,输入和输出节点消失
我正在尝试使用MobileNet_V2重新训练tensorflow deeplab模型。我已经从deeplab model zoo下载了检查点,大约在本页的一半: 具体来说,就是那个。我希望我重新训练的输出具有与此相同的图形,但参数不同。(好吧,几乎相同的图,最后的张量应该有不同的形状,因为我尝试使用不同数量的类。) 我将自己的图像组装到一个tfrecord中,目前只标记了一个类。这是一个具有4个类的数据集的实践 然后我运行以下命令重新训练网络,生成尝试重新训练tensorflow模型时,输入和输出节点消失,tensorflow,Tensorflow,我正在尝试使用MobileNet_V2重新训练tensorflow deeplab模型。我已经从deeplab model zoo下载了检查点,大约在本页的一半: 具体来说,就是那个。我希望我重新训练的输出具有与此相同的图形,但参数不同。(好吧,几乎相同的图,最后的张量应该有不同的形状,因为我尝试使用不同数量的类。) 我将自己的图像组装到一个tfrecord中,目前只标记了一个类。这是一个具有4个类的数据集的实践 然后我运行以下命令重新训练网络,生成.pbtxt、.meta、.index和.da
.pbtxt
、.meta
、.index
和.data-00000-of-00001
文件:
PATH_TO_INITIAL_CHECKPOINT=/path/to/unzipped/files/model.ckpt-30000.index
PATH_TO_TRAIN_DIR=/path/to/checkpoints/
PATH_TO_DATASET=/path/to/tfrecord
python /path/to/tensorflow/models/research/deeplab/train.py \
--logtostderr \
--training_number_of_steps=900 \ # 90000 \
--train_split="train" \
--model_variant="mobilenet_v2" \
--output_stride=16 \
--decoder_output_stride=4 \
--train_crop_size=128 \
--train_crop_size=128 \
--train_batch_size=1 \
--dataset="cityscapes" \
--tf_initial_checkpoint=${PATH_TO_INITIAL_CHECKPOINT} \
--train_logdir=${PATH_TO_TRAIN_DIR} \
--dataset_dir=${PATH_TO_DATASET} \
--initialize_last_layer=False \
--last_layers_contain_logits_only=True \
--fine_tune_batch_norm=False
在下载的文件上运行bazel的Summary_图可以得到:
Found 1 possible inputs: (name=ImageTensor, type=uint8(4), shape=[1,?,?,3])
No variables spotted.
Found 1 possible outputs: (name=SemanticPredictions, op=Slice)
当我扫描.pbtxt
文件的节点时,我找不到任何称为ImageTensor或SemanticPredictions的节点。我尝试过tensorboard、bazel的Summary_图和编程(例如,or)。汇总图显示未发现输入
,发现664个可能的输出:
这会导致冻结图.py
出现问题。如果我从tensorbord上看到的内容中选择output\u node\u names
,然后运行freeze\u graph.py
,我就能得到一个冻结的图形。但是运行这个模型让我
TypeError: Cannot interpret feed_dict key as Tensor: The name
'ImageTensor:0' refers to a Tensor which does not exist. The operation,
'ImageTensor', does not exist in the graph.
我肯定是做错了什么。问题是:什么?我怀疑这可能是我为train.py提供的论点,但实际上,这只是一个猜测。这可能是因为train.py
的使用方式不同,或者deeplab的train.py
与MobileNetV2不兼容
编辑:仔细查看train.py中可用的选项后,我更新了命令。从TRAIN_DIR中清除以前的故障型号也有助于避免错误:
Restoring from checkpoint failed. This is most likely due to a mismatch
between the current graph and the graph from the checkpoint. Please ensure
that you have not altered the graph expected based on the checkpoint.
我确实在这个问题上悬赏了,但已经过期了。如果有人能找到答案,我很乐意再次悬赏。(相关问题:为什么赏金到期后不退还给我?我想你不会希望人们提供赏金,然后把它留给自己,但由于没有答案,这在这里并不适用。)哦。“所有的奖金都是预先支付的,在任何情况下都是不可退还的。”显然,它的目的是更类似于广告而不是奖励。