models icon indicating copy to clipboard operation
models copied to clipboard

Value Error: First Step Cannot Be Zero

Open ashiqks opened this issue 8 years ago • 28 comments

  • What is the top-level directory of the model you are using: Object_detection
  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): No
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 7
  • TensorFlow installed from (source or binary): Binary
  • TensorFlow version (use command below): 1.6.0
  • Bazel version (if compiling from source):
  • CUDA/cuDNN version:
  • GPU model and memory:
  • Exact command to reproduce: python train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/pipeline.config

When running the faster_rcnn_resnet101_kitti_2018_01_28 model it is throwing the error:

(base) C:\Users\MAT\models-master\research\object_detection>python train.py --lo
gtostderr --train_dir=training/ --pipeline_config_path=training/pipeline.config
C:\Users\MAT\Anaconda3\lib\site-packages\h5py\__init__.py:36: FutureWarning: Con
version of the second argument of issubdtype from `float` to `np.floating` is de
precated. In future, it will be treated as `np.float64 == np.dtype(float).type`.

from ._conv import register_converters as _register_converters
INFO:tensorflow:Scale of 0 disables regularizer.
INFO:tensorflow:Scale of 0 disables regularizer.
WARNING:tensorflow:From C:\Users\MAT\models-master\research\object_detection\tra
iner.py:228: create_global_step (from tensorflow.contrib.framework.python.ops.va
riables) 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:Scale of 0 disables regularizer.
INFO:tensorflow:depth of additional conv before box predictor: 0
INFO:tensorflow:Scale of 0 disables regularizer.
WARNING:tensorflow:From C:\Users\MAT\models-master\research\object_detection\cor
e\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:\Users\MAT\models-master\research\object_detection\cor
e\losses.py:316: softmax_cross_entropy_with_logits (from tensorflow.python.ops.n
n_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:\Users\MAT\Anaconda3\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:\Users\MAT\models-master\research\object_detection\trainer.py", line 2
55, in train
train_config.optimizer)
File "C:\Users\MAT\models-master\research\object_detection\builders\optimizer_
builder.py", line 50, in build
learning_rate = _create_learning_rate(config.learning_rate)
File "C:\Users\MAT\models-master\research\object_detection\builders\optimizer_
builder.py", line 109, in _create_learning_rate
learning_rate_sequence, config.warmup)
File "C:\Users\MAT\models-master\research\object_detection\utils\learning_sche
dules.py", line 156, in manual_stepping
raise ValueError('First step cannot be zero.')

ashiqks avatar Mar 28 '18 15:03 ashiqks

We recently updated the code so this block

          schedule {
            step: 0
            learning_rate: .0001
          }

is not recognized anymore.

The model configs in model zoo still have this block so it crashed the program. You can remove this block or use the latest config instead of the downloaded one in tar.gz file.

pkulzc avatar Mar 28 '18 17:03 pkulzc

@pkulzc removing the block is no good , it still throws no variables to save error . "ValueError: No variables to save"

vishalgolcha avatar Mar 29 '18 17:03 vishalgolcha

@vishalgolcha could you share more details?

pkulzc avatar Mar 29 '18 17:03 pkulzc

What is the top-level directory of the model you are using: Object_detection Have I written custom code (as opposed to using a stock example script provided in TensorFlow): No OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Ubuntu 17.04 TensorFlow installed from (source or binary): Binary TensorFlow version (use command below): 1.6.0 **CUDA/cuDNN version **: cuda 9.0 GPU model and memory: 1080 8GB

