vanvalenlab / deepcell-tf

Deep Learning Library for Single Cell Analysis
https://deepcell.readthedocs.io
Other
412 stars 95 forks source link

Watershed Distance Transform for 2D Data not working #120

Closed riederd closed 5 years ago

riederd commented 5 years ago

Hi,

I'm tryining to run deepcell-tf using the "Watershed Distance Transform for 2D Data" notebook as python script on some of our images. For now I'm only using 2 sets of nuclear stain images each set has 1 image. However, unfortunately it seems not to work as expected.

After training the foreground/background separation model it crashes at step [5] and produces the following traceback:

Traceback (most recent call last): File "runDeepCellWatershedSeq.py", line 158, in shear=False) File "/home/foo/miniconda3/envs/deepCell-tf/lib/python3.6/site-packages/DeepCell-0.1-py3.6.egg/deepcell/training.py", line 169, in train_model_sample File "/home/foo/miniconda3/envs/deepCell-tf/lib/python3.6/site-packages/tensorflow/python/keras/engine/training.py", line 1761, in fit_generator initial_epoch=initial_epoch) File "/home/foo/miniconda3/envs/deepCell-tf/lib/python3.6/site-packages/tensorflow/python/keras/engine/training_generator.py", line 190, in fit_generator x, y, sample_weight=sample_weight, class_weight=class_weight) File "/home/foo/miniconda3/envs/deepCell-tf/lib/python3.6/site-packages/tensorflow/python/keras/engine/training.py", line 1537, in train_on_batch outputs = self.train_function(ins) File "/home/foo/miniconda3/envs/deepCell-tf/lib/python3.6/site-packages/tensorflow/python/keras/backend.py", line 2897, in call fetched = self._callable_fn(*array_vals) File "/home/foo/miniconda3/envs/deepCell-tf/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1454, in call self._session._session, self._handle, args, status, None) File "/home/foo/miniconda3/envs/deepCell-tf/lib/python3.6/site-packages/tensorflow/python/framework/errors_impl.py", line 519, in exit c_api.TF_GetCode(self.status.status)) tensorflow.python.framework.errors_impl.InvalidArgumentError: Incompatible shapes: [10,2] vs. [10,4] [[Node: loss_1/softmax_1_loss/mul_1 = Mul[T=DT_FLOAT, _class=["loc:@training_1/SGD/gradients/loss_1/softmax_1_loss/mul_1_grad/Reshape_1"], _device="/job:localhost/replica:0/task:0/device:GPU:0"](_arg_softmax_1_target_0_1/_1259, loss_1/softmax_1_loss/Log)]] [[Node: training_1/SGD/gradients/batch_normalization_15/cond/FusedBatchNorm_1_grad/FusedBatchNormGrad/_1481 = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge1300...chNormGrad", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]()

The problem seems to be: Incompatible shapes: [10,2] vs. [10,4]

How can this be fixed?

willgraf commented 5 years ago

It would be helpful if you could you post the code you're running to get this error. I think I've run into this error before, but seeing the exact code would really help diagnose.

riederd commented 5 years ago

Sure,

I attached a zipped python script. Thanks for looking at this.

DeepCellWatershedSeq.zip