tf识别非固定长度图片ocr(数字+字母 n位长度可变)- CNN+RNN+CTC

先安装必须的库

1
2
3
tensorflow_gpu==1.15.0
numpy
opencv_python

 

github: 

https://github.com/bai-shang/crnn_ctc_ocr_tf

  

下载数据集:

http://www.robots.ox.ac.uk/~vgg/data/text/mjsynth.tar.gz
要10G

然后解压缩,估计完整解压完需要1天

 

 

 

 

 

 

 

1
2
3
4
find ./mnt/ | xargs ls -d | grep jpg > image_list_all.txt
 
# use some of data to train and eval
cat image_list_all.txt | head -n 1000 > image_list.txt

  

 

 

 

 这个文件的图片txt将会作为输入,然后生成tfrecord

1
python create_synth90k_tfrecord.py --image_dir C:\Users\McKay\PycharmProjects\test8\tfdemo\data --anno_file ./image_list.txt --char_map_json_file ../char_map/char_map.json

  

 

 

 

然后就是训练了

 

 

参数:

1
--data_dir ../data/tfrecords/ --model_dir ./model/ --batch_size 32 --char_map_json_file ../char_map/char_map.json

  

 

 

没有GPU,训练了4个小时,也只是7%的正确率

 

果断中断,有缘再用GPU训练。

 

posted @   McKay  阅读(843)  评论(3编辑  收藏  举报
编辑推荐:
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
阅读排行:
· 单线程的Redis速度为什么快?
· 展开说说关于C#中ORM框架的用法!
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· Pantheons:用 TypeScript 打造主流大模型对话的一站式集成库
· SQL Server 2025 AI相关能力初探
历史上的今天:
2014-02-12 消息队列工具类(MSMQ)
点击右上角即可分享
微信分享提示