Darkflow: Incompatible shapes

Created on 3 Feb 2017  路  5Comments  路  Source: thtrieu/darkflow

Hi @thtrieu,

I got the following error:
InvalidArgumentError (see above for traceback): Incompatible shapes: [40,196,5,2] vs. [16,196,5,2]
[[Node: Minimum = Minimum[T=DT_FLOAT, _device="/job:localhost/replica:0/task:0/cpu:0"](add_2, _recv_Placeholder_6_0)]]

I use this command: ./flow --model cfg/tiny-yolo-voc.cfg --load bin/tiny-yolo-voc.weights --train

Most helpful comment

try to change "filters" in the last convolution layer

[convolutional]
size=1
stride=1
pad=1
filters= #num * (#classes + 5)
activation=linear

All 5 comments

I cannot reproduce this error on my machine, please make sure you have all the dependencies listed in README, pull new code and try again.

@thtrieu I've the same issue when trying to train a VOC2007 dataset. This happens when I use a custom cfg and custom labels.txt with three classes:

Changes in [region]:

[region]
anchors = 0.738768,0.874946, 2.42204,2.65704, 4.30971,7.04493, 10.246,4.59428, 12.6868,11.8741
bias_match=1
classes=3
coords=4
num=5
softmax=1
jitter=.2
rescore=1

Command:

./flow --train --model pathToMyCFG.cfg --annotation pathToMyAnnotationsFolder --dataset pathToMyImagesFolder

Output:

Caused by op 'Maximum', defined at:
File "./flow", line 42, in
tfnet = TFNet(FLAGS)
File "/Users/mbp/darkflow/net/build.py", line 51, in __init__
self.setup_meta_ops()
File "/Users/mbp/darkflow/net/build.py", line 94, in setup_meta_ops
if self.FLAGS.train: self.build_train_op()
File "/Users/mbp/darkflow/net/help.py", line 15, in build_train_op
self.framework.loss(self.out)
File "/Users/mbp/darkflow/net/yolov2/train.py", line 78, in loss
intersect_upleft = tf.maximum(floor, _upleft)
File "/Users/mbp/anaconda/lib/python3.5/site-packages/tensorflow/python/ops/gen_math_ops.py", line 1492, in maximum
result = _op_def_lib.apply_op("Maximum", x=x, y=y, name=name)
File "/Users/mbp/anaconda/lib/python3.5/site-packages/tensorflow/python/framework/op_def_library.py", line 759, in apply_op
op_def=op_def)
File "/Users/mbp/anaconda/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 2240, in create_op
original_op=self._default_original_op, op_def=op_def)
File "/Users/mbp/anaconda/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 1128, in __init__
self._traceback = _extract_stack()

InvalidArgumentError (see above for traceback): Incompatible shapes: [170,169,5,2] vs. [16,169,5,2]
[[Node: Maximum = Maximum[T=DT_FLOAT, _device="/job:localhost/replica:0/task:0/cpu:0"](sub, _recv_Placeholder_5_0)]]

try to change "filters" in the last convolution layer

[convolutional]
size=1
stride=1
pad=1
filters= #num * (#classes + 5)
activation=linear

Now it works perfectly :D Thank you @ryansun1900

Thanks All.

Was this page helpful?
0 / 5 - 0 ratings