当前位置:网站首页>MMOCR使用指南
MMOCR使用指南
2022-07-26 00:38:00 【算法之名】
MMOCR是通用视觉框架OpenMMLab的光学字符识别器。
安装配置环境
MMOCR github主页:GitHub - open-mmlab/mmocr: OpenMMLab Text Detection, Recognition and Understanding Toolbox
pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.11.0/index.htmlpip install mmdet -i https://pypi.tuna.tsinghua.edu.cn/simplepip install lmdbpip install shapelypip install rapidfuzzpip install lanmspip install pyclipperpip install scikit-imagepip install imgaug验证是否安装成功代码
import torch, torchvisionimport mmcvfrom mmcv.ops import get_compiling_cuda_version, get_compiler_versionimport mmdetimport mmocrfrom mmocr.utils.ocr import MMOCRmmocr = MMOCR(det=None, recog='SAR', device='cpu')print('mmocr载入成功')文本检测与文本提取
import torch, torchvisionimport mmcvfrom mmcv.ops import get_compiling_cuda_version, get_compiler_versionimport mmdetimport mmocrfrom mmocr.utils.ocr import MMOCR# mmocr = MMOCR(det=None, recog='SAR', device='cpu')# print('mmocr载入成功')if __name__ == '__main__': detector = MMOCR(det='TextSnake', recog='SAR', device='cuda') result = detector.readtext('demo/demo_densetext_det.jpg', output='output/demo_densetext_det.jpg')中文检测与提取
在mmocr主目录下新建文件夹/data/chineseocr/labels
进入该文件夹执行
wget http://download.openmmlab.com/mmocr/textrecog/sar/dict_printed_chinese_english_digits.txtwget http://download.openmmlab.com/mmocr/data/font.TTF下载字体和字库
import torch, torchvisionimport mmcvfrom mmcv.ops import get_compiling_cuda_version, get_compiler_versionimport mmdetimport mmocrfrom mmocr.utils.ocr import MMOCR# mmocr = MMOCR(det=None, recog='SAR', device='cpu')# print('mmocr载入成功')if __name__ == '__main__': detector = MMOCR(det='TextSnake', recog='SAR_CN', device='cuda') result = detector.readtext('demo/demo_densetext_det.jpg', output='output/demo_densetext_det.jpg')
边栏推荐
- 【RTOS训练营】上节回顾、空闲任务、定时器任务、执行顺序、调度策略和晚课提问
- LVGL官方+100ASK合力打造的中文输入(拼音输入法)组件,让LVGL支持中文输入!
- Jmeter之用户自定义变量和抽离公共变量
- [RTOS training camp] program framework, preview, after-school homework and evening class questions
- HCIP第十二天
- 【oops-framework】界面管理
- With data-driven management transformation, the first year of science and technology was at the right time
- 【RTOS训练营】课程学习方法和结构体知识复习 + 链表知识
- [untitled] how to realize pluggable configuration?
- [GOM engine] script setting method for dummy configuration
猜你喜欢

【RTOS训练营】I2C和UART知识和预习安排 + 晚课提问

The bumpy road of referencing jar package json-path.jar in jmeter/idea

【RTOS训练营】任务调度(续)、任务礼让、调度总结、队列和晚课提问

8 tips - database performance optimization, yyds~

Quick start sequence table chain table

8 tips to adjust database performance optimization, yyds

Redis命令参考手册 - Key

开发还没联调,任务就要上线

YOLOV2 YOLO9000

我们没有退路了
随机推荐
Leetcode 笔记 350. 两个数组的交集 II
[RTOS training camp] ring buffer, at instruction, preview arrangement and evening class questions
HCIP第十三天
2022/7/24 examination summary
【RTOS训练营】课程学习方法和C语言知识(指针、结构体、函数指针、链表)和学员问题
8 tips - database performance optimization, yyds~
[RTOS training camp] equipment subsystem, questions of evening students
【oops-framework】随机数生成管理
【oops-framework】网络模块WebSocket
以数据驱动管理转型,元年科技正当时
聊聊研发团队中的“人”
Django database addition, deletion, modification and query
Day06 MySQL knowledge points summary
SereTOD2022 Track1代码剖析-面向半监督和强化学习的任务型对话系统挑战赛
[untitled] how to realize pluggable configuration?
Are you still counting the time complexity?
Leetcode 笔记 20. 有效的括号
YOLOV2 YOLO9000
Nodejs learning
Redis Command Reference Manual - key