Giter Club home page Giter Club logo

mostel's Introduction

Exploring Stroke-Level Modifications for Scene Text Editing

Introduction

This is a pytorch implementation for paper MOSTEL. It edits scene text at stroke level and can be trained using both labeled synthetic images and unpaired real scene text images.

ToDo List

  • Release code
  • Release evaluation datasets
  • Document for Installation
  • Trained models
  • Document for training and testing

Installation

Requirements

  • Python==3.7
  • Pytorch==1.7.1
  • CUDA==10.1
https://github.com/qqqyd/MOSTEL.git
cd MOSTEL/

conda create --name MOSTEL python=3.7 -y
conda activate MOSTEL
pip install torch==1.7.1+cu101 torchvision==0.8.2+cu101 -f https://download.pytorch.org/whl/torch_stable.html
pip install mmcv-full==1.6.0 -f https://download.openmmlab.com/mmcv/dist/cu101/torch1.7/index.html
pip install -r requirements.txt

Training

Prepare the datasets and put them in datasets/. Our training data uses synthetic data generated by SRNet-Datagen and real scene text datasets. You can download our datasets here(password: t6bq) or OneDrive(password: t6bq).

To get better performance, Background Reconstruction Module can be pre-trained on SCUT-EnsText, and recognizer can be pre-trained on 50k synthetic data generated by SRNet-Datagen. You can also use our models(password: 85b5) or OneDrive(password: 85b5).

python train.py --config configs/mostel-train.py

Testing and evaluation

Prepare the models and put them in models/. You can download our models here(password: 85b5) or OneDrive(password: 85b5).

Generating the predicted results using following commands:

python predict.py --config configs/mostel-train.py --input_dir datasets/evaluation/Tamper-Syn2k/i_s/ --save_dir results-syn2k --checkpoint models/mostel.pth --slm
python predict.py --config configs/mostel-train.py --input_dir datasets/evaluation/Tamper-Scene/i_s/ --save_dir results-scene --checkpoint models/mostel.pth --slm

For synthetic data, the evaluation metrics are MSE, PSNR, SSIM and FID.

python evaluation.py --gt_path datasets/evaluation/Tamper-Syn2k/t_f/ --target_path results-syn2k/

For real data, the evaluation metric is recognition accuracy.

python eval_real.py --saved_model models/TPS-ResNet-BiLSTM-Attn.pth --gt_file datasets/evaluation/Tamper-Scene/i_t.txt --image_folder results-scene/

Or you can use eval_2k.sh and eval_scene.sh for testing and evaluation.

bash eval_2k.sh configs/mostel-train.py models/mostel.pth
bash eval_scene.sh configs/mostel-train.py models/mostel.pth

In our experiments, we found that SLM will improve the quantitative performance while leaving some text outline traces, which is not good for visualization. You can add --dilate for better visualization when generating predicted results.

Citing the related works

If you find our method useful for your research, please cite

@article{qu2022mostel,
  title={Exploring Stroke-Level Modifications for Scene Text Editing},
  author={Qu, Yadong and Tan, Qingfeng and Xie, Hongtao and Xu, Jianjun  and Wang, Yuxin and Zhang, Yongdong},
  journal={arXiv preprint arXiv:2212.01982},
  year={2022}}

References

Niwhskal/SRNet

youdao-ai/SRNet-Datagen

clovaai/deep-text-recognition-benchmark

mostel's People

Contributors

qqqyd avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.