[CVPR 2021] Rethinking Text Segmentation: A Novel Dataset and A Text-Specific Refinement Approach

Overview

Rethinking Text Segmentation: A Novel Dataset and A Text-Specific Refinement Approach

This is the repo to host the dataset TextSeg and code for TexRNet from the following paper:

Xingqian Xu, Zhifei Zhang, Zhaowen Wang, Brian Price, Zhonghao Wang and Humphrey Shi, Rethinking Text Segmentation: A Novel Dataset and A Text-Specific Refinement Approach, ArXiv Link

Note:

[2021.04.21] So far, our dataset is partially released with images and semantic labels. Since many people may request the dataset for OCR or non-segmentation tasks, please stay tuned, and we will release the dataset in full ASAP.

[2021.06.18] Our dataset is now fully released. To download the data, please send a request email to [email protected] and tell us which school you are affiliated with. Please be aware the released dataset is version 2, and the annotations are slightly different from the one in the paper. In order to provide the most accurate dataset, we went through a second round of quality assurance, in which we fixed some faulty annotations and made them more consistent across the dataset. Since our TexRNet in the paper doesn't use OCR and character instance labels (i.e. word- and character-level bounding polygons; character-level masks;), we will not release the older version of these labels. However, we release the retroactive semantic_label_v1.tar.gz for researchers to reproduce the results in the paper. For more details about the dataset, please see below.

Introduction

Text in the real world is extremely diverse, yet current text dataset does not reflect such diversity very well. To bridge this gap, we proposed TextSeg, a large-scale fine-annotated and multi-purpose text dataset, collecting scene and design text with six types of annotations: word- and character-wise bounding polygons, masks and transcriptions. We also introduce Text Refinement Network (TexRNet), a novel text segmentation approach that adapts to the unique properties of text, e.g. non-convex boundary, diverse texture, etc., which often impose burdens on traditional segmentation models. TexRNet refines results from common segmentation approach via key features pooling and attention, so that wrong-activated text regions can be adjusted. We also introduce trimap and discriminator losses that show significant improvement on text segmentation.

TextSeg Dataset

Image Collection

Annotation

Download

Our dataset (TextSeg) is academia-only and cannot be used on any commercial project and research. To download the data, please send a request email to [email protected] and tell us which school you are affiliated with.

A full download should contain these files:

  • image.tar.gz contains 4024 images.
  • annotation.tar.gz labels corresponding to the images. These three types of files are included:
    • [dataID]_anno.json contains all word- and character-level translations and bounding polygons.
    • [dataID]_mask.png contains all character masks. Character mask label value will be ordered from 1 to n. Label value 0 means background, 255 means ignore.
    • [dataID]_maskeff.png contains all character masks with effect.
    • Adobe_Research_License_TextSeg.txt license file.
  • semantic_label.tar.gz contains all word-level (semantic-level) masks. It contains:
    • [dataID]_maskfg.png 0 means background, 100 means word, 200 means word-effect, 255 means ignore. (The [dataID]_maskfg.png can also be generated using [dataID]_mask.png and [dataID]_maskeff.png)
  • split.json the official split of train, val and test.
  • [Optional] semantic_label_v1.tar.gz the old version of label that was used in our paper. One can download it to reproduce our paper results.

TexRNet Structure and Results

In this table, we report the performance of our TexRNet on 5 text segmentation dataset including ours.

TextSeg(Ours) ICDAR13 FST COCO_TS MLT_S Total-Text
Method fgIoU F-score fgIoU F-score fgIoU F-score fgIoU F-score fgIoU F-score
DeeplabV3+ 84.07 0.914 69.27 0.802 72.07 0.641 84.63 0.837 74.44 0.824
HRNetV2-W48 85.03 0.914 70.98 0.822 68.93 0.629 83.26 0.836 75.29 0.825
HRNetV2-W48 + OCR 85.98 0.918 72.45 0.830 69.54 0.627 83.49 0.838 76.23 0.832
Ours: TexRNet + DeeplabV3+ 86.06 0.921 72.16 0.835 73.98 0.722 86.31 0.830 76.53 0.844
Ours: TexRNet + HRNetV2-W48 86.84 0.924 73.38 0.850 72.39 0.720 86.09 0.865 78.47 0.848

