Yuxiang1995 / ICDAR2021_MFD

1st Solution For ICDAR 2021 Competition on Mathematical Formula Detection(公式检测冠军方案)
Apache License 2.0
125 stars 42 forks source link

Inference怎么用? #17

Open BensenHsu opened 1 year ago

BensenHsu commented 1 year ago

@Yuxiang1995 谢谢你做的这个项目,我想用你这个来试一下把公式的坐标从图片里面提取出来,但是不知道怎么用,我看到了Inference的说明,但是不明白这个checkpoint path需要放什么。我试过放mfd_gfl_s50.pth,但好像没有用。而且我还有个疑问,按理说我需要把待解析的图片传进去跑,但是要怎么传进去呢?

image
BensenHsu commented 1 year ago

@Yuxiang1995 谢谢你做的这个项目,我想用你这个来试一下把公式的坐标从图片里面提取出来,但是不知道怎么用,我看到了Inference的说明,但是不明白这个checkpoint path需要放什么。我试过放mfd_gfl_s50.pth,但好像没有用。而且我还有个疑问,按理说我需要把待解析的图片传进去跑,但是要怎么传进去呢?

image

@Yuxiang1995 完全是新手小白,请赐教🤯

Yuxiang1995 commented 1 year ago

@BensenHsu 抱歉最近没有看issue,你可以在一级目录下新建下面这个文件来跑预测,注意checkpoint_file需要填写你实际存放预训练模型的路径

from mmdet.apis import init_detector, inference_detector, show_result_pyplot
import mmcv

config_file = './configs/gfl/gfl_s50_fpn_2x_coco.py'
# download the checkpoint from model zoo and put it in `checkpoints/`
checkpoint_file = 'The path of mfd_gfl_s50.pth'

# build the model from a config file and a checkpoint file
model = init_detector(config_file, checkpoint_file, device='cuda:0')

# test a single image
img = 'demo.jpg'
result = inference_detector(model, img)

# show the results
show_result_pyplot(model, img, result)
Nauboys commented 1 year ago

Good day,

Just wanted to know where I can get the mfd_gfl_s50.pth?