skyerhxx / MaskTextspotterv3-for-Chinese

MaskTextspotterv3应用于中文数据集
Other
12 stars 1 forks source link

MaskTextspotterv3-for-chinese

MaskTextspotterv3应用于中文数据集

原作者github: https://github.com/MhLiao/MaskTextSpotterV3

1. 配置环境

cuda runtime 10.0

安装anaconda环境(步骤与MaskTextspotterv3原版本相同)

  conda create --name masktextspotter -y python=3.7
  conda activate masktextspotter

  # this installs the right pip and dependencies for the fresh python
  conda install ipython pip

  # python dependencies
  pip install ninja yacs cython matplotlib tqdm opencv-python shapely scipy tensorboardX pyclipper Polygon3 editdistance rapidfuzz

  # install PyTorch
  conda install pytorch torchvision cudatoolkit=10.0 -c pytorch

  export INSTALL_DIR=$PWD

  # install pycocotools
  cd $INSTALL_DIR
  git clone https://github.com/cocodataset/cocoapi.git
  cd cocoapi/PythonAPI
  python setup.py build_ext install

  # install apex
  cd $INSTALL_DIR
  git clone https://github.com/NVIDIA/apex.git
  cd apex
  python setup.py install --cuda_ext --cpp_ext

  # clone repo
  cd $INSTALL_DIR
  git clone https://github.com/skyerhxx/MaskTextspotterv3-for-chinese.git
  cd MaskTextspotterv3_for_chinese

  # build
  python setup.py build develop

  unset INSTALL_DIR

若运行中因为库的版本报错可参考pip_list.txt中相关库版本

2. train

bash train.sh

训练数据集: datasets/chinese/train_images, train_gts

训练结果:生成的train_output目录

3. test

bash test.sh
python visualize_result.py

结果见新生成的test_output_visu目录

image-20210812154817362 image-20210812154844626

4. evaluation

python evaluate.py
image-20210812154155667

5. 改动步骤

在原作者代码的基础上为了应用中文数据集做的改动

①在datasets目录下创建chinese数据集目录,类型格式参照ic13/15

​ gt格式: 13, 338, 258, 320, 264, 408, 19, 426,耻辱不亚于,19, 388, 68, 387, 68, 422, 19, 425,耻,70, 336, 121, 335, 121, 379, 70, 381,辱,123, 330, 167, 328, 168, 363, 123, 364,不,170, 338, 215, 337, 216, 369, 170, 370,亚,222, 371, 262, 369, 262, 409, 222, 410,于

②修改configs目录下的yaml文件

③修改maskrcnn_benchmark/config/paths_catalog.py

④修改maskrcnn_benchmark/data/datasets

⑤改动MaskTextSpotterV3/maskrcnn_benchmark/utils/chars.py

⑥改动configs/mixtrain/seg_rec_poly_fuse_feature_chinese_train.py

6. 相关说明