IIGROUP / MANIQA

[CVPRW 2022] MANIQA: Multi-dimension Attention Network for No-Reference Image Quality Assessment
Apache License 2.0
307 stars 36 forks source link

Using with my own images #12

Closed vsantjr closed 1 year ago

vsantjr commented 2 years ago

Hello,

Congrats for your work and also for being the top approach in the NTIRE 2022, NR-IQA track.

I am just wondering how to use your technique with my own high resolution images which were generated by blind/unsupervised deep learning methods. In other words, I do not have the high resolution images and only the low resolution ones. Thus, I created the high resolution images based on the low ones only.

Best regards.

TianheWu commented 2 years ago

Hi! Thanks for you question! With high resolution images, our methods are not friendly for high resolution images.

If you want to use MANIQA, we advise that you can resize your images to 224x224, not crop.

vsantjr commented 2 years ago

Hello,

Thank you for your response. I can do that and resize to 224 x 224. But how I can proceed precisely? I do not have MOS labels and only the high resolution images. I understood that you have used PIPAL 21 and 22. But I would like to use my images. What I thought is that if there is some checkpoint available, I could only run inference.py loading the checkpoint. If not, I believe I have to do both training and inference, right?

Note that my whole goal is to compare several super resolution methods and hence use your Perceptual Image Quality Assessment approach to accomplish such comparison.

Best regards.

TianheWu commented 2 years ago

Hi! I know your problems! We suggest you to train MANIQA with Kadid10k dataset (because Kadid10k have more kind of images). It can provide more precise image scores.

piba941 commented 2 years ago

HEY @vsantjr, Could you please share your update on this if you had any progress? I am trying to do the same.

nick-konovalchuk commented 2 years ago

@piba941 I've managed to launch it with pip install torch==1.8.0+cu111 torchvision==0.9.0+cu111 torchaudio==0.8.0 -f https://download.pytorch.org/whl/torch_stable.html and

import cv2
import torch
import numpy as np
from torchvision.transforms import Compose
from utils.inference_process import ToTensor, Normalize, five_point_crop

transform = Compose([Normalize(0.5, 0.5), ToTensor()])
model = torch.load('/content/drive/MyDrive/work/ckpt_valid',
                   map_location=torch.device('cuda'))
model.eval();

class c:
  crop_size=224

d_img_name = '/content/ann1.jpg'
d_img = cv2.imread(d_img_name, cv2.IMREAD_COLOR)
d_img = cv2.cvtColor(d_img, cv2.COLOR_BGR2RGB)
d_img = np.array(d_img).astype('float32') / 255
d_img = np.transpose(d_img, (2, 0, 1))
sample = {
    'd_img_org': d_img,
    'd_name': d_img_name
}
if transform:
    sample = transform(sample)

x_d = five_point_crop(0, d_img=sample['d_img_org'][None], config=c())
pred = model(x_d)

It's definitely messy, but...

TianheWu commented 1 year ago

Now, I am gonna release some checkpoints in some large datasets. The model trained with large IQA dataset will have more accurate quality score!

piba941 commented 1 year ago

@TianheWu , awesome.. looking forward to test it out

piba941 commented 1 year ago

@TianheWu , i am looking to customise it for giving me the score of blurriness. But training it with k10 data disnt give any good results. Can you please guide me here on how this can be done?

TianheWu commented 1 year ago

@piba941 I will release the kadid10k checkpoints and the code for inference one image. You can try it again!

TianheWu commented 1 year ago

I have released the kadid10k checkpoint and it's training, testing files. Inference one image py files also released.

TianheWu commented 1 year ago

@vsantjr @piba941 @bottledmind @ljzycmd