pavancm / CONTRIQUE

Official implementation for "Image Quality Assessment using Contrastive Learning"
125 stars 12 forks source link

[How to train on custom dataset] #3

Closed CaptainEven closed 2 years ago

CaptainEven commented 2 years ago

Thank you for your excellent work and contribution! I wonder how to train CONTRIQUE on my own datasets, not considering the linear projector training.

pavancm commented 2 years ago

CONTRIQUE is primarily designed for feature extraction and these features are mapped to quality scores using a linear regressor. So for your custom dataset first step is to extract features for all your images as demonstrated in demo_score.py and train the linear regressor using these features using your ground-truth.

CaptainEven commented 2 years ago

Thanks for the quick replying!How to generate csv files using custom dataset?

pavancm commented 2 years ago

You don't need to generate csv files if your goal is to just train the linear regressor. However if you want to pretrain the whole encoder, csv files can be generated depending on the type of distortions you have in your custom dataset. For synthetic distortions the knowledge of distortion type and degradation level is transformed to a one-hot encoded vector and stored in a csv file similar to file_names_syn.csv. For cases where you have no knowledge about the distortions, each image is treated as a different class and there is no need of one-hot encoding as seen in file_names_ugc.csv

CaptainEven commented 2 years ago

@pavancm Thanks for the explanations! An error occured when i run the matlab script 'generate_kadis700k.m' as below:

a-canal-boat-1538583_13_05.bmp
a-canal-boat-1538584_12_01.bmp
a-canal-boat-1538584_12_02.bmp
a-canal-boat-1538584_12_03.bmp
a-canal-boat-1538584_12_04.bmp
a-canal-boat-1538584_12_05.bmp
Undefined function or variable 'denoisingNetwork'.

Error in imdenoise (line 3)
net = denoisingNetwork('DnCNN');

Error in imdist_generator (line 51)
        distort_I = imdenoise(im, levels(dist_level));

Error in generate_kadis700k (line 18)
        [dist_im] = imdist_generator(ref_im, dist_type, dist_level);
CaptainEven commented 2 years ago

It's the version support problem of Matlab, I 'll try a newer version of Matlab for network support.