H4nwei commited on
Commit
4344189
·
verified ·
1 Parent(s): a08ae4b

Create readme.md

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