【问题标题】:How to know which scopes to exclude or to train when fine tuning a pre-trained model with TensorFlow slim?使用 TensorFlow slim 微调预训练模型时,如何知道要排除或训练哪些范围?
【发布时间】:2018-08-18 18:37:46
【问题描述】:

我想用我自己的图像数据集在 TensorFlow slim 中微调预训练的 resnet_v1_50。但是我的数据集不够大,无法调整整个网络。我想逐层查看范围名称,然后我可以知道要排除哪些范围以及要训练哪些范围。有谁知道这样做的方法

【问题讨论】:

    标签: python tensorflow resnet pre-trained-model


    【解决方案1】:

    现在回答可能为时已晚。我自己正在寻找与 renet_v2 和“InceptionResnetV2/Logits,InceptionResnetV2/AuxLogits”相关的这些东西,这些对我有用。您尝试在此处更改名称,或者如果您可以向我发送模型的链接,您可以使用此代码打印名称。只需给出模型的路径即可。

    from tensorflow.python.tools.inspect_checkpoint import print_tensors_in_checkpoint_file
    from tensorflow.python import pywrap_tensorflow
    import os
    
    
    checkpoint_path = os.path.join(os.getcwd(), "pnasnet/model.ckpt")
    # print_tensors_in_checkpoint_file(file_name=checkpoint_path,all_tensors=False, tensor_name='')
    
    reader = pywrap_tensorflow.NewCheckpointReader(checkpoint_path)
    items = []
    items.append(reader.debug_string().decode("utf-8"))
    
    
    with open('pnasnet/pnasnet.txt', 'w') as f:
        for item in items:
            f.write("%s\n" % item)
            print(item)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-07-25
      • 1970-01-01
      • 2019-04-10
      • 2019-01-22
      • 2017-08-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多