自定义对象培训张量流错误

时间:2018-05-06 19:35:04

标签: python opencv tensorflow object-detection-api

我想根据我的研究训练一组图像。按照本教程,最终会出现错误。这是我关注的教程。 Tutorial

我在python 3.6中实现了这个项目,tensorflow最新及其CPU版本,而我正在运行执行以根据教程训练模型,它给出了这样的错误。

    Instructions for updating:
    Please switch to tf.train.create_global_step
    INFO:tensorflow:Scale of 0 disables regularizer.
    INFO:tensorflow:Scale of 0 disables regularizer.
    INFO:tensorflow:depth of additional conv before box predictor: 0
    WARNING:tensorflow:From C:\tensorflow1\models\research\object_detection\core\box_predictor.py:403: calling reduce_mean (from tensorflow.python.ops.math_ops) with keep_dims is deprecated and will be removed in a future version.
    Instructions for updating:
    keep_dims is deprecated, use keepdims instead
    INFO:tensorflow:Scale of 0 disables regularizer.
    WARNING:tensorflow:From C:\tensorflow1\models\research\object_detection\core\losses.py:317: softmax_cross_entropy_with_logits (from tensorflow.python.ops.nn_ops) is deprecated and will be removed in a future version.
    Instructions for updating:

    Future major versions of TensorFlow will allow gradients to flow
    into the labels input on backprop by default.

    See @{tf.nn.softmax_cross_entropy_with_logits_v2}.

    Traceback (most recent call last):
      File "train.py", line 167, in <module>
        tf.app.run()
      File "C:\Anaconda\envs\tensorflow\lib\site-packages\tensorflow\python\platform\app.py", line 126, in run
        _sys.exit(main(argv))
      File "train.py", line 163, in main
        worker_job_name, is_chief, FLAGS.train_dir)
      File "C:\tensorflow1\models\research\object_detection\trainer.py", line 284, in train
        train_config.optimizer)
      File "C:\tensorflow1\models\research\object_detection\builders\optimizer_builder.py", line 50, in build
        learning_rate = _create_learning_rate(config.learning_rate)
      File "C:\tensorflow1\models\research\object_detection\builders\optimizer_builder.py", line 109, in _create_learning_rate
        learning_rate_sequence, config.warmup)
      File "C:\tensorflow1\models\research\object_detection\utils\learning_schedules.py", line 156, in manual_stepping
        raise ValueError('First step cannot be zero.')
    ValueError: First step cannot be zero.

为什么我会遇到这种错误?请帮我解决这个问题。

1 个答案:

答案 0 :(得分:0)

我在这里找到了解决方法:

https://github.com/tensorflow/models/issues/3794

基本上,从您的training / faster_rcnn_inception_v2_pets.config(或任何您命名的文件)文件中删除以下代码:

schedule {
   step: 0
   learning_rate: .0001
}

如果您要查找的是确切的文本,则可能找不到,在我的代码中,该文本为learning_rate:.0002。无论如何,希望能有所帮助。