i am trying to finetune a faster rcnn inception model for a custom tfrecord file , below is my config file model { faster_rcnn { num_classes: 8 image_resizer { keep_aspect_ratio_resizer { min_dimension: 600 max_dimension: 1024 } } feature_extractor { type: "faster_rcnn_inception_v2" first_stage_features_stride: 16 } first_stage_anchor_generator { grid_anchor_generator { height_stride: 16 width_stride: 16 scales: 0.25 scales: 0.5 scales: 1.0 scales: 2.0 aspect_ratios: 0.5 aspect_ratios: 1.0 aspect_ratios: 2.0 } } first_stage_box_predictor_conv_hyperparams { op: CONV regularizer { l2_regularizer { weight: 0.0 } } initializer { truncated_normal_initializer { stddev: 0.00999999977648 } } } first_stage_nms_score_threshold: 0.0 first_stage_nms_iou_threshold: 0.699999988079 first_stage_max_proposals: 300 first_stage_localization_loss_weight: 2.0 first_stage_objectness_loss_weight: 1.0 initial_crop_size: 14 maxpool_kernel_size: 2 maxpool_stride: 2 second_stage_box_predictor { mask_rcnn_box_predictor { fc_hyperparams { op: FC regularizer { l2_regularizer { weight: 0.0 } } initializer { variance_scaling_initializer { factor: 1.0 uniform: true mode: FAN_AVG } } } use_dropout: false dropout_keep_probability: 1.0 } } second_stage_post_processing { batch_non_max_suppression { score_threshold: 0.0 iou_threshold: 0.600000023842 max_detections_per_class: 100 max_total_detections: 300 } score_converter: SOFTMAX } second_stage_localization_loss_weight: 2.0 second_stage_classification_loss_weight: 1.0 } } train_config { batch_size: 1 data_augmentation_options { random_horizontal_flip { } } optimizer { momentum_optimizer { learning_rate { manual_step_learning_rate { initial_learning_rate: 0.000199999994948 schedule { step: 900000 learning_rate: 1.99999994948e-05 } schedule { step: 1200000 learning_rate: 1.99999999495e-06 } } } momentum_optimizer_value: 0.899999976158 } use_moving_average: false } gradient_clipping_by_norm: 10.0 fine_tune_checkpoint: "/home/lashiv/obj-detect/sop/models/model.ckpt.index" from_detection_checkpoint: true num_steps: 200000 } train_input_reader { label_map_path: "/home/lashiv/obj-detect/sop/data/StringIntLabelMap.pbtxt" tf_record_input_reader { input_path: "/home/lashiv/obj-detect/sop/data/train.record" } } eval_config { num_examples: 8000 max_evals: 10 use_moving_averages: false } eval_input_reader { label_map_path: "/home/lashiv/obj-detect/sop/data/StringIntLabelMap.pbtxt" shuffle: false num_readers: 1 tf_record_input_reader { input_path: "/home/lashiv/obj-detect/sop/data/train.record" } }

the traceback it shows is Traceback (most recent call last): File "object_detection/train.py", line 167, in tf.app.run() File "/home/lashiv/anaconda3/envs/detect/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 126, in run _sys.exit(main(argv)) File "object_detection/train.py", line 163, in main worker_job_name, is_chief, FLAGS.train_dir) File "/home/lashiv/obj-detect/models/research/object_detection/trainer.py", line 285, in train init_saver = tf.train.Saver(available_var_map) File "/home/lashiv/anaconda3/envs/detect/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1293, in init self.build() File "/home/lashiv/anaconda3/envs/detect/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1302, in build self._build(self._filename, build_save=True, build_restore=True) File "/home/lashiv/anaconda3/envs/detect/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1327, in _build raise ValueError("No variables to save") ValueError: No variables to save

vishalgolcha avatar Mar 29 '18 17:03 vishalgolcha

You're using the wrong file for checkpoint. Use this: fine_tune_checkpoint: "/home/lashiv/obj-detect/sop/models/model.ckpt" instead. Since this is a different problem, please open another thread for this if you have further questions.

pkulzc avatar Mar 29 '18 17:03 pkulzc

      schedule {
        step: 0
        learning_rate: .0001
      }

i have the same error . and i can find where is the block.could you please tell me ?

chenyuyi94 avatar Apr 05 '18 10:04 chenyuyi94

It's in the config file, train_config/optimizer/learning_rate.

pkulzc avatar Apr 05 '18 15:04 pkulzc

thank you for your reply

在 2018年4月5日,下午11:48,pkulzc [email protected] 写道:

It's in the config file, train_config/optimizer/learning_rate.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

chenyuyi94 avatar Apr 06 '18 04:04 chenyuyi94

Mr. pkulzc pls be more specific :

  1. The name of file that must be modifyed
  2. The location of this file
  3. if any link avalible for correct model zoo Best Regards

krassynesh avatar May 05 '18 15:05 krassynesh

An simpler way is to always use the config here instead of the ones in downloaded file.

For example, If you want to train a faster_rcnn_resnet101_kitti model, use models/research/object_detection/samples/configs/faster_rcnn_resnet101_kitti.config instead of the one in the downloaded compressed file. The configs in git repo are guaranteed to be latest.

pkulzc avatar May 10 '18 05:05 pkulzc

