Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: Tried to convert 't' to a tensor and failed. Error: Argument must be a dense tensor: range(0, 3) - got shape [3], but wanted []. #11

Closed
gharis opened this issue Mar 25, 2018 · 15 comments

Comments

@gharis
Copy link

gharis commented Mar 25, 2018

(tensorflow1) C:\tensorflow1\models\research\object_detection>python train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/faster_rcnn_inception_v2_pets.config
INFO:tensorflow:Scale of 0 disables regularizer.
INFO:tensorflow:Scale of 0 disables regularizer.
WARNING:tensorflow:From C:\tensorflow1\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
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:396: 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
WARNING:tensorflow:From C:\tensorflow1\models\research\object_detection\core\losses.py:316: 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 "C:\anaconda\envs\tensorflow1\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 510, in _apply_op_helper
preferred_dtype=default_dtype)
File "C:\anaconda\envs\tensorflow1\lib\site-packages\tensorflow\python\framework\ops.py", line 1036, in internal_convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "C:\anaconda\envs\tensorflow1\lib\site-packages\tensorflow\python\framework\constant_op.py", line 235, in _constant_tensor_conversion_function
return constant(v, dtype=dtype, name=name)
File "C:\anaconda\envs\tensorflow1\lib\site-packages\tensorflow\python\framework\constant_op.py", line 214, in constant
value, dtype=dtype, shape=shape, verify_shape=verify_shape))
File "C:\anaconda\envs\tensorflow1\lib\site-packages\tensorflow\python\framework\tensor_util.py", line 442, in make_tensor_proto
_GetDenseDimensions(values)))
ValueError: Argument must be a dense tensor: range(0, 3) - got shape [3], but wanted [].

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\anaconda\envs\tensorflow1\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 524, in _apply_op_helper
values, as_ref=input_arg.is_ref).dtype.name
File "C:\anaconda\envs\tensorflow1\lib\site-packages\tensorflow\python\framework\ops.py", line 1036, in internal_convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "C:\anaconda\envs\tensorflow1\lib\site-packages\tensorflow\python\framework\constant_op.py", line 235, in _constant_tensor_conversion_function
return constant(v, dtype=dtype, name=name)
File "C:\anaconda\envs\tensorflow1\lib\site-packages\tensorflow\python\framework\constant_op.py", line 214, in constant
value, dtype=dtype, shape=shape, verify_shape=verify_shape))
File "C:\anaconda\envs\tensorflow1\lib\site-packages\tensorflow\python\framework\tensor_util.py", line 442, in make_tensor_proto
_GetDenseDimensions(values)))
ValueError: Argument must be a dense tensor: range(0, 3) - got shape [3], but wanted [].

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "train.py", line 167, in
tf.app.run()
File "C:\anaconda\envs\tensorflow1\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 255, 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 169, in manual_stepping
[0] * num_boundaries))
File "C:\anaconda\envs\tensorflow1\lib\site-packages\tensorflow\python\ops\array_ops.py", line 2619, in where
return gen_math_ops._select(condition=condition, x=x, y=y, name=name)
File "C:\anaconda\envs\tensorflow1\lib\site-packages\tensorflow\python\ops\gen_math_ops.py", line 4503, in _select
"Select", condition=condition, t=x, e=y, name=name)
File "C:\anaconda\envs\tensorflow1\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 528, in _apply_op_helper
(input_name, err))
ValueError: Tried to convert 't' to a tensor and failed. Error: Argument must be a dense tensor: range(0, 3) - got shape [3], but wanted [].

(tensorflow1) C:\tensorflow1\models\research\object_detection>

I got this error when running train.py command. can you help?

@epratheeban
Copy link

epratheeban commented Mar 26, 2018

It's easy. Go to the utils folder. Find the learning_schedules.py file. Go to the line 167. And replace the line 167 with below

rate_index = tf.reduce_max(tf.where(tf.greater_equal(global_step, boundaries),
                                      list(range(num_boundaries)),
                                      [0] * num_boundaries))

@EdjeElectronics
Copy link
Owner

Thanks epratheeban! gharis, please re-open this issue if that did not fix the problem.

