tf.version 1.6.0
python 3.6.3
ubuntu 16.04 x86_64
I got an error
ubuntu@ubuntu:~/segmentation/models-master/research$ python deeplab/train.py --logtostderr --train_split="trainval" --model_variant="xception_65" --atrous_rates=6 --atrous_rates=12 --atrous_rates=18 --output_stride=16 --decoder_output_stride=4 --train_crop_size=513 --train_crop_size=513 --train_batch_size=4 --training_number_of_steps=10 --fine_tune_batch_norm=true --tf_initial_checkpoint="/data/ubuntu/segmentation/models-master/research/deeplab/datasets/pascal_voc_seg/init_models/deeplabv3_pascal_train_aug/model.ckpt" --train_logdir="/data/ubuntu/segmentation/models-master/research/deeplab/datasets/pascal_voc_seg/exp/train_on_trainval_set/train/" --dataset_dir="/data/ubuntu/segmentation/models-master/research/deeplab/datasets/pascal_voc_seg/tfrecord/"
/data/ubuntu/config/anaconda3/lib/python3.6/site-packages/h5py/__init__.py:34: 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
INFO:tensorflow:Training on trainval set
Traceback (most recent call last):
File "/data/ubuntu/config/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 510, in _apply_op_helper
preferred_dtype=default_dtype)
File "/data/ubuntu/config/anaconda3/lib/python3.6/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 "/data/ubuntu/config/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/constant_op.py", line 235, in _constant_tensor_conversion_function
return constant(v, dtype=dtype, name=name)
File "/data/ubuntu/config/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/constant_op.py", line 214, in constant
value, dtype=dtype, shape=shape, verify_shape=verify_shape))
File "/data/ubuntu/config/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/tensor_util.py", line 433, in make_tensor_proto
_AssertCompatible(values, dtype)
File "/data/ubuntu/config/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/tensor_util.py", line 344, in _AssertCompatible
(dtype.name, repr(mismatch), type(mismatch).__name__))
TypeError: Expected int32, got 4.0 of type 'float' instead.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "deeplab/train.py", line 347, in
tf.app.run()
File "/data/ubuntu/config/anaconda3/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 126, in run
_sys.exit(main(argv))
File "deeplab/train.py", line 243, in main
model_variant=FLAGS.model_variant)
File "/data/ubuntu/segmentation/models-master/research/deeplab/utils/input_generator.py", line 168, in get
dynamic_pad=True)
File "/data/ubuntu/config/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/input.py", line 989, in batch
name=name)
File "/data/ubuntu/config/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/input.py", line 763, in _batch
dequeued = queue.dequeue_many(batch_size, name=name)
File "/data/ubuntu/config/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/data_flow_ops.py", line 483, in dequeue_many
self._queue_ref, n=n, component_types=self._dtypes, name=name)
File "/data/ubuntu/config/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/gen_data_flow_ops.py", line 2430, in _queue_dequeue_many_v2
component_types=component_types, timeout_ms=timeout_ms, name=name)
File "/data/ubuntu/config/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 519, in _apply_op_helper
repr(values), type(values).__name__))
TypeError: Expected int32 passed to parameter 'n' of op 'QueueDequeueManyV2', got 4.0 of type 'float' instead.
Hi,
Same issue, it seems that casting batch_size to integer in input_generator.py solves it.
Jeremy
It's a python 2 to 3 issue, and the solution from @jeremy-cv helps.
Specifically, near train.py line 220:
clone_batch_size = int(FLAGS.train_batch_size / config.num_clones)
That works on both py2 and py3.
Most helpful comment
It's a python 2 to 3 issue, and the solution from @jeremy-cv helps.
Specifically, near
train.pyline 220:That works on both py2 and py3.