首页 > 解决方案 > 在 raise_from_not_ok_status 六.raise_from(core._status_to_exception(e.code, message), None)

问题描述

系统信息

问题

我正在尝试构建和训练一个对象检测模型(使用 ssd_resnet50_v1_fpn)来配置一个具有 train.tfrecord、test.tfrecord 和 label_map.pbtxt 路径的管道。以 TFRecord 格式导出项目时,我从 cvat.org 获取最后一个文件。

信息/日志

我跑: python model_main_tf2.py --model_dir=models/my_ssd_resnet50_v1_fpn --pipeline_config_path=models/my_ssd_resnet50_v1_fpn/pipeline.config

在我读到的下面:

to use the following CPU instructions in performance-critical operations: AVX AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2021-10-26 10:36:04.117867: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1510] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 3967 MB memory:
-> device: 0, name: NVIDIA GeForce RTX 2060, pci bus id: 0000:01:00.0, compute capability: 7.5
INFO:tensorflow:Using MirroredStrategy with devices ('/job:localhost/replica:0/task:0/device:GPU:0',)
I1026 10:36:04.304352 16668 mirrored_strategy.py:369] Using MirroredStrategy with devices ('/job:localhost/replica:0/task:0/device:GPU:0',)
INFO:tensorflow:Maybe overwriting train_steps: None
I1026 10:36:04.309246 16668 config_util.py:552] Maybe overwriting train_steps: None
INFO:tensorflow:Maybe overwriting use_bfloat16: False
I1026 10:36:04.309246 16668 config_util.py:552] Maybe overwriting use_bfloat16: False
WARNING:tensorflow:From C:\Users\donat\anaconda3\envs\doEnv\lib\site-packages\object_detection\model_lib_v2.py:557: StrategyBase.experimental_distribute_datasets_from
function (from tensorflow.python.distribute.distribute_lib) is deprecated and will be removed in a future version.
Instructions for updating:
rename to distribute_datasets_from_function
W1026 10:36:04.327197 16668 deprecation.py:339] From C:\Users\donat\anaconda3\envs\doEnv\lib\site-packages\object_detection\model_lib_v2.py:557: StrategyBase.experime
ntal_distribute_datasets_from_function (from tensorflow.python.distribute.distribute_lib) is deprecated and will be removed in a future version.
Instructions for updating:
rename to distribute_datasets_from_function
INFO:tensorflow:Reading unweighted datasets: ['annotations\Train.tfrecord']
I1026 10:36:04.334176 16668 dataset_builder.py:163] Reading unweighted datasets: ['annotations\Train.tfrecord']
INFO:tensorflow:Reading record datasets for input file: ['annotations\Train.tfrecord']
I1026 10:36:04.646700 16668 dataset_builder.py:80] Reading record datasets for input file: ['annotations\Train.tfrecord']
INFO:tensorflow:Number of filenames to read: 1
I1026 10:36:04.646700 16668 dataset_builder.py:81] Number of filenames to read: 1
WARNING:tensorflow:num_readers has been reduced to 1 to match input file shards.
W1026 10:36:04.648099 16668 dataset_builder.py:87] num_readers has been reduced to 1 to match input file shards.
WARNING:tensorflow:From C:\Users\donat\anaconda3\envs\doEnv\lib\site-packages\object_detection\builders\dataset_builder.py:101: parallel_interleave (from tensorflow.p
ython.data.experimental.ops.interleave_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.data.Dataset.interleave(map_func, cycle_length, block_length, num_parallel_calls=tf.data.AUTOTUNE) instead. If sloppy execution is desired, use tf.data.Opti ons.experimental_deterministic.
W1026 10:36:04.654085 16668 deprecation.py:339] From C:\Users\donat\anaconda3\envs\doEnv\lib\site-packages\object_detection\builders\dataset_builder.py:101: parallel
interleave (from tensorflow.python.data.experimental.ops.interleave_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.data.Dataset.interleave(map_func, cycle_length, block_length, num_parallel_calls=tf.data.AUTOTUNE) instead. If sloppy execution is desired, use tf.data.Opti ons.experimental_deterministic.
WARNING:tensorflow:From C:\Users\donat\anaconda3\envs\doEnv\lib\site-packages\object_detection\builders\dataset_builder.py:236: DatasetV1.map_with_legacy_function (fr
om tensorflow.python.data.ops.dataset_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.data.Dataset.map() W1026 10:36:04.688991 16668 deprecation.py:339] From C:\Users\donat\anaconda3\envs\doEnv\lib\site-packages\object_detection\builders\dataset_builder.py:236: DatasetV1 .map_with_legacy_function (from tensorflow.python.data.ops.dataset_ops) is deprecated and will be removed in a future version. Instructions for updating: Use tf.data.Dataset.map()
WARNING:tensorflow:From C:\Users\donat\anaconda3\envs\doEnv\lib\site-packages\tensorflow\python\util\dispatch.py:206: sparse_to_dense (from tensorflow.python.ops.spar
se_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Create a tf.sparse.SparseTensor and use tf.sparse.to_dense instead.
W1026 10:36:10.687601 16668 deprecation.py:339] From C:\Users\donat\anaconda3\envs\doEnv\lib\site-packages\tensorflow\python\util\dispatch.py:206: sparse_to_dense (fr
om tensorflow.python.ops.sparse_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Create a tf.sparse.SparseTensor and use tf.sparse.to_dense instead.
WARNING:tensorflow:From C:\Users\donat\anaconda3\envs\doEnv\lib\site-packages\tensorflow\python\util\dispatch.py:206: sample_distorted_bounding_box (from tensorflow.p
ython.ops.image_ops_impl) is deprecated and will be removed in a future version.
Instructions for updating:
seed2 arg is deprecated.Use sample_distorted_bounding_box_v2 instead.
W1026 10:36:13.237039 16668 deprecation.py:339] From C:\Users\donat\anaconda3\envs\doEnv\lib\site-packages\tensorflow\python\util\dispatch.py:206: sample_distorted_bo
unding_box (from tensorflow.python.ops.image_ops_impl) is deprecated and will be removed in a future version.
Instructions for updating:
seed2 arg is deprecated.Use sample_distorted_bounding_box_v2 instead.
WARNING:tensorflow:From C:\Users\donat\anaconda3\envs\doEnv\lib\site-packages\tensorflow\python\autograph\impl\api.py:464: to_float (from tensorflow.python.ops.math_o
ps) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.cast instead.
W1026 10:36:14.707938 16668 deprecation.py:339] From C:\Users\donat\anaconda3\envs\doEnv\lib\site-packages\tensorflow\python\autograph\impl\api.py:464: 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.
2021-10-26 10:36:16.954501: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:185] None of the MLIR Optimization Passes are enabled (registered 2)
Traceback (most recent call last):
File "D:\programmi\tensorflow\workspace\training_demo\model_main_tf2.py", line 115, in
tf.compat.v1.app.run()
File "C:\Users\donat\anaconda3\envs\doEnv\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\donat\anaconda3\envs\doEnv\lib\site-packages\absl\app.py", line 303, in run
_run_main(main, args)
File "C:\Users\donat\anaconda3\envs\doEnv\lib\site-packages\absl\app.py", line 251, in _run_main
sys.exit(main(argv))
File "D:\programmi\tensorflow\workspace\training_demo\model_main_tf2.py", line 106, in main
model_lib_v2.train_loop(
File "C:\Users\donat\anaconda3\envs\doEnv\lib\site-packages\object_detection\model_lib_v2.py", line 599, in train_loop
load_fine_tune_checkpoint(
File "C:\Users\donat\anaconda3\envs\doEnv\lib\site-packages\object_detection\model_lib_v2.py", line 394, in load_fine_tune_checkpoint
_ensure_model_is_built(model, input_dataset, unpad_groundtruth_tensors)
File "C:\Users\donat\anaconda3\envs\doEnv\lib\site-packages\object_detection\model_lib_v2.py", line 159, in _ensure_model_is_built
features, labels = iter(input_dataset).next()
File "C:\Users\donat\anaconda3\envs\doEnv\lib\site-packages\tensorflow\python\distribute\input_lib.py", line 689, in next
return self.next()
File "C:\Users\donat\anaconda3\envs\doEnv\lib\site-packages\tensorflow\python\distribute\input_lib.py", line 693, in next
return self.get_next()
File "C:\Users\donat\anaconda3\envs\doEnv\lib\site-packages\tensorflow\python\distribute\input_lib.py", line 731, in get_next
self._iterators[i].get_next_as_list_static_shapes(new_name))
File "C:\Users\donat\anaconda3\envs\doEnv\lib\site-packages\tensorflow\python\distribute\input_lib.py", line 1951, in get_next_as_list_static_shapes
return self._format_data_list_with_options(self._iterator.get_next())
File "C:\Users\donat\anaconda3\envs\doEnv\lib\site-packages\tensorflow\python\data\ops\multi_device_iterator_ops.py", line 573, in get_next
result.append(self._device_iterators[i].get_next())
File "C:\Users\donat\anaconda3\envs\doEnv\lib\site-packages\tensorflow\python\data\ops\iterator_ops.py", line 814, in get_next
return self._next_internal()
File "C:\Users\donat\anaconda3\envs\doEnv\lib\site-packages\tensorflow\python\data\ops\iterator_ops.py", line 744, in _next_internal
ret = gen_dataset_ops.iterator_get_next(
File "C:\Users\donat\anaconda3\envs\doEnv\lib\site-packages\tensorflow\python\ops\gen_dataset_ops.py", line 2727, in iterator_get_next
_ops.raise_from_not_ok_status(e, name)
File "C:\Users\donat\anaconda3\envs\doEnv\lib\site-packages\tensorflow\python\framework\ops.py", line 6941, in raise_from_not_ok_status
six.raise_from(core._status_to_exception(e.code, message), None)
File "", line 3, in raise_from
tensorflow.python.framework.errors_impl.InvalidArgumentError: Input is empty.
[[{{node case/cond/else/_10/case/cond/cond_jpeg/else/_105/case/cond/cond_jpeg/decode_image/DecodeImage}}]]
[[MultiDeviceIteratorGetNextFromShard]]
[[RemoteCall]] [Op:IteratorGetNext] ```

标签: tensorflowmachine-learningobject-detectionobject-detection-apitfrecord

解决方案


推荐阅读