kerlomz / captcha_trainer

[验证码识别-训练] This project is based on CNN/ResNet/DenseNet+GRU/LSTM+CTC/CrossEntropy to realize verification code identification. This project is only for training the model.
Apache License 2.0
3.02k stars 821 forks source link

GPU环境下遇到问题,问题如下。 #21

Closed GuanFoxyier closed 5 years ago

GuanFoxyier commented 5 years ago

INFO:tensorflow:Start training... 2019-06-05 10:24:19.195228: W tensorflow/core/framework/op_kernel.cc:1273] OP_REQUIRES failed at ctc_loss_op.cc:168 : Invalid argument: Labels length is zero in batch 0 Traceback (most recent call last): File "/data1/gjl/venv3.6/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1334, in _do_call return fn(*args) File "/data1/gjl/venv3.6/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1319, in _run_fn options, feed_dict, fetch_list, target_list, run_metadata) File "/data1/gjl/venv3.6/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1407, in _call_tf_sessionrun run_metadata) tensorflow.python.framework.errors_impl.InvalidArgumentError: Labels length is zero in batch 0 [[{{node CTCLoss}} = CTCLoss[ctc_merge_repeated=true, ignore_longer_outputs_than_inputs=false, preprocess_collapse_repeated=false, _device="/job:localhost/replica:0/task:0/device:CPU:0"](output/predict/_89, _arg_labels/indices_0_1, _arg_labels/values_0_3, seq_len/_91)]] [[{{node gradients/Mean_grad/Shape/_104}} = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device_incarnation=1, tensor_name="edge_5999_gradients/Mean_grad/Shape", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"]()]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "trains.py", line 228, in tf.app.run() File "/data1/gjl/venv3.6/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 125, in run _sys.exit(main(argv)) File "trains.py", line 221, in main train_process() File "trains.py", line 146, in train_process feed_dict=feed File "/data1/gjl/venv3.6/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 929, in run run_metadata_ptr) File "/data1/gjl/venv3.6/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1152, in _run feed_dict_tensor, options, run_metadata) File "/data1/gjl/venv3.6/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1328, in _do_run run_metadata) File "/data1/gjl/venv3.6/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1348, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.InvalidArgumentError: Labels length is zero in batch 0 [[node CTCLoss (defined at /data1/gjl/captcha_trainer/framework.py:119) = CTCLoss[ctc_merge_repeated=true, ignore_longer_outputs_than_inputs=false, preprocess_collapse_repeated=false, _device="/job:localhost/replica:0/task:0/device:CPU:0"](output/predict/_89, _arg_labels/indices_0_1, _arg_labels/values_0_3, seq_len/_91)]] [[{{node gradients/Mean_grad/Shape/_104}} = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device_incarnation=1, tensor_name="edge_5999_gradients/Mean_grad/Shape", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"]()]]

Caused by op 'CTCLoss', defined at: File "trains.py", line 228, in tf.app.run() File "/data1/gjl/venv3.6/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 125, in run _sys.exit(main(argv)) File "trains.py", line 221, in main train_process() File "trains.py", line 49, in train_process model.build_graph() File "/data1/gjl/captcha_trainer/framework.py", line 33, in build_graph self._build_train_op() File "/data1/gjl/captcha_trainer/framework.py", line 119, in _build_train_op time_major=CTC_LOSS_TIME_MAJOR File "/data1/gjl/venv3.6/lib/python3.6/site-packages/tensorflow/python/ops/ctc_ops.py", line 158, in ctc_loss ignore_longer_outputs_than_inputs=ignore_longer_outputs_than_inputs) File "/data1/gjl/venv3.6/lib/python3.6/site-packages/tensorflow/python/ops/gen_ctc_ops.py", line 286, in ctc_loss name=name) File "/data1/gjl/venv3.6/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper op_def=op_def) File "/data1/gjl/venv3.6/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 488, in new_func return func(*args, **kwargs) File "/data1/gjl/venv3.6/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3274, in create_op op_def=op_def) File "/data1/gjl/venv3.6/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1770, in init self._traceback = tf_stack.extract_stack()

InvalidArgumentError (see above for traceback): Labels length is zero in batch 0 [[node CTCLoss (defined at /data1/gjl/captcha_trainer/framework.py:119) = CTCLoss[ctc_merge_repeated=true, ignore_longer_outputs_than_inputs=false, preprocess_collapse_repeated=false, _device="/job:localhost/replica:0/task:0/device:CPU:0"](output/predict/_89, _arg_labels/indices_0_1, _arg_labels/values_0_3, seq_len/_91)]] [[{{node gradients/Mean_grad/Shape/_104}} = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device_incarnation=1, tensor_name="edge_5999_gradients/Mean_grad/Shape", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"]()]]

GuanFoxyier commented 5 years ago

已解决。正则写的有问题。