You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
2.4 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# data_gen — 합성 LP 데이터 생성
## 자산 (Korean-license-plate-Generator)
`setup_assets.sh`가 [qjadud1994/Korean-license-plate-Generator](https://github.com/qjadud1994/Korean-license-plate-Generator) (MIT)을 clone합니다. 폰트 파일 대신 **이미 렌더링된 글자 PNG + plate 배경 이미지**를 제공해서 폰트 라이센스를 회피합니다.
자산은 이 repo에 포함되지 않고(`.gitignore`), `setup_assets.sh`로 매번 받습니다.
## 사용법 (서버 컨테이너 안)
```bash
# 1. 자산 다운로드 (1회)
bash /workspace/kr_lp_pgnet/data_gen/setup_assets.sh
# 2. 합성 데이터 생성
python3.10 /workspace/kr_lp_pgnet/data_gen/generate_synthetic.py \
--out_dir /workspace/train_data/kr_lp_synth \
--num 200000 \
--types 1,2,3,4 \
--dict /workspace/kr_lp_pgnet/dict/kr_lp_dict.txt
```
## 출력 구조
```
out_dir/
├── train/
│ ├── images/000000.jpg ...
│ └── train.txt ← PaddleOCR PGNet 라벨
└── test/
├── images/...
└── test.txt
```
라벨 한 줄 예시 (탭 구분):
```
images/000123.jpg\t[{"transcription": "12가3456", "points": [[0,0],[520,0],[520,110],[0,110]]}]
```
## Plate 종류
| Type | 사이즈 | 배경 | 라벨 형식 |
|---|---|---|---|
| 1 | 520×110 | 흰 | `NN한NNNN` (한 줄) |
| 2 | 355×155 | 흰 (구형) | `NN한NNNN` (한 줄) |
| 3 | 336×170 | 노랑 | `지역명NN` + `한NNNN` (두 줄, polygon 분리) |
| 4 | 336×170 | 파/녹 | `지역명NN` + `한NNNN` (두 줄, polygon 분리) |
## 알려진 제약
- **REGION_MAP은 추정 매핑** — `region_y/A.jpg ~ P.jpg`가 어떤 한국 지역명과 매칭되는지 정확한 정보가 자산 README에 없습니다. 합성 결과 PNG를 시각 확인 후 `generate_synthetic.py``REGION_MAP`을 정정하세요.
- **자산이 못 만드는 글자**: `하`, `호`, `배`. 이 글자가 들어간 LP는 합성 데이터에 등장하지 않습니다 — Step2 fine-tune의 실차 데이터로 보충됩니다.
- **세종 지역**: 자산 region이 16개라 세종이 빠진 것으로 추정 (한국 광역지자체 17개 중 1개). 마찬가지로 Step2에서 보충.
- **plate 배경 정확도**: 자산이 모방한 배경이라 실제 한국 LP와 색상·로고 일부 차이. 학습은 글자 segmentation+분류가 핵심이라 큰 영향 없으나, Step2 fine-tune이 필수.