breezedeus / CnSTD

CnSTD: 基于 PyTorch/MXNet 的 中文/英文 场景文字检测(Scene Text Detection)、数学公式检测(Mathematical Formula Detection, MFD)、篇章分析(Layout Analysis)的Python3 包
https://www.breezedeus.com/article/cnocr
Apache License 2.0
654 stars 101 forks source link

layout模型预测时能否单独设置--resized-shape #65

Open Ontheroad123 opened 10 months ago

Ontheroad123 commented 10 months ago

cnstd analyze 参数 --resized-shape 只能输入一个32倍数的整数,shape的height和width只能是一个整数,能否设置不同的值 `cnstd analyze -m layout --resized-shape 2336,1632 -i table_image1.png -o std_table_image1.png

Error: Invalid value for '--resized-shape': '2336,1632' is not a valid integer.`

若如此设置: cnstd analyze -m layout --resized-shape 2336 -i table_image1.png -o std_table_image1.png则没问题

Ontheroad123 commented 10 months ago

函数调用可以设置不同的height和width ` from cnstd import LayoutAnalyzer, CATEGORY_DICT

import cv2

img_fp = 'image1.png' img0 = cv2.imread(img_fp) analyzer = LayoutAnalyzer('layout') out = analyzer.analyze(img_fp, resized_shape=(2336,1632)) analyzer.save_img(img0, out, 'std_image1_reshape.png') ` std_image1_reshape reshape_image(2336,1632)

std_image1 默认大小(704,704)

其实效果并不好,还是和模型训练时输入shape有很大关系,最好还是根据自己任务的input shape重新训练模型效果最好。

breezedeus commented 10 months ago

对,版面分析模型的效果一般,没做过特别的优化。

Ontheroad123 commented 10 months ago

这是PaddleOCR基于CDLA数据集训练的版面分析模型[https://github.com/PaddlePaddle/PaddleOCR/blob/release/2.6/ppstructure/docs/models_list.md],有时间做测试了把效果放上来对比