Closed Jubird915 closed 5 years ago
~/learnAI/keras-centernet$ PYTHONPATH=. python keras_centernet/bin/ctdet_image.py --fn assets/demo2.jpg --inres 512,512 Using TensorFlow backend. Traceback (most recent call last): File "keras_centernet/bin/ctdet_image.py", line 59, in main() File "keras_centernet/bin/ctdet_image.py", line 35, in main model = CtDetDecode(model) File "/home/ubuntu/learnAI/keras-centernet/keras_centernet/models/decode.py", line 66, in CtDetDecode output = Lambda(_decode)([model.outputs[i] for i in [hm_index, reg_index, wh_index]]) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/keras/engine/base_layer.py", line 457, in call output = self.call(inputs, kwargs) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/keras/layers/core.py", line 687, in call return self.function(inputs, arguments) File "/home/ubuntu/learnAI/keras-centernet/keras_centernet/models/decode.py", line 65, in _decode return _ctdet_decode(hm, reg, wh, k=k, output_stride=output_stride) File "/home/ubuntu/learnAI/keras-centernet/keras_centernet/models/decode.py", line 57, in _ctdet_decode detections = K.map_fn(_process_sample, [hm_flat, reg_flat, wh_flat], dtype=K.floatx()) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 4321, in map_fn return tf.map_fn(fn, elems, name=name, dtype=dtype) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/functional_ops.py", line 459, in map_fn maximum_iterations=n) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/control_flow_ops.py", line 3209, in while_loop result = loop_context.BuildLoop(cond, body, loop_vars, shape_invariants) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2941, in BuildLoop pred, body, original_loop_vars, loop_vars, shape_invariants) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2878, in _BuildLoop body_result = body(packed_vars_for_body) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/control_flow_ops.py", line 3179, in body = lambda i, lv: (i + 1, orig_body(lv)) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/functional_ops.py", line 448, in compute packed_fn_values = fn(packed_values) File "/home/ubuntu/learnAI/keras-centernet/keras_centernet/models/decode.py", line 32, in _process_sample _scores, _inds = tf.math.top_k(_hm, k=k, sorted=True) AttributeError: module 'tensorflow.math' has no attribute 'top_k'
do any one meet the same issue?
try tf.nn.top_k. It suppose to work
tf.nn.top_k works fine, thank you @white2018
~/learnAI/keras-centernet$ PYTHONPATH=. python keras_centernet/bin/ctdet_image.py --fn assets/demo2.jpg --inres 512,512 Using TensorFlow backend. Traceback (most recent call last): File "keras_centernet/bin/ctdet_image.py", line 59, in
main()
File "keras_centernet/bin/ctdet_image.py", line 35, in main
model = CtDetDecode(model)
File "/home/ubuntu/learnAI/keras-centernet/keras_centernet/models/decode.py", line 66, in CtDetDecode
output = Lambda(_decode)([model.outputs[i] for i in [hm_index, reg_index, wh_index]])
File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/keras/engine/base_layer.py", line 457, in call
output = self.call(inputs, kwargs)
File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/keras/layers/core.py", line 687, in call
return self.function(inputs, arguments)
File "/home/ubuntu/learnAI/keras-centernet/keras_centernet/models/decode.py", line 65, in _decode
return _ctdet_decode(hm, reg, wh, k=k, output_stride=output_stride)
File "/home/ubuntu/learnAI/keras-centernet/keras_centernet/models/decode.py", line 57, in _ctdet_decode
detections = K.map_fn(_process_sample, [hm_flat, reg_flat, wh_flat], dtype=K.floatx())
File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 4321, in map_fn
return tf.map_fn(fn, elems, name=name, dtype=dtype)
File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/functional_ops.py", line 459, in map_fn
maximum_iterations=n)
File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/control_flow_ops.py", line 3209, in while_loop
result = loop_context.BuildLoop(cond, body, loop_vars, shape_invariants)
File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2941, in BuildLoop
pred, body, original_loop_vars, loop_vars, shape_invariants)
File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2878, in _BuildLoop
body_result = body(packed_vars_for_body)
File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/control_flow_ops.py", line 3179, in
body = lambda i, lv: (i + 1, orig_body( lv))
File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/functional_ops.py", line 448, in compute
packed_fn_values = fn(packed_values)
File "/home/ubuntu/learnAI/keras-centernet/keras_centernet/models/decode.py", line 32, in _process_sample
_scores, _inds = tf.math.top_k(_hm, k=k, sorted=True)
AttributeError: module 'tensorflow.math' has no attribute 'top_k'
do any one meet the same issue?