Thank you the issue resolved but coming up with new 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 Traceback (most recent call last): File "train.py", line 184, in tf.app.run() File "C:\Users\Ankit Sharma\Anaconda2\envs\tensorflow1\lib\site-packages\tensorflow\python\platform\app.py", line 126, in run _sys.exit(main(argv)) File "train.py", line 93, in main FLAGS.pipeline_config_path) File "C:\tensorflow1\models\research\object_detection\utils\config_util.py", line 94, in get_configs_from_pipeline_file text_format.Merge(proto_str, pipeline_config) File "C:\Users\Ankit Sharma\Anaconda2\envs\tensorflow1\lib\site-packages\google\protobuf\text_format.py", line 533, in Merge descriptor_pool=descriptor_pool) File "C:\Users\Ankit Sharma\Anaconda2\envs\tensorflow1\lib\site-packages\google\protobuf\text_format.py", line 587, in MergeLines return parser.MergeLines(lines, message) File "C:\Users\Ankit Sharma\Anaconda2\envs\tensorflow1\lib\site-packages\google\protobuf\text_format.py", line 620, in MergeLines self._ParseOrMerge(lines, message) File "C:\Users\Ankit Sharma\Anaconda2\envs\tensorflow1\lib\site-packages\google\protobuf\text_format.py", line 635, in _ParseOrMerge self._MergeField(tokenizer, message) File "C:\Users\Ankit Sharma\Anaconda2\envs\tensorflow1\lib\site-packages\google\protobuf\text_format.py", line 735, in _MergeField merger(tokenizer, message, field) File "C:\Users\Ankit Sharma\Anaconda2\envs\tensorflow1\lib\site-packages\google\protobuf\text_format.py", line 822, in _MergeMessageField raise tokenizer.ParseErrorPreviousToken('Expected "%s".' % (end_token,)) google.protobuf.text_format.ParseError: 140:16 : Expected "}"

Shiv1799 avatar May 29 '18 14:05 Shiv1799

@Shiv1799 apparently the config file is missing a "}" , you will want to check it.

pkulzc avatar May 29 '18 17:05 pkulzc

hi @pkulzc could you help me with this? i have a pretrained model (RCNN with Inception v2 model trained on the COCO dataset) with these files : checkpoint model.ckpt.data-00000-of-00001 example.config model.ckpt.index frozen_inference_graph.pb model.ckpt.meta labels.txt saved_model/

what file should i set to the "fine_tune_checkpoint:" value in my file example.config ?

currently my example.config looks like this :

fine_tune_checkpoint: "/home/antoine/Documents/ia/HereIsWally/trained_model/checkpoint" it is right ? I have some mistakes in the training of the model and I suspect that it could be by this checkpoint

antoine29 avatar Jun 12 '18 01:06 antoine29

@antoine29 you should use "...trained_model/model.ckpt". BTW, This is a stackoverflow question since it's neither a bug or a feature request. Please ask there if you have future questions like this.

I'm closing this bug since it's straightforward and has been answered.

pkulzc avatar Jun 12 '18 04:06 pkulzc

(tensorflow1) C:\tensorflow1\models\research\object_detection>python train.py -- logtostderr --train_dir=training/ --pipeline_config_path=training/faster_rcnn_in ception_v2_pets.config WARNING:tensorflow:From C:\tensorflow1\models\research\object_detection\trainer. py:260: create_global_step (from tensorflow.contrib.framework.python.ops.variabl es) is deprecated and will be removed in a future version. Instructions for updating: Please switch to tf.train.create_global_step WARNING:tensorflow:num_readers has been reduced to 0 to match input file shards.

