所以我试图重新训练一个fast_rcnn对象检测模型,只有一个类,我试图在本地(在VM上)和ML引擎上运行。我继续遇到与train_config文件相同的错误,但这是对faster_rcnn_resnet50_coco.config配置的改编:
回溯(最近一次调用最后一次):文件“/usr/lib/python2.7/runpy.py”,第174行,在_run_module_as_main“main”,fname,loader,pkg_name)文件“/usr/lib/python2.7/ runpy.py“,第72行,在run_globals文件中的_run_code exec代码中”/root/.local/lib/python2.7/site-packages/trainer/task.py“,第171行,在tf.app.run(main = main,argv = [sys.argv [0]] + unparsed)运行_sys中的文件“/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py”,第125行.exit(main(argv))文件“/root/.local/lib/python2.7/site-packages/trainer/task.py”,第142行,主要是tf.estimator.train_and_evaluate(estimator,train_spec,eval_specs [ 0])文件“/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/training.py”,第471行,在train_and_evaluate中返回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行,在ru n_master self._start_distributed_training(saving_listeners = saving_listeners)文件“/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/training.py”,第788行,在_start_distributed_training中保存save_listeners = saving_listeners)文件“/ usr /local/lib/python2.7/dist-packages/tensorflow/python/estimator/estimator.py“,第354行,列车损失= self._train_model(input_fn,hooks,saving_listeners)文件”/ usr / local / lib / python2.7 / dist-packages / tensorflow / python / estimator / estimator.py“,第1207行,在_train_model中返回self._train_model_default(input_fn,hooks,saving_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,mode))文件”/usr/local/lib/python2.7/dist-packages/tensorflow/python/estima tor / 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引发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']
添加到here
让我知道什么是印刷品?