Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/362.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何使用Tensorflow对象检测API和tf.estimator执行自定义数据扩充?_Python_Tensorflow_Object Detection Api_Tensorflow Estimator_Data Augmentation - Fatal编程技术网

Python 如何使用Tensorflow对象检测API和tf.estimator执行自定义数据扩充?

Python 如何使用Tensorflow对象检测API和tf.estimator执行自定义数据扩充?,python,tensorflow,object-detection-api,tensorflow-estimator,data-augmentation,Python,Tensorflow,Object Detection Api,Tensorflow Estimator,Data Augmentation,我知道它们已经在model.config中提供,使用了如下内容: data_augmentation_options { random_adjust_contrast { } } 但是,我需要执行自己的数据扩充方法。下面是我用来训练探测器的当前代码: config = tf.estimator.RunConfig(model_dir=modelpath, keep_checkpoint_max=2, save_summary_steps=100/5) train_and

我知道它们已经在
model.config
中提供,使用了如下内容:

  data_augmentation_options {
    random_adjust_contrast {
    }
  }
但是,我需要执行自己的数据扩充方法。下面是我用来训练探测器的当前代码:

config = tf.estimator.RunConfig(model_dir=modelpath, keep_checkpoint_max=2, save_summary_steps=100/5)
train_and_eval_dict = model_lib.create_estimator_and_inputs(
    run_config=config,
    hparams=model_hparams.create_hparams(None),
    pipeline_config_path=pipelinepath,
    train_steps=trainsteps,
    eval_steps=evalsteps)
estimator = train_and_eval_dict['estimator']
train_input_fn = train_and_eval_dict['train_input_fn']
eval_input_fns = train_and_eval_dict['eval_input_fns']
eval_on_train_input_fn = train_and_eval_dict['eval_on_train_input_fn']
predict_input_fn = train_and_eval_dict['predict_input_fn']
train_steps = train_and_eval_dict['train_steps']

train_spec, eval_specs = model_lib.create_train_and_eval_specs(
        train_input_fn,
        eval_input_fns,
        eval_on_train_input_fn,
        predict_input_fn,
        train_steps,
        eval_on_train_data=False)

trainer_estimator = tf.estimator.train_and_evaluate(
    estimator, train_spec, eval_specs[0])
我试着用这样的东西来阅读
列车输入\u fn

iterator = train_input_fn().__iter__()
next_element = iterator.get_next()
x_next = next_element[0]
y_next = next_element[1]
x_true_image_shape = x_next.get('true_image_shape', 0)
我只能得到张量,但我不知道如何读取值,甚至不知道如何替换它们

我的想法是:

  • 读取
    列车输入\u fn
  • 在每个批次中添加我自己的增强方法
这样做是正确的还是有其他方法来实现这一目标