我已成功将ssd_mobilenet模型用于tensorflow对象检测API。 当我尝试使用faster_rcnn_inception_v2_pets时,它会出现以下错误。
Traceback (most recent call last):
File "train.py", line 167, in <module>
tf.app.run()
File "/home/chamod/anaconda3/envs/tensorflow-new/lib/python3.5/site-packages/tensorflow/python/platform/app.py", line 124, in run
_sys.exit(main(argv))
File "train.py", line 163, in main
worker_job_name, is_chief, FLAGS.train_dir)
File "/home/chamod/champ/new-project-v2/models/object_detection/trainer.py", line 255, in train
train_config.optimizer)
File "/home/chamod/champ/new-project-v2/models/object_detection/builders/optimizer_builder.py", line 50, in build
learning_rate = _create_learning_rate(config.learning_rate)
File "/home/chamod/champ/new-project-v2/models/object_detection/builders/optimizer_builder.py", line 108, in _create_learning_rate
learning_rate_sequence)
File "/home/chamod/champ/new-project-v2/models/object_detection/utils/learning_schedules.py", line 153, in manual_stepping
tf.constant(range(num_boundaries), dtype=tf.int32),
File "/home/chamod/anaconda3/envs/tensorflow-new/lib/python3.5/site-packages/tensorflow/python/framework/constant_op.py", line 212, in constant
value, dtype=dtype, shape=shape, verify_shape=verify_shape))
File "/home/chamod/anaconda3/envs/tensorflow-new/lib/python3.5/site-packages/tensorflow/python/framework/tensor_util.py", line 413, in make_tensor_proto
_AssertCompatible(values, dtype)
File "/home/chamod/anaconda3/envs/tensorflow-new/lib/python3.5/site-packages/tensorflow/python/framework/tensor_util.py", line 328, in _AssertCompatible
(dtype.name, repr(mismatch), type(mismatch).__name__))
TypeError: Expected int32, got range(0, 3) of type 'range' instead.
在faster_rcnn_inception_v2_pets.config文件中是否有任何具体的更改?
答案 0 :(得分:1)
您可以如下修改相关文件。
第153行:tf.constant(range(num_boundaries),dtype = tf.int32), 到tf.constant(list(range(num_boundaries)),dtype = tf.int32),
这是一个python问题,因为range不是列表。