GAN Image Generator and Characterwise Image Recognizer with python

Overview

MODEL SUMMARY

모델의 구조는 크게 6단계로 나뉩니다.

STEP 0: Input Image

raw

Predict 할 이미지를 모델에 입력합니다.

STEP 1: Make Black and White Image

raw

STEP 1 은 입력받은 이미지의 글자를 흑색으로, 배경을 백색으로 변환하는 과정입니다.

STEP 2: Make Fake image by GAN Model

raw

STEP 2 는 STEP 1에서 입력받은 이미지를 하나의 통일된 폰트의 이미지로 변환하는 과정입니다.

모델은 Pix2Pix Image-to-Image Translation 모델의 Generator 를 이용하며, 기울어지거나 Blurring 된 이미지도 위와 같이 정렬 및 복원하여 출력합니다.

STEP 3: Character-wise Text Detection - Bounding Box

raw

STEP 3 는 STEP 2의 Word 단위로 출력된 이미지에 Charater 단위 Bounding Box 를 만드는 과정입니다.

Bounding Box 를 형성하는데 Naver Clova CRAFT 모델을 사용하며, 위와 같이 CRAFT 모델 결과로 나온 score map 을 이용하여 Bounding Box 를 만듭니다.

STEP 4: Character-wise Text Detection - Cut Out Image

raw

STEP4 는 Bounding Box 좌표값을 바탕으로 STEP 2의 이미지에서 이미지를 잘라내는 과정입니다.

STEP 5: Character-wise Recognition

raw

raw

STEP 5 는 잘라낸 이미지를 글자로 변환하는 과정입니다.

다양한 폰트의 한글과 영어, 특수기호 이미지 데이터에 왜곡와 Blur 를 추가하여 학습한 모델을 사용하며, 각 Character 에 맞는 글자를 출력합니다.

STEP 6: Make Result File

raw

STEP 6 STEP 5 에서 Charater 단위로 출력한 글자를 조합하여 입력 이미지에 맞는 Word 를 출력하는 과정입니다.

HOW TO PREDICT

제출된 submission 폴더로 들어간 뒤, images 폴더 내에 새 폴더를 생성합니다. 이때, 새 폴더의 이름을 "test"라 하겠습니다.

~submission/$ cd images
~submission/images/$ mkdir test

새로 생성된 test 폴더에 이미지들을 넣습니다.

이후, 아래 코드를 실행합니다.

~/submission/$ myOCR_6STEP.py --input_tag test --output_tag first

이후, 코드는 예측을 시작하며, 결과파일은 아래 경로에 저장됩니다.

~/submission/result/test_first/result.csv

HOW TO TRAIN

본 대회 제출물에서 사용된 모델은 총 3개이며, 이 모델은 1개의 사전학습모델과 2개의 자체학습모델로 구성됩니다.

PRE-TRAINED

이미지에서 단일 Character를 인식해내는 모델은 NAVER 팀의 CRAFT 사전학습모델을 사용하였습니다. 이 모델은 이미지를 입력받아, 단일 Character의 중심점 위치를 판단할 수 있는 score map을 반환합니다. REFERENCE-CRAFT

TRAIN

GAN Image Generator

다양한 색상과 폰트, 크기를 가진 단어 이미지를 흑백 색상, 단일 폰트, 단일 크기를 가진 단어 이미지로 바꾸어주는 Image Generater Model 입니다. 이 모델에서는 전처리된 이미지를 사용합니다. 전처리의 경우 아래와 같이 진행합니다.

# TO DO

아래 위치에 각각 원본데이터와 새로 제작하고자 하는 이미지를 저장합니다.

~/submission/GAN_train/images_preprocessed # 원본 이미지
~/submission/GAN_train/images_trans(default font) # 출력하고자 하는 이미지

각각 위치에는, 실재 학습에 사용된 30060장의 데이터가 들어가 있습니다.

~/submission/$ cd GAN_train
~/submission/GAN_train/Full_train.py

Characterwise Image Recognizer

글자 인식 부분은 아래와 같이 학습 가능합니다.

~/submission/$ cd hangul-syllable-recognition
~/submission/hangul-syllable-recognition/$ python train.py

위 코드를 실행시키면 기존에 저정되어있는 학습용 이미지와 label로 학습을 시작하며, 일정 주기로 모델을 저장합니다.

~/submission/hangul-syllable-recognition/data/train_150000_F49/ # 학습용 이미지 저장소
~/submission/hangul-syllable-recognition/data/train_150000_F49.csv #학습용 이미지 정답 label
~/submission/hangul-syllable-recognition/saved_model/ #학습된 모델 저장 공간

학습용 이미지는 TRGD를 이용해 제작했으며, 상업적으로 이용 가능한 폰트 49종을 이용해 제작했습니다. 학습에 사용된 글자는 한글 KS X 1001 완성형 2350자와 영어 대소문자 52자, 특수기호 26자 (){}[]<>.'?!:+-/*=~@#$%^& 숫자 10자를 포함해 총 2438자를 학습했습니다.

REFERENCE-MODEL REFERENCE-TRDG

CONTRIBUTOR

고려대학교 김정기 ([email protected])

한양대학교 정혜영 ([email protected])

포항공과대학교 한주완 ([email protected])

Owner
Juwan HAN
Juwan HAN
ppo_pytorch_cpp - an implementation of the proximal policy optimization algorithm for the C++ API of Pytorch

