huawei-noah / Efficient-Computing

Efficient computing methods developed by Huawei Noah's Ark Lab
1.18k stars 207 forks source link

IPG项目数据准备以及环境部署 #144

Closed igotsmoke9 closed 2 weeks ago

igotsmoke9 commented 1 month ago

您好,我在复现您24年CVPR的 Image Processing GNN: Breaking Rigidity in Super-Resolution 论文时,在数据集准备这里遇到了问题,直接下载的数据集并没有划分为子文件,例如Urban100数据集 微信图片_20240812144352 以及我在配置虚拟环境的时候出现了ERROR: Could not build wheels for antlr4-python3-runtime, which is required to install pyproject.toml-based projects这个错误,希望能得到您的解答,谢谢!

YuchuanTian commented 3 weeks ago

Thank you for your interest in our work!

For the dataset: I guess the problem is that Urban100 only contains original ground truth images. We used an official MATLAB code provided by BasicSR to process these gt images (sorry I lost the official link to the code; but I could provide a copy as follows).

function generate_bicubic_img()
%% matlab code to genetate mod images, bicubic-downsampled images and
%% bicubic_upsampled images

%% set configurations
% comment the unnecessary lines
input_folder = 'Set14/original';
save_mod_folder = 'Set14/GTmod2';
save_lr_folder = 'Set14/LRbicx2';
% save_bic_folder = '';

mod_scale = 2;
up_scale = 2;

if exist('save_mod_folder', 'var')
    if exist(save_mod_folder, 'dir')
        disp(['It will cover ', save_mod_folder]);
    else
        mkdir(save_mod_folder);
    end
end
if exist('save_lr_folder', 'var')
    if exist(save_lr_folder, 'dir')
        disp(['It will cover ', save_lr_folder]);
    else
        mkdir(save_lr_folder);
    end
end
if exist('save_bic_folder', 'var')
    if exist(save_bic_folder, 'dir')
        disp(['It will cover ', save_bic_folder]);
    else
        mkdir(save_bic_folder);
    end
end

idx = 0;
filepaths = dir(fullfile(input_folder,'*.*'));
for i = 1 : length(filepaths)
    [paths, img_name, ext] = fileparts(filepaths(i).name);
    if isempty(img_name)
        disp('Ignore . folder.');
    elseif strcmp(img_name, '.')
        disp('Ignore .. folder.');
    else
        idx = idx + 1;
        str_result = sprintf('%d\t%s.\n', idx, img_name);
        fprintf(str_result);

        % read image
        img = imread(fullfile(input_folder, [img_name, ext]));
        img = im2double(img);

        % modcrop
        img = modcrop(img, mod_scale);
        if exist('save_mod_folder', 'var')
            imwrite(img, fullfile(save_mod_folder, [img_name, '.png']));
        end

        % LR
        im_lr = imresize(img, 1/up_scale, 'bicubic');
        if exist('save_lr_folder', 'var')
            imwrite(im_lr, fullfile(save_lr_folder, [img_name, '.png']));
        end

        % Bicubic
        if exist('save_bic_folder', 'var')
            im_bicubic = imresize(im_lr, up_scale, 'bicubic');
            imwrite(im_bicubic, fullfile(save_bic_folder, [img_name, '.png']));
        end
    end
end
end

%% modcrop
function img = modcrop(img, modulo)
if size(img,3) == 1
    sz = size(img);
    sz = sz - mod(sz, modulo);
    img = img(1:sz(1), 1:sz(2));
else
    tmpsz = size(img);
    sz = tmpsz(1:2);
    sz = sz - mod(sz, modulo);
    img = img(1:sz(1), 1:sz(2),:);
end
end

For the error: actually I haven't encountered this strange error before. When (Installing which package) does this error pop up? I'd appreciate it very much if you could provide more information.