To run the code

Set up the environment

conda create -n texrnet python=3.7
conda activate texrnet
pip install -r requirement.txt

To eval

First, make the following directories to hold pre-trained models, dataset, and running logs:

mkdir ./pretrained
mkdir ./data
mkdir ./log

Second, download the models from this link. Move those downloaded models to ./pretrained.

Thrid, make sure that ./data contains the data. A sample root directory for TextSeg would be ./data/TextSeg.

Lastly, evaluate the model and compute fgIoU/F-score with the following command:

python main.py --eval --pth [model path] [--hrnet] [--gpu 0 1 ...] --dsname [dataset name]

Here is the sample command to eval a TexRNet_HRNet on TextSeg with 4 GPUs:

python main.py --eval --pth pretrained/texrnet_hrnet.pth --hrnet --gpu 0 1 2 3 --dsname textseg

The program will store results and execution log in ./log/eval.

To train

Similarly, these directories need to be created:

mkdir ./pretrained
mkdir ./pretrained/init
mkdir ./data
mkdir ./log

Second, we use multiple pre-trained models for training. Download these initial models from this link. Move those models to ./pretrained/init. Also, make sure that ./data contains the data.

Lastly, execute the training code with the following command:

python main.py [--hrnet] [--gpu 0 1 ...] --dsname [dataset name] [--trainwithcls]

Here is the sample command to train a TexRNet_HRNet on TextSeg with classifier and discriminate loss using 4 GPUs:

python main.py --hrnet --gpu 0 1 2 3 --dsname textseg --trainwithcls

The training configs, logs, and models will be stored in ./log/texrnet_[dsname]/[exid]_[signature].

Bibtex

@article{xu2020rethinking,
  title={Rethinking Text Segmentation: A Novel Dataset and A Text-Specific Refinement Approach},
  author={Xu, Xingqian and Zhang, Zhifei and Wang, Zhaowen and Price, Brian and Wang, Zhonghao and Shi, Humphrey},
  journal={arXiv preprint arXiv:2011.14021},
  year={2020}
}

Acknowledgements

The directory .\hrnet_code is directly copied from the HRNet official github website (link). HRNet code ownership should be credited to HRNet authors, and users should follow their terms of usage.

