논문리뷰 : https://velog.io/@leejken530/%EB%85%BC%EB%AC%B8%EB%A6%AC%EB%B7%B06-ViT
👉이러한 구성을 통해서 Vision transformer는 CNN과 달리 이미지 귀납적 편향이 거의 발생하지 않는다.(논문에서는 이렇게 설명한다."Inductive bias. We note that Vision Transformer has much less image-specific inductive bias than CNNs. In CNNs, locality, two-dimensional neighborhood structure, and translation equivariance are baked into each layer throughout the whole model. In ViT, only MLP layers are local and transla-tionally equivariant, while the self-attention layers are global. The two-dimensional neighborhood structure is used very sparingly: in the beginning of the model by cutting the image into patches and at fine-tuning time for adjusting the position embeddings for images of different resolution (as de-scribed below). Other than that, the position embeddings at initialization time carry no information about the 2D positions of the patches and all spatial relations between the patches have to be learned from scratch")
논문 : https://arxiv.org/pdf/2206.06488
Self-attention의 global한 패턴을 이용해 각 입력을 fully connected graph로 처리가능
👉 각 modality input의 tokenization 과 embedding이 주어지면, 토근들의 임베딩 공간을 선택하면 된다. 전략으로 단순합산, 단순연결, 교차 attention 등 다양한 전략이 존재.
논문 : https://arxiv.org/abs/1704.03155v2
1. 입력 이미지 (Input Image)
원본 이미지는 "LICENSEE OF MCDONALD'S"라는 문구가 포함된 이미지입니다. 이 이미지를 ViT 모델이 처리할 수 있는 형태로 변환하는 과정이 필요합니다.
2. 이미지 패치 분할 (Image Patches)
입력 이미지는 작은 패치들(patches)로 나뉩니다. 이 과정은 CNN의 필터와 유사한 방식으로, 이미지의 특정 구역을 자르는 역할을 합니다.
예를 들어, 각 글자 또는 이미지의 일부가 개별적인 패치로 분할됩니다. 그림에서 각 패치는 번호(1, 2, 3, ...)로 구분되어 있으며, 이를 통해 ViT가 이미지 내 개별적인 부분들을 인식할 수 있게 됩니다.
3. 패치 임베딩 (Patch Embedding)
패치들이 플래튼(flatten)되며 1차원 벡터 형태로 변환됩니다. 이렇게 변환된 각 패치는 Transformer 모델이 처리할 수 있는 형태의 입력 데이터가 됩니다.
각 패치에는 위치 임베딩(position embedding)이 추가됩니다. 위치 임베딩은 Transformer 모델이 순서나 위치 정보를 알 수 있도록 해주는 역할을 합니다. Transformer는 원래 순차적인 정보를 가지지 않기 때문에, 이미지 패치들이 어떤 순서에 위치하는지 알려주기 위해 위치 임베딩이 필요합니다.
4. 인코더 (Encoder)
인코더(Encoder)는 여러 층의 다중 헤드 어텐션(Multi-Head Attention)과 피드포워드 네트워크(Feed Forward)로 구성됩니다. 이 모듈은 패치들의 상호 관계와 특징을 학습합니다.
다중 헤드 어텐션을 통해 패치들 사이의 관계를 학습하며, 피드포워드 네트워크는 각 패치의 정보를 더욱 세밀하게 가공합니다.
인코더는 이미지 내 패치들 간의 관계와 패턴을 이해하고, 이를 기반으로 다음 단계에서 사용할 히든 벡터 를 생성합니다.
5. 디코더 (Decoder)
디코더는 Transformer의 인코더-디코더 구조를 따라 Masked Multi-Head Attention을 통해 입력된 패치를 바탕으로 텍스트를 생성합니다.
첫 번째 입력은 [BOS] (Begin of Sequence) 토큰이며, 각 출력 위치에는 이전 출력 결과가 입력으로 들어갑니다. 이는 다음 토큰을 예측하기 위해 이전 예측 결과를 활용하는 방식입니다.
디코더의 출력은 처음에는 [BOS], 그다음에는 "L", "IC", "ENSE" 등의 텍스트 조각들이 생성되며, 마지막에는 [EOS] (End of Sequence) 토큰이 생성됩니다. 이 과정을 통해 최종적으로 텍스트가 완성됩니다.
6. 출력 생성 (Outputs)
디코더의 최종 출력은 이미지에서 추출된 텍스트로, "LICENSEE OF MCDONALD'S" 문구가 출력됩니다.
출력은 디코더가 생성한 텍스트의 순서대로 나열되며, 입력 이미지에서 확인된 텍스트와 동일하게 재구성됩니다.
논문 :https://arxiv.org/abs/1605.05923
모델은 일반 인쇄 텍스트에 대해 기초적인 인식 능력학습
다양한 형식의 텍스트를 추가로 학습하여 비정형 데이터에 대한 인식 높임.
2Tasks:Text Recognition Task & Scene Text Recognition
데이터 증강화는 있을 법한 예외상황을 모델링 할때 가장 효과적!!
붓글씨 더 힘차게(Dilation) 하거나 얉게(Erosion) 하는 형식으로 Data augmentation함.
참고 Rand_augmentation: https://openaccess.thecvf.com/content_CVPRW_2020/papers/w40/Cubuk_Randaugment_Practical_Automated_Data_Augmentation_With_a_Reduced_Search_Space_CVPRW_2020_paper.pdf
DTrOCR: Decoder-only Transformer for Optical Character Recognition
https://arxiv.org/abs/2308.15996
"""
This method uses a decoder-only Transformer to take advantage of a generative language model that is pre-trained on a large corpus. We examined whether a generative language model that has been successful in natural language processing can also be effective for text recognition in computer vision. Our experiments demonstrated that DTrOCR outperforms current state-of-the-art methods by a large margin in the recognition of printed, handwritten, and scene text in both English and Chinese.
"""
논문 : https://arxiv.org/abs/2111.15263
① Feature Extractor:
Visual/language model,seed text generator
② Multi-modal feature enhancement
Attention layer에서 시각/글자정보 모두 self_attended
③ Output Fusion
시각정보는 다시 seed text generator를 통과 -> Gated Mechanisim
Visual Feature : ResNet과 Transformer 기반 모델 활용
Seed Text Generation : visual feature 를 sequential 한 text로 전환
Semantic Feature: 4개의 transformer decoder block
이제 mulimodal feature enhancement &masking을 통해..
• 이 둘을 동시에 사용하게끔 하는 task정의
• 서로를 상호 고려하게끔 feature enhance
• 어떻게 둘을 합칠 것인지
Final Output Fusion:visualfeature를 sequential feature로 만든 뒤,gate mechanism을 적용
👉 최종적으로 linear layer 와 softmax를 F에 적용하여 character sequence Y(1)얻어냄.
Spatial Encoding to Semantics(SES)
SES는 공간정보를 의미적 정보로 변환하는 프로세스
- SES 는 text 와 image 정보의 alignment 을 나타내는 attention map 이다
- 시각 정보는 U-net 을 거쳐 더 refine 하여 사용한다
- SES에 spatial feature를 곱하면 semantic 의 embedding space 로 project 했다고 볼 수는 있으나, 논문에서는 여기에 learnable linear weight 를 곱하고, softmax 를 취해 estimated text 를 구하였습니다.
- SES의 row별 top K score를 사용하여 텍스트와 관련된 이미지의 위치 정보를 알 수 있다
- Seed text generation 과 visual clue masking 에 사용된다