栏目分类:
子分类:
返回
文库吧用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
文库吧 > IT > 软件开发 > 后端开发 > Python

pixellink

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

pixellink

pixellink_RCNN文本检测/识别

检测与识别分为两部分进行训练,训练模型保存到测试demo中进行测试结果

检测模型图片标注、识别模型图片标注

推荐软件:https://download.csdn.net/download/weixin_45593603/86394460

模型训练

训练模型之前先检查好数据格式正确否,一定要检查好数据的情况。
训练检测模型打开text_detection文件夹,把所需要的依赖包pip install -r *** 安装成功。
需要的环境最好是在cuda10.0下,不然安装tensorflow2.0.0a0的时候很难受。

依次运行以下命令:

########训练所需数据转换########
python tools/prepare_annotation.py --type toy --images data --out_annotation data/annotation.json
python tools/create_dataset.py --input_datasets data/annotation.json --output data/annotation.tfrecord
########训练########
python tools/train.py --learning_rate 0.0001 --train_dir model --train_dataset data/annotation.tfrecord --epochs_per_evaluation 100 --test_dataset data/annotation.tfrecord --model_type mobilenet_v2_ext --config configs/config.yaml --weights init_weights/model_mobilenet_v2_ext/weights/model-523.save_weights
########评估检测########
python tools/test.py --config model/configuration.yaml --dataset data/annotation.tfrecord --weights model/weights/model-18.save_weights
########2pb########
python tools/export.py --resolution 1280 768 --config model/configuration.yaml --weights model/weights/model-18.save_weights
########pb2IR########
mo.py --model_name text_detection --input_model /home/xinxin/2dmodel/ocr/text_detection/model/weights/export/frozen_graph.pb --reverse_input_channels --data_type FP32 --output_dir /home/xinxin/2dmodel/ocr/text_detection/model/weights/export/IR
注意 1~5步切换到cuda10.0 text_detection的conda环境中运行,6步切换到openvino_tf的conda环境下进行
切换cuda10.0运行sudo ldconfig /usr/local/cuda-10.0/lib64
识别模型训练

在ocr.pytorch-master里README.md存在的包安装。
需要的识别代码在ocr.pytorch-master/train_code/train_crnn下,把从mark软件中标注好的数据text_recognition文件夹data下annotation.txt与images放到datasets文件下将训练图片归位!
运行python3 train_pytorch_ctc.py开始训练ing。。。

训练结果验证

在验证模型结果时,将上述两个模型训练好的文件,保存到model_file下的这两个对应文件下,记得修改demo.py中的model_path配置哦。下面就可以测试我们的训练结果了。

转载请注明:文章转载自 www.wk8.com.cn
本文地址:https://www.wk8.com.cn/it/1038653.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 wk8.com.cn

ICP备案号:晋ICP备2021003244-6号