当我尝试执行train.py时发生错误

时间:2019-12-12 17:14:42

标签: tensorflow object-detection object-detection-api

执行时

python train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/faster_rcnn_inception_v2_pets.config

我收到此错误:

WARNING:tensorflow: The TensorFlow contrib module will not be included
in TensorFlow 2.0. For more information, please see:   *
https://github.com/tensorflow/community/blob/master/rfcs/20180907-contrib-sunset.md
* https://github.com/tensorflow/addons   * https://github.com/tensorflow/io (for I/O related ops) If you depend
on functionality not listed there, please file an issue.

WARNING:tensorflow:From train.py:55: The name tf.logging.set_verbosity
is deprecated. Please use tf.compat.v1.logging.set_verbosity instead.

WARNING:tensorflow:From train.py:55: The name tf.logging.INFO is
deprecated. Please use tf.compat.v1.logging.INFO instead.

WARNING:tensorflow:From train.py:167: The name tf.app.run is
deprecated. Please use tf.compat.v1.app.run instead.

WARNING:tensorflow:From train.py:89: The name tf.gfile.MakeDirs is
deprecated. Please use tf.io.gfile.makedirs instead.

W1212 22:01:57.353342  3060 deprecation_wrapper.py:119] From
train.py:89: The name tf.gfile.MakeDirs is deprecated. Please use
tf.io.gfile.makedirs instead.

WARNING:tensorflow:From
c:\users\aamir\desktop\models\research\object_detection\utils\config_util.py:86:
The name tf.gfile.GFile is deprecated. Please use tf.io.gfile.GFile
instead.

W1212 22:01:57.354341  3060 deprecation_wrapper.py:119] From
c:\users\aamir\desktop\models\research\object_detection\utils\config_util.py:86:
The name tf.gfile.GFile is deprecated. Please use tf.io.gfile.GFile
instead.

WARNING:tensorflow:From train.py:94: The name tf.gfile.Copy is
deprecated. Please use tf.io.gfile.copy instead.

W1212 22:01:57.358338  3060 deprecation_wrapper.py:119] From
train.py:94: The name tf.gfile.Copy is deprecated. Please use
tf.io.gfile.copy instead.

WARNING:tensorflow:From
c:\users\aamir\desktop\models\research\object_detection\anchor_generators\grid_anchor_generator.py:59:
to_float (from tensorflow.python.ops.math_ops) is deprecated and will
be removed in a future version. Instructions for updating: Use
`tf.cast` instead. W1212 22:01:57.401396  3060 deprecation.py:323]
From
c:\users\aamir\desktop\models\research\object_detection\anchor_generators\grid_anchor_generator.py:59:
to_float (from tensorflow.python.ops.math_ops) is deprecated and will
be removed in a future version. Instructions for updating: Use
`tf.cast` instead. INFO:tensorflow:Scale of 0 disables regularizer.
I1212 22:01:57.406377  3060 regularizers.py:98] Scale of 0 disables
regularizer. INFO:tensorflow:Scale of 0 disables regularizer. I1212
22:01:57.406377  3060 regularizers.py:98] Scale of 0 disables
regularizer. WARNING:tensorflow:From
c:\users\aamir\desktop\models\research\object_detection\trainer.py:228:
create_global_step (from
tensorflow.contrib.framework.python.ops.variables) is deprecated and
will be removed in a future version. Instructions for updating: Please
switch to tf.train.create_global_step W1212 22:01:57.408376  3060
deprecation.py:323] From
c:\users\aamir\desktop\models\research\object_detection\trainer.py:228:
create_global_step (from
tensorflow.contrib.framework.python.ops.variables) is deprecated and
will be removed in a future version. Instructions for updating: Please
switch to tf.train.create_global_step WARNING:tensorflow:From
c:\users\aamir\desktop\models\research\object_detection\data_decoders\tf_example_decoder.py:104:
The name tf.FixedLenFeature is deprecated. Please use
tf.io.FixedLenFeature instead.

W1212 22:01:57.413390  3060 deprecation_wrapper.py:119] From
c:\users\aamir\desktop\models\research\object_detection\data_decoders\tf_example_decoder.py:104:
The name tf.FixedLenFeature is deprecated. Please use
tf.io.FixedLenFeature instead.

WARNING:tensorflow:From
c:\users\aamir\desktop\models\research\object_detection\data_decoders\tf_example_decoder.py:119:
The name tf.VarLenFeature is deprecated. Please use
tf.io.VarLenFeature instead.

W1212 22:01:57.414372  3060 deprecation_wrapper.py:119] From
c:\users\aamir\desktop\models\research\object_detection\data_decoders\tf_example_decoder.py:119:
The name tf.VarLenFeature is deprecated. Please use
tf.io.VarLenFeature instead.

Traceback (most recent call last):   File "train.py", line 167, in
<module>
    tf.app.run()   File "C:\Users\Aamir\Anaconda3\lib\site-packages\tensorflow\python\platform\app.py",
line 40, in run
    _run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)   File
"C:\Users\Aamir\Anaconda3\lib\site-packages\absl\app.py", line 299, in
run
    _run_main(main, args)   File "C:\Users\Aamir\Anaconda3\lib\site-packages\absl\app.py", line 250, in
_run_main
    sys.exit(main(argv))   File "train.py", line 163, in main
    worker_job_name, is_chief, FLAGS.train_dir)   File "c:\users\aamir\desktop\models\research\object_detection\trainer.py",
line 235, in train
    train_config.prefetch_queue_capacity, data_augmentation_options)   File
"c:\users\aamir\desktop\models\research\object_detection\trainer.py",
line 59, in create_input_queue
    tensor_dict = create_tensor_dict_fn()   File "train.py", line 120, in get_next
    dataset_builder.build(config)).get_next()   File "c:\users\aamir\desktop\models\research\object_detection\builders\dataset_builder.py",
line 138, in build
    label_map_proto_file=label_map_proto_file)   File "c:\users\aamir\desktop\models\research\object_detection\data_decoders\tf_example_decoder.py",
line 195, in __init__
    use_display_name)   File "c:\users\aamir\desktop\models\research\object_detection\utils\label_map_util.py",
line 149, in get_label_map_dict
    label_map = load_labelmap(label_map_path)   File "c:\users\aamir\desktop\models\research\object_detection\utils\label_map_util.py",
line 129, in load_labelmap
    label_map_string = fid.read()   File "C:\Users\Aamir\Anaconda3\lib\site-packages\tensorflow\python\lib\io\file_io.py",
line 122, in read
    self._preread_check()   File "C:\Users\Aamir\Anaconda3\lib\site-packages\tensorflow\python\lib\io\file_io.py",
line 84, in _preread_check
    compat.as_bytes(self.__name), 1024 * 512) tensorflow.python.framework.errors_impl.NotFoundError:
NewRandomAccessFile failed to Create/Open:
C:/Users/Aamir/Desktop/models/research/object_detection/training/object-detection.pbtxt
: The system cannot find the file specified. ; No such file or
directory

1 个答案:

答案 0 :(得分:0)

在代码中的某处使用文件C:/Users/Aamir/Desktop/models/research/object_detection/training/object-detection.pbtxt 但它不见了。也许此文件位于其他文件夹中,或者您输入错误