安装按照官网来操作就行:
主要是自己cuda版本要和pytorch匹配,我的是cuda10.2版本:
conda install pytorch==1.9.1 torchvision==0.10.1 torchaudio==0.9.1 cudatoolkit=10.2 -c pytorch
缺什么就装什么。
conda create -n DPText-DETR python=3.8 -y
conda activate DPText-DETR
#这里的torch按照自己的电脑cuda版本来选择指令
pip install torch==1.9.1+cu111 torchvision==0.10.1+cu111 -f https://download.pytorch.org
/whl/torch_stable.html
pip install opencv-python scipy timm shapely albumentations Polygon3
python -m pip install detectron2 -f https://dl.fbaipublicfiles.com/detectron2/wheels/cu111/torch1.9/index.html
pip install setuptools==59.5.0
git clone https://github.com/ymy-k/DPText-DETR.git
cd DPText-DETR
python setup.py build develop
下载数据集,暂时还不会制作自己的数据集,慢慢摸索,或者有大佬能提供吗?评论区球球
官网的数据集,只有百度网盘才能下载哦,阿里云好像不行。直接把JSON文件解压到主目录,把ICDER2019解压后直接放在:JSON文件解压的dataset目录下。
然后把配置文件给修改,我的图片是ICDER2019,也就是art文件,对应的是:configs/DPText_DETR/Pretrain_ArT/R_50_poly.yaml
把训练数据修改成你下载的数据,我只有一个
DATASETS:
# TRAIN: ("syntext1_poly_train_pos", "syntext2_poly_train_pos", "mlt_poly_train_pos", "lsvt_poly_train_pos", "art_poly_train_pos",)
TRAIN: ("art_poly_train_pos",)
TEST: ("art_test",)
训练:
python tools/train_net.py --config-file configs/DPText_DETR/Pretrain_ArT/R_50_poly.yaml
报错:Pillow 报错module ‘PIL.Image’ has no attribute ‘LINEAR’
解决:版本太高了。
pip install Pillow==9.0.1 -i https://pypi.mirrors.ustc.edu.cn/simple/
报错: ImportError: cannot import name ‘string_metric‘ from ‘rapidfuzz‘
解决:版本太高了。
$ pip install rapidfuzz==1.1.1 -i https://pypi.mirrors.ustc.edu.cn/simple/
但是我的显存不够,跑不了啊啊啊。