watsonyanghx / CNN_LSTM_CTC_Tensorflow

CNN+LSTM+CTC based OCR implemented using tensorflow.
MIT License
362 stars 210 forks source link

文件名中 73091_(8+9)*4.png 含有特殊字符,是不能命名成功的,不知道您是怎么处理的 #25

Closed QQ2737499951 closed 5 years ago

QQ2737499951 commented 6 years ago

在网上看过您的CNN_LSTM_CTC_Tensorflow 源码,也下载了数据集,想重现您的结果,有几个问题请教一下,谢谢! 1,源码是在这里下载的,https://github.com/watsonyanghx/CNN_LSTM_CTC_Tensorflow,数据集也下载解压了。 D:\Tensorflow\CNN_LSTM_CTC_Tensorflow-master\imgs 解压后目录结构 imgs\labels.txt imgs\image_contest_level_1\

2.运行 helper.py 后,在imgs 目录下生成了 X_train.txt、 X_val.txt、 y_train.txt、 y_val.txt4个文件是正常的。

X_train.txt 训练的文件名 X_val.txt 测试的文件名

y_train.txt 训练的答案 y_val.txt 测试的答案

但 cp_file(X_train, y_train, './imgs/train/') cp_file(X_val, y_val, './imgs/val/') "D:\Program Files\Python365\python36.exe" D:/Tensorflow/CNN_LSTM_CTC_Tensorflow-master/helper.py ['./imgs/image_contest_level_1/0.png' './imgs/image_contest_level_1/1.png' './imgs/image_contest_level_1/2.png' './imgs/image_contest_level_1/3.png' './imgs/image_contest_level_1/4.png' './imgs/image_contest_level_1/5.png' './imgs/image_contest_level_1/6.png' './imgs/image_contest_level_1/7.png' './imgs/image_contest_level_1/8.png' './imgs/image_contest_level_1/9.png'] Traceback (most recent call last): File "D:/Tensorflow/CNN_LSTM_CTC_Tensorflow-master/helper.py", line 129, in cp_file(X_train, y_train, './imgs/train/') File "D:/Tensorflow/CNN_LSTM_CTC_Tensorflow-master/helper.py", line 102, in cp_file shutil.copyfile(file_path, destfilename) File "D:\Program Files\Python365\lib\shutil.py", line 121, in copyfile with open(dst, 'wb') as fdst: OSError: [Errno 22] Invalid argument: './imgs/train/73091(8+9)*4.png'

进程完成,退出码 1 文件名中 73091_(8+9)*4.png 含有特殊字符,是不能命名成功的,不知道您是怎么处理的

3.运行 cnn_lstm_otc_ocr.py 报错

"D:\Program Files\Python365\python36.exe" D:/Tensorflow/CNN_LSTM_CTC_Tensorflow-master/cnn_lstm_otc_ocr.py D:/Tensorflow/CNN_LSTM_CTC_Tensorflow-master/cnn_lstm_otc_ocr.py:42: SyntaxWarning: assertion is always true, perhaps remove parentheses? assert (FLAGS.cnncount <= count, "FLAGS.cnncount should be <= {}!".format(count))

4.运行 main.py

"D:\Program Files\Python365\python36.exe" D:/Tensorflow/CNN_LSTM_CTC_Tensorflow-master/main.py

feature_h: 4, feature_w: 12 lstm input shape: [40, 12, 256] loading train data size: 0 loading validation data size: 0

2018-07-12 11:02:14.624545: I c:\users\user\source\repos\tensorflow\tensorflow\core\platform\cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2 2018-07-12 11:02:14.844809: I c:\users\user\source\repos\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1356] Found device 0 with properties: name: GeForce GTX 1070 major: 6 minor: 1 memoryClockRate(GHz): 1.683 pciBusID: 0000:01:00.0 totalMemory: 8.00GiB freeMemory: 6.63GiB 2018-07-12 11:02:14.845239: I c:\users\user\source\repos\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1435] Adding visible gpu devices: 0 2018-07-12 11:02:16.119318: I c:\users\user\source\repos\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix: 2018-07-12 11:02:16.119683: I c:\users\user\source\repos\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:929] 0 2018-07-12 11:02:16.119937: I c:\users\user\source\repos\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:942] 0: N 2018-07-12 11:02:16.137500: I c:\users\user\source\repos\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 6410 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1070, pci bus id: 0000:01:00.0, compute capability: 6.1) =============================begin training=============================

进程完成,退出码 0

  1. 运行 utils.py "D:\Program Files\Python365\python36.exe" D:/Tensorflow/CNN_LSTM_CTC_Tensorflow-master/utils.py

进程完成,退出码 0

谢谢指点,不知您是否有微信或qq方便联系,请教学习,谢谢

wangke1003 commented 6 years ago

我是把labels.txt里的所有星号替换成x,再把utils里的charset里的也替换掉就可以了。windows平台文件名不能带星号

QQ2737499951 commented 5 years ago

谢谢!