Reference to non-existent field 'NIQE'.
1 view (last 30 days)
Show older comments
Dear Matlab users,
In Matlab R2017a, when i run evaluate_result.m , it returns the error of Reference to non-existent field 'NIQE'.
The followings are relevant functions.
evaluate_result.m:
input_dir = fullfile(pwd,'your_results');
% Directory with ground truth images
GT_dir = fullfile(pwd,'self_validation_HR');
% Number of pixels to shave off image borders when calcualting scores
shave_width = 4;
% Set verbose option
verbose = true;
%% Calculate scores and save
addpath utils
scores = calc_scores(input_dir,GT_dir,shave_width,verbose);
% Saving
save('your_scores.mat','scores');
%% Printing results
perceptual_score = (mean([scores.NIQE]) + (10 - mean([scores.Ma]))) / 2;
fprintf(['\n\nYour perceptual score is: ',num2str(perceptual_score)]);
fprintf(['\nYour RMSE is: ',num2str(sqrt(mean([scores.MSE]))),'\n']);
calc_scores.m :
function scores = calc_scores(input_dir,GT_dir,shave_width,verbose)
addpath(genpath(fullfile(pwd,'utils')));
%% Loading model
load modelparameters.mat
blocksizerow = 96;
blocksizecol = 96;
blockrowoverlap = 0;
blockcoloverlap = 0;
%% Reading file list
file_list = dir([input_dir,'/*.png']);
im_num = length(file_list);
%% Calculating scores
scores = struct([]);
for ii=1:im_num
if verbose
fprintf(['\nCalculating scores for image ',num2str(ii),' / ',num2str(im_num)]);
end
% Reading and converting images
input_image_path = fullfile(input_dir,file_list(ii).name);
input_image = convert_shave_image(imread(input_image_path),shave_width);
GD_image_path = fullfile(GT_dir,file_list(ii).name);
GD_image = convert_shave_image(imread(GD_image_path),shave_width);
% Calculating scores
scores(ii).name = file_list(ii).name;
scores(ii).MSE = immse(input_image,GD_image);
scores(ii).Ma = quality_predict(input_image);
scores(ii).NIQE = computequality(input_image,blocksizerow,blocksizecol,...
blockrowoverlap,blockcoloverlap,mu_prisparam,cov_prisparam);
end
end
Does anyone have some ideas ?
Thanks so much.
0 Comments
Accepted Answer
Walter Roberson
on 15 Sep 2019
When there are no .png images in the subdirectory your_results of the current directory, then scores will be returned as an empty struct with no fields. The NIQE field of scores will not exist until at least one .png file was found there.
0 Comments
More Answers (3)
lu yao lu
on 15 Sep 2019
1 Comment
Walter Roberson
on 15 Sep 2019
On the page I indicated, in the upper right corner, choose Download and select Direct Download from there. Save the .zip file you get. Unzip that and you will find the .mex* files.
.mexa64 is correct for Linux.
See Also
Categories
Find more on Display Image in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!