Traceback (most recent call last): File "train.py", line 184, in tf.app.run() File "C:\Users\Osama\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\p ython\platform\app.py", line 126, in run _sys.exit(main(argv)) File "train.py", line 180, in main graph_hook_fn=graph_rewriter_fn) File "C:\tensorflow1\models\research\object_detection\trainer.py", line 274, i n train train_config.prefetch_queue_capacity, data_augmentation_options) File "C:\tensorflow1\models\research\object_detection\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:\tensorflow1\models\research\object_detection\builders\dataset_builder .py", line 186, in build process_fn, config.input_path[:], input_reader_config) File "C:\tensorflow1\models\research\object_detection\utils\dataset_util.py", line 141, in read_dataset sloppy=config.shuffle)) File "C:\Users\Osama\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\p ython\data\ops\dataset_ops.py", line 973, in apply dataset = transformation_func(self) File "C:\Users\Osama\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\c ontrib\data\python\ops\interleave_ops.py", line 76, in _apply_fn buffer_output_elements, prefetch_input_elements) File "C:\Users\Osama\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\p ython\data\ops\readers.py", line 130, in init cycle_length, block_length) File "C:\Users\Osama\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\p ython\data\ops\dataset_ops.py", line 1959, in init super(InterleaveDataset, self).init(input_dataset, map_func) File "C:\Users\Osama\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\p ython\data\ops\dataset_ops.py", line 1928, in init self._map_func.add_to_graph(ops.get_default_graph()) File "C:\Users\Osama\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\p ython\framework\function.py", line 484, in add_to_graph self._create_definition_if_needed() File "C:\Users\Osama\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\p ython\framework\function.py", line 319, in _create_definition_if_needed self._create_definition_if_needed_impl() File "C:\Users\Osama\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\p ython\framework\function.py", line 336, in _create_definition_if_needed_impl outputs = self._func(*inputs) File "C:\Users\Osama\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\p ython\data\ops\dataset_ops.py", line 1916, in tf_map_func dataset = map_func(nested_args) File "C:\Users\Osama\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\p ython\data\ops\readers.py", line 196, in init filenames = ops.convert_to_tensor(filenames, dtype=dtypes.string) File "C:\Users\Osama\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\p ython\framework\ops.py", line 1014, in convert_to_tensor as_ref=False) File "C:\Users\Osama\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\p ython\framework\ops.py", line 1104, in internal_convert_to_tensor ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref) File "C:\Users\Osama\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\p ython\framework\ops.py", line 947, in _TensorTensorConversionFunction (dtype.name, t.dtype.name, str(t))) ValueError: Tensor conversion requested dtype string for Tensor with dtype float 32: 'Tensor("arg0:0", shape=(), dtype=float32)'

Getting this error anyone who can help with this??

osama191 avatar Jun 20 '18 05:06 osama191

After resolving the first step cannot be zero, I encountered this problem below.

(tensorflow) C:\Users\User\Documents\GitHub\models-master\research\object_detection>python train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/faster_rcnn_inception_v2_pets.config C:\Users\User\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\h5py_init_.py:36: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type. from ._conv import register_converters as _register_converters WARNING:tensorflow:From C:\Users\User\Documents\GitHub\models-master\research\object_detection\trainer.py:260: 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:num_readers has been reduced to 1 to match input file shards. 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:\Users\User\Documents\GitHub\models-master\research\object_detection\core\box_predictor.py:407: 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:\Users\User\Documents\GitHub\models-master\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 "C:\Users\User\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 510, in _apply_op_helper preferred_dtype=default_dtype) File "C:\Users\User\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\tensorflow\python\framework\ops.py", line 1104, in internal_convert_to_tensor ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref) File "C:\Users\User\AppData\Local\conda\conda\envs\tensorflow\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\User\AppData\Local\conda\conda\envs\tensorflow\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\User\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\tensorflow\python\framework\tensor_util.py", line 441, 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\User\AppData\Local\conda\conda\envs\tensorflow\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\User\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\tensorflow\python\framework\ops.py", line 1104, in internal_convert_to_tensor ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref) File "C:\Users\User\AppData\Local\conda\conda\envs\tensorflow\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\User\AppData\Local\conda\conda\envs\tensorflow\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\User\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\tensorflow\python\framework\tensor_util.py", line 441, 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 184, in tf.app.run() File "C:\Users\User\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\tensorflow\python\platform\app.py", line 126, in run _sys.exit(main(argv)) File "train.py", line 180, in main graph_hook_fn=graph_rewriter_fn) File "C:\Users\User\Documents\GitHub\models-master\research\object_detection\trainer.py", line 298, in train train_config.optimizer) File "C:\Users\User\Documents\GitHub\models-master\research\object_detection\builders\optimizer_builder.py", line 50, in build learning_rate = _create_learning_rate(config.learning_rate) File "C:\Users\User\Documents\GitHub\models-master\research\object_detection\builders\optimizer_builder.py", line 109, in _create_learning_rate learning_rate_sequence, config.warmup) File "C:\Users\User\Documents\GitHub\models-master\research\object_detection\utils\learning_schedules.py", line 169, in manual_stepping [0] * num_boundaries)) File "C:\Users\User\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\tensorflow\python\ops\array_ops.py", line 2681, in where return gen_math_ops.select(condition=condition, x=x, y=y, name=name) File "C:\Users\User\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\tensorflow\python\ops\gen_math_ops.py", line 7189, in select "Select", condition=condition, t=x, e=y, name=name) File "C:\Users\User\AppData\Local\conda\conda\envs\tensorflow\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 [].