@dharanidhar12
Copy link

sir can you please help me with this am getting this error...

(tensorflow1) C:\tensorflow1\models\research\object_detection>python train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/faster_rcnn_inception_v2_pets.config
WARNING:tensorflow:From C:\Users\SBI\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\contrib\learn\python\learn
datasets\base.py:198: retry (from tensorflow.contrib.learn.python.learn.datasets.base) is deprecated and will be removed
in a future version.
Instructions for updating:
Use the retry module or similar alternatives.
Traceback (most recent call last):
File "train.py", line 49, in
from object_detection import trainer
File "C:\Users\SBI\Anaconda3\envs\tensorflow1\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection
trainer.py", line 33, in
from deployment import model_deploy
ModuleNotFoundError: No module named 'deployment'

(tensorflow1) C:\tensorflow1\models\research\object_detection>

@F4H4D-87
Copy link

WARNING:tensorflow:From C:\Users\fahad\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\contrib\learn\python\learn\datasets\base.py:198: retry (from tensorflow.contrib.learn.python.learn.datasets.base) is deprecated and will be removed in a future version.
Instructions for updating:
Use the retry module or similar alternatives.
WARNING:tensorflow:From C:\tensorflow1\models\research\object_detection\trainer.py:257: 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
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:400: 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:316: 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 "C:\Users\fahad\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 510, in _apply_op_helper
preferred_dtype=default_dtype)
File "C:\Users\fahad\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\framework\ops.py", line 1040, in internal_convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "C:\Users\fahad\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\framework\constant_op.py", line 235, in _constant_tensor_conversion_function
return constant(v, dtype=dtype, name=name)
File "C:\Users\fahad\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\framework\constant_op.py", line 214, in constant
value, dtype=dtype, shape=shape, verify_shape=verify_shape))
File "C:\Users\fahad\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\framework\tensor_util.py", line 442, in make_tensor_proto
_GetDenseDimensions(values)))
ValueError: Argument must be a dense tensor: range(0, 3) - got shape [3], but wanted [].

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\fahad\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 524, in _apply_op_helper
values, as_ref=input_arg.is_ref).dtype.name
File "C:\Users\fahad\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\framework\ops.py", line 1040, in internal_convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "C:\Users\fahad\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\framework\constant_op.py", line 235, in _constant_tensor_conversion_function
return constant(v, dtype=dtype, name=name)
File "C:\Users\fahad\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\framework\constant_op.py", line 214, in constant
value, dtype=dtype, shape=shape, verify_shape=verify_shape))
File "C:\Users\fahad\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\framework\tensor_util.py", line 442, in make_tensor_proto
_GetDenseDimensions(values)))
ValueError: Argument must be a dense tensor: range(0, 3) - got shape [3], but wanted [].

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "train.py", line 167, in
tf.app.run()
File "C:\Users\fahad\Anaconda3\envs\tensorflow1\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 169, in manual_stepping
[0] * num_boundaries))
File "C:\Users\fahad\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\ops\array_ops.py", line 2650, in where
return gen_math_ops.select(condition=condition, x=x, y=y, name=name)
File "C:\Users\fahad\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\ops\gen_math_ops.py", line 7112, in select
"Select", condition=condition, t=x, e=y, name=name)
File "C:\Users\fahad\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 528, in _apply_op_helper
(input_name, err))
ValueError: Tried to convert 't' to a tensor and failed. Error: Argument must be a dense tensor: range(0, 3) - got shape [3], but wanted [].

