Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,140 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<div align="center">
|
| 2 |
+
<a href="https://arxiv.org/abs/2508.14475"><img src="https://img.shields.io/badge/Arxiv-preprint-red"></a>
|
| 3 |
+
<a href="https://pxf0429.github.io/FGResQ/"><img src="https://img.shields.io/badge/Homepage-green"></a>
|
| 4 |
+
<a href='https://github.com/sxfly99/FGRestore/stargazers'><img src='https://img.shields.io/github/stars/sxfly99/FGRestore.svg?style=social'></a>
|
| 5 |
+
</div>
|
| 6 |
+
|
| 7 |
+
<h1 align="center">Fine-grained Image Quality Assessment for Perceptual Image Restoration</h1>
|
| 8 |
+
|
| 9 |
+
<div align="center">
|
| 10 |
+
<a href="https://github.com/sxfly99">Xiangfei Sheng</a><sup>1*</sup>,
|
| 11 |
+
<a href="https://github.com/pxf0429">Xiaofeng Pan</a><sup>1*</sup>,
|
| 12 |
+
<a href="https://github.com/yzc-ippl">Zhichao Yang</a><sup>1</sup>,
|
| 13 |
+
<a href="https://faculty.xidian.edu.cn/cpf/">Pengfei Chen</a><sup>1</sup>,
|
| 14 |
+
<a href="https://web.xidian.edu.cn/ldli/">Leida Li</a><sup>1#</sup>
|
| 15 |
+
</div>
|
| 16 |
+
|
| 17 |
+
<div align="center">
|
| 18 |
+
<sup>1</sup>School of Artificial Intelligence, Xidian University
|
| 19 |
+
</div>
|
| 20 |
+
|
| 21 |
+
<div align="center">
|
| 22 |
+
<sup>*</sup>Equal contribution. <sup>#</sup>Corresponding author.
|
| 23 |
+
</div>
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
<div align="center">
|
| 27 |
+
<img src="FGResQ.png" width="800"/>
|
| 28 |
+
</div>
|
| 29 |
+
|
| 30 |
+
<div style="font-family: sans-serif; margin-bottom: 2em;">
|
| 31 |
+
<h2 style="border-bottom: 1px solid #eaecef; padding-bottom: 0.3em; margin-bottom: 1em;">📰 News</h2>
|
| 32 |
+
<ul style="list-style-type: none; padding-left: 0;">
|
| 33 |
+
<li style="margin-bottom: 0.8em;">
|
| 34 |
+
<strong>[2025-11-08]</strong> 🎉🎉🎉Our paper, "Fine-grained Image Quality Assessment for Perceptual Image Restoration", has been accepted to appear at AAAI 2026!
|
| 35 |
+
</li>
|
| 36 |
+
<li style="margin-bottom: 0.8em;">
|
| 37 |
+
<strong>[2025-08-20]</strong> Code and pre-trained models for FGResQ released.
|
| 38 |
+
</li>
|
| 39 |
+
</ul>
|
| 40 |
+
</div>
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
## Quick Start
|
| 44 |
+
|
| 45 |
+
This guide will help you get started with the FGResQ inference code.
|
| 46 |
+
|
| 47 |
+
### 1. Installation
|
| 48 |
+
|
| 49 |
+
First, clone the repository and install the required dependencies.
|
| 50 |
+
|
| 51 |
+
```bash
|
| 52 |
+
git clone https://github.com/sxfly99/FGResQ.git
|
| 53 |
+
cd FGResQ
|
| 54 |
+
pip install -r requirements.txt
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
### 2. Download Pre-trained Weights
|
| 58 |
+
|
| 59 |
+
You can download the pre-trained model weights from the following link:
|
| 60 |
+
[**Download Weights (Google Drive)**](https://drive.google.com/drive/folders/10MVnAoEIDZ08Rek4qkStGDY0qLiWUahJ?usp=drive_link) or [**(Baidu Netdisk)**](https://pan.baidu.com/s/1a2IZbr_PrgZYCbUbjKLykA?pwd=9ivu)
|
| 61 |
+
|
| 62 |
+
Place the downloaded files in the `weights` directory.
|
| 63 |
+
|
| 64 |
+
- `FGResQ.pth`: The main model for quality scoring and ranking.
|
| 65 |
+
- `Degradation.pth`: The weights for the degradation-aware task branch.
|
| 66 |
+
|
| 67 |
+
Create the `weights` directory if it doesn't exist and place the files inside.
|
| 68 |
+
|
| 69 |
+
```
|
| 70 |
+
FGRestore/
|
| 71 |
+
|-- weights/
|
| 72 |
+
| |-- FGResQ.pth
|
| 73 |
+
| |-- Degradation.pth
|
| 74 |
+
|-- model/
|
| 75 |
+
| |-- FGResQ.py
|
| 76 |
+
|-- requirements.txt
|
| 77 |
+
|-- README.md
|
| 78 |
+
```
|
| 79 |
+
|
| 80 |
+
## Usage
|
| 81 |
+
|
| 82 |
+
The `FGResQ` provides two main functionalities: scoring a single image and comparing a pair of images.
|
| 83 |
+
|
| 84 |
+
### Initialize the Scorer
|
| 85 |
+
|
| 86 |
+
First, import and initialize the `FGResQ`.
|
| 87 |
+
|
| 88 |
+
```python
|
| 89 |
+
from model.FGResQ import FGResQ
|
| 90 |
+
|
| 91 |
+
# Path to the main model weights
|
| 92 |
+
model_path = "weights/FGResQ.pth"
|
| 93 |
+
|
| 94 |
+
# Initialize the inference engine
|
| 95 |
+
model = FGResQ(model_path=model_path)
|
| 96 |
+
```
|
| 97 |
+
|
| 98 |
+
### 1. Single Image Input Mode: Quality Scoring
|
| 99 |
+
|
| 100 |
+
You can get a quality score for a single image. The score typically ranges from 0 to 1, where a higher score indicates better quality.
|
| 101 |
+
|
| 102 |
+
```python
|
| 103 |
+
image_path = "path/to/your/image.jpg"
|
| 104 |
+
quality_score = model.predict_single(image_path)
|
| 105 |
+
print(f"The quality score for the image is: {quality_score:.4f}")
|
| 106 |
+
```
|
| 107 |
+
|
| 108 |
+
### 2. Pairwise Image Input Mode: Quality Ranking
|
| 109 |
+
|
| 110 |
+
You can also compare two images to determine which one has better quality.
|
| 111 |
+
|
| 112 |
+
```python
|
| 113 |
+
image_path1 = "path/to/image1.jpg"
|
| 114 |
+
image_path2 = "path/to/image2.jpg"
|
| 115 |
+
|
| 116 |
+
comparison_result = model.predict_pair(image_path1, image_path2)
|
| 117 |
+
|
| 118 |
+
# The result includes a human-readable comparison and raw probabilities
|
| 119 |
+
print(f"Comparison: {comparison_result['comparison']}")
|
| 120 |
+
# Example output: "Comparison: Image 1 is better"
|
| 121 |
+
|
| 122 |
+
print(f"Raw output probabilities: {comparison_result['comparison_raw']}")
|
| 123 |
+
# Example output: "[0.8, 0.1, 0.1]" (Probabilities for Image1 > Image2, Image2 > Image1, Image1 ≈ Image2)
|
| 124 |
+
```
|
| 125 |
+
## Citation
|
| 126 |
+
|
| 127 |
+
If you find this work is useful, pleaes cite our paper!
|
| 128 |
+
|
| 129 |
+
```bibtex
|
| 130 |
+
|
| 131 |
+
@article{sheng2025fgresq,
|
| 132 |
+
title={Fine-grained Image Quality Assessment for Perceptual Image Restoration},
|
| 133 |
+
author={Sheng, Xiangfei and Pan, Xiaofeng and Yang, Zhichao and Chen, Pengfei and Li, Leida},
|
| 134 |
+
journal={arXiv preprint arXiv:2508.14475},
|
| 135 |
+
year={2025}
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
---
|
| 139 |
+
license: apache-2.0
|
| 140 |
+
---
|