MANIQA icon indicating copy to clipboard operation
MANIQA copied to clipboard

Using with my own images

Open vsantjr opened this issue 2 years ago • 5 comments

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.

vsantjr avatar Jul 08 '22 15:07 vsantjr

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.

TianheWu avatar Jul 08 '22 15:07 TianheWu

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.

vsantjr avatar Jul 08 '22 16:07 vsantjr

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.

TianheWu avatar Jul 18 '22 17:07 TianheWu

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

piba941 avatar Sep 07 '22 10:09 piba941

@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...

nick-konovalchuk avatar Oct 10 '22 19:10 nick-konovalchuk

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

TianheWu avatar Mar 08 '23 16:03 TianheWu

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

piba941 avatar Mar 08 '23 17:03 piba941

@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?

piba941 avatar Mar 08 '23 18:03 piba941

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

TianheWu avatar Mar 09 '23 04:03 TianheWu

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

TianheWu avatar Mar 11 '23 03:03 TianheWu

@vsantjr @piba941 @bottledmind @ljzycmd

TianheWu avatar Mar 11 '23 03:03 TianheWu