λ₯건 | μ¬κ±΄ν¬ | μ€νμ€ | μ΄κ°ν¬ | μ΄μλΌ |
---|---|---|---|---|
Blog | - | Blog | Blog | Blog |
λͺ¨λΈλ§ νμ΄νλΌμΈ λ°μ΄ν° μμ§ |
λͺ¨λΈλ§ μ°κ΅¬ λ°μ΄ν° μμ§ |
λ°±μλ λ°νμλ£ νμ
κ΄λ¦¬ |
νλ‘ νΈμλ μλΉμ€ λ°°ν¬ νμ΄νλΌμΈ |
λ°±μλ μλΉμ€ λ°°ν¬ νμ΄νλΌμΈ |
μ ν¬μ μλΉμ€λ μνμ ν΄μΈλ‘ μ§μΆνκ³ μΆμ μΉν° μκ°λ λ²μ λ° νΈμ§μ μ΄λ €μμ κ²ͺλ λ²μ-νΈμ§μλ₯Ό μν μλΉμ€λ₯Ό μ 곡ν©λλ€.
(Webtoon)+(Translation)μ ν©μ³ ToonslatorλΌλ μλΉμ€λ₯Ό λ§λ€μμ΅λλ€.
- Ubuntu 18.04.5 LTS
- Intel(R) Xeon(R) Gold 5120 CPU @ 2.20GHz
- NVIDIA Tesla V100-PCIE-32GB
- React
- pytorch
- FastAPI
- Nginx
- OpenCV
<final-project-level2-cv-11>
|
π-- README.md
π-- notebooks
| π-- font_ex.ipynb
| π-- imagemaker.py
| π-- tesseract_boxes.py
| π-- txt2json.ipynb
βοΈ-- poetry.lock
βοΈ-- pyproject.toml
π-- src
π-- __init__.py
π-- backend
| π-- __main__.py
| π-- main.py
| π-- pipeline
| | π-- __init_.py
| | π-- typical_pipeline.py
| | π-- untypical_pipeline.py
| π-- routers
| π-- machine_translation.py
| π-- test.py
| π-- txt_extraction.py
| π-- untypical_generation.py
| π-- untypical_machine_translation.py
| π-- untypical_txt_extraction.py
π-- frontend
| π-- README.md
| π-- package-lock.json
| π-- package.json
| π-- public
| π-- src
π-- model
π-- MachineTranslate
| π-- papago_MT.py
π-- OCR
| π-- clova_OCR.py
| π-- tesseract_OCR.py
π-- __init__.py
π-- font_classifier
| π-- FC.py
| π-- dataset_font.py
| π-- inference_font.py
| π-- loss.py
| π-- model_font.py
| π-- requirements.txt
| π-- scheduler.py
| π-- train_font.py
| π-- weights
π-- font_color
| π-- font_color.py
π-- font_generator
| π-- gasnext
| π-- mxfont
π-- svg2ttf
π-- example.json
π-- svgs2ttf.py
λμ§νΈ λ§νμμ₯μ μ μ μ¨μ΄ μ μ°¨ λμμ Έ κ²°κ΅ 2019λ μλ μΈμ λ§ν μμ₯μ λ°μ΄ λμμ΅λλ€.
μλΉμλ€μ μ±κ³΅μ λ°μμΌλ‘ μΈκ³μ μΌλ‘ μμΆ μμ₯μ΄ μ»€μ§λ μ€μ λλ€.
νμ§λ§ λ²μ λ° νμ§ν κ³Όμ μ μΉν° μμΆ κ³Όμ μμ κ±Έλ¦Όλμ λλ€.
- λ¬Έμ μ μ
- μ μ ν νΈμ§ λꡬ μμ΄ λ²μμ ν κ²½μ° λΉμ©μ΄ μ¦κ°
- νμ§νκ° μ λμ§ μλ κ²½μ° μμ κ°μλ‘ μΈν μμ΅ νλ½
- νλ‘μ νΈ λͺ©ν
- νΈμ§ μλνλ₯Ό ν΅ν΄ λ²μκ³Όμ μ λΉμ©μ μ΅μννκ³ μλΉμ μ¦κ°λ₯Ό ν΅ν μμ΅ κ·Ήλνλ₯Ό λͺ©νλ‘ ν©λλ€.
- μλΉμ€ νκ²
- κΈλ‘λ²νλ₯Ό μνλ μΉν° μκ°
- λ²μ λ° νΈμ§μ μ΄λ €μμ κ²ͺλ μΉν° λ²μ-νΈμ§μ
- Frontend
- HTML
- CSS
- React
- Backend
- FastAPI
- API
- Clova OCR
- Papago κΈ°κ³λ²μ
- μ¬μ©μλ‘λΆν° λ°°κ²½, λμ¬ ν¨κ³Όμ μ΄λ―Έμ§λ₯Ό λ°μ΅λλ€.
- λμ¬ μ΄λ―Έμ§λ λμ¬ νμ΄νλΌμΈμ ν΅ν΄ λμ¬μ μμΉλ₯Ό μ°Ύκ³ , λ²μ λ° ν°νΈλ₯Ό λΆλ₯κ³Όμ μ κ±°μΉ©λλ€.
- ν¨κ³Όμ νμ΄νλΌμΈμ λμ¬ νμ΄νλΌμΈμ ν΅ν outputμ μ¬μ©νμ¬ ν°νΈ μμ±νλ κ³Όμ μ κ±°μΉ©λλ€.
- λ²μλ κ²°κ³Όλ¬Όμ μ΄μ©νμ¬ ν°νΈλ₯Ό μμ , μμΉ λ³κ²½, μ λ³κ²½ λ±μ νΈμ§μ ν μ μμ΅λλ€.
- νΈμ§μ΄ μλ£λλ©΄ μ΅μ’ κ²°κ³Όλ¬Όμ μ»μ μ μμ΅λλ€.
https://www.youtube.com/watch?v=ILJyhd24qd4
- κ²½λ‘ μ΄λ
cd src
cd frontend
- Nodejs μ€μΉ (μ°λΆν¬)
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash - &&\
sudo apt-get install -y nodejs
- ν¨ν€μ§ μ€μΉ
npm install
- μλ² μμ
npm start
- ν¨ν€μ§ νκ²½ μ€μ
pip install --user poetry
# (sudo) vi ~/.bashrc μ
λ ₯ ν, 맨 μλμ PATH="$HOME/.local/bin:$PATH" μΆκ° (ν λ²λ§ νλ©΄ λ¨)
# νλ‘μ νΈ ν΄λ λ΄μ κ°μνκ²½μ μ μ₯
poetry config virtualenvs.in-project true
# poetry κ°μνκ²½ λ΄μμ μ€ν
poetry shell
- κ°μ€μΉ, font λ€μ΄λ‘λ λ° νκ²½λ³μ μ€μ
- Font Classifier κ°μ€μΉ
# λ§ν¬1 : https://drive.google.com/file/d/1a28eDYyOUrJEhvLHsfI1iFBHhA7LlWl7/view?usp=sharing
# -O μ΅μ
μ λ€μ΄λ°μ κ²½λ‘ μ§μ
wget --load-cookies ~/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies ~/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=1a28eDYyOUrJEhvLHsfI1iFBHhA7LlWl7' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=1a28eDYyOUrJEhvLHsfI1iFBHhA7LlWl7" -O /opt/ml/final-project-level2-cv-11/src/model/font_classifier/weights/typical/weight.pth && rm -rf ~/cookies.txt
# λ§ν¬2 : https://drive.google.com/file/d/107iA6ir5Fbii-5JimkGaL-HBomTDeKR1/view?usp=sharing
wget --load-cookies ~/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies ~/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=107iA6ir5Fbii-5JimkGaL-HBomTDeKR1' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=107iA6ir5Fbii-5JimkGaL-HBomTDeKR1" -O /opt/ml/final-project-level2-cv-11/src/model/font_classifier/weights/untypical/weight.pth && rm -rf ~/cookies.txt
- Font Generator κ°μ€μΉ
# mxfontλ§ν¬: https://drive.google.com/file/d/1URxBMtHx1SXAAJ4b4A2jbmD44S1Ns1Jp/view?usp=sharing
wget --load-cookies ~/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies ~/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=1URxBMtHx1SXAAJ4b4A2jbmD44S1Ns1Jp' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=1URxBMtHx1SXAAJ4b4A2jbmD44S1Ns1Jp" -O /opt/ml/final-project-level2-cv-11/src/model/font_generator/mxfont/mxfont_weight.pth && rm -rf ~/cookies.txt
# gasnextλ§ν¬: https://drive.google.com/file/d/173SEHgYuSoJ6eze-BaofzJutjd6bAIGo/view?usp=sharing
wget --load-cookies ~/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies ~/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=173SEHgYuSoJ6eze-BaofzJutjd6bAIGo' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=173SEHgYuSoJ6eze-BaofzJutjd6bAIGo" -O /opt/ml/final-project-level2-cv-11/src/model/font_generator/gasnext/checkpoints/gasnext_weight.pth && rm -rf ~/cookies.txt
- Script Font λ€μ΄λ‘λ
# λ§ν¬ : https://drive.google.com/file/d/1p7Rwc08Xbk9bHGIE_7UoWl5OQksfVHrm/view?usp=sharing
mkdir -p data/font/typical
wget --load-cookies ~/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies ~/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=1p7Rwc08Xbk9bHGIE_7UoWl5OQksfVHrm' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=1p7Rwc08Xbk9bHGIE_7UoWl5OQksfVHrm" -O /opt/ml/final-project-level2-cv-11/data/font/typical.zip && rm -rf ~/cookies.txt
unzip data/font/typical.zip -d data/font
- Effect Font λ€μ΄λ‘λ
# λ§ν¬ : https://drive.google.com/file/d/14rTAp7WJpr4Cl4qLrh5H7qgeiy4SfHw9/view?usp=sharing
mkdir -p data/font/untypical
wget --load-cookies ~/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies ~/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=14rTAp7WJpr4Cl4qLrh5H7qgeiy4SfHw9' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=14rTAp7WJpr4Cl4qLrh5H7qgeiy4SfHw9" -O /opt/ml/final-project-level2-cv-11/data/font/untypical.zip && rm -rf ~/cookies.txt
unzip data/font/untypical.zip -d data/font
- .env νμΌ μ€μ
# .envνμΌ λ§λ€κ³ μλ μ
λ ₯
# μ¬μ©μ μν΄μ λ μ¬μ΄νΈμμ keyλ₯Ό λ°κΈλ°μμΌ ν©λλ€.
# ννκ³ :https://developers.naver.com/docs/papago/papago-nmt-example-code.md
# Clova OCR: https://guide-fin.ncloud-docs.com/docs/ocr-ocr-1-4
PAPAGO_ID="μΈμ¦ IDλ₯Ό μ
λ ₯ν΄μ£ΌμΈμ"
PAPAGO_SECRET="μΈμ¦ keyλ₯Ό μ
λ ₯ν΄μ£ΌμΈμ"
CLOVA_URL="μΈμ¦ URLμ μ
λ ₯ν΄μ£ΌμΈμ"
CLOVA_KEY="μΈμ¦ keyλ₯Ό μ
λ ₯ν΄μ£ΌμΈμ"
- μ€ν
# Backend (FastAPI) μ€ν
cd src/
python -m backend
- gasnext νμ΅ κ°μ€μΉ νμΌ λ€μ΄λ‘λ
mkdir src/model/font_generator/gasnext/checkpoints
mkdir src/model/font_generator/gasnext/checkpoints/gas_test_100ep_aug
cd src/model/font_generator/gasnext/checkpoints/gas_test_100ep_aug
100epoch νμ΅μν¨ gasnext κ°μ€μΉ νμΌμ λ€μ΄, gasnext/font_generate_gasnext.py 65 line μ°Έμ‘°
2. gasnext ttf μν λ€μ΄λ‘λ
μν data λ€μ΄ λ° λ ν¬ rootμμ μμΆ νκΈ°
- Font Generation
- mxfont
- gasnext:
- Dataset
- font repo: https://noonnu.cc/
- typical font list: https://twitter.com/Gold7ll/status/1351568186374721539
- Open source
- svgs2ttf: https://github.com/pteromys/svgs2ttf
- pytesseract: https://github.com/tesseract-ocr/tesstrain
- tesseract: https://github.com/tesseract-ocr/tesseract
- fontforge: https://fontforge.org/en-US/
- API