(tensorflow1) C:\tensorflow1\models\research\object_detection>python train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/faster_rcnn_inception_v2_pets.config
WARNING:tensorflow:From C:\Users\fahad\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\contrib\learn\python\learn\datasets\base.py:198: retry (from tensorflow.contrib.learn.python.learn.datasets.base) is deprecated and will be removed in a future version.
Instructions for updating:
Use the retry module or similar alternatives.
WARNING:tensorflow:From C:\tensorflow1\models\research\object_detection\trainer.py:257: 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
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:400: 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:316: 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 "C:\Users\fahad\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 510, in _apply_op_helper
preferred_dtype=default_dtype)
File "C:\Users\fahad\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\framework\ops.py", line 1040, in internal_convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "C:\Users\fahad\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\framework\constant_op.py", line 235, in _constant_tensor_conversion_function
return constant(v, dtype=dtype, name=name)
File "C:\Users\fahad\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\framework\constant_op.py", line 214, in constant
value, dtype=dtype, shape=shape, verify_shape=verify_shape))
File "C:\Users\fahad\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\framework\tensor_util.py", line 442, in make_tensor_proto
_GetDenseDimensions(values)))
ValueError: Argument must be a dense tensor: range(0, 3) - got shape [3], but wanted [].

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\fahad\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 524, in _apply_op_helper
values, as_ref=input_arg.is_ref).dtype.name
File "C:\Users\fahad\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\framework\ops.py", line 1040, in internal_convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "C:\Users\fahad\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\framework\constant_op.py", line 235, in _constant_tensor_conversion_function
return constant(v, dtype=dtype, name=name)
File "C:\Users\fahad\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\framework\constant_op.py", line 214, in constant
value, dtype=dtype, shape=shape, verify_shape=verify_shape))
File "C:\Users\fahad\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\framework\tensor_util.py", line 442, in make_tensor_proto
_GetDenseDimensions(values)))
ValueError: Argument must be a dense tensor: range(0, 3) - got shape [3], but wanted [].

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "train.py", line 167, in
tf.app.run()
File "C:\Users\fahad\Anaconda3\envs\tensorflow1\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 169, in manual_stepping
[0] * num_boundaries))
File "C:\Users\fahad\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\ops\array_ops.py", line 2650, in where
return gen_math_ops.select(condition=condition, x=x, y=y, name=name)
File "C:\Users\fahad\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\ops\gen_math_ops.py", line 7112, in select
"Select", condition=condition, t=x, e=y, name=name)
File "C:\Users\fahad\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 528, in _apply_op_helper
(input_name, err))
ValueError: Tried to convert 't' to a tensor and failed. Error: Argument must be a dense tensor: range(0, 3) - got shape [3], but wanted [].

i go this error then i did like (epratheeban ) i changed 167 line then i got another error

