【问题标题】:Tensorflow 1.4.1 google.protobuf.text_format.ParseError: 8:1张量流 1.4.1 google.protobuf.text_format.ParseError: 8:1
【发布时间】:2018-03-06 10:55:29
【问题描述】:

当我尝试使用来自 github https://github.com/tensorflow/models/tree/master/research 的 tensorflow/models 训练 object_detection 网络时,我收到以下错误:

Traceback (most recent call last):
  File "train.py", line 163, in <module>
    tf.app.run()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 48, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "train.py", line 100, in main
    train_input_config_path=FLAGS.input_config_path)
  File "/home/d_sperber/models_fixed/research/object_detection/utils/config_util.py", line 100, in get_configs_from_multiple_files
    text_format.Merge(f.read(), model_config)
  File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 533, in Merge
    descriptor_pool=descriptor_pool)
  File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 587, in MergeLines
    return parser.MergeLines(lines, message)
  File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 620, in MergeLines
    self._ParseOrMerge(lines, message)
  File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 635, in _ParseOrMerge
    self._MergeField(tokenizer, message)
  File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 703, in _MergeField
    (message_descriptor.full_name, name))
google.protobuf.text_format.ParseError: 8:1 : Message type "object_detection.protos.DetectionModel" has no field named "model".

我使用 models/research/object_detection 中的以下命令开始训练

python train.py --logtostderr --model_config_path=./my_tests/faster_rcnn.config --train_dir=./train
  • 我使用的是 tensorflow 1.4.1(我无法升级到 1.5,因为管理员由于某些原因无法安装 CUDA 9 版本)
  • 我用 Python 2.7 和 Python 3.5.2 都试过了
  • Ubuntu 16.04
  • Faster-RCNN 和 SSD 存在相同问题

我的 .config 文件如下所示

# Faster R-CNN with Inception v2, configuration for MSCOCO Dataset.
# Users should configure the fine_tune_checkpoint field in the train config as
# well as the label_map_path and input_path fields in the train_input_reader and
# eval_input_reader. Search for "PATH_TO_BE_CONFIGURED" to find the fields that
# should be configured.


model {
  faster_rcnn {
    num_classes: 1
    image_resizer {
      fixed_shape_resizer {
            height: 480
            width: 640
      }
    }
    feature_extractor {
      type: 'faster_rcnn_inception_v2'
      first_stage_features_stride: 16
    }
    first_stage_anchor_generator {
      grid_anchor_generator {
        scales: [0.25, 0.5, 1.0, 2.0]
        aspect_ratios: [0.5, 1.0, 2.0]
        height_stride: 16
        width_stride: 16
      }
    }
    first_stage_box_predictor_conv_hyperparams {
      op: CONV
      regularizer {
        l2_regularizer {
          weight: 0.0
        }
      }
      initializer {
        truncated_normal_initializer {
          stddev: 0.01
        }
      }
    }
    first_stage_nms_score_threshold: 0.0
    first_stage_nms_iou_threshold: 0.7
    first_stage_max_proposals: 300
    first_stage_localization_loss_weight: 2.0
    first_stage_objectness_loss_weight: 1.0
    initial_crop_size: 14
    maxpool_kernel_size: 2
    maxpool_stride: 2
    second_stage_box_predictor {
      mask_rcnn_box_predictor {
        use_dropout: false
        dropout_keep_probability: 0.8
        fc_hyperparams {
          op: FC
          regularizer {
            l2_regularizer {
              weight: 0.0
            }
          }
          initializer {
            variance_scaling_initializer {
              factor: 1.0
              uniform: true
              mode: FAN_AVG
            }
          }
        }
      }
    }
    second_stage_post_processing {
      batch_non_max_suppression {
        score_threshold: 0.0
        iou_threshold: 0.6
        max_detections_per_class: 100
        max_total_detections: 300
      }
      score_converter: SOFTMAX
    }
    second_stage_localization_loss_weight: 2.0
    second_stage_classification_loss_weight: 1.0
  }
}

train_config: {
  batch_size: 2
  optimizer {
    momentum_optimizer: {
      learning_rate: {
        manual_step_learning_rate {
          initial_learning_rate: 0.0002
          schedule {
            step: 0
            learning_rate: .0002
          }
          schedule {
            step: 90000
            learning_rate: .0001
          }
          schedule {
            step: 120000
            learning_rate: .00002
          }
          schedule {
            step: 180000
            learning_rate: .000002
          }
          schedule {
            step: 250000
            learning_rate: .000001
          }
        }
      }
      momentum_optimizer_value: 0.9
    }
    use_moving_average: false
  }
  gradient_clipping_by_norm: 10.0
  fine_tune_checkpoint: "/home/d_sperber/pretrained_models/inception_v2.ckpt"
  from_detection_checkpoint: false
  num_steps: 800000
  data_augmentation_options {
    random_horizontal_flip {
    }
  }
}

train_input_reader: {
  tf_record_input_reader {
    input_path: "/mnt/bigtmp/datasets/rrlab/unreal/Pawlak/unreal_training.tfrecord"
  }
  label_map_path: "/home/d_sperber/TF_Training/unreal_label_map.pbtxt"

}

eval_config: {
  num_examples: 10
}

eval_input_reader: {
  tf_record_input_reader {
    input_path: "/mnt/bigtmp/datasets/rrlab/unreal/Pawlak/unreal_eval.tfrecord"
  }
  label_map_path: "/home/d_sperber/caltech-pedestrian-dataset-converter/data/caltech_tf/label_map.pbtxt"
  shuffle: true
  num_readers: 1
}

你有什么想法吗?

【问题讨论】:

    标签: python tensorflow neural-network protocol-buffers


    【解决方案1】:

    检查您是否正确设置模型目录。例如,您应该将 RCNN 模型路径引入“pipeline_config_path”。

    这个问题只和型号介绍有关。

    【讨论】:

    • 您应该检查模型路径、模型和您设置的参数。如果您使用的是 0 工人,请检查管道
    猜你喜欢
    • 1970-01-01
    • 2017-11-05
    • 2017-06-14
    • 2022-07-04
    • 1970-01-01
    • 2017-12-01
    • 2019-08-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多