kcct-fujimotolab / 3DCNN

3D convolutional neural network for video classification
270 stars 105 forks source link

Value for attr 'data_format' of "NDHWC" is not in the list of allowed values:"NHWC","NCHW" #12

Closed BUGUER closed 6 years ago

BUGUER commented 6 years ago

I think it maybe because the wrong version of tensorflow or mkl ,or maybe the performance of cpu is not good.but I'm not sure,so if someone met the same question before,please help me. my tensorflow version is 1.7.0,my mkl version is 2018.0.2

2018-05-02 17:32:27.747982: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA 2018-05-02 17:32:28.586141: E tensorflow/core/common_runtime/executor.cc:644] Executor failed to create kernel. Invalid argument: Value for attr 'data_format' of "NDHWC" is not in the list of allowed values: "NHWC", "NCHW" ; NodeDef: MklInputConversion/_210 = _MklInputConversion[T=DT_FLOAT, _kernel="MklOp", data_format="NDHWC", _device="/job:localhost/replica:0/task:0/device:CPU:0"](conv3d_1/convolution, conv3d_1/Reshape, DMT/_8, conv3d_1/Reshape:1); Op<name=_MklInputConversion; signature=input_0:T, input_1:T, mkl_input_0:uint8, mkl_input_1:uint8 -> output_0:T, output_1:T, mkl_output_0:uint8, mkl_output_1:uint8; attr=T:type,allowed=[DT_HALF, DT_FLOAT, DT_DOUBLE, DT_UINT8, DT_INT8, DT_UINT16, DT_INT16, DT_INT32, DT_INT64, DT_COMPLEX64, DT_COMPLEX128]; attr=data_format:string,default="NHWC",allowed=["NHWC", "NCHW"]> [[Node: MklInputConversion/_210 = _MklInputConversion[T=DT_FLOAT, _kernel="MklOp", data_format="NDHWC", _device="/job:localhost/replica:0/task:0/device:CPU:0"](conv3d_1/convolution, conv3d_1/Reshape, DMT/_8, conv3d_1/Reshape:1)]] Traceback (most recent call last): File "/home/zhangronghui/anaconda3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1327, in _do_call return fn(*args) File "/home/zhangronghui/anaconda3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1312, in _run_fn options, feed_dict, fetch_list, target_list, run_metadata) File "/home/zhangronghui/anaconda3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1420, in _call_tf_sessionrun status, run_metadata) File "/home/zhangronghui/anaconda3/lib/python3.5/site-packages/tensorflow/python/framework/errors_impl.py", line 516, in exit c_api.TF_GetCode(self.status.status)) tensorflow.python.framework.errors_impl.InvalidArgumentError: Value for attr 'data_format' of "NDHWC" is not in the list of allowed values: "NHWC", "NCHW" ; NodeDef: MklInputConversion/_210 = _MklInputConversion[T=DT_FLOAT, _kernel="MklOp", data_format="NDHWC", _device="/job:localhost/replica:0/task:0/device:CPU:0"](conv3d_1/convolution, conv3d_1/Reshape, DMT/_8, conv3d_1/Reshape:1); Op<name=_MklInputConversion; signature=input_0:T, input_1:T, mkl_input_0:uint8, mkl_input_1:uint8 -> output_0:T, output_1:T, mkl_output_0:uint8, mkl_output_1:uint8; attr=T:type,allowed=[DT_HALF, DT_FLOAT, DT_DOUBLE, DT_UINT8, DT_INT8, DT_UINT16, DT_INT16, DT_INT32, DT_INT64, DT_COMPLEX64, DT_COMPLEX128]; attr=data_format:string,default="NHWC",allowed=["NHWC", "NCHW"]> [[Node: MklInputConversion/_210 = _MklInputConversion[T=DT_FLOAT, _kernel="MklOp", data_format="NDHWC", _device="/job:localhost/replica:0/task:0/device:CPU:0"](conv3d_1/convolution, conv3d_1/Reshape, DMT/_8, conv3d_1/Reshape:1)]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "3dcnn.py", line 185, in main() File "3dcnn.py", line 168, in main history = model.fit(X_train, Y_train, validation_data=(X_test, Y_test), batch_size=args.batch,epochs=args.epoch, verbose=1, shuffle=True) File "/home/zhangronghui/anaconda3/lib/python3.5/site-packages/keras/models.py", line 1002, in fit validation_steps=validation_steps) File "/home/zhangronghui/anaconda3/lib/python3.5/site-packages/keras/engine/training.py", line 1705, in fit validation_steps=validation_steps) File "/home/zhangronghui/anaconda3/lib/python3.5/site-packages/keras/engine/training.py", line 1236, in _fit_loop outs = f(ins_batch) File "/home/zhangronghui/anaconda3/lib/python3.5/site-packages/keras/backend/tensorflow_backend.py", line 2482, in call **self.session_kwargs) File "/home/zhangronghui/anaconda3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 905, in run run_metadata_ptr) File "/home/zhangronghui/anaconda3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1140, in _run feed_dict_tensor, options, run_metadata) File "/home/zhangronghui/anaconda3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1321, in _do_run run_metadata) File "/home/zhangronghui/anaconda3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1340, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.InvalidArgumentError: Value for attr 'data_format' of "NDHWC" is not in the list of allowed values: "NHWC", "NCHW" ; NodeDef: MklInputConversion/_210 = _MklInputConversion[T=DT_FLOAT, _kernel="MklOp", data_format="NDHWC", _device="/job:localhost/replica:0/task:0/device:CPU:0"](conv3d_1/convolution, conv3d_1/Reshape, DMT/_8, conv3d_1/Reshape:1); Op<name=_MklInputConversion; signature=input_0:T, input_1:T, mkl_input_0:uint8, mkl_input_1:uint8 -> output_0:T, output_1:T, mkl_output_0:uint8, mkl_output_1:uint8; attr=T:type,allowed=[DT_HALF, DT_FLOAT, DT_DOUBLE, DT_UINT8, DT_INT8, DT_UINT16, DT_INT16, DT_INT32, DT_INT64, DT_COMPLEX64, DT_COMPLEX128]; attr=data_format:string,default="NHWC",allowed=["NHWC", "NCHW"]> [[Node: MklInputConversion/_210 = _MklInputConversion[T=DT_FLOAT, _kernel="MklOp", data_format="NDHWC", _device="/job:localhost/replica:0/task:0/device:CPU:0"](conv3d_1/convolution, conv3d_1/Reshape, DMT/_8, conv3d_1/Reshape:1)]]

BUGUER commented 6 years ago

I have solved the problem by myself. I updated tensorflow to the version 1.8.0,then it worked when you see the problem like mine,you can consider update your tensorflow.

moon-home commented 6 years ago

Hi, I have updated my tf version to 1.9, but this error still occurs.

Have I written custom code: Not very sure what custom code means here, I am trying to replicate this work: https://github.com/harvitronix/five-video-classification-methods. This error occurs only when I try model "Conv3d" or "c3d" both of which call keras.layers.Conv3D(). OS Platform and Distribution: Ubuntu--16-0 with AWS DLAMI TensorFlow installed from: tensorflow 1.9.0 mkl_py36h6d6ce78_1 Bazel version: bazel 0.15.0 0 conda-forge GPU model and memory: No GPU, 4G I am using AWS EC2 c5.large