Comments
  • net.load_state_dict(new_paras) stagnates

    net.load_state_dict(new_paras) stagnates

    Thank you for your sharing! I want to train the model and found that when it runs on line 12 in lib/model_zoo/get_model.py ,'net.load_state_dict(new_paras)', it will stagnates for a long time. Do you have some advices? Thank you again and waiting for you reply! Best wishes!

    opened by xxAna 3
  • Error predicting using pretrained model

    Error predicting using pretrained model

    FileNotFoundError: [Errno 2] No such file or directory: /Rethinking-Text-Segmentation/data/TextSeg/split.json'

    How to predict using pretrained model ?

    opened by ManuBN786 2
  • TextSeg Dataset Question

    TextSeg Dataset Question

    Does anyone share the data?I sent the above email “[email protected]”, but it didn't reply to me. If you can,please send it to my email “[email protected]” Thank you!

    opened by heping0307 2
  • Dataset Request

    Dataset Request

    opened by gjh8760 1
  • Dataset Requests

    Dataset Requests

    Hi guys, Thanks for your great work! I just sent an email to apply for TextSeg dataset. My email is [email protected], and hope to get your reponse soon. Many thanks❤

    opened by Mountchicken 1
  • Dataset request

    Dataset request

    Hi, I have sent email to “[email protected]” requesting the TextSeg dataset for research purposes. If you can, please send it to my email “[email protected]” Thank you!

    opened by hiyaroy12 1
  • which training dataset used for testing ICDAR13 FST and Total-Text dataset?

    which training dataset used for testing ICDAR13 FST and Total-Text dataset?

    Dear Authors, Thank you for your great work. I have one question: The number of images in ICDAR13 FST and Total-Text is too small (462 and 1555 images). Which is their training dataset ? (corresponding to in table 2 of your paper) Thank you!

    opened by vince2003 1
  • result on COCO_TS and MLT_S dataset

    result on COCO_TS and MLT_S dataset

    Dear Authors, Thank you for your great work. However, I don't understand how you visualize and calculate metrics for COCO_TS and MLT_S datasets. Specifically, in Figures 5.c and 5.d, the original ground-truth of COO_TS and MLT_S datasets have very low quality. They look like the disconnected boundary of text rather than pixel-level ground truth for segmentation. img_1006

    Question1: How to preprocess this original ground-truth to have visualization as Figure 5.c and 5.d? Question2: For the result of the COCO_TS and MLT_S dataset in Table 2, do you use original ground truth directly or processed ground truth for training? How to preprocess this original ground truth? I'm looking forward to hearing from you. Thank you!

    opened by vince2003 1
  • how do you create the mask picture

    how do you create the mask picture

    Could you please teach me how to create the mask picture? I want to use my own dataset, but it doesn't contain gt pictures for segmentation, so I want to create one myself. I tried to convert the picture simply by using convert('L'), but the result is not so satisfying, could you please public the way to create the masks?

    opened by Patricia1019 1
  • why don't train with all dataset?

    why don't train with all dataset?

    Thank you for your sharing I notice that in your paper, there is a description "Each model in comparison will be re-trained on each of the aforementioned text segmentation datasets." I wonder that why don't your train them all together? Will more datas trained yield a better result?

    opened by xxAna 1
  • Where can we find 'cocotext.v2.json'?Do we need to rebuild one?

    Where can we find 'cocotext.v2.json'?Do we need to rebuild one?

    Thank you for your sharing and when I download datasets from http://clem.diism.unisi.it/~coco_ts/download.html, I couldn't find the 'cocotext.v2.json' that was needed in the codes. Could you please sharing it with us ? Thank you again and waiting for your reply. Best wishes.

    opened by xxAna 1
Owner
SHI Lab
Research in Synergetic & Holistic Intelligence, with current focus on Computer Vision, Machine Learning, and AI Systems & Applications
SHI Lab
[CVPR 2021] Rethinking Semantic Segmentation from a Sequence-to-Sequence Perspective with Transformers

[CVPR 2021] Rethinking Semantic Segmentation from a Sequence-to-Sequence Perspective with Transformers

Fudan Zhang Vision Group 897 Jan 5, 2023
Simple Pose: Rethinking and Improving a Bottom-up Approach for Multi-Person Pose Estimation

SimplePose Code and pre-trained models for our paper, “Simple Pose: Rethinking and Improving a Bottom-up Approach for Multi-Person Pose Estimation”, a

Jia Li 256 Dec 24, 2022
Code for the paper One Thing One Click: A Self-Training Approach for Weakly Supervised 3D Semantic Segmentation, CVPR 2021.

One Thing One Click One Thing One Click: A Self-Training Approach for Weakly Supervised 3D Semantic Segmentation (CVPR2021) Code for the paper One Thi

null 44 Dec 12, 2022
Official implementation for (Refine Myself by Teaching Myself : Feature Refinement via Self-Knowledge Distillation, CVPR-2021)

FRSKD Official implementation for Refine Myself by Teaching Myself : Feature Refinement via Self-Knowledge Distillation (CVPR-2021) Requirements Pytho

null 75 Dec 28, 2022
Code for our CVPR 2021 Paper "Rethinking Style Transfer: From Pixels to Parameterized Brushstrokes".

Rethinking Style Transfer: From Pixels to Parameterized Brushstrokes (CVPR 2021) Project page | Paper | Colab | Colab for Drawing App Rethinking Style

CompVis Heidelberg 153 Jan 4, 2023
Official Implementation and Dataset of "PPR10K: A Large-Scale Portrait Photo Retouching Dataset with Human-Region Mask and Group-Level Consistency", CVPR 2021