Traceback (most recent call last):
File "train.py", line 49, in
from object_detection import trainer
File "C:\tensorflow1\models\research\object_detection\trainer.py", line 26, in
from object_detection.builders import optimizer_builder
File "C:\tensorflow1\models\research\object_detection\builders\optimizer_builder.py", line 19, in
from object_detection.utils import learning_schedules
File "C:\tensorflow1\models\research\object_detection\utils\learning_schedules.py", line 167
rate_index = tf.reduce_max(tf.where(tf.greater_equal(global_step, boundaries),
^
IndentationError: unindent does not match any outer indentation level

please help me i need it sooooooo bad

@italojs
Copy link

italojs commented May 3, 2018

see this solution here: #3705 (comment)

@doggy0116
Copy link

doggy0116 commented May 12, 2018

(tensorflow1) C:\tensorflow1\models\research\object_detection>python train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/faster_rcnn_inception_v2_pets.config
WARNING:tensorflow:From C:\tensorflow1\models\research\object_detection\trainer.py:257: 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
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:400: 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:316: 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
tf.app.run()
File "C:\Users\DEVIP\Anaconda3\envs\tensorflow1\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.

(tensorflow1) C:\tensorflow1\models\research\object_detection>


I got this error when I run the trainning.
Please help me...
I'll really appreciate you.

@hashirali2604
Copy link

hashirali2604 commented Oct 9, 2018

C:\models-master\research\object_detection\legacy>python train.py --logtostderr --train_dir=../training/ --pipeline_config_path=../training/ssd_mobilenet_v2_coco.config
WARNING:tensorflow:From C:\Users\Hashir Ali\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\platform\app.py:125: main (from main) is deprecated and will be removed in a future version.
Instructions for updating:
Use object_detection/model_main.py.
W1009 19:40:49.990331 15724 tf_logging.py:125] From C:\Users\Hashir Ali\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\platform\app.py:125: main (from main) is deprecated and will be removed in a future version.
Instructions for updating:
Use object_detection/model_main.py.
WARNING:tensorflow:From C:\models-master\research\object_detection\legacy\trainer.py:265: 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
W1009 19:40:50.134185 15724 tf_logging.py:125] From C:\models-master\research\object_detection\legacy\trainer.py:265: 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
Traceback (most recent call last):
File "C:\models-master\research\object_detection\utils\label_map_util.py", line 136, in load_labelmap
text_format.Merge(label_map_string, label_map)
File "C:\Users\Hashir Ali\AppData\Local\Programs\Python\Python36\lib\site-packages\google\protobuf\text_format.py", line 536, in Merge
descriptor_pool=descriptor_pool)
File "C:\Users\Hashir Ali\AppData\Local\Programs\Python\Python36\lib\site-packages\google\protobuf\text_format.py", line 590, in MergeLines
return parser.MergeLines(lines, message)
File "C:\Users\Hashir Ali\AppData\Local\Programs\Python\Python36\lib\site-packages\google\protobuf\text_format.py", line 623, in MergeLines
self._ParseOrMerge(lines, message)
File "C:\Users\Hashir Ali\AppData\Local\Programs\Python\Python36\lib\site-packages\google\protobuf\text_format.py", line 638, in _ParseOrMerge
self._MergeField(tokenizer, message)
File "C:\Users\Hashir Ali\AppData\Local\Programs\Python\Python36\lib\site-packages\google\protobuf\text_format.py", line 763, in _MergeField
merger(tokenizer, message, field)
File "C:\Users\Hashir Ali\AppData\Local\Programs\Python\Python36\lib\site-packages\google\protobuf\text_format.py", line 837, in _MergeMessageField
self._MergeField(tokenizer, sub_message)
File "C:\Users\Hashir Ali\AppData\Local\Programs\Python\Python36\lib\site-packages\google\protobuf\text_format.py", line 763, in _MergeField
merger(tokenizer, message, field)
File "C:\Users\Hashir Ali\AppData\Local\Programs\Python\Python36\lib\site-packages\google\protobuf\text_format.py", line 888, in _MergeScalarField
value = tokenizer.ConsumeString()
File "C:\Users\Hashir Ali\AppData\Local\Programs\Python\Python36\lib\site-packages\google\protobuf\text_format.py", line 1251, in ConsumeString
the_bytes = self.ConsumeByteString()
File "C:\Users\Hashir Ali\AppData\Local\Programs\Python\Python36\lib\site-packages\google\protobuf\text_format.py", line 1266, in ConsumeByteString
the_list = [self._ConsumeSingleByteString()]
File "C:\Users\Hashir Ali\AppData\Local\Programs\Python\Python36\lib\site-packages\google\protobuf\text_format.py", line 1285, in _ConsumeSingleByteString
raise self.ParseError('Expected string but found: %r' % (text,))
google.protobuf.text_format.ParseError: 3:8 : Expected string but found: 'amalgam_gun'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "train.py", line 184, in
tf.app.run()
File "C:\Users\Hashir Ali\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run
_sys.exit(main(argv))
File "C:\Users\Hashir Ali\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\util\deprecation.py", line 306, in new_func
return func(*args, **kwargs)
File "train.py", line 180, in main
graph_hook_fn=graph_rewriter_fn)
File "C:\models-master\research\object_detection\legacy\trainer.py", line 279, in train
train_config.prefetch_queue_capacity, data_augmentation_options)
File "C:\models-master\research\object_detection\legacy\trainer.py", line 59, in create_input_queue
tensor_dict = create_tensor_dict_fn()
File "train.py", line 121, in get_next
dataset_builder.build(config)).get_next()
File "C:\models-master\research\object_detection\builders\dataset_builder.py", line 123, in build
num_additional_channels=input_reader_config.num_additional_channels)
File "C:\models-master\research\object_detection\data_decoders\tf_example_decoder.py", line 297, in init
default_value=''),
File "C:\models-master\research\object_detection\data_decoders\tf_example_decoder.py", line 59, in init
label_map_proto_file, use_display_name=False)
File "C:\models-master\research\object_detection\utils\label_map_util.py", line 164, in get_label_map_dict
label_map = load_labelmap(label_map_path)
File "C:\models-master\research\object_detection\utils\label_map_util.py", line 138, in load_labelmap
label_map.ParseFromString(label_map_string)
TypeError: a bytes-like object is required, not 'str'

