Training on custom dataset num class error
RohitKeshari opened this issue · comments
Rohit Keshari commented
I have run the code on VOC database. I is working fine. But I am getting following error when I changed the number of classes from 20 to 4 (I have four classes in my database). Can you look into this why its happening. Basically some where matrix operation is getting "Invalid argument: Incompatible shapes: [6,15,15,3,20] vs. [6,15,15,3,4]".
Now it starts to train YOLOV3 from scratch ...
0%| | 0/2758 [00:13<?, ?it/s]
Traceback (most recent call last):
File "train_road_sign.py", line 186, in <module>
if __name__ == '__main__': YoloTrain().train()
File "train_road_sign.py", line 156, in train
self.trainable: True,
File "/home/ec2-user/anaconda3/envs/tensorflow_p27/lib/python2.7/site-packages/tensorflow_core/python/client/session.py", line 956, in run
run_metadata_ptr)
File "/home/ec2-user/anaconda3/envs/tensorflow_p27/lib/python2.7/site-packages/tensorflow_core/python/client/session.py", line 1180, in _run
feed_dict_tensor, options, run_metadata)
File "/home/ec2-user/anaconda3/envs/tensorflow_p27/lib/python2.7/site-packages/tensorflow_core/python/client/session.py", line 1359, in _do_run
run_metadata)
File "/home/ec2-user/anaconda3/envs/tensorflow_p27/lib/python2.7/site-packages/tensorflow_core/python/client/session.py", line 1384, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: 2 root error(s) found.
(0) Invalid argument: Incompatible shapes: [6,15,15,3,20] vs. [6,15,15,3,4]
[[node define_loss/bigger_box_loss/logistic_loss_2/mul (defined at /home/ec2-user/anaconda3/envs/tensorflow_p27/lib/python2.7/site-packages/tensorflow_core/python/framework/ops.py:1748) ]]
[[define_loss/conf_loss/add_1/_915]]
(1) Invalid argument: Incompatible shapes: [6,15,15,3,20] vs. [6,15,15,3,4]
[[node define_loss/bigger_box_loss/logistic_loss_2/mul (defined at /home/ec2-user/anaconda3/envs/tensorflow_p27/lib/python2.7/site-packages/tensorflow_core/python/framework/ops.py:1748) ]]
0 successful operations.
0 derived errors ignored.
Original stack trace for u'define_loss/bigger_box_loss/logistic_loss_2/mul':
File "train_road_sign.py", line 186, in <module>
if __name__ == '__main__': YoloTrain().train()
File "train_road_sign.py", line 63, in __init__
self.true_sbboxes, self.true_mbboxes, self.true_lbboxes)
File "/home/ec2-user/SageMaker/TF_road_sign_exp/tensorflow-yolov3/core/yolov3.py", line 246, in compute_loss
anchors = self.anchors[2], stride = self.strides[2])
File "/home/ec2-user/SageMaker/TF_road_sign_exp/tensorflow-yolov3/core/yolov3.py", line 224, in loss_layer
prob_loss = respond_bbox * tf.nn.sigmoid_cross_entropy_with_logits(labels=label_prob, logits=conv_raw_prob)
File "/home/ec2-user/anaconda3/envs/tensorflow_p27/lib/python2.7/site-packages/tensorflow_core/python/ops/nn_impl.py", line 186, in sigmoid_cross_entropy_with_logits
relu_logits - logits * labels,
File "/home/ec2-user/anaconda3/envs/tensorflow_p27/lib/python2.7/site-packages/tensorflow_core/python/ops/math_ops.py", line 899, in binary_op_wrapper
return func(x, y, name=name)
File "/home/ec2-user/anaconda3/envs/tensorflow_p27/lib/python2.7/site-packages/tensorflow_core/python/ops/math_ops.py", line 1206, in _mul_dispatch
return gen_math_ops.mul(x, y, name=name)
File "/home/ec2-user/anaconda3/envs/tensorflow_p27/lib/python2.7/site-packages/tensorflow_core/python/ops/gen_math_ops.py", line 6701, in mul
"Mul", x=x, y=y, name=name)
File "/home/ec2-user/anaconda3/envs/tensorflow_p27/lib/python2.7/site-packages/tensorflow_core/python/framework/op_def_library.py", line 794, in _apply_op_helper
op_def=op_def)
File "/home/ec2-user/anaconda3/envs/tensorflow_p27/lib/python2.7/site-packages/tensorflow_core/python/util/deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "/home/ec2-user/anaconda3/envs/tensorflow_p27/lib/python2.7/site-packages/tensorflow_core/python/framework/ops.py", line 3357, in create_op
attrs, op_def, compute_device)
File "/home/ec2-user/anaconda3/envs/tensorflow_p27/lib/python2.7/site-packages/tensorflow_core/python/framework/ops.py", line 3426, in _create_op_internal
op_def=op_def)
File "/home/ec2-user/anaconda3/envs/tensorflow_p27/lib/python2.7/site-packages/tensorflow_core/python/framework/ops.py", line 1748, in __init__
self._traceback = tf_stack.extract_stack()