Any one familiar with this?

RolandOne avatar Jun 23 '18 09:06 RolandOne

@osama191 i have the same problem. Do you fix it ?

Help me please

WARNING:tensorflow:From /home/luiz/model_ssd/research/object_detection/trainer.py:262: 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:num_readers has been reduced to 0 to match input file shards. Traceback (most recent call last): File "train.py", line 188, in tf.app.run() File "/home/luiz/.virtualenvs/virtual-py2/local/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 126, in run _sys.exit(main(argv)) File "train.py", line 184, in main graph_hook_fn=graph_rewriter_fn) File "/home/luiz/model_ssd/research/object_detection/trainer.py", line 276, in train train_config.prefetch_queue_capacity, data_augmentation_options) File "/home/luiz/model_ssd/research/object_detection/trainer.py", line 59, in create_input_queue tensor_dict = create_tensor_dict_fn() File "train.py", line 125, in get_next dataset_builder.build(config)).get_next() File "/home/luiz/model_ssd/research/object_detection/builders/dataset_builder.py", line 134, in build config.input_path[:], input_reader_config) File "/home/luiz/model_ssd/research/object_detection/builders/dataset_builder.py", line 80, in read_dataset sloppy=config.shuffle)) File "/home/luiz/.virtualenvs/virtual-py2/local/lib/python2.7/site-packages/tensorflow/python/data/ops/dataset_ops.py", line 973, in apply dataset = transformation_func(self) File "/home/luiz/.virtualenvs/virtual-py2/local/lib/python2.7/site-packages/tensorflow/contrib/data/python/ops/interleave_ops.py", line 76, in _apply_fn buffer_output_elements, prefetch_input_elements) File "/home/luiz/.virtualenvs/virtual-py2/local/lib/python2.7/site-packages/tensorflow/python/data/ops/readers.py", line 130, in init cycle_length, block_length) File "/home/luiz/.virtualenvs/virtual-py2/local/lib/python2.7/site-packages/tensorflow/python/data/ops/dataset_ops.py", line 1959, in init super(InterleaveDataset, self).init(input_dataset, map_func) File "/home/luiz/.virtualenvs/virtual-py2/local/lib/python2.7/site-packages/tensorflow/python/data/ops/dataset_ops.py", line 1928, in init self._map_func.add_to_graph(ops.get_default_graph()) File "/home/luiz/.virtualenvs/virtual-py2/local/lib/python2.7/site-packages/tensorflow/python/framework/function.py", line 484, in add_to_graph self._create_definition_if_needed() File "/home/luiz/.virtualenvs/virtual-py2/local/lib/python2.7/site-packages/tensorflow/python/framework/function.py", line 319, in _create_definition_if_needed self._create_definition_if_needed_impl() File "/home/luiz/.virtualenvs/virtual-py2/local/lib/python2.7/site-packages/tensorflow/python/framework/function.py", line 336, in _create_definition_if_needed_impl outputs = self._func(*inputs) File "/home/luiz/.virtualenvs/virtual-py2/local/lib/python2.7/site-packages/tensorflow/python/data/ops/dataset_ops.py", line 1916, in tf_map_func dataset = map_func(nested_args) File "/home/luiz/.virtualenvs/virtual-py2/local/lib/python2.7/site-packages/tensorflow/python/data/ops/readers.py", line 196, in init filenames = ops.convert_to_tensor(filenames, dtype=dtypes.string) File "/home/luiz/.virtualenvs/virtual-py2/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1014, in convert_to_tensor as_ref=False) File "/home/luiz/.virtualenvs/virtual-py2/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1104, in internal_convert_to_tensor ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref) File "/home/luiz/.virtualenvs/virtual-py2/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 947, 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)'

I did put the "prints" in the function above def _TensorTensorConversionFunction(t, dtype=None, name=None, as_ref=False): _ = name, as_ref print('t',t,'dt', dtype ,'name', name,'ref', as_ref) print('t.dtype',t.dtype) print('comp', dtype.is_compatible_with(t.dtype)) if dtype and not dtype.is_compatible_with(t.dtype): print('entry21',t, dtype , name, as_ref) raise ValueError( "Tensor conversion requested dtype %s for Tensor with dtype %s: %r" % (dtype.name, t.dtype.name, str(t))) return t