Portrait Photo Retouching with PPR10K Paper | Supplementary Material PPR10K: A Large-Scale Portrait Photo Retouching Dataset with Human-Region Mask an

null 184 Dec 11, 2022
The source code for the Cutoff data augmentation approach proposed in this paper: "A Simple but Tough-to-Beat Data Augmentation Approach for Natural Language Understanding and Generation".

Cutoff: A Simple Data Augmentation Approach for Natural Language This repository contains source code necessary to reproduce the results presented in

Dinghan Shen 49 Dec 22, 2022
code for `Look Closer to Segment Better: Boundary Patch Refinement for Instance Segmentation`

Look Closer to Segment Better: Boundary Patch Refinement for Instance Segmentation (CVPR 2021) Introduction PBR is a conceptually simple yet effective

H.Chen 143 Jan 5, 2023
[CVPR 2022 Oral] Rethinking Minimal Sufficient Representation in Contrastive Learning

Rethinking Minimal Sufficient Representation in Contrastive Learning PyTorch implementation of Rethinking Minimal Sufficient Representation in Contras

null 36 Nov 23, 2022
The official implementation of our CVPR 2021 paper - Hybrid Rotation Averaging: A Fast and Robust Rotation Averaging Approach

Graph Optimizer This repo contains the official implementation of our CVPR 2021 paper - Hybrid Rotation Averaging: A Fast and Robust Rotation Averagin

Chenyu 109 Dec 23, 2022
A novel benchmark dataset for Monocular Layout prediction

AutoLay AutoLay: Benchmarking Monocular Layout Estimation Kaustubh Mani, N. Sai Shankar, J. Krishna Murthy, and K. Madhava Krishna Abstract In this pa

Kaustubh Mani 39 Apr 26, 2022
Rethinking Semantic Segmentation from a Sequence-to-Sequence Perspective with Transformers

Segmentation Transformer Implementation of Segmentation Transformer in PyTorch, a new model to achieve SOTA in semantic segmentation while using trans

Abhay Gupta 161 Dec 8, 2022
Implementation of SETR model, Original paper: Rethinking Semantic Segmentation from a Sequence-to-Sequence Perspective with Transformers.

SETR - Pytorch Since the original paper (Rethinking Semantic Segmentation from a Sequence-to-Sequence Perspective with Transformers.) has no official

zhaohu xing 112 Dec 16, 2022
Rethinking the U-Net architecture for multimodal biomedical image segmentation

MultiResUNet Rethinking the U-Net architecture for multimodal biomedical image segmentation This repository contains the original implementation of "M

Nabil Ibtehaz 308 Jan 5, 2023
Rethinking Space-Time Networks with Improved Memory Coverage for Efficient Video Object Segmentation

STCN Rethinking Space-Time Networks with Improved Memory Coverage for Efficient Video Object Segmentation Ho Kei Cheng, Yu-Wing Tai, Chi-Keung Tang [a

Rex Cheng 456 Dec 12, 2022
UnpNet - Rethinking 3-D LiDAR Point Cloud Segmentation(IEEE TNNLS)

UnpNet Citation Please cite the following paper if you use this repository in your reseach. @article {PMID:34914599, Title = {Rethinking 3-D LiDAR Po

Shijie Li 4 Jul 15, 2022
CVPR2022 (Oral) - Rethinking Semantic Segmentation: A Prototype View

Rethinking Semantic Segmentation: A Prototype View Rethinking Semantic Segmentation: A Prototype View, Tianfei Zhou, Wenguan Wang, Ender Konukoglu and

Tianfei Zhou 239 Dec 26, 2022
clDice - a Novel Topology-Preserving Loss Function for Tubular Structure Segmentation

README clDice - a Novel Topology-Preserving Loss Function for Tubular Structure Segmentation CVPR 2021 Authors: Suprosanna Shit and Johannes C. Paetzo

null 110 Dec 29, 2022