Closed gyheart closed 5 years ago
Hello,
It seems that the .cu file is being included more than once. I haven't compiled this project in a while (but nothing should have changed), did you do something with the directories and files or just try to compile as is?
Hello,
It seems that the .cu file is being included more than once. I haven't compiled this project in a while (but nothing should have changed), did you do something with the directories and files or just try to compile as is?
Thanks for your reply. It is my error. I have solved it.
But I have a new problem when I use your CRFasRNN after FCN by keras. The unput shape is 256*256.
First I set the batch size=1, and define the shape of the inputs before the crf as rnn layer. The code can work successfully.
Then I set the batch size=10, and define the shape of the inputs before the crf as rnn layer. But the code can't work. It have a error behind:
2018-12-05 10:39:39.091356: W tensorflow/core/framework/op_kernel.cc:1192] Invalid argument: Incompatible shapes: [655360] vs. [10] [[Node: training/Adam/gradients/loss/crfrnn_loss/mul_1_grad/BroadcastGradientArgs = BroadcastGradientArgs[T=DT_INT32, _class=["loc:@loss/crfrnn_loss/mul_1"], _device="/job:localhost/replica:0/task:0/device:GPU:0"](training/Adam/gradients/loss/crfrnn_loss/mul_1_grad/Shape, training/Adam/gradients/loss/crfrnn_loss/mul_1_grad/Shape_1)]] 2018-12-05 10:39:39.094278: W tensorflow/core/framework/op_kernel.cc:1192] Invalid argument: Incompatible shapes: [655360] vs. [10] [[Node: training/Adam/gradients/loss/crfrnn_loss/mul_1_grad/BroadcastGradientArgs = BroadcastGradientArgs[T=DT_INT32, _class=["loc:@loss/crfrnn_loss/mul_1"], _device="/job:localhost/replica:0/task:0/device:GPU:0"](training/Adam/gradients/loss/crfrnn_loss/mul_1_grad/Shape, training/Adam/gradients/loss/crfrnn_loss/mul_1_grad/Shape_1)]] 2018-12-05 10:39:39.094375: W tensorflow/core/framework/op_kernel.cc:1192] Invalid argument: Incompatible shapes: [655360] vs. [10] [[Node: training/Adam/gradients/loss/crfrnn_loss/mul_1_grad/BroadcastGradientArgs = BroadcastGradientArgs[T=DT_INT32, _class=["loc:@loss/crfrnn_loss/mul_1"], _device="/job:localhost/replica:0/task:0/device:GPU:0"](training/Adam/gradients/loss/crfrnn_loss/mul_1_grad/Shape, training/Adam/gradients/loss/crfrnn_loss/mul_1_grad/Shape_1)]] Traceback (most recent call last): File "/home/amax/.local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1323, in _do_call return fn(*args) File "/home/amax/.local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1302, in _run_fn status, run_metadata) File "/home/amax/.local/lib/python3.5/site-packages/tensorflow/python/framework/errors_impl.py", line 473, in exit c_api.TF_GetCode(self.status.status)) tensorflow.python.framework.errors_impl.InvalidArgumentError: Incompatible shapes: [655360] vs. [10] [[Node: training/Adam/gradients/loss/crfrnn_loss/mul_1_grad/BroadcastGradientArgs = BroadcastGradientArgs[T=DT_INT32, _class=["loc:@loss/crfrnn_loss/mul_1"], _device="/job:localhost/replica:0/task:0/device:GPU:0"](training/Adam/gradients/loss/crfrnn_loss/mul_1_grad/Shape, training/Adam/gradients/loss/crfrnn_loss/mul_1_grad/Shape_1)]] [[Node: crfrnn/spatial_ker_weights/read/_735 = _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="edge_866_crfrnn/spatial_ker_weights/read", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "qq_train.py", line 85, in
Caused by op 'training/Adam/gradients/loss/crfrnn_loss/mul_1_grad/BroadcastGradientArgs', defined at:
File "qq_train.py", line 85, in
...which was originally created as op 'loss/crfrnn_loss/mul_1', defined at:
File "qq_train.py", line 46, in
InvalidArgumentError (see above for traceback): Incompatible shapes: [655360] vs. [10] [[Node: training/Adam/gradients/loss/crfrnn_loss/mul_1_grad/BroadcastGradientArgs = BroadcastGradientArgs[T=DT_INT32, _class=["loc:@loss/crfrnn_loss/mul_1"], _device="/job:localhost/replica:0/task:0/device:GPU:0"](training/Adam/gradients/loss/crfrnn_loss/mul_1_grad/Shape, training/Adam/gradients/loss/crfrnn_loss/mul_1_grad/Shape_1)]] [[Node: crfrnn/spatial_ker_weights/read/_735 = _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="edge_866_crfrnn/spatial_ker_weights/read", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]
The input shape of the CRFasRNN layer should be [batch_size, spatial_dim_1, spatial_dim_2, ..., spatial_dim_m, num_classes].
The input shape of the CRFasRNN layer should be [batch_size, spatial_dim_1, spatial_dim_2, ..., spatial_dim_m, num_classes].
My input shape of the CRFasRNN layer is 10, 256, 256, 2 and 10, 256, 256, 3 .
have you compiled for the correct number of dimensions and channels?
I set PATIAL_DIMS=2, INPUT_CHANNELS=2 (object/background) and REFERENCE_CHANNELS=3(RGB). When the batch size is 1, the code can work successfully.
Did you manage to fix it? What was the problem?
Did you manage to fix it? What was the problem?
I have managed it. I made a stupid mistake in my code. Thank you for your help.
But It doesn't seem that the CRF layer effect the output. The out by FCN + your CRF and FCN were (visually) identical! I set the theta_alpha = 160, theta_beta = 3, theta_gamma = 3 like that the original setting. And the reference image is to be within [0, 255] .
How can I use your CRF layer to let it produce the same effect as the original version.
Have you trained the algorithm from scratch?
Have you trained the algorithm from scratch?
Yes, I trained the algorithm from scratch. Is the theta setting error?
What was the final values for the compatibility matrix and weights of the CRFasrRNN layer? Comment on the thetas, if theta is very large (e.g. 160) this is the same as bypassing the filter. Also you can try normalizing the images between 0 and 1.
Hello! I use ubuntu16.04. python3.5. tensorflow1.4 My version g++ 5 and cuda 8.0.
At the beginning of compiling, there are several information show that both tow compiler is work well. All the errors occur after 50% are compile task is done and i see this [50%] Building CUDA object CMakeFiles/lattice_filter.dir/src/LatticeFilterkernel.cu.o
Scanning dependencies of target lattice_filter [ 25%] Building CXX object CMakeFiles/lattice_filter.dir/src/LatticeFilterKernel.cpp.o [ 50%] Building CUDA object CMakeFiles/lattice_filter.dir/src/LatticeFilterKernel.cu.o