Tensor("global_step:0", shape=(), dtype=int64_ref, device=/device:CPU:0) dt None name ref ref True t.dtype <dtype: 'int64_ref'>

print('comap', dtype.is_compatible_with(t.dtype)) AttributeError: 'NoneType' object has no attribute 'is_compatible_with'

lgribeiro avatar Jul 07 '18 02:07 lgribeiro

A complete answer: The issue is that step: 0 in the following block is not recognized by the newer releases:

schedule {
            step: 0
            learning_rate: .0001
          }

A fix is to delete this block and changing initial_learning_rate to the learning_rate described in the block. The file that you have to modify is the one that you pass as option --pipeline_config_path to the train.py script.

dshahrokhian avatar Aug 02 '18 09:08 dshahrokhian

@pkulzc there are like 3 blocks for schedule, which one?

dscha09 avatar Aug 17 '18 14:08 dscha09

I am getting this error

(tensorflow1) C:\tensorflow1\models\research\object_detection>python train.py -- logtostderr --train_dir=training/ --pipeline_config_path=training/faster_rcnn_in ception_v2_pets.config WARNING:tensorflow:From C:\tensorflow1\models\research\object_detection\trainer. py:260: create_global_step (from tensorflow.contrib.framework.python.ops.variabl es) is deprecated and will be removed in a future version. Instructions for updating: Please switch to tf.train.create_global_step WARNING:tensorflow:num_readers has been reduced to 0 to match input file shards.

Traceback (most recent call last): File "train.py", line 184, in tf.app.run() File "C:\Users\Osama\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\p ython\platform\app.py", line 126, in run _sys.exit(main(argv)) File "train.py", line 180, in main graph_hook_fn=graph_rewriter_fn) File "C:\tensorflow1\models\research\object_detection\trainer.py", line 274, i n train train_config.prefetch_queue_capacity, data_augmentation_options) File "C:\tensorflow1\models\research\object_detection\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:\tensorflow1\models\research\object_detection\builders\dataset_builder .py", line 186, in build process_fn, config.input_path[:], input_reader_config) File "C:\tensorflow1\models\research\object_detection\utils\dataset_util.py", line 141, in read_dataset sloppy=config.shuffle)) File "C:\Users\Osama\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\p ython\data\ops\dataset_ops.py", line 973, in apply dataset = transformation_func(self) File "C:\Users\Osama\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\c ontrib\data\python\ops\interleave_ops.py", line 76, in _apply_fn buffer_output_elements, prefetch_input_elements) File "C:\Users\Osama\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\p ython\data\ops\readers.py", line 130, in init cycle_length, block_length) File "C:\Users\Osama\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\p ython\data\ops\dataset_ops.py", line 1959, in init super(InterleaveDataset, self).init(input_dataset, map_func) File "C:\Users\Osama\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\p ython\data\ops\dataset_ops.py", line 1928, in init self._map_func.add_to_graph(ops.get_default_graph()) File "C:\Users\Osama\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\p ython\framework\function.py", line 484, in add_to_graph self._create_definition_if_needed() File "C:\Users\Osama\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\p ython\framework\function.py", line 319, in _create_definition_if_needed self._create_definition_if_needed_impl() File "C:\Users\Osama\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\p ython\framework\function.py", line 336, in _create_definition_if_needed_impl outputs = self._func(*inputs) File "C:\Users\Osama\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\p ython\data\ops\dataset_ops.py", line 1916, in tf_map_func dataset = map_func(nested_args) File "C:\Users\Osama\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\p ython\data\ops\readers.py", line 196, in init filenames = ops.convert_to_tensor(filenames, dtype=dtypes.string) File "C:\Users\Osama\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\p ython\framework\ops.py", line 1014, in convert_to_tensor as_ref=False) File "C:\Users\Osama\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\p ython\framework\ops.py", line 1104, in internal_convert_to_tensor ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref) File "C:\Users\Osama\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\p ython\framework\ops.py", line 947, in _TensorTensorConversionFunction (dtype.name, t.dtype.name, str(t))) ValueError: Tensor conversion requested dtype string for Tensor with dtype float 32: 'Tensor("arg0:0", shape=(), dtype=float32)'

Can anyone explain why I am getting this error?

moinkhan3012 avatar Sep 24 '18 00:09 moinkhan3012