File size: 2,271 Bytes
29d1fb6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | # Result Analysis
## 1. Tokenizer
`AutoTokenizer`๋ ํ
์คํธ ๋ฌธ์ฅ์ ๋ชจ๋ธ์ด ์ฒ๋ฆฌํ ์ ์๋ ์ ์ ID ํํ๋ก ๋ณํํ๋ค.
์คํ ๊ฒฐ๊ณผ `input_ids`, `token_type_ids`, `attention_mask`๊ฐ ์์ฑ๋์๋ค.
- `input_ids`: ํ ํฐ์ vocabulary index๋ก ๋ฐ๊พผ ๊ฐ
- `token_type_ids`: BERT ๊ณ์ด์์ ๋ฌธ์ฅ A/B๋ฅผ ๊ตฌ๋ถํ๋ ๊ฐ
- `attention_mask`: ์ค์ ํ ํฐ์ 1, padding ํ ํฐ์ 0
์ ์ฅ ํ ๋ค์ ๋ถ๋ฌ์จ tokenizer๋ ๊ฐ์ ๋ฐฉ์์ผ๋ก ์
๋ ฅ์ ์ฒ๋ฆฌํ ์ ์์๋ค.
## 2. ImageProcessor
`AutoImageProcessor` ๋๋ fallback `ViTImageProcessor`๋ PIL ์ด๋ฏธ์ง๋ฅผ ๋ชจ๋ธ ์
๋ ฅ์ฉ tensor๋ก ๋ณํํ๋ค.
์คํ ๊ฒฐ๊ณผ `pixel_values`์ shape๋ `(1, 3, 224, 224)`๋ก ํ์ธ๋์๋ค.
์ด๋ ๋ค์ ์๋ฏธ๋ฅผ ๊ฐ์ง๋ค.
- batch size: 1
- channel: 3, RGB ์ด๋ฏธ์ง
- height, width: 224 x 224
์ ์ฅ ์ `preprocessor_config.json`์ด ์์ฑ๋๋ฉฐ, ์ด ์ค์ ํ์ผ์ ํตํด ๊ฐ์ ์ ์ฒ๋ฆฌ ๋ฐฉ์์ ๋ค์ ๋ณต์ํ ์ ์๋ค.
## 3. Processor / CLIP
`AutoProcessor` ๋๋ `CLIPProcessor`๋ tokenizer์ image processor๋ฅผ ํจ๊ป ๋ฌถ์ ๊ฐ์ฒด์ด๋ค.
๋ฐ๋ผ์ ํ
์คํธ์ ์ด๋ฏธ์ง๋ฅผ ๋์์ ์
๋ ฅ๋ฐ์ ๋ค์ key๋ฅผ ์์ฑํ๋ค.
- `pixel_values`: ์ด๋ฏธ์ง ์
๋ ฅ
- `input_ids`: ํ
์คํธ ํ ํฐ ID
- `attention_mask`: ํ
์คํธ padding mask
- `token_type_ids`: tokenizer ์ข
๋ฅ์ ๋ฐ๋ผ ์์ฑ๋ ์ ์๋ ๋ฌธ์ฅ ๊ตฌ๋ถ ID
Processor๋ `save_pretrained()`์ `from_pretrained()` ๋ฐฉ์์ผ๋ก ์ ์ฅํ๊ณ ๋ณต์ํ ์ ์์๋ค.
## 4. Custom ImageProcessor
`ImageProcessingMixin`์ ์์ํ์ฌ ์ง์ `SimpleVisionImageProcessor`๋ฅผ ๊ตฌํํ์๋ค.
์ด ํ๋ก์ธ์๋ ๋ค์ ์์
์ ์ํํ๋ค.
1. PIL ์ด๋ฏธ์ง ๋๋ numpy array ์
๋ ฅ ์ฒ๋ฆฌ
2. RGB ๋ณํ
3. resize
4. `[0, 1]` ๋ฒ์๋ก rescale
5. mean/std normalize
6. `(B, C, H, W)` ํ์์ `pixel_values` ์์ฑ
์ ์ฅ ์ ๊ณผ ์ ์ฅ ํ ๋ค์ ๋ก๋ํ processor์ ์ถ๋ ฅ ์ฐจ์ด๋ฅผ ๋น๊ตํ์ ๋ `max diff = 0.0`์ผ๋ก ํ์ธ๋์๋ค.
์ฆ, ์ ์ฅ/๋ณต์ ํ์๋ ๊ฐ์ ์ ์ฒ๋ฆฌ ๊ฒฐ๊ณผ๋ฅผ ์ป์๋ค.
## 5. ์คํ ๊ฒ์ฆ
- ๋ชจ๋ Python ํ์ผ ๋ฌธ๋ฒ ๊ฒ์ฌ ํต๊ณผ
- ์ธํฐ๋ท์ด ์๋ ํ๊ฒฝ์์ fallback ๋ชจ๋๋ก `python scripts/run_all.py` ์คํ ์ฑ๊ณต
- ์คํ ๋ก๊ทธ๋ `outputs/logs/run_all_test.log`์ ์ ์ฅ๋จ
|