keras-faster-rcnn icon indicating copy to clipboard operation
keras-faster-rcnn copied to clipboard

TypeError: Incompatible types: <dtype: 'resource'> vs. int64. Value is 0

Open MARUIHAN123 opened this issue 4 years ago • 3 comments

请问这个是什么错误?

MARUIHAN123 avatar Dec 11 '20 08:12 MARUIHAN123

@MARUIHAN123 您好,需要复现错误才能解决问题,麻烦说一下运行环境,版本信息,代码改动,数据集等等,保证能够重现错误

yizt avatar Dec 11 '20 09:12 yizt

python3.7. tensorflow1.14.0 keras 2.3.1 我是用的自己的数据集。数据集是按照voc的格式做的。麻烦您帮我看一下。谢谢 WARNING:tensorflow:Model failed to serialize as JSON. Ignoring... ('Not JSON Serializable:', b'\n\x04Mean\x12\x04Mean\x1a\x12rpn_bbox_loss/Mean\x1a\x05Const*\x0f\n\tkeep_dims\x12\x02(\x01*\n\n\x04Tidx\x12\x020\x03*\x07\n\x01T\x12\x020\x01') Epoch 1/80 Traceback (most recent call last): File "/home/multiai4/Ruihan/face_mask_detection/train.py", line 133, in main(arguments) File "/home/multiai4/Ruihan/face_mask_detection/train.py", line 125, in main callbacks=get_call_back()) File "/home/multiai4/.conda/envs/ruihan3.7/lib/python3.7/site-packages/tensorflow/python/keras/engine/training.py", line 1433, in fit_generator steps_name='steps_per_epoch') File "/home/multiai4/.conda/envs/ruihan3.7/lib/python3.7/site-packages/tensorflow/python/keras/engine/training_generator.py", line 264, in model_iteration batch_outs = batch_function(*batch_data) File "/home/multiai4/.conda/envs/ruihan3.7/lib/python3.7/site-packages/tensorflow/python/keras/engine/training.py", line 1174, in train_on_batch self._make_train_function() File "/home/multiai4/.conda/envs/ruihan3.7/lib/python3.7/site-packages/tensorflow/python/keras/engine/training.py", line 2219, in _make_train_function params=self._collected_trainable_weights, loss=self.total_loss) File "/home/multiai4/.conda/envs/ruihan3.7/lib/python3.7/site-packages/tensorflow/python/keras/optimizers.py", line 183, in get_updates grads = self.get_gradients(loss, params) File "/home/multiai4/.conda/envs/ruihan3.7/lib/python3.7/site-packages/tensorflow/python/keras/optimizers.py", line 91, in get_gradients grads = K.gradients(loss, params) File "/home/multiai4/.conda/envs/ruihan3.7/lib/python3.7/site-packages/tensorflow/python/keras/backend.py", line 3494, in gradients loss, variables, colocate_gradients_with_ops=True) File "/home/multiai4/.conda/envs/ruihan3.7/lib/python3.7/site-packages/tensorflow/python/ops/gradients_impl.py", line 158, in gradients unconnected_gradients) File "/home/multiai4/.conda/envs/ruihan3.7/lib/python3.7/site-packages/tensorflow/python/ops/gradients_util.py", line 720, in _GradientsHelper out_grads[i] = loop_state.ZerosLike(op, i) File "/home/multiai4/.conda/envs/ruihan3.7/lib/python3.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 1231, in ZerosLike result = constant_op.constant(0, shape=shape.dims, dtype=val.dtype) File "/home/multiai4/.conda/envs/ruihan3.7/lib/python3.7/site-packages/tensorflow/python/framework/constant_op.py", line 246, in constant allow_broadcast=True) File "/home/multiai4/.conda/envs/ruihan3.7/lib/python3.7/site-packages/tensorflow/python/framework/constant_op.py", line 284, in _constant_impl allow_broadcast=allow_broadcast)) File "/home/multiai4/.conda/envs/ruihan3.7/lib/python3.7/site-packages/tensorflow/python/framework/tensor_util.py", line 501, in make_tensor_proto (dtype, nparray.dtype, values)) TypeError: Incompatible types: <dtype: 'resource'> vs. int64. Value is 0

Process finished with exit code 1

MARUIHAN123 avatar Dec 11 '20 09:12 MARUIHAN123

这个问题已经解决,谢谢

MARUIHAN123 avatar Dec 12 '20 10:12 MARUIHAN123