Reference to non-existent field 'NIQE'.

1 次查看(过去 30 天)
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.

采纳的回答

Walter Roberson
Walter Roberson 2019-9-15
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.

更多回答(3 个)

lu yao lu
lu yao lu 2019-9-15
@Walter Roberson
Thanks so much.
I put image file (named Set5) under your_results before not directly images in this file. I follow your advice and put 5 images in your_results file.
It returns another error of Undefined function or variable 'mexRF_predict'.
I will google how to solve this problem.
Best regards.

lu yao lu
lu yao lu 2019-9-15
@Walter Roberson
Thanks so much.
For linux , I think it should .mexa64 ,right ? But it can not download. It can be saved , but is .html file.
What did you do ?
  1 个评论
Walter Roberson
Walter Roberson 2019-9-15
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.

请先登录,再进行评论。


lu yao lu
lu yao lu 2019-9-15
@Walter Roberson
I am so sorry to disturb you . And thanks so much.
It is so easy problem that i can solve it by myself.

类别

Help CenterFile Exchange 中查找有关 Display Image 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by