You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+19-64
Original file line number
Diff line number
Diff line change
@@ -4,108 +4,63 @@ This repository implements a pretrained Character Region Awareness For Text dete
4
4
5
5
[](https://matlab.mathworks.com/open/github/v1?repo=matlab-deep-learning/Text-Detection-using-Deep-Learning)
6
6
7
+
**Creator**: MathWorks Development
8
+
7
9
Requirements
8
10
------------
9
11
10
-
- MATLAB R2021a or later
12
+
- MATLAB R2022a or later
11
13
- Deep Learning Toolbox™
12
14
- Computer Vision Toolbox™
15
+
- Computer Vision Toolbox™ Model for Text Detection
16
+
17
+
Note: Previous MATLAB release users can use this branch to download the pretrained models.
13
18
14
19
Overview
15
20
--------
16
21
17
-
This repository implements CRAFT with VGG-16 as backbone. The network is trained on various scene text detection datasets with text in English, Korean, Italian, French, Arabic, German and Bangla (Indian).
22
+
This repository implements text detection in images using CRAFT deep learning model with VGG-16 as backbone. The network is trained on various scene text detection datasets with text in English, Korean, Italian, French, Arabic, German and Bangla (Indian).
18
23
19
24
CRAFT uses a convolutional neural network to produce two outputs, region score, and affinity score. The region score localizes individual characters in the image, and the affinity score groups each character into a single instance. The character-level region awareness mechanism helps in detecting texts of various shapes such as long, curved, and arbitrarily shaped texts.
20
25
21
26
Getting Started
22
27
---------------
23
-
Download or clone this repository to your machine and open it in MATLAB.
24
-
### Setup
25
-
Add path to the source directory.
26
-
27
-
`addpath('src');`
28
-
29
-
### Load the pretrained network
30
-
Use the below helper to download the pretrained network.
31
-
```
32
-
model = helper.downloadPretrainedCRAFT;
33
-
craftNet = model.craftNet;
34
-
```
28
+
[detectTextCRAFT](https://in.mathworks.com/help/vision/ref/detecttextcraft.html) - Detect texts in images by using CRAFT deep learning model
35
29
36
-
Detect Objects Using Pretrained CRAFT
30
+
Detect Text Using Pretrained CRAFT
37
31
---------------------------------------
38
-
32
+
Note: This functionality requires Deep Learning Toolbox™ and the Computer Vision Toolbox™ Model for Text Detection. You can install the Computer Vision Toolbox Model for Text Detection from Add-On Explorer. For more information about installing add-ons, see [Get and Manage Add-Ons](https://in.mathworks.com/help/matlab/matlab_env/get-add-ons.html).
If the image contains text in arbitrary shape then change the value of `polygonText` variable in `src/+helper/postprocess.m` to `true`.
60
-
61
-
The CRAFT network has three tunable parameters, text threshold, low text and link threshold. Tune these hyperparameters in `src/+helper/postprocess.m` to get better results.
62
-
- Text threshold: Higher value indicates that character in image has to be more clear to be considered as text.
63
-
- Low text: Higher value will give less boundary space around characters.
64
-
- Link threshold: Higher value will increase the amount by which two characters will be considered as single word.
65
-
66
-
Code Generation for CRAFT
67
-
---------------------------------------
68
-
Code generation enables you to generate code and deploy CRAFT on multiple embedded platforms.
69
-
70
-
Run `codegenCRAFT.m`. This script calls the `craftPredict.m` entry point function and generate CUDA code for it. It will run the generated MEX and gives output.
71
-
| Model | Inference Speed (FPS) |
72
-
| ------ | ------ |
73
-
| CRAFT w/o codegen | 3.044 |
74
-
| CRAFT with codegen | 5.356 |
75
-
76
-
Note: Performance (in FPS) is measured on a TITAN-RTX GPU using 672x992 image.
77
-
78
47
Text Recognition using OCR + CRAFT
79
48
----------------------------------
80
49
81
-
Output of CRAFT network generates the quadrilateral-shape bounding boxes that can be passed to `ocr` function as region of interest (roi) for text recognition applications.
50
+
Output of `detectTextCRAFT` return the bounding boxes that can be passed to `ocr` function as region of interest (roi) for text recognition applications.
82
51
83
52
```
84
-
% Convert boundingBoxes format from [x1 y1 ... x8 y8] to [x y w h].
85
-
roi = [];
86
-
for i = 1:size(boundingBoxes,1)
87
-
w = norm(boundingBoxes(i,[3 4]) - boundingBoxes(i,[1 2]));
88
-
h = norm(boundingBoxes(i,[5 6]) - boundingBoxes(i,[3 4]));
89
-
roi = [roi; [boundingBoxes(i,1) boundingBoxes(i,2) w h]];
90
-
end
91
-
92
53
% Binarizing the image before using OCR for better results.
0 commit comments