我将landmark用的数据集换成了我自己的数据集,process对数据的处理都没有问题,也成功生成了tfcord文件,但是在训练p-net的时候却遇到了如下错误。求解。
2019-08-03 17:03:27.010008: 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
Traceback (most recent call last):
File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1322, in _do_call
return fn(*args)
File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1307, in _run_fn
options, feed_dict, fetch_list, target_list, run_metadata)
File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1409, in _call_tf_sessionrun
run_metadata)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Reshape cannot infer the missing input size for an empty tensor unless all specified input sizes are non-zero
[[Node: gradients/PNet/TopKV2_2_grad/Reshape = Reshape[T=DT_INT32, Tshape=DT_INT32, _device="/job:localhost/replica:0/task:0/device:CPU:0"](PNet/TopKV2_2:1, gradients/PNet/TopKV2_2_grad/stack)]]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "train.py", line 58, in
main(parse_arguments(sys.argv[1:]))
File "train.py", line 41, in main
train(net_factory,prefix,end_epoch,base_dir,display,lr)
File "/home/lishuwei/dsx/tensorflow-MTCNN-master/train/trainmodel.py", line 122, in train
,_,summary = sess.run([train_op, lr_op ,summary_op], feed_dict={input_image: image_batch_array, label: label_batch_array, bbox_target: bbox_batch_array,landmark_target:landmark_batch_array})
File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 900, in run
run_metadata_ptr)
File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1135, in _run
feed_dict_tensor, options, run_metadata)
File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1316, in _do_run
run_metadata)
File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1335, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Reshape cannot infer the missing input size for an empty tensor unless all specified input sizes are non-zero
[[Node: gradients/PNet/TopKV2_2_grad/Reshape = Reshape[T=DT_INT32, Tshape=DT_INT32, _device="/job:localhost/replica:0/task:0/device:CPU:0"](PNet/TopKV2_2:1, gradients/PNet/TopKV2_2_grad/stack)]]
Caused by op 'gradients/PNet/TopKV2_2_grad/Reshape', defined at:
File "train.py", line 58, in
main(parse_arguments(sys.argv[1:]))
File "train.py", line 41, in main
train(net_factory,prefix,end_epoch,base_dir,display,lr)
File "/home/lishuwei/dsx/tensorflow-MTCNN-master/train/train_model.py", line 82, in train
train_op,lr_op=optimize(base_lr,total_loss_op,num)
File "/home/lishuwei/dsx/tensorflow-MTCNN-master/train/train_model.py", line 159, in optimize
train_op = optimizer.minimize(loss, global_step)
File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/training/optimizer.py", line 414, in minimize
grad_loss=grad_loss)
File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/training/optimizer.py", line 526, in compute_gradients
colocate_gradients_with_ops=colocate_gradients_with_ops)
File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/ops/gradients_impl.py", line 494, in gradients
gate_gradients, aggregation_method, stop_gradients)
File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/ops/gradients_impl.py", line 636, in _GradientsHelper
lambda: grad_fn(op, out_grads))
File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/ops/gradients_impl.py", line 385, in _MaybeCompile
return grad_fn() # Exit early
File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/ops/gradients_impl.py", line 636, in
lambda: grad_fn(op, out_grads))
File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/ops/nn_grad.py", line 978, in _TopKGrad
ind_2d = array_ops.reshape(op.outputs[1], array_ops.stack([-1, ind_lastdim]))
File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/ops/gen_array_ops.py", line 6113, in reshape
"Reshape", tensor=tensor, shape=shape, name=name)
File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3392, in create_op
op_def=op_def)
File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1718, in init
self._traceback = self._graph._extract_stack() # pylint: disable=protected-access
...which was originally created as op 'PNet/TopKV2_2', defined at:
File "train.py", line 58, in
main(parse_arguments(sys.argv[1:]))
[elided 0 identical lines from previous traceback]
File "train.py", line 41, in main
train(net_factory,prefix,end_epoch,base_dir,display,lr)
File "/home/lishuwei/dsx/tensorflow-MTCNN-master/train/train_model.py", line 80, in train
label,bbox_target,landmark_target,training=True)
File "/home/lishuwei/dsx/tensorflow-MTCNN-master/train/model.py", line 41, in P_Net
landmark_loss=landmark_ohem(landmark_pred,landmark_target,label)
File "/home/lishuwei/dsx/tensorflow-MTCNN-master/train/model.py", line 219, in landmark_ohem
squareerror,=tf.nn.top_k(square_error,k=keep_num)
File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/ops/nn_ops.py", line 2352, in top_k
return gen_nn_ops.top_kv2(input, k=k, sorted=sorted, name=name)
File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/ops/gen_nn_ops.py", line 7660, in top_kv2
"TopKV2", input=input, k=k, sorted=sorted, name=name)
File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3392, in create_op
op_def=op_def)
File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1718, in init
self._traceback = self._graph._extract_stack() # pylint: disable=protected-access
InvalidArgumentError (see above for traceback): Reshape cannot infer the missing input size for an empty tensor unless all specified input sizes are non-zero
[[Node: gradients/PNet/TopKV2_2_grad/Reshape = Reshape[T=DT_INT32, Tshape=DT_INT32, _device="/job:localhost/replica:0/task:0/device:CPU:0"](PNet/TopKV2_2:1, gradients/PNet/TopKV2_2_grad/stack)]]
我将landmark用的数据集换成了我自己的数据集,process对数据的处理都没有问题,也成功生成了tfcord文件,但是在训练p-net的时候却遇到了如下错误。求解。 2019-08-03 17:03:27.010008: 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 Traceback (most recent call last): File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1322, in _do_call return fn(*args) File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1307, in _run_fn options, feed_dict, fetch_list, target_list, run_metadata) File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1409, in _call_tf_sessionrun run_metadata) tensorflow.python.framework.errors_impl.InvalidArgumentError: Reshape cannot infer the missing input size for an empty tensor unless all specified input sizes are non-zero [[Node: gradients/PNet/TopKV2_2_grad/Reshape = Reshape[T=DT_INT32, Tshape=DT_INT32, _device="/job:localhost/replica:0/task:0/device:CPU:0"](PNet/TopKV2_2:1, gradients/PNet/TopKV2_2_grad/stack)]]
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "train.py", line 58, in
main(parse_arguments(sys.argv[1:]))
File "train.py", line 41, in main
train(net_factory,prefix,end_epoch,base_dir,display,lr)
File "/home/lishuwei/dsx/tensorflow-MTCNN-master/train/trainmodel.py", line 122, in train
,_,summary = sess.run([train_op, lr_op ,summary_op], feed_dict={input_image: image_batch_array, label: label_batch_array, bbox_target: bbox_batch_array,landmark_target:landmark_batch_array})
File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 900, in run
run_metadata_ptr)
File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1135, in _run
feed_dict_tensor, options, run_metadata)
File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1316, in _do_run
run_metadata)
File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1335, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Reshape cannot infer the missing input size for an empty tensor unless all specified input sizes are non-zero
[[Node: gradients/PNet/TopKV2_2_grad/Reshape = Reshape[T=DT_INT32, Tshape=DT_INT32, _device="/job:localhost/replica:0/task:0/device:CPU:0"](PNet/TopKV2_2:1, gradients/PNet/TopKV2_2_grad/stack)]]
Caused by op 'gradients/PNet/TopKV2_2_grad/Reshape', defined at: File "train.py", line 58, in
main(parse_arguments(sys.argv[1:]))
File "train.py", line 41, in main
train(net_factory,prefix,end_epoch,base_dir,display,lr)
File "/home/lishuwei/dsx/tensorflow-MTCNN-master/train/train_model.py", line 82, in train
train_op,lr_op=optimize(base_lr,total_loss_op,num)
File "/home/lishuwei/dsx/tensorflow-MTCNN-master/train/train_model.py", line 159, in optimize
train_op = optimizer.minimize(loss, global_step)
File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/training/optimizer.py", line 414, in minimize
grad_loss=grad_loss)
File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/training/optimizer.py", line 526, in compute_gradients
colocate_gradients_with_ops=colocate_gradients_with_ops)
File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/ops/gradients_impl.py", line 494, in gradients
gate_gradients, aggregation_method, stop_gradients)
File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/ops/gradients_impl.py", line 636, in _GradientsHelper
lambda: grad_fn(op, out_grads))
File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/ops/gradients_impl.py", line 385, in _MaybeCompile
return grad_fn() # Exit early
File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/ops/gradients_impl.py", line 636, in
lambda: grad_fn(op, out_grads))
File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/ops/nn_grad.py", line 978, in _TopKGrad
ind_2d = array_ops.reshape(op.outputs[1], array_ops.stack([-1, ind_lastdim]))
File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/ops/gen_array_ops.py", line 6113, in reshape
"Reshape", tensor=tensor, shape=shape, name=name)
File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3392, in create_op
op_def=op_def)
File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1718, in init
self._traceback = self._graph._extract_stack() # pylint: disable=protected-access
...which was originally created as op 'PNet/TopKV2_2', defined at: File "train.py", line 58, in
main(parse_arguments(sys.argv[1:]))
[elided 0 identical lines from previous traceback]
File "train.py", line 41, in main
train(net_factory,prefix,end_epoch,base_dir,display,lr)
File "/home/lishuwei/dsx/tensorflow-MTCNN-master/train/train_model.py", line 80, in train
label,bbox_target,landmark_target,training=True)
File "/home/lishuwei/dsx/tensorflow-MTCNN-master/train/model.py", line 41, in P_Net
landmark_loss=landmark_ohem(landmark_pred,landmark_target,label)
File "/home/lishuwei/dsx/tensorflow-MTCNN-master/train/model.py", line 219, in landmark_ohem
squareerror,=tf.nn.top_k(square_error,k=keep_num)
File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/ops/nn_ops.py", line 2352, in top_k
return gen_nn_ops.top_kv2(input, k=k, sorted=sorted, name=name)
File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/ops/gen_nn_ops.py", line 7660, in top_kv2
"TopKV2", input=input, k=k, sorted=sorted, name=name)
File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3392, in create_op
op_def=op_def)
File "/home/lishuwei/anaconda3/envs/dsx_tf/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1718, in init
self._traceback = self._graph._extract_stack() # pylint: disable=protected-access
InvalidArgumentError (see above for traceback): Reshape cannot infer the missing input size for an empty tensor unless all specified input sizes are non-zero [[Node: gradients/PNet/TopKV2_2_grad/Reshape = Reshape[T=DT_INT32, Tshape=DT_INT32, _device="/job:localhost/replica:0/task:0/device:CPU:0"](PNet/TopKV2_2:1, gradients/PNet/TopKV2_2_grad/stack)]]