Instructions to use sungjin-code/siglip2-base-patch16-224-dress with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use sungjin-code/siglip2-base-patch16-224-dress with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-feature-extraction", model="sungjin-code/siglip2-base-patch16-224-dress")# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForZeroShotImageClassification processor = AutoProcessor.from_pretrained("sungjin-code/siglip2-base-patch16-224-dress") model = AutoModelForZeroShotImageClassification.from_pretrained("sungjin-code/siglip2-base-patch16-224-dress", device_map="auto") - Notebooks
- Google Colab
- Kaggle
siglip2-base-patch16-224-dress
google/siglip2-base-patch16-224์ ๋น์ ์ธ์ฝ๋๋ฅผ GLAMI-1M ๋๋ ์ค ์ด๋ฏธ์ง๋ก LoRA fine-tuneํ ๋ค base์ ํฉ์น(merged) ๊ฐ์ค์น์ ๋๋ค. ๋๋ ์ค ์ด๋ฏธ์ง ๊ฒ์์ฉ ์ด๋ฏธ์ง ์๋ฒ ๋ฉ(768์ฐจ์)์ ๋ง๋ค ๋ ์๋๋ค. ํ ์คํธ ํ์๋ base์ ๊ฐ์ต๋๋ค.
์ฌ์ฉ๋ฒ
import torch
from PIL import Image
from transformers import AutoImageProcessor, AutoModel
repo = "sungjin-code/siglip2-base-patch16-224-dress"
model = AutoModel.from_pretrained(repo).eval()
processor = AutoImageProcessor.from_pretrained(repo)
images = [Image.open("a.jpg").convert("RGB"), Image.open("b.jpg").convert("RGB")]
with torch.no_grad():
output = model.get_image_features(**processor(images=images, return_tensors="pt"))
features = getattr(output, "pooler_output", output) # transformers v5๋ ์ถ๋ ฅ ๊ฐ์ฒด๋ฅผ ๋ฐํํฉ๋๋ค
embeddings = torch.nn.functional.normalize(features, dim=-1) # (N, 768), L2 ์ ๊ทํ
similarity = embeddings @ embeddings.T # ๋ด์ = ์ฝ์ฌ์ธ ์ ์ฌ๋
- ์ ๋ ฅ์ SigLIP2 ํ๋ก์ธ์๊ฐ ๋น์จ์ ๋ฌด์ํ๊ณ 224ร224๋ก ๋ฐ๊ฟ๋๋ค.
- ํ
์คํธ๋ ๊ฐ์ ๊ณต๊ฐ์ ์๋ฒ ๋ฉํ ์ ์์ต๋๋ค(
get_text_features, 64ํ ํฐ max-length padding). ๋ค๋ง ์ด ๋ชจ๋ธ์ ์ด๋ฏธ์งโ์ด๋ฏธ์ง ๊ฒ์์ ๋ชฉํ๋ก ํ๊ฐํ์ต๋๋ค.
ํ์ต
- ๋ฐ์ดํฐ: GLAMI-1M์์
dresses์นดํ ๊ณ ๋ฆฌ 26,183์ฅ(OWLv2"dress"์ ์ 0.01 ์ดํ ์ ์ธ). - ๋ฐฉ๋ฒ: ๋น์ ์ธ์ฝ๋(attention + MLP)์ LoRA(r=32, alpha=64, dropout 0.3)๋ฅผ ๋ถ์ด๊ณ ํ
์คํธ ํ์๋ ๊ณ ์ ํ ์ฑ ์ด๋ฏธ์ง-ํ
์คํธ ๋์นญ InfoNCE๋ก ํ์ตํ์ต๋๋ค. ํ
์คํธ๋
"{์ํ๋ช }. {์ค๋ช }"(64ํ ํฐ), lr 1e-4, ์ต๋ 20 epoch, ๊ฒ์ฆ textโimage Recall@5 ๊ธฐ์ค early stopping. - ๋ณด์กฐ ์์ : OWLv2๊ฐ ๋ง๋ ๋๋ ์ค ๋ฐ์ค๋ฅผ ์์ธกํ๋ ์์ head(๊ฐ์ค์น 0.3), ํ์ต ์ด๋ฏธ์ง์ color jitter(๋ฐ๊ธฐยท๋๋นยท์ฑ๋ 0.6). ์ด head๋ ์ด ์ ์ฅ์์ ํฌํจ๋์ด ์์ง ์์ต๋๋ค.
ํ๊ฐ
Pexels ์ฌ์ง 100์ฅ(๋๋ ์ค๋ฅผ ์ ์ ์ฌ๋)์์ ์ด๋ฏธ์ง ํ ์ฅ์ ์ฟผ๋ฆฌ๋ก, ๋๋จธ์ง 99์ฅ์ ๊ฒ์ํฉ๋๋ค. ์ ๋ต์ ์ฌ๋์ด ๋ผ๋ฒจ๋งํ ๊ฒ์ด ์๋๋ผ EmbeddingGemma 2๋ก ๋ง๋ ์์ ์ ๋ต 1๊ฐ์ ๋๋ค.
| ๋ชจ๋ธ | R@1 | R@3 | R@5 | R@10 | nDCG@5 |
|---|---|---|---|---|---|
| SigLIP2 base | 0.050 | 0.140 | 0.210 | 0.370 | 0.132 |
| ์ด ๋ชจ๋ธ | 0.130 | 0.270 | 0.350 | 0.460 | 0.242 |
์ฟผ๋ฆฌ๊ฐ 100๊ฐ, ์ ๋ต์ด 1๊ฐ๋ฟ์ด๋ผ R@5์ ํ์ค์ค์ฐจ๊ฐ ์ฝ 0.045์ ๋๋ค. ์์ ์ฐจ์ด๋ ๋ ธ์ด์ฆ์ผ ์ ์๊ณ , ๋ ํฐ ๋ชจ๋ธ(Tianmu-MERE ๋ฑ)๊ณผ์ ๊ฒฉ์ฐจ๋ ํฝ๋๋ค.
ํ๊ณ
- ํ์ต ๋ฐ์ดํฐ๋ ์ํ ์ฌ์ง ์์ฃผ์ด๊ณ , ํ๊ฐ๋ ์ผ์ธ ์ธ๋ฌผ ์ฌ์ง์ด๋ผ ๋๋ฉ์ธ์ด ๋ค๋ฆ ๋๋ค.
- GLAMI์
dresses๋ผ๋ฒจ์๋ ๋ฒจํธยท์ ๋ฐ ๋ฑ ์ค๋ผ๋ฒจ์ด ์ผ๋ถ ์์ฌ ์์ต๋๋ค. - ์ฌ๋์ด ์๊ฒ ์ฐํ ์ฌ์ง์ 224ร224 ์ ๋ ฅ์์ ๋๋ ์ค ์์ญ์ด ๋ช ํ ํฐ๋ฐ์ ๋์ง ์์ ์ฑ๋ฅ์ด ๋จ์ด์ง ์ ์์ต๋๋ค.
๋ผ์ด์ ์ค
Apache-2.0 (base ๋ชจ๋ธ๊ณผ GLAMI-1M ๋ฐ์ดํฐ์ ๋ชจ๋ Apache-2.0).
- Downloads last month
- 24
Model tree for sungjin-code/siglip2-base-patch16-224-dress
Base model
google/siglip2-base-patch16-224