breezedeus / CnSTD

CnSTD: 基于 PyTorch/MXNet 的 中文/英文 场景文字检测(Scene Text Detection)、数学公式检测(Mathematical Formula Detection, MFD)、篇章分析(Layout Analysis)的Python3 包

Home Page:https://www.breezedeus.com/article/cnocr

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Ontheroad123 opened this issue · comments

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则没问题

函数调用可以设置不同的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重新训练模型效果最好。

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

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