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

InvalidArgumentError (see above for traceback): Incompatible shapes: [1146880] vs. [158720] #5

Open
Bananaboy99 opened this issue Apr 28, 2017 · 1 comment

Comments

@Bananaboy99
Copy link

Bananaboy99 commented Apr 28, 2017

I´m trying to run the Network but always running into the Error below:

Caused by op 'mul', defined at:
  File "train.py", line 206, in <module>
    train_and_predict()
  File "train.py", line 153, in train_and_predict
    model = get_unet()
  File "train.py", line 115, in get_unet
    model.compile(optimizer=Adam(lr=1e-5), loss=dice_coef_loss, metrics=[dice_coef])
  File "/usr/lib64/python3.4/site-packages/keras/engine/training.py", line 899, in compile
    sample_weight, mask)
  File "/usr/lib64/python3.4/site-packages/keras/engine/training.py", line 430, in weighted
    score_array = fn(y_true, y_pred)
  File "train.py", line 30, in dice_coef_loss
    return 1.-dice_coef(y_true, y_pred)
  File "train.py", line 25, in dice_coef
    intersection = K.sum(y_true_f * y_pred_f)
  File "/usr/lib/python3.4/site-packages/tensorflow/python/ops/math_ops.py", line 794, in binary_op_wrapper
    return func(x, y, name=name)
  File "/usr/lib/python3.4/site-packages/tensorflow/python/ops/math_ops.py", line 1015, in _mul_dispatch
    return gen_math_ops._mul(x, y, name=name)
  File "/usr/lib/python3.4/site-packages/tensorflow/python/ops/gen_math_ops.py", line 1625, in _mul
    result = _op_def_lib.apply_op("Mul", x=x, y=y, name=name)
  File "/usr/lib/python3.4/site-packages/tensorflow/python/framework/op_def_library.py", line 763, in apply_op
    op_def=op_def)
  File "/usr/lib/python3.4/site-packages/tensorflow/python/framework/ops.py", line 2327, in create_op
    original_op=self._default_original_op, op_def=op_def)
  File "/usr/lib/python3.4/site-packages/tensorflow/python/framework/ops.py", line 1226, in __init__
    self._traceback = _extract_stack()

InvalidArgumentError (see above for traceback): Incompatible shapes: [1146880] vs. [158720]
	 [[Node: mul = Mul[T=DT_FLOAT, _device="/job:localhost/replica:0/task:0/gpu:0"](Reshape, Reshape_1)]]
	 [[Node: mul_5/_29 = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/cpu:0", send_device="/job:localhost/replica:0/task:0/gpu:0", send_device_incarnation=1, tensor_name="edge_3199_mul_5", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/cpu:0"]()]]

At line 25 it has a problem with calculating intersection = K.sum(y_true_f * y_pred_f

Where is y_true and y_pred defined??

Thanks for the help.

@ethanhe42
Copy link
Owner

y_true and y_pred are parameters

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

2 participants