PPO Pytorch C++ This is an implementation of the proximal policy optimization algorithm for the C++ API of Pytorch. It uses a simple TestEnvironment t

Martin Huber 59 Dec 09, 2022
Permute Me Softly: Learning Soft Permutations for Graph Representations

Permute Me Softly: Learning Soft Permutations for Graph Representations

Giannis Nikolentzos 7 Jul 10, 2022
Code and data for paper "Deep Photo Style Transfer"

deep-photo-styletransfer Code and data for paper "Deep Photo Style Transfer" Disclaimer This software is published for academic and non-commercial use

Fujun Luan 9.9k Dec 29, 2022
My coursework for Machine Learning (2021 Spring) at National Taiwan University (NTU)

Machine Learning 2021 Machine Learning (NTU EE 5184, Spring 2021) Instructor: Hung-yi Lee Course Website : (https://speech.ee.ntu.edu.tw/~hylee/ml/202

100 Dec 26, 2022
Coded illumination for improved lensless imaging

CodedCam Coded Illumination for Improved Lensless Imaging Paper | Supplementary results | Data and Code are available. Coded illumination for improved

Computational Sensing and Information Processing Lab 1 Nov 29, 2021
50-days-of-Statistics-for-Data-Science - This repository consist of a 50-day program

50-days-of-Statistics-for-Data-Science - This repository consist of a 50-day program. All the statistics required for the complete understanding of data science will be uploaded in this repository.

komal_lamba 22 Dec 09, 2022
Modified prey-predator system - Modified prey–predator model describes the rate of change for each species by adding coupling terms.

Modified prey-predator system We aim to study the behaviors of the modified prey–predator model and establish the effects of several parameters that p

Seoyoung Oh 1 Jan 02, 2022
working repo for my xumx-sliCQ submissions to the ISMIR 2021 MDX

Music Demixing Challenge - xumx-sliCQ This repository is the GitHub mirror of my working submission repository for the AICrowd ISMIR 2021 Music Demixi

4 Aug 25, 2021
Alignment Attention Fusion framework for Few-Shot Object Detection

AAF framework Framework generalities This repository contains the code of the AAF framework proposed in this paper. The main idea behind this work is

Pierre Le Jeune 20 Dec 16, 2022
Politecnico of Turin Thesis: "Implementation and Evaluation of an Educational Chatbot based on NLP Techniques"

THESIS_CAIRONE_FIORENTINO Politecnico of Turin Thesis: "Implementation and Evaluation of an Educational Chatbot based on NLP Techniques" GENERATE TOKE

cairone_fiorentino97 1 Dec 10, 2021
SAT Project - The first project I had done at General Assembly, performed EDA, data cleaning and created data visualizations

Project 1: Standardized Test Analysis by Adam Klesc Overview This project covers: Basic statistics and probability Many Python programming concepts Pr

Adam Muhammad Klesc 1 Jan 03, 2022
Locally Enhanced Self-Attention: Rethinking Self-Attention as Local and Context Terms

LESA Introduction This repository contains the official implementation of Locally Enhanced Self-Attention: Rethinking Self-Attention as Local and Cont

Chenglin Yang 20 Dec 31, 2021
This project deploys a yolo fastest model in the form of tflite on raspberry 3b+. The model is from another repository of mine called -Trash-Classification-Car

Deploy-yolo-fastest-tflite-on-raspberry 觉得有用的话可以顺手点个star嗷 这个项目将垃圾分类小车中的tflite模型移植到了树莓派3b+上面。 该项目主要是为了记录在树莓派部署yolo fastest tflite的流程 (之后有时间会尝试用C++部署来提升

7 Aug 16, 2022
All of the figures and notebooks for my deep learning book, for free!

"Deep Learning - A Visual Approach" by Andrew Glassner This is the official repo for my book from No Starch Press. Ordering the book My book is called

Andrew Glassner 227 Jan 04, 2023
Perturb-and-max-product: Sampling and learning in discrete energy-based models

Perturb-and-max-product: Sampling and learning in discrete energy-based models This repo contains code for reproducing the results in the paper Pertur

Vicarious 2 Mar 14, 2022
QAHOI: Query-Based Anchors for Human-Object Interaction Detection (paper)

QAHOI QAHOI: Query-Based Anchors for Human-Object Interaction Detection (paper) Requirements PyTorch = 1.5.1 torchvision = 0.6.1 pip install -r requ

38 Dec 29, 2022
Open source code for Paper "A Co-Interactive Transformer for Joint Slot Filling and Intent Detection"

A Co-Interactive Transformer for Joint Slot Filling and Intent Detection This repository contains the PyTorch implementation of the paper: A Co-Intera

67 Dec 05, 2022
Transfer Learning for Pose Estimation of Illustrated Characters

bizarre-pose-estimator Transfer Learning for Pose Estimation of Illustrated Characters Shuhong Chen *, Matthias Zwicker * WACV2022 [arxiv] [video] [po

Shuhong Chen 142 Dec 28, 2022
TransMIL: Transformer based Correlated Multiple Instance Learning for Whole Slide Image Classification

TransMIL: Transformer based Correlated Multiple Instance Learning for Whole Slide Image Classification [NeurIPS 2021] Abstract Multiple instance learn

132 Dec 30, 2022
Learning to Estimate Hidden Motions with Global Motion Aggregation

Learning to Estimate Hidden Motions with Global Motion Aggregation (GMA) This repository contains the source code for our paper: Learning to Estimate

Shihao Jiang (Zac) 221 Dec 18, 2022