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

ValueError: None is only supported in the 1st dimension. Tensor 'input' has invalid shape '[None, None, 60, 1]'. #79

Open padluo opened 3 years ago

padluo commented 3 years ago

模型已经训练完毕,在保存模型时,报错如下: Traceback (most recent call last): File "trains.py", line 336, in tf.compat.v1.app.run() File "/usr/local/anaconda3/lib/python3.7/site-packages/tensorflow/python/platform/app.py", line 40, in run _run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef) File "/usr/local/anaconda3/lib/python3.7/site-packages/absl_py-0.7.1-py3.7.egg/absl/app.py", line 300, in run _run_main(main, args) File "/usr/local/anaconda3/lib/python3.7/site-packages/absl_py-0.7.1-py3.7.egg/absl/app.py", line 251, in _run_main sys.exit(main(argv)) File "trains.py", line 329, in main Trains(model_conf).train_process() File "trains.py", line 318, in train_process self.compile_graph(accuracy) File "trains.py", line 117, in compile_graph self.compile_tflite(last_compile_model_path) File "trains.py", line 63, in compile_tflite tflite_model = converter.convert() File "/usr/local/anaconda3/lib/python3.7/site-packages/tensorflow/lite/python/lite.py", line 811, in convert _get_tensor_name(tensor), shape_list)) ValueError: None is only supported in the 1st dimension. Tensor 'input' has invalid shape '[None, None, 60, 1]'.

zhaokanghuiasd commented 3 years ago

您好~请问您解决了吗?我也遇到了这个问题

padluo commented 3 years ago

您好~请问您解决了吗?我也遇到了这个问题

还未解决

kerlomz commented 3 years ago

修改config.py的这部分内容如下: RESIZE_MAP = { LossFunction.CTC: lambda x, y: [x, y], LossFunction.CrossEntropy: lambda x, y: [x, y] } 出现这个没什么关系,模型已经生成了其实,这是tf2onnx的模型不支持不定宽输出