当前位置:网站首页>Fundamentals of deep learning [4] build easyocr and carry out simple character recognition from 0

Fundamentals of deep learning [4] build easyocr and carry out simple character recognition from 0

2022-06-11 02:30:00 Polar chain AI cloud

Deep learning foundation 【4】

from 0 Begin to build EasyOCR

And simple character recognition

So-called OCR, Its full name is “Optical Character Recognition”, Optical character recognition . simply , It is to analyze, recognize and process the image files of text data , To obtain the text and layout information . 

- Language environment :Python3.7

- compiler :jupyter notebook

- Deep learning environment :pytorch 1.6

- Deep learning platform : Polar chain AI cloud

- The graphics card (GPU):NVIDIA RTX 2080Ti

        Catalog

    01 Instance creation

    02 preparation

    03 Data preprocessing

    04 Build the model

    05 compile

    06 Training models

    07 Model to evaluate

01 Instance creation

1. Open polar chain AI Cloud platform

         https://cloud.videojj.com/?source=vx

2. Click calculate power lease

 3. Choose the right graphics card

          Here we use NVIDIA RTX 2080Ti For example

4. Deep learning framework construction

          Frame selection pytorch, edition 1.6

         python edition 3.7

5. The connection instance

After creation , Click on jupyterlab Connect

6. Open the terminal

02 Environment building

In the terminal , Enter the following command to use pip install EasyOCR Stable version

pip install easyocr

For more information, please slide left and right

Get into GitHub Address

GitHub - JaidedAI/EasyOCR: Ready-to-use OCR with 80+ supported languages and all popular writing scripts including Latin, Chinese, Arabic, Devanagari, Cyrillic and etc.

Download the target file

When the download is complete , Uploaded to the root In the folder , Enter the following command to unzip

pip install unzip #  install unzipunzip EasyOCR-master

Use... At the command prompt cd Command to enter the destination folder address , In the use of  Python setup.py install  Command to pre install ​​​​​​​

cd EasyOCR-masterpython setup.py install

03 Usage method

Perform character recognition on the picture ​​​​​​​

import easyocrreader = easyocr.Reader(['ch_sim','en']) #  You only need to run it once to load the model into memory result = reader.readtext('chinese.jpg')

The output will be in list format , Each item represents a bounding box , Text and confidence .

notes 1:[‘ch_sim’,‘en’] Is a list of languages you want to read . You can pass several languages at once , But not all languages can be used together . English is compatible with every language . Languages that share common characters are usually compatible with each other .

notes 2: You can also change OpenCV Image object (numpy Array ) Or image files are passed as bytes , instead of filepath chinese.jpg. The URL of the original image is also acceptable .

notes 3: That's ok reader = easyocr.Reader([‘ch_sim’,‘en’]) Used to load the model into memory . It will take some time , But you only need to run it once .

Can also be detail Set to 0, To simplify output .

reader.readtext('chinese.jpg', detail = 0)

原网站

版权声明
本文为[Polar chain AI cloud]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/162/202206110123556388.html