# Scene Text Telescope: Text-focused Scene Image Super-Resolution \[Kor]

[**English version**](https://awesome-davian.gitbook.io/awesome-reviews/paper-review/2021-fall-paper-review/cvpr-2021-scenetext-eng) of this article is available.

## 1. Problem definition

> ***Scene Text Recognition (STR)란, 일상적인 풍경 이미지에서 글자를 인식하는 task입니다.***
>
> (활용 예시: 운전면허증에 있는 문자 읽기, ID card에서의 글자 인식, etc)

![Figure1](https://3854520906-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MlJ20tNdSAn8Lm4038V%2Fuploads%2Fgit-blob-b4a6c0deb849b56d634e9df5d0ffa5291f9db46b%2FFigure1.PNG?alt=media)

* 최근 STR분야에 대한 연구가 활발하지만, 저해상도(Low-Resolution, 이하 LR) 이미지에서는 아직까지도 많은 성능 개선이 필요합니다.
* 하지만 실생활에서 LR 텍스트 이미지를 사용하는 경우는 꽤나 많습니다. 예를 들어, 초점이 잘 맞지 않는 카메라로 찍은 이미지나 용량을 줄이기 위해 불가피하게 압축된 텍스트 이미지들이 있습니다.

  → 이러한 문제점을 해결하기 위해, 본 논문에서는 텍스트에 초점을 맞춘 초해상화 (Super-Resolution, 이하 SR) 프레임워크를 제안합니다.

## 2. Motivation

### Related work

* **Scene Text Recognition**
  * *Shi, Baoguang, Xiang Bai, and Cong Yao. "An end-to-end trainable neural network for image-based sequence recognition and its application to scene text recognition." IEEE transactions on pattern analysis and machine intelligence 39.11 (2016): 2298-2304.*

    : 이 논문에서는 CNN과 RNN을 결합하여 텍스트 이미지에서 sequential한 특징을 구했으며, CTC decoder \[1]를 사용하여 ground truth에 가장 가깝게 접근할 수 있는 path를 선택할 확률을 최대화했다고 합니다.
  * *Shi, Baoguang, et al. "Aster: An attentional scene text recognizer with flexible rectification." IEEE transactions on pattern analysis and machine intelligence 41.9 (2018): 2035-2048.*

    : 이 논문에서는 Spatial Transformer Network를 사용하여 텍스트 이미지를 어느정도 rectify하고 attention mechanism을 활용하여 각 타임스텝마다 특정 문자에 초점을 두었다고 합니다.

    → 하지만 위의 논문들 경우 이미지에서 휘어있는(curved) 텍스트들을 처리하기에는 적합하지 않다고 합니다.
* **Text Image Super-Resolution**
  * *Mou, Yongqiang, et al. "Plugnet: Degradation aware scene text recognition supervised by a pluggable super-resolution unit." Computer Vision–ECCV 2020: 16th European Conference, Glasgow, UK, August 23–28, 2020, Proceedings, Part XV 16. Springer International Publishing, 2020.*

    : 이 논문에서는 multi-task 프레임워크를 고안하여 text-specific한 특징들을 고려하였다고 합니다.
  * *Wang, Wenjia, et al. "Scene text image super-resolution in the wild." European Conference on Computer Vision. Springer, Cham, 2020.*

    : 이 논문의 경우에는 text SR 데이터셋인 \_TextZoom\_을 제안하고, \_TSRN\_이라는 SR네트워크를 제안했습니다.

    → 하지만, 이 두가지 논문의 경우 이미지의 모든 픽셀을 고려하기 때문에 배경으로 인한 disturbance 문제가 생길 수 있으며, 이는 텍스트를 upsampling했을 때 성능 문제를 야기할 수 있다고 합니다.

### Idea

> 기본적으로, 본 논문에서는 *Scene Text Telescope* (텍스트에 초점을 맞춘 SR 프레임워크)를 제안합니다.

* 먼저, 임의의 방향으로 회전되어있는 텍스트를 처리하기 위해, *TBSRN (Transformer-Based Super-Resolution Network)* 을 고안하여 텍스트의 sequential한 information을 고려했습니다
* 또한, 위에서 언급했던 이미지 배경으로 인한 disturbance문제를 해결하기 위해, SR을 이미지 전체에 집중하여 하기보다는 텍스트에 초점을 두었습니다. 따라서, 텍스트 각 문자의 position과 content를 고려하는 *Position-Aware Module* 과 *Content-Aware Module* 을 두었습니다.
* 나아가, LR 이미지에서 헷갈릴 수 있는 문자들을 고려하여 *Content-Aware Module* 에서 *weighted cross-entropy loss* 를 사용했습니다.
* **추가적으로, 아래의 논문들은 본 논문의 Model 과 Evaluation에서 참고된 논문들입니다.**
  * *Luo, Canjie, Lianwen Jin, and Zenghui Sun. "Moran: A multi-object rectified attention network for scene text recognition." Pattern Recognition 90 (2019): 109-118.*
  * *Shi, Baoguang, Xiang Bai, and Cong Yao. "An end-to-end trainable neural network for image-based sequence recognition and its application to scene text recognition." IEEE transactions on pattern analysis and machine intelligence 39.11 (2016): 2298-2304.*
  * *Shi, Baoguang, et al. "Aster: An attentional scene text recognizer with flexible rectification." IEEE transactions on pattern analysis and machine intelligence 41.9 (2018): 2035-2048.*
  * *Wang, Wenjia, et al. "Scene text image super-resolution in the wild." European Conference on Computer Vision. Springer, Cham, 2020.*

## 3. Method

> *Scene Text Telescope* 는 크게 아래의 세가지 모듈로 구성되어 있습니다.
>
> → ***Pixel-Wise Supervision Module + Position-Aware Module + Content-Aware Module***

![Figure2](https://3854520906-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MlJ20tNdSAn8Lm4038V%2Fuploads%2Fgit-blob-d19f18a80afa660b19e0a0cfb079ced2f2973633%2FFigure2.PNG?alt=media)

* **Pixel-Wise Supervision Module**
  1. 먼저, LR 이미지는 \[2]에서 언급되었던 misalignment 문제 해결을 위해 *STN (Spatial Transformer Network)* 을 통과합니다.
  2. 그 후, rectified된 이미지는 *TBSRN* 을 통과합니다. *TBSRN* 의 구성은 아래 그림과 같습니다.

     > **TBSRN (Transformer-based Super-Resolution Networks)**
     >
     > <img src="https://3854520906-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MlJ20tNdSAn8Lm4038V%2Fuploads%2Fgit-blob-60465182899999258e604fc57cb0f163a38274d8%2FFigure3.PNG?alt=media" alt="Figure3" data-size="original">
     >
     > * *CNN × 2* : feature map을 추출하기 위한 부분
     > * *Self-Attention Module* : sequential한 정보를 고려하기 위한 부분
     > * *2-D Positional Encoding* : spatial / positional한 정보를 고려해주는 부분
  3. 마지막으로, 이미지는 *pixel-shuffling* 을 통해 SR로 upsampling됩니다.

     +) 해당 모듈에서, loss는 ![Eq11](https://3854520906-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MlJ20tNdSAn8Lm4038V%2Fuploads%2Fgit-blob-5e45236aed2e2c5d8104ea9683290e8b6443544b%2FEq11.gif?alt=media) 으로 표현되며, 이때 ![Eq12](https://3854520906-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MlJ20tNdSAn8Lm4038V%2Fuploads%2Fgit-blob-a6409501169f3e2e84a6b12fad7a9e50bb57be8c%2FEq12.gif?alt=media)은 각각 HR이미지와 SR이미지입니다.
* **Position-Aware Module**

  1. Position-Aware 모듈에서는 먼저 synthetic 텍스트 데이터셋 (*Syn90k* \[3], *SynthText* \[4], etc) 을 이용하여 트랜스포머를 기반으로 한 recognition 모델을 pre-train시킵니다.
  2. 이때, 각 time-step의 attending region을 positional clue로 사용합니다.
     * HR 이미지가 주어졌을 때, 트랜스포머의 output은 attention map들의 리스트 형태입니다. 다시 말해, output은 ![Eq2](https://3854520906-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MlJ20tNdSAn8Lm4038V%2Fuploads%2Fgit-blob-ad3397dcb5c42d6899d3867dcb0c506bd9414821%2FEq2.gif?alt=media) 로 표현될 수 있는데, 이 때 ![Eq3](https://3854520906-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MlJ20tNdSAn8Lm4038V%2Fuploads%2Fgit-blob-cd94231d01ce7158866517c4616711d000053b7d%2FEq3.gif?alt=media) 는 i번째 time-step에서의 attention map이며, ![Eq4](https://3854520906-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MlJ20tNdSAn8Lm4038V%2Fuploads%2Fgit-blob-8ca283b64e15999f920512e98d7ef35cb8b549c7%2FEq4.gif?alt=media) 은 text label의 길이입니다.
     * SR이미지 또한 트랜스포머를 통과시켜 ![Eq5](https://3854520906-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MlJ20tNdSAn8Lm4038V%2Fuploads%2Fgit-blob-7cc66245204fdb7c900212f6fbc608ee7593963a%2FEq5.gif?alt=media)를 구합니다.
  3. 위의 과정에서 구한 attention map들로 *L1 loss* 를 계산합니다.

  <img src="https://3854520906-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MlJ20tNdSAn8Lm4038V%2Fuploads%2Fgit-blob-56ff1946a17a52f0084c5d738df51f8b95a01e49%2FEq6.gif?alt=media" alt="Eq6" data-size="original">
* **Content-Aware Module**
  1. 해당 모듈에서는 먼저, *EMNIST* \[5]를 이용하여 *VAE (Variational Autoencoder)* 를 학습시켜 텍스트 각 문자의 2차원 latent representaion을 구합니다.

     <img src="https://3854520906-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MlJ20tNdSAn8Lm4038V%2Fuploads%2Fgit-blob-2a5380109286641e523bde2cf3b4d613446d1204%2FFigure4.PNG?alt=media" alt="Figure4" data-size="original">
  2. 각 time-step마다 pre-train된 트랜스포머의 결과값 (![Eq7](https://3854520906-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MlJ20tNdSAn8Lm4038V%2Fuploads%2Fgit-blob-ff950300e7f8447dddfedf5e1697563b4197f61c%2FEq7.gif?alt=media))과 ground-truth label을 비교합니다.

     즉, ![Eq8](https://3854520906-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MlJ20tNdSAn8Lm4038V%2Fuploads%2Fgit-blob-e4759e4ad00f44329e8ebc849a88ecb1b1d7aa2e%2FEq8.gif?alt=media)(content loss)는 아래와 같이 계산할 수 있습니다.

     → ![Eq9](https://3854520906-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MlJ20tNdSAn8Lm4038V%2Fuploads%2Fgit-blob-6e1a4158c59963a5864f084aceb07b32d036e62e%2FEq9.gif?alt=media) (![Eq10](https://3854520906-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MlJ20tNdSAn8Lm4038V%2Fuploads%2Fgit-blob-4014030c653f3129ed58828550858f9926320229%2FEq10.gif?alt=media)= t번째 step에서의 ground-truth)
* **Overall Loss Function**

  <img src="https://3854520906-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MlJ20tNdSAn8Lm4038V%2Fuploads%2Fgit-blob-a9de4213f281c7827b30c5b23c931a56c6cb5480%2FEq1.PNG?alt=media" alt="Eq1" data-size="original">

  (위의 식에서 *lambda* 들은 loss term들 사이의 균형을 조절하기 위한 hyperparameter입니다.)

## 4. Experiment & Result

### Experimental setup

* **Dataset**

  > **TextZoom** \[2] : 학습을 위한 LR-HR 이미지 17,367쌍 + testing을 위한 이미지 4,373쌍 (easy subset 1,619쌍 / medium 1,411쌍 / hard 1,343쌍)
  >
  > +) LR 이미지 해상도 : 16 × 64 / HR 이미지 해상도 : 32 × 128
  >
  > <img src="https://3854520906-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MlJ20tNdSAn8Lm4038V%2Fuploads%2Fgit-blob-39d7d43322a1e5a121c4bb6245aee37a19033904%2FFigure6.PNG?alt=media" alt="Figure6" data-size="original">
* **Evaluation metric**

  > **SR 이미지** 의 경우, 아래의 두가지 metric을 사용합니다.
  >
  > * PSNR (Peak Signal-to-Noist Ratio)
  > * SSIM (Structural Similarity Index Measure)

  > 나아가, 텍스트에 초점을 맞춘 metric을 두가지 더 사용합니다. 참고로, 아래의 두가지 metric은 논문에서 제안된 metric들입니다. 이 두가지 metric의 경우, *SynthText* \[4] 와 *U-Net* \[6] 에서의 방법을 사용하여 이미지의 텍스트 부분만 고려합니다.
  >
  > * TR-PSNR (Text Region PSNR)
  > * TR-SSIM (Text Region SSIM)
* **Implementation Details**

  > **HyperParameters**
  >
  > * Optimizer : Adam
  > * Batch 크기 : 80
  > * Learning Rate : 0.0001

  > 사용한 GPU : NVIDIA TITAN Xp GPUs (12GB × 4)

### Result

* **Ablation Study**

  > * 나아가, 본 논문에서는 각 모듈 및 요소 (backbone, Position-Aware Module, Content-Aware Module, etc.) 들의 효과를 검증하기 위해 ablation study를 진행했습니다.
  > * 데이터셋 : *TextZoom* \[2]
  >
  >   +) 아래의 표들에서 Recognition 정확도는 pre-train된 *CRNN* \[7]을 기반으로 계산되었습니다.
  >
  >   <img src="https://3854520906-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MlJ20tNdSAn8Lm4038V%2Fuploads%2Fgit-blob-b7674a1458b46cefadd19aa0c63aeaa54fa3d175%2FTable.PNG?alt=media" alt="Table" data-size="original">
* **Results on&#x20;*****TextZoom*****&#x20;\[2]**

  > * 각각 다른 backbone을 기반으로 세 가지 모델 (*CRNN* \[7], *ASTER* \[8], *MORAN* \[9]) 에서의 정확도를 비교했으며, 결과는 아래 표와 같습니다.
  > * 본 논문의 *TBSRN* 를 backbone으로 사용했을 때의 정확도가 상대적으로 높음을 확인할 수 있습니다.
  >
  > <img src="https://3854520906-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MlJ20tNdSAn8Lm4038V%2Fuploads%2Fgit-blob-78a2de7a6c283618a3685328dd6cc3640ab9e5c6%2FTable5.PNG?alt=media" alt="Table5" data-size="original">
  >
  > * *Visualized Examples*
  >
  >   <img src="https://3854520906-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MlJ20tNdSAn8Lm4038V%2Fuploads%2Fgit-blob-2776ce41cf741dcf047382754eb35204855685f8%2FFigure8.PNG?alt=media" alt="Figure8" data-size="original">
* **Failure Cases**

  > <img src="https://3854520906-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MlJ20tNdSAn8Lm4038V%2Fuploads%2Fgit-blob-37a0573b06164652a1600c63d2d44e11b2cc7ac4%2FFigure10.PNG?alt=media" alt="Figure10" data-size="original">
  >
  > 또한, 논문에서는 SR에서 제대로 인식을 하지 못한 경우도 조사를 했는데, 해당 경우들은 아래와 같습니다.
  >
  > * 길거나 작은 텍스트
  > * 배경이 복잡하거나 occlusion이 있는 경우
  > * Artistic한 폰트 또는 손글씨
  > * 학습 데이터셋에 label이 없는 이미지들

## 5. Conclusion

* 요약하자면, 본 논문은
  * 불규칙한 텍스트 이미지들을 처리하기 위해 self-attention mechanism을 사용한 *TBSRN* 을 backbone으로 사용했고,
  * 헷갈릴만한, 즉, 인식이 까다로운 문자들을 고려해 weighted cross-entropy loss를 사용하고,
  * 텍스트에 초점을 둔 여러가지 module로 구성된,
  * Super-Resolution 모델 (*Scene Text Telescope*) 을 제안한 논문입니다.

### Take home message

> * SR technique을 텍스트에 초점을 두어 사용하면 성능이 향상될 수 있다.
> * Ablation study나 Failure case 설명 등이 잘 되어 있는 논문은 fancy하다!

### Author

**박나현 (Park Na Hyeon)**

* *NSS Lab, KAIST EE*
* *<julia19@kaist.ac.kr>*

### Reviewer

1. Korean name (English name): Affiliation / Contact information
2. Korean name (English name): Affiliation / Contact information
3. ...

## Reference & Additional materials

1. *Graves, Alex, et al. "Connectionist temporal classification: labelling unsegmented sequence data with recurrent neural networks." Proceedings of the 23rd international conference on Machine learning. 2006.*
2. *Wang, Wenjia, et al. "Scene text image super-resolution in the wild." European Conference on Computer Vision. Springer, Cham, 2020.*
3. *Jaderberg, Max, et al. "Reading text in the wild with convolutional neural networks." International journal of computer vision 116.1 (2016): 1-20.*
4. *Gupta, Ankush, Andrea Vedaldi, and Andrew Zisserman. "Synthetic data for text localisation in natural images." Proceedings of the IEEE conference on computer vision and pattern recognition. 2016.*
5. *Cohen, Gregory, et al. "EMNIST: Extending MNIST to handwritten letters." 2017 International Joint Conference on Neural Networks (IJCNN). IEEE, 2017.*
6. *Ronneberger, Olaf, Philipp Fischer, and Thomas Brox. "U-net: Convolutional networks for biomedical image segmentation." International Conference on Medical image computing and computer-assisted intervention. Springer, Cham, 2015.*
7. *Shi, Baoguang, Xiang Bai, and Cong Yao. "An end-to-end trainable neural network for image-based sequence recognition and its application to scene text recognition." IEEE transactions on pattern analysis and machine intelligence 39.11 (2016): 2298-2304.*
8. *Shi, Baoguang, et al. "Aster: An attentional scene text recognizer with flexible rectification." IEEE transactions on pattern analysis and machine intelligence 41.9 (2018): 2035-2048.*
9. *Luo, Canjie, Lianwen Jin, and Zenghui Sun. "Moran: A multi-object rectified attention network for scene text recognition." Pattern Recognition 90 (2019): 109-118.*
