【问题标题】:TenssorFlow: fine tune Inception v3 for image classificationTensorFlow:微调 Inception v3 用于图像分类
【发布时间】:2016-11-15 11:50:14
【问题描述】:

我是 TensorFlow 的新手。 我正在尝试按照以下示例微调 Inception v3 模型: https://github.com/tensorflow/models/tree/master/slim#Tuning

我已经运行了他的脚本:

python train_image_classifier.py \
--train_dir=${TRAIN_DIR} \
--dataset_name=flowers \
--dataset_split_name=train \
--dataset_dir=${DATASET_DIR} \
--model_name=inception_v3 \
--checkpoint_path=${PRETRAINED_CHECKPOINT_DIR}/inception_v3.ckpt \
--checkpoint_exclude_scopes=InceptionV3/Logits,InceptionV3/AuxLogits \
--trainable_scopes=InceptionV3/Logits,InceptionV3/AuxLogits \
--learning_rate=0.01 \
--learning_rate_decay_type=fixed \
--save_interval_secs=60 \
--save_summaries_secs=60 \
--log_every_n_steps=100 \
--weight_decay=0.00004

生成model.ckpt-XXXX文件。 如何将此文件转换为 pb 文件以便在 label_image 示例 (https://github.com/tensorflow/tensorflow/tree/master/tensorflow/examples/label_image) 中使用它?

谢谢。

【问题讨论】:

    标签: tensorflow


    【解决方案1】:

    model.ckpt 文件只有变量检查点,但没有graph def。您是否注意到还有一个名为model-ckpt-xxxxx.meta 的文件?该文件有graph def

    from tensorflow.python.framework import meta_graph
    from tensorflow.python.training import training_util
    
    mg = meta_graph.read_meta_graph_file("model-ckpt-xxxxx.meta")
    training_util.write_graph(mg.graph_def, "your/output/dir", "graph.pb", as_text=False)
    

    【讨论】:

      猜你喜欢
      • 2018-11-27
      • 1970-01-01
      • 2018-01-23
      • 2018-02-01
      • 2017-02-22
      • 2017-10-24
      • 1970-01-01
      • 1970-01-01
      • 2018-04-07
      相关资源
      最近更新 更多