TensorFlow对象检测train_config文件错误



因此,我试图重新训练一个只有一个类的Fast_RCNN对象检测模型,我试图在本地(在VM上)和ML引擎进行同时运行。但是,我一直在train_config文件中遇到相同的错误,但是,这是abort_rcnn_resnet50_coco.config configuration的适应:

trackback(最近的最新调用):文件"/usr/lib/python2.7/runpy.py", 第174行,在_run_module_as_main中 文件"/usr/lib/python2.7/runpy.py",第72行,in _run_code exec in run_globals文件 "/root/.local/lib/python2.7/site-packages/trainer/task.py",第171行, 在tf.app.run(main = main,argv = [sys.argv [0]] unparsed)文件中 "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", 第125行,在运行_sys.exit(main(argv))文件中 "/root/.local/lib/python2.7/site-packages/trainer/task.py",第142行, 在tf.estimator.train_and_evaluate中 eval_specs [0])文件 "/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/training.py", 第471行,在train_and_evaluate returt executor.run()文件中 "/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/training.py", 第637行,在运行getAttr(self,task_to_run)()文件中 "/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/training.py", 第674行,run_master self._start_distributed_training(savey_listeners = savey_listeners) 文件 "/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/training.py", 第788行,在_start_distributed_training savey_listeners = savey_listeners)文件 "/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/estimator.py", 第354行,在火车损失中= self._train_model(input_fn,钩子, 保存_listeners)文件 "/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/estimator.py", 第1207行,在_train_model返回self._train_model_default(input_fn, 挂钩,保存_listeners)文件 "/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/estimator.py", 第1234行,在_train_model_default input_fn中 model_fn_lib.modekeys.train))文件 "/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/estimator.py", 第1075行,在_get_features_and_labels_from_input_fn self._call_input_fn(input_fn,模式))文件 "/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/estimator.py", 第1162行,在_call_input_fn返回input_fn(** kwargs)文件 "/root/.local/lib/python2.7/site-packages/trainer/object_detection/inputs.py", 第375行,在_train_input_fn rish TypeError('用于训练模式, train_config必须是'TypeError:对于训练模式, train_config必须是train_pb2.trainconfig。

我花了很长时间在配置文件中寻找此问题的潜在原因,但是我看不到问题出在哪里。除了TF源代码本身,似乎没有任何文档提到这一点。任何洞察力都将不胜感激!

    model {
  faster_rcnn {
    num_classes: 1
    image_resizer {
      fixed_shape_resizer {
        height: 600
        width: 205
      }
    }
    feature_extractor {
      type: 'faster_rcnn_resnet50'
      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: 1.0
        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: 5
  optimizer {
    momentum_optimizer: {
      learning_rate: {
        exponential_decay_learning_rate {
          initial_learning_rate: 0.0003
          decay_steps: 500
          decay_factor: 0.9
        }
      }
      momentum_optimizer_value: 0.9
    }
    use_moving_average: false
  }
  gradient_clipping_by_norm: 10.0
  fine_tune_checkpoint: "gs://ml-pipeline/checkpoints/fast_rcnn_resnet50/model.ckpt-5500"
  from_detection_checkpoint: true
  load_all_detection_checkpoint_vars: true
  num_steps: 2000
  data_augmentation_options {
    normalize_image {
    }
    random_pixel_value_scale {
    }
    random_adjust_brightness {
    }
    random_jitter_boxes {
    }
    random_pad_image {
    }
  }
  max_number_of_boxes: 35
}
train_input_reader: {
  tf_record_input_reader {
    input_path: "gs://ml-pipeline/data/tf-records/train.record"
  }
  label_map_path: "gs://ml-pipeline/story_label_map.pbtxt"
}
eval_config {
  num_examples: 54
  num_visualizations: 54
  eval_interval_secs: 10
  max_evals: 1
  #use_moving_averages: false
}
eval_input_reader: {
  tf_record_input_reader {
    input_path: "gs://ml-pipeline/data/tf-records/test.record"
  }
  label_map_path: "gs://ml-pipeline/story_label_map.pbtxt"
  shuffle: false
  num_readers: 1
}

我在这里没有看到任何明显的错误。您能做到这一点以调试:

添加print type(configs['train_config'])print configs['train_config']到这里

让我知道什么是印刷?

相关内容

  • 没有找到相关文章

最新更新