H4nwei commited on
Commit
49bb5d7
·
verified ·
1 Parent(s): 829fc1b

Create README.md

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