getting this error upon running train.py..... can anyone giude me please???
tried rewriting commas "" but still not solve

@gnanimail
Copy link

I got the below error when I hit

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

Traceback (most recent call last):
File "train.py", line 184, in
tf.app.run()
File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run
_sys.exit(main(argv))
File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\util\deprecation.py", line 272, in new_func
return func(*args, **kwargs)
File "train.py", line 180, in main
graph_hook_fn=graph_rewriter_fn)
File "C:..\models\research\object_detection\legacy\trainer.py", line 303, in train
train_config.optimizer)
File "C:..\models\research\object_detection\builders\optimizer_builder.py", line 50, in build
learning_rate = _create_learning_rate(config.learning_rate)
File "C:..\models\research\object_detection\builders\optimizer_builder.py", line 112, in _create_learning_rate
learning_rate_sequence, config.warmup)
File "C:..\models\research\object_detection\utils\learning_schedules.py", line 160, in manual_stepping
raise ValueError('First step cannot be zero.')
ValueError: First step cannot be zero.

Appreciate your help thanks

@daiguel
Copy link

daiguel commented Dec 26, 2018

did you find out how to solve your error @gnanimail
???§§§

@aminemosbah
Copy link

(tensorflow1) C:\tensorflow1\models\research\object_detection>python train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/faster_rcnn_inception_v2_pets.config
WARNING:tensorflow:From C:\tensorflow1\models\research\object_detection\trainer.py:257: 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
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:400: 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:316: 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
tf.app.run()
File "C:\Users\DEVIP\Anaconda3\envs\tensorflow1\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.

(tensorflow1) C:\tensorflow1\models\research\object_detection>

I got this error when I run the trainning.
Please help me...
I'll really appreciate you.

the same problem here seems unmitigated error ????

@Harshavardhan18
Copy link

