Open vinniyo opened 6 years ago
Even I am having the same issue
I have the same problem after I upgraded my Keras version from 2.1.6 to 2.2.0. I am not sure what part of code caused this error in 2.2.0. You can install keras 2.1.6 by using pip install keras==2.1.6
I Hope this solves the issue temporarily.
I'm try to updata Keras from 2.2.0 to 2.2.2 ,it's also work.
Running windows 10 with everything installed and I get this error:
ValueError: Shape must be rank 1 but is rank 4 for 'bn1/cond/FusedBatchNorm' (op: 'FusedBatchNorm') with input shapes: [?,64,48,48], [1,64,1,1], [1,64,1,1], [1,64,1,1], [1,64,1,1].
Any thoughts?
Full error: Using TensorFlow backend. 2018-06-29 12:25:03.141799: I T:\src\github\tensorflow\tensorflow\core\platform\cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 2018-06-29 12:25:03.498122: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1356] Found device 0 with properties: name: GeForce GTX TITAN Black major: 3 minor: 5 memoryClockRate(GHz): 0.98 pciBusID: 0000:01:00.0 totalMemory: 6.00GiB freeMemory: 5.00GiB 2018-06-29 12:25:03.505607: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1435] Adding visible gpu devices: 0 2018-06-29 12:25:03.782568: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix: 2018-06-29 12:25:03.787601: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:929] 0 2018-06-29 12:25:03.790697: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:942] 0: N 2018-06-29 12:25:03.795210: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 4790 MB memory) -> physical GPU (device: 0, name: GeForce GTX TITAN Black, pci bus id: 0000:01:00.0, compute capability: 3.5) Traceback (most recent call last): File "C:\Users\vince\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\ops.py", line 1567, in _create_c_op c_op = c_api.TF_FinishOperation(op_desc) tensorflow.python.framework.errors_impl.InvalidArgumentError: Shape must be rank 1 but is rank 4 for 'bn1/cond/FusedBatchNorm' (op: 'FusedBatchNorm') with input shapes: [?,64,48,48], [1,64,1,1], [1,64,1,1], [1,64,1,1], [1,64,1,1].
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "facenet.py", line 19, in
FRmodel = faceRecoModel(input_shape=(3, 96, 96))
File "C:\Users\vince\Desktop\facenet-face-recognition\inception_blocks_v2.py", line 233, in faceRecoModel
X = BatchNormalization(axis = 1, name = 'bn1')(X)
File "C:\Users\vince\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\engine\base_layer.py", line 460, in call
output = self.call(inputs, *kwargs)
File "C:\Users\vince\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\layers\normalization.py", line 204, in call
training=training)
File "C:\Users\vince\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\backend\tensorflow_backend.py", line 3069, in in_train_phase
x = switch(training, x, alt)
File "C:\Users\vince\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\backend\tensorflow_backend.py", line 3004, in switch
else_expression_fn)
File "C:\Users\vince\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\util\deprecation.py", line 432, in new_func
return func(args, **kwargs)
File "C:\Users\vince\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\ops\control_flow_ops.py", line 2072, in cond
orig_res_f, res_f = context_f.BuildCondBranch(false_fn)
File "C:\Users\vince\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\ops\control_flow_ops.py", line 1913, in BuildCondBranch
original_result = fn()
File "C:\Users\vince\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\layers\normalization.py", line 165, in normalize_inference
epsilon=self.epsilon)
File "C:\Users\vince\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\backend\tensorflow_backend.py", line 1894, in batch_normalization
is_training=False
File "C:\Users\vince\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\ops\nn_impl.py", line 904, in fused_batch_norm
name=name)
File "C:\Users\vince\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\ops\gen_nn_ops.py", line 3774, in _fused_batch_norm
is_training=is_training, name=name)
File "C:\Users\vince\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "C:\Users\vince\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\ops.py", line 3392, in create_op
op_def=op_def)
File "C:\Users\vince\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\ops.py", line 1734, in init
control_input_ops)
File "C:\Users\vince\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\ops.py", line 1570, in _create_c_op
raise ValueError(str(e))
ValueError: Shape must be rank 1 but is rank 4 for 'bn1/cond/FusedBatchNorm' (op: 'FusedBatchNorm') with input shapes: [?,64,48,48], [1,64,1,1], [1,64,1,1], [1,64,1,1], [1,64,1,1].