Обновить README.md
This commit is contained in:
parent
f8ad0cb315
commit
676a3f19d8
1 changed files with 8 additions and 8 deletions
16
README.md
16
README.md
|
|
@ -40,16 +40,16 @@
|
|||
- Не требует эталонного изображения (reference-free).
|
||||
- Является общепринятым стандартом в сообществе.
|
||||
- **Источник**: [Learning Transferable Visual Models From Natural Language Supervision](https://arxiv.org/abs/2103.00020) (Radford et al.)
|
||||
- [library for testing](https://github.com/Taited/clip-score/)
|
||||
|
||||
### Детали реализации
|
||||
|
||||
```python
|
||||
# Псевдокод расчета CLIP-score
|
||||
from transformers import CLIPProcessor, CLIPModel
|
||||
```bash
|
||||
# код расчета CLIP-score
|
||||
pip install transformers=4.25.1
|
||||
pip install torch
|
||||
pip install clip-score
|
||||
|
||||
model = CLIPModel.from_pretrained("openai/clip-vit-base-patch32")
|
||||
processor = CLIPProcessor.from_pretrained("openai/clip-vit-base-patch32")
|
||||
python -m clip_score .\images .\texts
|
||||
|
||||
inputs = processor(text=prompt, images=image, return_tensors="pt", padding=True)
|
||||
outputs = model(**inputs)
|
||||
score = outputs.logits_per_image.softmax(dim=1).item() # или чистое косинусное сходство
|
||||
# CLIP Score: 0.3308749198913574
|
||||
Loading…
Add table
Add a link
Reference in a new issue