Hi, that was a great tutorial on implementing the API for custom object detection but unfortunately i'm stuck in step 6 i.e, training the rcnn. When i ran the command for training i'm getting the following exceptions. Can you please help me to sort it.
Thanks in advance
Please switch to tf.train.create_global_step
Traceback (most recent call last):
File "D:\tensorflow\models\research\object_detection\utils\label_map_util.py", line 136, in load_labelmap
text_format.Merge(label_map_string, label_map)
File "C:\Users\Harsha527\Miniconda3\envs\tensorflow\lib\site-packages\google\protobuf\text_format.py", line 536, in Merge
descriptor_pool=descriptor_pool)
File "C:\Users\Harsha527\Miniconda3\envs\tensorflow\lib\site-packages\google\protobuf\text_format.py", line 590, in MergeLines
return parser.MergeLines(lines, message)
File "C:\Users\Harsha527\Miniconda3\envs\tensorflow\lib\site-packages\google\protobuf\text_format.py", line 623, in MergeLines
self._ParseOrMerge(lines, message)
File "C:\Users\Harsha527\Miniconda3\envs\tensorflow\lib\site-packages\google\protobuf\text_format.py", line 638, in _ParseOrMerge
self._MergeField(tokenizer, message)
File "C:\Users\Harsha527\Miniconda3\envs\tensorflow\lib\site-packages\google\protobuf\text_format.py", line 763, in _MergeField
merger(tokenizer, message, field)
File "C:\Users\Harsha527\Miniconda3\envs\tensorflow\lib\site-packages\google\protobuf\text_format.py", line 837, in _MergeMessageField
self._MergeField(tokenizer, sub_message)
File "C:\Users\Harsha527\Miniconda3\envs\tensorflow\lib\site-packages\google\protobuf\text_format.py", line 763, in _MergeField
merger(tokenizer, message, field)
File "C:\Users\Harsha527\Miniconda3\envs\tensorflow\lib\site-packages\google\protobuf\text_format.py", line 888, in _MergeScalarField
value = tokenizer.ConsumeString()
File "C:\Users\Harsha527\Miniconda3\envs\tensorflow\lib\site-packages\google\protobuf\text_format.py", line 1251, in ConsumeString
the_bytes = self.ConsumeByteString()
File "C:\Users\Harsha527\Miniconda3\envs\tensorflow\lib\site-packages\google\protobuf\text_format.py", line 1266, in ConsumeByteString
the_list = [self._ConsumeSingleByteString()]
File "C:\Users\Harsha527\Miniconda3\envs\tensorflow\lib\site-packages\google\protobuf\text_format.py", line 1285, in _ConsumeSingleByteString
raise self.ParseError('Expected string but found: %r' % (text,))
google.protobuf.text_format.ParseError: 2555:9 : Expected string but found: 'Amoonguss'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "train.py", line 184, in
tf.app.run()
File "C:\Users\Harsha527\Miniconda3\envs\tensorflow\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run
_sys.exit(main(argv))
File "C:\Users\Harsha527\Miniconda3\envs\tensorflow\lib\site-packages\tensorflow\python\util\deprecation.py", line 306, in new_func
return func(*args, **kwargs)
File "train.py", line 180, in main
graph_hook_fn=graph_rewriter_fn)
File "D:\tensorflow\models\research\object_detection\legacy\trainer.py", line 280, in train
train_config.prefetch_queue_capacity, data_augmentation_options)
File "D:\tensorflow\models\research\object_detection\legacy\trainer.py", line 59, in create_input_queue
tensor_dict = create_tensor_dict_fn()
File "train.py", line 121, in get_next
dataset_builder.build(config)).get_next()
File "D:\tensorflow\models\research\object_detection\builders\dataset_builder.py", line 123, in build
num_additional_channels=input_reader_config.num_additional_channels)
File "D:\tensorflow\models\research\object_detection\data_decoders\tf_example_decoder.py", line 297, in init
default_value=''),
File "D:\tensorflow\models\research\object_detection\data_decoders\tf_example_decoder.py", line 59, in init
label_map_proto_file, use_display_name=False)
File "D:\tensorflow\models\research\object_detection\utils\label_map_util.py", line 164, in get_label_map_dict
label_map = load_labelmap(label_map_path)
File "D:\tensorflow\models\research\object_detection\utils\label_map_util.py", line 138, in load_labelmap
label_map.ParseFromString(label_map_string)
TypeError: a bytes-like object is required, not 'str'

@dbedant
Copy link

dbedant commented Mar 9, 2019

from object_detection.protos import calibration_pb2 as object__detection_dot_protos_dot_calibration__pb2

ImportError: cannot import name 'calibration_pb2' from 'object_detection.protos' (C:\Anaconda3\lib\site-packages\object_detection-0.1-py3.7.egg\object_detection\protos_init_.py)
i have this error is there any solution to clear this out .
Presently i try in cpu mode as i do not have nvidea graphics card

@RafaelANNO
Copy link

I have the same problem but i think it's because of the init.py which is empty

@saifhamza
Copy link

can anyone help me with the below error, please?

Anaconda Error

(base) C:\WINDOWS\system32>cd C:/tensorflow1\models\research\object_detection

(base) C:\tensorflow1\models\research\object_detection>activate tensorflow1

