Skip to content

Latest commit

 

History

History
199 lines (148 loc) · 9.42 KB

README.md

File metadata and controls

199 lines (148 loc) · 9.42 KB

SEAGULL

Open in Spaces

🚀 🚀 🚀 News:

  • To be updated...
  • Dec. 12, 2024: We release the checkpoints SEAGULL-7B and inference codes.
  • Nov. 29, 2024: We release the online and offline demo for SEAGULL.
  • Nov. 25, 2024: We make SEAGULL-100w publicly available at Hugging Face and Baidu Netdisk. More details can be found at Hugging Face.
  • Nov. 12, 2024: We create this repository.

TODO List 📝

  • Release the SEAGULL-100w dataset.
  • Release the online and offline demo.
  • Release the checkpoints and inference codes.
  • [] Release the training codes.
  • [] Release the SEAGULL-3k dataset.

Contents 📌

  1. Introduction 👀
  2. Try Our Demo 🕹️
  3. Run SEAGULL 🛠️
  4. Demonstrate 🎥
  5. Acknowledgement 💌

Introduction 👀

TL;DR: We propose a novel network (SEAGULL) and construct two datasets (SEAGULL-100w and SEAGULL-3k) to achieve fine-grained IQA for any ROIs.

Existing Image Quality Assessment (IQA) methods achieve remarkable success in analyzing quality for overall image, but few works explore quality analysis for Regions of Interest (ROIs). The quality analysis of ROIs can provide fine-grained guidance for image quality improvement and is crucial for scenarios focusing on region-level quality. This paper proposes a novel network, SEAGULL, which can SEe and Assess ROIs quality with GUidance from a Large vision-Language model. SEAGULL incorporates a vision-language model (VLM), masks generated by Segment Anything Model (SAM) to specify ROIs, and a meticulously designed Mask-based Feature Extractor (MFE) to extract global and local tokens for specified ROIs, enabling accurate fine-grained IQA for ROIs. Moreover, this paper constructs two ROI-based IQA datasets, SEAGULL-100w and SEAGULL-3k, for training and evaluating ROI-based IQA. SEAGULL-100w comprises about 100w synthetic distortion images with 33 million ROIs for pre-training to improve the model's ability of regional quality perception, and SEAGULL-3k contains about 3k authentic distortion ROIs to enhance the model's ability to perceive real world distortions. After pre-training on SEAGULL-100w and fine-tuning on SEAGULL-3k, SEAGULL shows remarkable performance on fine-grained ROI quality assessment.

The framework of SEAGULL

Try Our Demo 🕹️

Online demo

Click 👇 to try our demo. You might need to click Restart this Space to wake our demo up 🌞

Open in Spaces

Offline demo

⚠️ Please make sure the GPU memory of your device is larger than 17GB.

  1. Create the environment
conda create -n seagull python=3.10 -y
conda activate seagull
pip install -e .
  1. Install Gradio Extention for drawing boxes on images.

Tip

If the network is not accessible, try the following steps. It might work.

  • Download the gradio.zip from Baidu Netdisk or Google Drive.
  • Run unzip gradio.zip and then gain the gradio-bbox folder.
  • Run cd gradio-bbox && pip install -e .
  1. Install Segment Anything Model.
pip install git+https://github.com/facebookresearch/segment-anything.git
  1. Download ViT-B SAM model and CLIP-convnext, then put them into the checkpoints folder.

  2. Run demo on your device.

python app.py --model Zevin2023/SEAGULL-7B

Tip

If Hugging Face is not accessible to you, try the following command.

HF_ENDPOINT=https://hf-mirror.com python app.py --model Zevin2023/SEAGULL-7B 
  1. You can also download SEAGULL-7B and put them into the checkpoints folder.

The folder structure should be:

├── checkpoints
    ├── SEAGULL-7B
    │   ├── config.json
    │   ├── pytorch_model-xxxxx-of-xxxxx.bin
    │   └── xxx
    ├── sam_vit_b_01ec64.pth 
    └── open_clip_pytorch_model.bin

Then run the following command:

python app.py --model ./checkpoints/SEAGULL-7B 

Run SEAGULL 🛠️

Preparation

  1. Create the environment
conda create -n seagull python=3.10 -y
conda activate seagull
pip install -e .
  1. If you want to train SEAGULL by yourself, install the additional packages.
pip install -e ".[train]"
pip install flash-attn --no-build-isolation
  1. Download CLIP-convnext and SEAGULL-7B, then put them into the checkpoints folder.

The folder structure should be:

├── checkpoints
    ├── SEAGULL-7B
    │   ├── config.json
    │   ├── pytorch_model-xxxxx-of-xxxxx.bin
    │   └── xxx
    └── open_clip_pytorch_model.bin

Usage for training

Coming soon.

Usage for inference

  1. We provide a ./demo/inference_demo.json template for better understanding.
  2. Run the following command for inference:
python3 inference.py \
--img_dir ./imgs/Examples \
--json_path ./demo/inference_demo.json \
--mask_type rel \ # rel or points (x, y, w, h)
--inst_type quality \ # quality, importance, distortion
--model ./checkpoints/SEAGULL-7B 

Demonstrate 🎥

Demonstration of SEAGULL

Acknowledgement 💌

  • Osprey and LLaVA-v1.5: We build this repostory based on them.
  • RAISE: The Dist. images in SEAGULL-100w are constructed based on this dataset.
  • SAM and SEEM: The mask-based ROIs are generated using these two awesome works. And SAM are used to get the segmentation result in the demo.
  • TOPIQ: The quality scores and importance scores for ROIs are generated using this great FR-IQA.

Stars ⭐️

Star History Chart

Citation 🖊️

If our work is useful to your research, we will be grateful for you to cite our paper:

@misc{chen2024seagull,
      title={SEAGULL: No-reference Image Quality Assessment for Regions of Interest via Vision-Language Instruction Tuning}, 
      author={Zewen Chen and Juan Wang and Wen Wang and Sunhan Xu and Hang Xiong and Yun Zeng and Jian Guo and Shuxun Wang and Chunfeng Yuan and Bing Li and Weiming Hu},
      year={2024},
      eprint={2411.10161},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2411.10161}, 
}