TypeError: Expected int32, got range(0, 3) of type 'range' instead.

错误1

See tf.nn.softmax_cross_entropy_with_logits_v2.

Traceback (most recent call last):
File “D:\software\PyCharm\helpers\pydev\pydevd.py”, line 1668, in
main()
File “D:\software\PyCharm\helpers\pydev\pydevd.py”, line 1662, in main
globals = debugger.run(setup[‘file’], None, None, is_module)
File “D:\software\PyCharm\helpers\pydev\pydevd.py”, line 1072, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File “D:\software\PyCharm\helpers\pydev_pydev_imps_pydev_execfile.py”, line 18, in execfile
exec(compile(contents+”\n”, file, ‘exec’), glob, loc)
File “E:/tensorflow-relevant-download/light_dection/object_detection/train.py”, line 196, in
tf.app.run()
File “D:\software\Anaconda\envs\py3\lib\site-packages\tensorflow\python\platform\app.py”, line 124, in run
_sys.exit(main(argv))
File “E:/tensorflow-relevant-download/light_dection/object_detection/train.py”, line 192, in main
worker_job_name, is_chief, FLAGS.train_dir)
File “E:\tensorflow-relevant-download\light_dection\object_detection\trainer.py”, line 255, in train
train_config.optimizer)
File “E:\tensorflow-relevant-download\light_dection\object_detection\builders\optimizer_builder.py”, line 50, in build
learning_rate = _create_learning_rate(config.learning_rate)
File “E:\tensorflow-relevant-download\light_dection\object_detection\builders\optimizer_builder.py”, line 108, in _create_learning_rate
learning_rate_sequence)
File “E:\tensorflow-relevant-download\light_dection\object_detection\utils\learning_schedules.py”, line 153, in manual_stepping
tf.constant(range(num_boundaries), dtype=tf.int32),
File “D:\software\Anaconda\envs\py3\lib\site-packages\tensorflow\python\framework\constant_op.py”, line 212, in constant
value, dtype=dtype, shape=shape, verify_shape=verify_shape))
File “D:\software\Anaconda\envs\py3\lib\site-packages\tensorflow\python\framework\tensor_util.py”, line 413, in make_tensor_proto
_AssertCompatible(values, dtype)
File “D:\software\Anaconda\envs\py3\lib\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.

解决方案 :

make sure which object_detection module do you use before change

Expected float32, got range(0, 3) of type ‘range’ instead. #17209
https://github.com/tensorflow/tensorflow/issues/17209
explicitely create list from range() for python3 compatibility #3442
https://github.com/tensorflow/models/pull/3442/commits/c9592aa60134b457bcb8acba4cea434485494010
https://github.com/tensorflow/models/issues/3443

solution

object_detection\utils\learning_schedules.py 153

tf.constant(list(range(num_boundaries)), dtype=tf.int32),

错误2 :x and y must have the same dtype, got tf.float32 != tf.int32

解决方案 :

object_detection\core\losses.py 301

self._logit_scale = tf.cast(self._logit_scale, tf.float32) # TODO change : Add cast to float to avoid devid error

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

mtj66

看心情

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值