[Tensorflow][对象检测] 尝试使用 --num_clones=2 进行训练时出现 ValueError

KoS*_*KoS 7 python object-detection tensorflow

我想在多个 CPU 上训练,所以我运行这个命令

C:\Users\solution\Desktop\Tensorflow\research>python object_detection/train.py --logtostderr --pipeline_config_path=C:\Users\solution\Desktop\Tensorflow\myFolder\power_drink.config --train_dir=C:\Users \solution\Desktop\Tensorflow\research\object_detection\train --num_clones=2 --clone_on_cpu=True

我收到以下错误

回溯(最近一次调用):文件“object_detection/train.py”,第 169 行,在 tf.app.run() 文件“C:\Users\solution\AppData\Local\Programs\Python\Python35\lib\site -packages\tensorflow\python\platform\app.py", line 124, in run _sys.exit(main(argv)) 文件 "object_detection/train.py", line 165, in main worker_job_name, is_chief, FLAGS.train_dir)文件“C:\Users\solution\Desktop\Tensorflow\research\object_detection\trainer.py”,第 246 行,在 train clones = model_deploy.create_clones(deploy_config, model_fn, [input_queue]) 文件“C:\Users\solution\ Desktop\Tensorflow\research\slim\deployment\model_deploy.py”,第 193 行,在 create_clones 输出 = model_fn(*args, **kwargs) 文件“C:\Users\solution\Desktop\Tensorflow\research\object_detection\trainer.py”中。py”,第 158 行,在 _create_losses train_config.merge_multiple_label_boxes 中)ValueError:没有足够的值来解包(预期为 7,得到 0)

如果我将 num_clones 设置为 1 或省略它,它可以正常工作。我也尝试设置 --ps_tasks=1 这没有帮助

任何意见,将不胜感激

Ale*_*cha 3

我通过稍微更改原始配置中的一个参数解决了这个问题:

...
train_config: {
  fine_tune_checkpoint: "C:/some_path/model.ckpt"
  batch_size: 1
  sync_replicas: true
  startup_delay_steps: 0
  replicas_to_aggregate: 8
  num_steps: 25000
  ...
}
...
Run Code Online (Sandbox Code Playgroud)

更改参数replicas_to_aggregate: 1或设置sync_replicas: false两者都可以解决我的问题,因为我只在一张显卡上进行训练并且没有任何副本(就像在 TPU 上训练时一样)。