PIPELINE_CONFIG_PATH=/Users/kraisler/Desktop/raccoon_tutorial/models/model/ssd_mobilenet_v1_pets.config
MODEL_DIR=/Users/kraisler/Desktop/raccoon_tutorial/models/model
NUM_TRAIN_STEPS=50000
SAMPLE_1_OF_N_EVAL_EXAMPLES=1
python object_detection/model_main.py \
--pipeline_config_path=${PIPELINE_CONFIG_PATH} \
--model_dir=${MODEL_DIR} \
--num_train_steps=${NUM_TRAIN_STEPS} \
--sample_1_of_n_eval_examples=$SAMPLE_1_OF_N_EVAL_EXAMPLES \
--alsologtostderr
You can collect some of this information using our environment capture script:
https://github.com/tensorflow/tensorflow/tree/master/tools/tf_env_collect.sh
You can obtain the TensorFlow version with
python -c "import tensorflow as tf; print(tf.GIT_VERSION, tf.VERSION)"
I am following this tutorial: https://towardsdatascience.com/how-to-train-your-own-object-detector-with-tensorflows-object-detector-api-bec72ecfe1d9
I did everything. Protoc is installed, the object detector test tensor flow provided worked, everything. I enter the following at the research directory in the object detection API:
PIPELINE_CONFIG_PATH=/Users/kraisler/Desktop/raccoon_tutorial/models/model/ssd_mobilenet_v1_pets.config
MODEL_DIR=/Users/kraisler/Desktop/raccoon_tutorial/models/model
NUM_TRAIN_STEPS=50000
SAMPLE_1_OF_N_EVAL_EXAMPLES=1
python object_detection/model_main.py \
--pipeline_config_path=${PIPELINE_CONFIG_PATH} \
--model_dir=${MODEL_DIR} \
--num_train_steps=${NUM_TRAIN_STEPS} \
--sample_1_of_n_eval_examples=$SAMPLE_1_OF_N_EVAL_EXAMPLES \
--alsologtostderr
and I get the error in the title. I have no idea what this means.
OUGL-2-NW-C04-M:research kraisler$ PIPELINE_CONFIG_PATH=/Users/kraisler/Desktop/raccoon_tutorial/models/model/ssd_mobilenet_v1_pets.config
OUGL-2-NW-C04-M:research kraisler$ MODEL_DIR=/Users/kraisler/Desktop/raccoon_tutorial/models/model
OUGL-2-NW-C04-M:research kraisler$ NUM_TRAIN_STEPS=50000
OUGL-2-NW-C04-M:research kraisler$ SAMPLE_1_OF_N_EVAL_EXAMPLES=1
OUGL-2-NW-C04-M:research kraisler$ python object_detection/model_main.py \
--pipeline_config_path=${PIPELINE_CONFIG_PATH} \ --model_dir=${MODEL_DIR} \ --num_train_steps=${NUM_TRAIN_STEPS} \ --sample_1_of_n_eval_examples=$SAMPLE_1_OF_N_EVAL_EXAMPLES \ --alsologtostderr/Users/kraisler/models/research/object_detection/utils/visualization_utils.py:27: UserWarning:
This call to matplotlib.use() has no effect because the backend has already
been chosen; matplotlib.use() must be called before pylab, matplotlib.pyplot,
or matplotlib.backends is imported for the first time.
The backend was originally set to 'MacOSX' by the following code:
File "object_detection/model_main.py", line 26, in
from object_detection import model_lib
File "/Users/kraisler/models/research/object_detection/model_lib.py", line 27, in
from object_detection import eval_util
File "/Users/kraisler/models/research/object_detection/eval_util.py", line 27, in
from object_detection.metrics import coco_evaluation
File "/Users/kraisler/models/research/object_detection/metrics/coco_evaluation.py", line 20, in
from object_detection.metrics import coco_tools
File "/Users/kraisler/models/research/object_detection/metrics/coco_tools.py", line 47, in
from pycocotools import coco
File "/usr/local/lib/python2.7/site-packages/pycocotools/coco.py", line 49, in
import matplotlib.pyplot as plt
File "/usr/local/lib/python2.7/site-packages/matplotlib/pyplot.py", line 71, in
from matplotlib.backends import pylab_setup
File "/usr/local/lib/python2.7/site-packages/matplotlib/backends/__init__.py", line 16, in
line for line in traceback.format_stack()
import matplotlib; matplotlib.use('Agg') # pylint: disable=multiple-statements
WARNING:tensorflow:Forced number of epochs for all eval validations to be 1.
W1114 20:29:31.596975 140735970734976 tf_logging.py:125] Forced number of epochs for all eval validations to be 1.
WARNING:tensorflow:Expected number of evaluation epochs is 1, but instead encountered eval_on_train_input_config.num_epochs = 0. Overwriting num_epochs to 1.
W1114 20:29:31.597275 140735970734976 tf_logging.py:125] Expected number of evaluation epochs is 1, but instead encountered eval_on_train_input_config.num_epochs = 0. Overwriting num_epochs to 1.
WARNING:tensorflow:Estimator's model_fn (
W1114 20:29:31.597842 140735970734976 tf_logging.py:125] Estimator's model_fn (
WARNING:tensorflow:num_readers has been reduced to 0 to match input file shards.
W1114 20:29:31.619033 140735970734976 tf_logging.py:125] num_readers has been reduced to 0 to match input file shards.
WARNING:tensorflow:From /Users/kraisler/models/research/object_detection/builders/dataset_builder.py:80: parallel_interleave (from tensorflow.contrib.data.python.ops.interleave_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.data.experimental.parallel_interleave(...).
W1114 20:29:31.685348 140735970734976 tf_logging.py:125] From /Users/kraisler/models/research/object_detection/builders/dataset_builder.py:80: parallel_interleave (from tensorflow.contrib.data.python.ops.interleave_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.data.experimental.parallel_interleave(...).
Traceback (most recent call last):
File "object_detection/model_main.py", line 109, in
tf.app.run()
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 125, in run
_sys.exit(main(argv))
File "object_detection/model_main.py", line 105, in main
tf.estimator.train_and_evaluate(estimator, train_spec, eval_specs[0])
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/estimator/training.py", line 471, in train_and_evaluate
return executor.run()
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/estimator/training.py", line 610, in run
return self.run_local()
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/estimator/training.py", line 711, in run_local
saving_listeners=saving_listeners)
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/estimator/estimator.py", line 354, in train
loss = self._train_model(input_fn, hooks, saving_listeners)
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/estimator/estimator.py", line 1207, in _train_model
return self._train_model_default(input_fn, hooks, saving_listeners)
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/estimator/estimator.py", line 1234, in _train_model_default
input_fn, model_fn_lib.ModeKeys.TRAIN))
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/estimator/estimator.py", line 1075, in _get_features_and_labels_from_input_fn
self._call_input_fn(input_fn, mode))
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/estimator/estimator.py", line 1162, in _call_input_fn
return input_fn(*kwargs)
File "/Users/kraisler/models/research/object_detection/inputs.py", line 479, in _train_input_fn
batch_size=params['batch_size'] if params else train_config.batch_size)
File "/Users/kraisler/models/research/object_detection/builders/dataset_builder.py", line 134, in build
config.input_path[:], input_reader_config)
File "/Users/kraisler/models/research/object_detection/builders/dataset_builder.py", line 80, in read_dataset
sloppy=config.shuffle))
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/data/ops/dataset_ops.py", line 1190, in apply
dataset = transformation_func(self)
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/data/experimental/ops/interleave_ops.py", line 87, in _apply_fn
buffer_output_elements, prefetch_input_elements)
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/data/ops/readers.py", line 134, in __init__
cycle_length, block_length)
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/data/ops/dataset_ops.py", line 2714, in __init__
super(InterleaveDataset, self).__init__(input_dataset, map_func)
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/data/ops/dataset_ops.py", line 2677, in __init__
experimental_nested_dataset_support=True)
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/data/ops/dataset_ops.py", line 1860, in __init__
self._function.add_to_graph(ops.get_default_graph())
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/framework/function.py", line 479, in add_to_graph
self._create_definition_if_needed()
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/framework/function.py", line 335, in _create_definition_if_needed
self._create_definition_if_needed_impl()
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/framework/function.py", line 344, in _create_definition_if_needed_impl
self._capture_by_value, self._caller_device)
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/framework/function.py", line 864, in func_graph_from_py_func
outputs = func(func_graph.inputs)
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/data/ops/dataset_ops.py", line 1794, in tf_data_structured_function_wrapper
ret = func(*nested_args)
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/data/ops/readers.py", line 200, in __init__
filenames = ops.convert_to_tensor(filenames, dtype=dtypes.string)
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1050, in convert_to_tensor
as_ref=False)
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1146, in internal_convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 983, in _TensorTensorConversionFunction
(dtype.name, t.dtype.name, str(t)))
ValueError: Tensor conversion requested dtype string for Tensor with dtype float32: 'Tensor("arg0:0", shape=(), dtype=float32, device=/device:CPU:0)'
I just want to say I have been at this for a very very long time. I'm kind aggravated. I would greatly greatly greatly appreciate it if anyone helped me. Yes, I did search for this error and no none of the methods I found worked.
Have you checked the *.record PATH
Have you checked the *.record PATH
Where is that located? My .bash_profile folder?
I solve the same problem... check out your input config, 'coco_train.record-00095-of-00100' are not consistent with 'mscoco_train.record-00095-of-00100'
I solve the same problem... check out your input config, 'coco_train.record-00095-of-00100' are not consistent with 'mscoco_train.record-00095-of-00100'
thank a lot~~~~
The error is thrown when the path to the record files is not right. I would recommend adding the whole path to the train and test records file in the data folder in the .config file. Will definitely work and get rid of this particular error.
I ran from /research and the path tf.records is research/object_detection/data/train.records but still not working. Any help?
check out your tfrecord files in train input reader input path
Hi There,
We are checking to see if you still need help on this, as this seems to be considerably old issue. Please update this issue with the latest information, code snippet to reproduce your issue and error you are seeing.
If we don't hear from you in the next 7 days, this issue will be closed automatically. If you don't need help on this issue any more, please consider closing this.
Most helpful comment
I solve the same problem... check out your input config, 'coco_train.record-00095-of-00100' are not consistent with 'mscoco_train.record-00095-of-00100'