Skip to content

📄 Awesome OCR multiple programing languages toolkits based on ONNX Runtime, OpenVINO, MNN, PaddlePaddle, TensorRT and PyTorch.

Remove width_height_ratio parameter

SWHL10c2977080f1
diff --git a/ocrweb/config.yaml b/ocrweb/config.yaml
index 19ef378..4bbca40 100644
--- a/ocrweb/config.yaml
+++ b/ocrweb/config.yaml
@@ -3,7 +3,6 @@ Global:
use_angle_cls: true
print_verbose: true
min_height: 50
- width_height_ratio: 8
Det:
module_name: ch_ppocr_v2_det
diff --git a/ocrweb/rapidocr_onnxruntime/rapid_ocr_api.py b/ocrweb/rapidocr_onnxruntime/rapid_ocr_api.py
index f3a8a18..e442cd8 100644
--- a/ocrweb/rapidocr_onnxruntime/rapid_ocr_api.py
+++ b/ocrweb/rapidocr_onnxruntime/rapid_ocr_api.py
@@ -23,7 +23,6 @@ class TextSystem(object):
self.print_verbose = global_config['print_verbose']
self.text_score = global_config['text_score']
self.min_height = global_config['min_height']
- self.width_height_ratio = global_config['width_height_ratio']
TextDetector = self.init_module(config['Det']['module_name'],
config['Det']['class_name'])
@@ -41,7 +40,7 @@ class TextSystem(object):
def __call__(self, img: np.ndarray):
h, w = img.shape[:2]
- if h < self.min_height and w / h >= self.width_height_ratio:
+ if h < self.min_height:
start_time = time.time()
dt_boxes, img_crop_list = self.get_boxes_img_without_det(img, h, w)
crop_elapse = time.time() - start_time
diff --git a/python/README.md b/python/README.md
index 1a97819..6e224a4 100755
--- a/python/README.md
+++ b/python/README.md
@@ -130,12 +130,11 @@
|Global| `use_angle_cls` | `bool` | `true` | 是否使用文本行的方向分类 |
|Global| `print_verbose` | `bool` | `true` | 是否打印各个部分耗时信息 |
|Global| `min_heigh` | `int` | 50 | 图像高度,单位是像素 |
-|Global| `width_height_ratio` | `float` | 8.0 | 图像宽高比 |
||||||
|Det| `box_thresh` | [0, 1] | 0.5 | 文本检测所得框是否保留的阈值,值越大,召回率越低 |
|Det| `unclip_ratio` | [1.6, 2.0] | 1.6 | 控制文本检测框的大小,值越大,检测框整体越大 |
|Det/Cls/Rec| `use_cuda` | | `false` | 是否使用CUDA,加速推理 |
-- `min_height`和`width_height_ratio`这两个参数是用来卡那些只有一行文本的图像,例如下图,这类图像不会进入文本检测模块,直接进入后续过程即可。
+- `min_height`这个参数是用来卡那些只有一行文本的图像,例如下图,这类图像不会进入文本检测模块,直接进入后续过程即可。
![](./test_images/single_line_text.jpg)
diff --git a/python/config.yaml b/python/config.yaml
index 19ef378..891d010 100644
--- a/python/config.yaml
+++ b/python/config.yaml
@@ -2,8 +2,7 @@ Global:
text_score: 0.5
use_angle_cls: true
print_verbose: true
- min_height: 50
- width_height_ratio: 8
+ min_height: 30
Det:
module_name: ch_ppocr_v2_det
diff --git a/python/rapidocr_onnxruntime/rapid_ocr_api.py b/python/rapidocr_onnxruntime/rapid_ocr_api.py
index 35f994f..f4b11a2 100644
--- a/python/rapidocr_onnxruntime/rapid_ocr_api.py
+++ b/python/rapidocr_onnxruntime/rapid_ocr_api.py
@@ -22,7 +22,6 @@ class TextSystem(object):
self.print_verbose = global_config['print_verbose']
self.text_score = global_config['text_score']
self.min_height = global_config['min_height']
- self.width_height_ratio = global_config['width_height_ratio']
TextDetector = self.init_module(config['Det']['module_name'],
config['Det']['class_name'])
@@ -40,7 +39,7 @@ class TextSystem(object):
def __call__(self, img: np.ndarray):
h, w = img.shape[:2]
- if h < self.min_height and w / h >= self.width_height_ratio:
+ if h <= self.min_height:
dt_boxes, img_crop_list = self.get_boxes_img_without_det(img, h, w)
else:
dt_boxes, elapse = self.text_detector(img)
diff --git a/python/rapidocr_openvino/rapid_ocr_api.py b/python/rapidocr_openvino/rapid_ocr_api.py
index 35f994f..e15cc87 100644
--- a/python/rapidocr_openvino/rapid_ocr_api.py
+++ b/python/rapidocr_openvino/rapid_ocr_api.py
@@ -22,7 +22,6 @@ class TextSystem(object):
self.print_verbose = global_config['print_verbose']
self.text_score = global_config['text_score']
self.min_height = global_config['min_height']
- self.width_height_ratio = global_config['width_height_ratio']
TextDetector = self.init_module(config['Det']['module_name'],
config['Det']['class_name'])
@@ -40,7 +39,7 @@ class TextSystem(object):
def __call__(self, img: np.ndarray):
h, w = img.shape[:2]
- if h < self.min_height and w / h >= self.width_height_ratio:
+ if h < self.min_height:
dt_boxes, img_crop_list = self.get_boxes_img_without_det(img, h, w)
else:
dt_boxes, elapse = self.text_detector(img)