(tensorflow1) C:\tensorflow1\models\research\object_detection>python legacy\train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/faster_rcnn_inception_v2_pets.config
Traceback (most recent call last):
File "legacy\train.py", line 47, in
import tensorflow as tf
File "C:\Users\Athar\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow_init_.py", line 29, in
from tensorflow.api.v1 import compat
File "C:\Users\Athar\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow_api\v1\compat_init
.py", line 21, in
from tensorflow.api.v1.compat import v1
File "C:\Users\Athar\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow_api\v1\compat\v1_init
.py", line 626, in
child_package_str=('tensorflow_estimator.python.estimator.api.estimator'))
File "C:\Users\Athar\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\tools\component_api_helper.py", line 56, in package_hook
child_pkg = importlib.import_module(child_package_str)
File "C:\Users\Athar\Anaconda3\envs\tensorflow1\lib\importlib_init_.py", line 127, in import_module
return bootstrap.gcd_import(name[level:], package, level)
File "C:\Users\Athar\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow_estimator_init
.py", line 8, in
from tensorflow_estimator.api.v1 import estimator
File "C:\Users\Athar\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow_estimator_api\v1\estimator_init
.py", line 8, in
from tensorflow_estimator.api.v1.estimator import experimental
File "C:\Users\Athar\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow_estimator_api\v1\estimator\experimental_init
.py", line 8, in
from tensorflow_estimator.python.estimator.canned.dnn import dnn_logit_fn_builder
File "C:\Users\Athar\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow_estimator\python\estimator_init
.py", line 25, in
import tensorflow_estimator.python.estimator.estimator_lib
File "C:\Users\Athar\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow_estimator\python\estimator\estimator_lib.py", line 22, in
from tensorflow_estimator.python.estimator.canned.baseline import BaselineClassifier
File "C:\Users\Athar\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow_estimator\python\estimator\canned\baseline.py", line 64, in
from tensorflow_estimator.python.estimator import estimator
File "C:\Users\Athar\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow_estimator\python\estimator\estimator.py", line 66, in
from tensorflow_estimator.python.estimator import model_fn as model_fn_lib
File "C:\Users\Athar\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow_estimator\python\estimator\model_fn.py", line 36, in
from tensorflow_estimator.python.estimator.export import export_lib
File "C:\Users\Athar\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow_estimator\python\estimator\export\export_lib.py", line 25, in
from tensorflow.python.saved_model.model_utils import build_all_signature_defs
File "C:\Users\Athar\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\saved_model\model_utils_init_.py", line 22, in
from tensorflow.python.saved_model.model_utils.export_utils import build_all_signature_defs
File "C:\Users\Athar\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\saved_model\model_utils\export_utils.py", line 51, in
ModeKeys.TRAIN: signature_constants.DEFAULT_TRAIN_SIGNATURE_DEF_KEY,
AttributeError: module 'tensorflow.python.saved_model.signature_constants' has no attribute 'DEFAULT_TRAIN_SIGNATURE_DEF_KEY'

(tensorflow1) C:\tensorflow1\models\research\object_detection>

@KhurshidFF
Copy link

Hi there,
when I tried to run train.py I got this error:

(tensorflow1) C:\tensorflow1\models\research\object_detection>python train.py --logtostderr --train_dir=training/ --pipline_config_path=training/faster_rcnn_inception_v2_pets.config

WARNING: The TensorFlow contrib module will not be included in TensorFlow 2.0.
For more information, please see:

Traceback (most recent call last):
File "train.py", line 51, in
from object_detection.builders import model_builder
File "C:\Users\LifeSTYLE\Anaconda3\envs\tensorflow1\lib\site-packages\object_detection-0.1-py3.7.egg\object_detection\builders\model_builder.py", line 20, in
from object_detection.builders import anchor_generator_builder
File "C:\Users\LifeSTYLE\Anaconda3\envs\tensorflow1\lib\site-packages\object_detection-0.1-py3.7.egg\object_detection\builders\anchor_generator_builder.py", line 22, in
from object_detection.protos import anchor_generator_pb2
File "C:\Users\LifeSTYLE\Anaconda3\envs\tensorflow1\lib\site-packages\object_detection-0.1-py3.7.egg\object_detection\protos\anchor_generator_pb2.py", line 16, in
from object_detection.protos import flexible_grid_anchor_generator_pb2 as object__detection_dot_protos_dot_flexible__grid__anchor__generator__pb2
ImportError: cannot import name 'flexible_grid_anchor_generator_pb2' from 'object_detection.protos' (C:\Users\LifeSTYLE\Anaconda3\envs\tensorflow1\lib\site-packages\object_detection-0.1-py3.7.egg\object_detection\protos_init_.py)

please help
I would appreciate thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests