Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatible shapes #42

Closed
pribadihcr opened this issue Feb 3, 2017 · 5 comments
Closed

Incompatible shapes #42

pribadihcr opened this issue Feb 3, 2017 · 5 comments

Comments

@pribadihcr
Copy link

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

@thtrieu thtrieu assigned thtrieu and unassigned thtrieu Feb 3, 2017
@thtrieu
Copy link
Owner

thtrieu commented Feb 3, 2017

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.

@spiez
Copy link

spiez commented Feb 3, 2017

@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)]]

@ryansun1900
Copy link
Contributor

ryansun1900 commented Feb 3, 2017

try to change "filters" in the last convolution layer

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

@spiez
Copy link

spiez commented Feb 5, 2017

Now it works perfectly :D Thank you @ryansun1900

@pribadihcr
Copy link
Author

Thanks All.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants