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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<div align="center">
|
| 2 |
+
<a href="https://arxiv.org/abs/2603.03907"><img src="https://img.shields.io/badge/Arxiv-preprint-red"></a>
|
| 3 |
+
<a href="https://yzc-ippl.github.io/FG-IAA/"><img src="https://img.shields.io/badge/Homepage-green"></a>
|
| 4 |
+
<a href='https://github.com/yzc-ippl/FG-IAA/stargazers'><img src='https://img.shields.io/github/stars/yzc-ippl/FG-IAA.svg?style=social'></a>
|
| 5 |
+
</div>
|
| 6 |
+
|
| 7 |
+
<h1 align="center">Fine-grained Image Aesthetic Assessment: Learning Discriminative Scores from Relative Ranks</h1>
|
| 8 |
+
|
| 9 |
+
<div align="center">
|
| 10 |
+
Zhichao Yang<sup>1β </sup>,
|
| 11 |
+
Jianjie Wang<sup>1β </sup>,
|
| 12 |
+
Zhixianhe Zhang<sup>1</sup>,
|
| 13 |
+
Pangu Xie<sup>1</sup>,
|
| 14 |
+
Xiangfei Sheng<sup>1</sup>,
|
| 15 |
+
Pengfei Chen<sup>1</sup>,
|
| 16 |
+
Leida Li<sup>1,2*</sup>
|
| 17 |
+
</div>
|
| 18 |
+
|
| 19 |
+
<div align="center">
|
| 20 |
+
<sup>1</sup>School of Artificial Intelligence,
|
| 21 |
+
<sup>2</sup>State Key Laboratory of EMIM, Xidian University
|
| 22 |
+
</div>
|
| 23 |
+
|
| 24 |
+
<div align="center">
|
| 25 |
+
<sup>β </sup>Equal contribution <sup>*</sup>Corresponding author
|
| 26 |
+
</div>
|
| 27 |
+
|
| 28 |
+
<br>
|
| 29 |
+
|
| 30 |
+
<div align="center">
|
| 31 |
+
<img src="FGAesthetics+Q.png" width="900"/>
|
| 32 |
+
</div>
|
| 33 |
+
|
| 34 |
+
<div style="font-family: sans-serif; margin-bottom: 2em;">
|
| 35 |
+
<h2 style="border-bottom: 1px solid #eaecef; padding-bottom: 0.3em; margin-bottom: 1em;">News</h2>
|
| 36 |
+
<ul style="list-style-type: none; padding-left: 0;">
|
| 37 |
+
<li style="margin-bottom: 0.8em;">
|
| 38 |
+
<strong>[2026-04-10]</strong> β¨</span>β¨</span> The <strong>Inference Code</strong> and <strong>Pre-trained Weights</strong>, are now publicly available. A demo video demonstrating FGAesQ's application in <strong>LivePhoto Cover Recommendation</strong> is also provided.
|
| 39 |
+
</li>
|
| 40 |
+
<li style="margin-bottom: 0.8em;">
|
| 41 |
+
<strong> [2026-04-09]</strong> π</span>π</span> Congratulations! Our paper has been accepted for an <strong>Oral Presentation</strong> at CVPR 2026.
|
| 42 |
+
</li>
|
| 43 |
+
<li style="margin-bottom: 0.8em;">
|
| 44 |
+
<strong>[2026-02-21]</strong> π</span>π</span> Our paper, "Fine-grained Image Aesthetic Assessment: Learning Discriminative Scores from Relative Ranks", has been accepted to <strong>CVPR 2026</strong>!
|
| 45 |
+
</li>
|
| 46 |
+
</ul>
|
| 47 |
+
</div>
|
| 48 |
+
|
| 49 |
+
## Applicatons (More scenarios will be uncovered)
|
| 50 |
+
|
| 51 |
+
<div align="center">
|
| 52 |
+
<video src="https://github.com/yzc-ippl/FG-IAA/releases/download/v1.0/demo_2.mp4" width="900" controls></video>
|
| 53 |
+
</div>
|
| 54 |
+
|
| 55 |
+
## Quick Start
|
| 56 |
+
|
| 57 |
+
This guide will help you get started with FGAesQ inference in minutes.
|
| 58 |
+
|
| 59 |
+
### 1. Installation
|
| 60 |
+
|
| 61 |
+
Clone the repository and install the required dependencies:
|
| 62 |
+
|
| 63 |
+
```bash
|
| 64 |
+
git clone https://github.com/yzc-ippl/FG-IAA.git
|
| 65 |
+
cd FG-IAA
|
| 66 |
+
pip install -r requirements.txt
|
| 67 |
+
```
|
| 68 |
+
|
| 69 |
+
> **Note:** The CLIP dependency is installed directly from the official OpenAI repository and will be fetched automatically via `pip install -r requirements.txt`.
|
| 70 |
+
|
| 71 |
+
### 2. Download Pre-trained Weights
|
| 72 |
+
|
| 73 |
+
Download the pre-trained model weights from: [**(Hugging Face)**](https://huggingface.co/yzc002/FGAesQ) | [**(Baidu Netdisk)**](#)
|
| 74 |
+
|
| 75 |
+
Place the downloaded weight file at a path of your choice and set `MODEL_PATH` accordingly in the inference scripts.
|
| 76 |
+
|
| 77 |
+
The expected project structure is as follows:
|
| 78 |
+
|
| 79 |
+
```
|
| 80 |
+
FG-IAA/
|
| 81 |
+
FGAesQ_Inference/
|
| 82 |
+
βββutils/
|
| 83 |
+
βββ FGAesQ.py # Model definition
|
| 84 |
+
βββ DiffToken.py # Differential token preprocessing
|
| 85 |
+
βββ data_utils.py
|
| 86 |
+
βββ clip_vit_base_16_224.pt
|
| 87 |
+
βββ inference_series.py # Series-mode inference
|
| 88 |
+
βββ inference_single.py # Single-image inference
|
| 89 |
+
βββ requirements.txt
|
| 90 |
+
README.md
|
| 91 |
+
```
|
| 92 |
+
|
| 93 |
+
### 3. Run Inference
|
| 94 |
+
|
| 95 |
+
FGAesQ supports two inference modes: **Series Mode** for photo series ranking, and **Single Mode** for individual image scoring.
|
| 96 |
+
|
| 97 |
+
---
|
| 98 |
+
|
| 99 |
+
#### πΌοΈ Mode 1 β Single Image / Folder Scoring
|
| 100 |
+
|
| 101 |
+
Use `inference_single.py` to score a single image or all images within a folder.
|
| 102 |
+
|
| 103 |
+
**Configuration** (edit the `main()` function in `inference_single.py`):
|
| 104 |
+
|
| 105 |
+
```python
|
| 106 |
+
MODEL_PATH = "path/to/your/model.pt" # Path to the pre-trained weights
|
| 107 |
+
INPUT_PATH = "path/to/image_or_folder" # Single image file or folder of images
|
| 108 |
+
OUTPUT_TXT = "path/to/output.txt" # Output txt path (folder mode only; set None to auto-generate)
|
| 109 |
+
DEVICE = "cuda"
|
| 110 |
+
BATCH_SIZE = 128
|
| 111 |
+
```
|
| 112 |
+
|
| 113 |
+
**Run:**
|
| 114 |
+
|
| 115 |
+
```bash
|
| 116 |
+
python inference_single.py
|
| 117 |
+
```
|
| 118 |
+
|
| 119 |
+
**Output format** (`single_result.txt`):
|
| 120 |
+
|
| 121 |
+
```
|
| 122 |
+
Total: 3
|
| 123 |
+
============================================================
|
| 124 |
+
|
| 125 |
+
1. photo_A.jpg 0.872314
|
| 126 |
+
2. photo_B.jpg 0.751203
|
| 127 |
+
3. photo_C.jpg 0.634891
|
| 128 |
+
```
|
| 129 |
+
|
| 130 |
+
- **Single image**: the predicted aesthetic score is printed directly to the terminal.
|
| 131 |
+
- **Folder**: a ranked list of all images with scores is saved to `OUTPUT_TXT`.
|
| 132 |
+
|
| 133 |
+
---
|
| 134 |
+
|
| 135 |
+
#### π Mode 2 β Photo Series Ranking
|
| 136 |
+
|
| 137 |
+
Use `inference_series.py` to rank images within multiple photo series simultaneously.
|
| 138 |
+
|
| 139 |
+
The input folder should contain one sub-folder per series, with image files named in the format `{series_id}-{index}.jpg` (e.g., `000009-01.jpg`, `000009-02.jpg`).
|
| 140 |
+
|
| 141 |
+
```
|
| 142 |
+
input_folder/
|
| 143 |
+
000009/
|
| 144 |
+
βββ 000009-01.jpg
|
| 145 |
+
βββ 000009-02.jpg
|
| 146 |
+
βββ 000009-03.jpg
|
| 147 |
+
000010/
|
| 148 |
+
βββ 000010-01.jpg
|
| 149 |
+
βββ 000010-02.jpg
|
| 150 |
+
...
|
| 151 |
+
```
|
| 152 |
+
|
| 153 |
+
**Configuration** (edit the `main()` function in `inference_series.py`):
|
| 154 |
+
|
| 155 |
+
```python
|
| 156 |
+
MODEL_PATH = "path/to/your/model.pt" # Path to the pre-trained weights
|
| 157 |
+
INPUT_FOLDER = "path/to/series_folder" # Root folder containing all series sub-folders
|
| 158 |
+
OUTPUT_FOLDER = "path/to/series_result" # Output directory for per-series result txt files
|
| 159 |
+
DEVICE = "cuda:0"
|
| 160 |
+
BATCH_SIZE = 64
|
| 161 |
+
MAX_SIZE = 2048 # Max image resolution (long edge). Use None for no limit.
|
| 162 |
+
# Recommended: 2048 if many images exceed this resolution.
|
| 163 |
+
```
|
| 164 |
+
|
| 165 |
+
**Run:**
|
| 166 |
+
|
| 167 |
+
```bash
|
| 168 |
+
python inference_series.py
|
| 169 |
+
```
|
| 170 |
+
|
| 171 |
+
**Output format** (one `{series_id}_result.txt` per series in `OUTPUT_FOLDER`):
|
| 172 |
+
|
| 173 |
+
```
|
| 174 |
+
Series: 9
|
| 175 |
+
Count: 3
|
| 176 |
+
============================================================
|
| 177 |
+
|
| 178 |
+
Ranking: 000009-02.jpg 000009-01.jpg 000009-03.jpg
|
| 179 |
+
|
| 180 |
+
Scores: 0.8812 0.7654 0.6231
|
| 181 |
+
|
| 182 |
+
Order: 000009-02.jpg > 000009-01.jpg > 000009-03.jpg
|
| 183 |
+
```
|
| 184 |
+
|
| 185 |
+
Each output file contains the predicted ranking and aesthetic scores for all images in that series, sorted from best to worst.
|
| 186 |
+
|
| 187 |
+
---
|
| 188 |
+
|
| 189 |
+
## Citation
|
| 190 |
+
|
| 191 |
+
If you find this work useful, please cite our paper!
|
| 192 |
+
|
| 193 |
+
```bibtex
|
| 194 |
+
@article{yang2026fine,
|
| 195 |
+
title={Fine-grained Image Aesthetic Assessment: Learning Discriminative Scores from Relative Ranks},
|
| 196 |
+
author={Yang, Zhichao and Wang, Jianjie and Zhang, Zhixianhe and Xie, Pangu and Sheng, Xiangfei and Chen, Pengfei and Li, Leida},
|
| 197 |
+
journal={arXiv preprint arXiv:2603.03907},
|
| 198 |
+
year={2026}
|
| 199 |
+
}
|
| 200 |
+
```
|