Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
---
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
The model corresponds to [Compare2Score](https://compare2score.github.io/).
|
| 7 |
+
|
| 8 |
+
## Quick Start with AutoModel
|
| 9 |
+
|
| 10 |
+
<!-- For this image,  start an AutoModel scorer with `transformers==4.36.1`:
|
| 11 |
+
-->
|
| 12 |
+
```python
|
| 13 |
+
import requests
|
| 14 |
+
import torch
|
| 15 |
+
from transformers import AutoModelForCausalLM
|
| 16 |
+
|
| 17 |
+
model = AutoModelForCausalLM.from_pretrained("q-future/Compare2Score", trust_remote_code=True, attn_implementation="eager",
|
| 18 |
+
torch_dtype=torch.float16, device_map="auto")
|
| 19 |
+
|
| 20 |
+
from PIL import Image
|
| 21 |
+
image_path_url = "https://raw.githubusercontent.com/Q-Future/Q-Align/main/fig/singapore_flyer.jpg"
|
| 22 |
+
print("The quality score of this image is {}".format(model.score(image_path_url))
|
| 23 |
+
```
|
| 24 |
+
|
| 25 |
+
## Evaluation with GitHub
|
| 26 |
+
```shell
|
| 27 |
+
git clone https://github.com/Q-Future/Compare2Score.git
|
| 28 |
+
cd Compare2Score
|
| 29 |
+
pip install -e .
|
| 30 |
+
```
|
| 31 |
+
|
| 32 |
+
```python
|
| 33 |
+
from q_align import Compare2Scorer
|
| 34 |
+
from PIL import Image
|
| 35 |
+
|
| 36 |
+
scorer = Compare2Scorer()
|
| 37 |
+
image_path = "figs/i04_03_4.bmp"
|
| 38 |
+
print("The quality score of this image is {}.".format(scorer(image_path)))
|
| 39 |
+
```
|
| 40 |
+
|
| 41 |
+
## Citation
|
| 42 |
+
|
| 43 |
+
```bibtex
|
| 44 |
+
@article{zhu2024adaptive,
|
| 45 |
+
title={Adaptive Image Quality Assessment via Teaching Large Multimodal Model to Compare},
|
| 46 |
+
author={Zhu, Hanwei and Wu, Haoning and Li, Yixuan and Zhang, Zicheng and Chen, Baoliang and Zhu, Lingyu and Fang, Yuming and Zhai, Guangtao and Lin, Weisi and Wang, Shiqi},
|
| 47 |
+
journal={arXiv preprint arXiv:2405.19298},
|
| 48 |
+
year={2024},
|
| 49 |
+
}
|
| 50 |
+
```
|