wenguanwang / DHF1K

Revisiting Video Saliency: A Large-scale Benchmark and a New Model (CVPR18, PAMI19)
138 stars 28 forks source link

discrepancy in exportdata_train and DHF1K fixation maps? #11

Open prashnani opened 4 years ago

prashnani commented 4 years ago

Hi, thanks for the nice dataset. I want to recreate the fixation maps using the raw gaze records in exportdata_train folder released for DHF1K.

However, the fixation map obtained using record_mapping.m script and raw data from exportdata_train folder donot match the ones released in DHF1K.

For example:

  1. 0001.png: this is the fixation map for first frame of 001.AVI copied from: annotation/0001/fixation/0001.png

0001

  1. 0001_regenerated.png : I regenerated this fixation map using files from exportdata_train folder.

0001_regenerated

I used the record_mapping.m file after specifying appropriate paths and modifying line 22 and line 24.

Could you please help me understand what I might be missing?

For your reference, here is my copy of record_mapping.m file:

%This function is used for mapping the fixation record into the corresponding fixation maps.
screen_res_x = 1440;
screen_res_y = 900;

parent_dir = 'GIVE PATH TO PARENT DIRECTORY';

datasetFile1 = 'movie';
datasetFile = 'video';
gazeFile = 'exportdata_train';

videoFiles = dir(fullfile('./', datasetFile));
videoNUM = length(videoFiles)-2;
rate = 30;

full_vid_dir = [parent_dir, datasetFile, '/'];

 for videonum = 1:700
        videofolder =  videoFiles(videonum+2).name
        vidObj = VideoReader([full_vid_dir,videofolder]);
        options.infolder = fullfile( './', datasetFile,  videofolder, 'images' );
        % no need to read full video if I can use VideoReader to know
        % dimensions and duration of video
        % Cache all frames in memory
        %[data.frames,names,video_res_y,video_res_x,nframe ]= readAllFrames( options );
        nframe = vidObj.NumberOfFrames;
        video_res_x = vidObj.Width;
        video_res_y = vidObj.Height;
        a=video_res_x/screen_res_x;
        b=(screen_res_y-video_res_y/a)/2;
        all_fixation = zeros(video_res_y,video_res_x,nframe);
        for person = 1:17
            %modified the following line to match the video naming format
            txtloc = fullfile(parent_dir, gazeFile, sprintf('P%02d',person), [sprintf('P%02d_Trail',person), sprintf('%03d.txt',videonum)]);
            if exist(txtloc, 'file')
                %modified the following line to match the txt file format
                [time,model,trialnum,diax, diay, x_screen,y_screen,event]=textread(txtloc,'%f%s%f%f%f%f%f%s','headerlines',1);
                if size(time,1)
                    time = time-time(1);
                    event = cellfun(@(x) x(1), event);
                    for index = 1:nframe
                            eff = find( ((index-1)<rate*time/1000000)&(rate*time/1000000<index)&event=='F'); %framerate = 10;
                            x_stimulus=int32(a*x_screen(eff));
                            y_stimulus=int32(a*(y_screen(eff)-b));
                            t = x_stimulus<=0|x_stimulus>=video_res_x|y_stimulus<=0|y_stimulus>=video_res_y;
                            all_fixation(y_stimulus(~t),x_stimulus(~t),index) = 1;
                    end
                end
            end
        end 
end
prashnani commented 4 years ago

hi @wenguanwang , please help me understand how to resolve the above issue?

wenguanwang commented 4 years ago

@prashnani

Thanks for your interest.

As the data and code are generated/modified some times, I cannot figure out the exact reason. Maybe you can directly use the generated fixation maps.

KID0203 commented 4 years ago

Hi, thanks for the nice dataset. I want to recreate the fixation maps using the raw gaze records in exportdata_train folder released for DHF1K.

However, the fixation map obtained using record_mapping.m script and raw data from exportdata_train folder donot match the ones released in DHF1K.

For example:

  1. 0001.png: this is the fixation map for first frame of 001.AVI copied from: annotation/0001/fixation/0001.png

0001

  1. 0001_regenerated.png : I regenerated this fixation map using files from exportdata_train folder.

0001_regenerated

I used the record_mapping.m file after specifying appropriate paths and modifying line 22 and line 24.

Could you please help me understand what I might be missing?

For your reference, here is my copy of record_mapping.m file:

%This function is used for mapping the fixation record into the corresponding fixation maps.
screen_res_x = 1440;
screen_res_y = 900;

parent_dir = 'GIVE PATH TO PARENT DIRECTORY';

datasetFile1 = 'movie';
datasetFile = 'video';
gazeFile = 'exportdata_train';

videoFiles = dir(fullfile('./', datasetFile));
videoNUM = length(videoFiles)-2;
rate = 30;

full_vid_dir = [parent_dir, datasetFile, '/'];

 for videonum = 1:700
        videofolder =  videoFiles(videonum+2).name
        vidObj = VideoReader([full_vid_dir,videofolder]);
        options.infolder = fullfile( './', datasetFile,  videofolder, 'images' );
        % no need to read full video if I can use VideoReader to know
        % dimensions and duration of video
        % Cache all frames in memory
        %[data.frames,names,video_res_y,video_res_x,nframe ]= readAllFrames( options );
        nframe = vidObj.NumberOfFrames;
        video_res_x = vidObj.Width;
        video_res_y = vidObj.Height;
        a=video_res_x/screen_res_x;
        b=(screen_res_y-video_res_y/a)/2;
        all_fixation = zeros(video_res_y,video_res_x,nframe);
        for person = 1:17
            %modified the following line to match the video naming format
            txtloc = fullfile(parent_dir, gazeFile, sprintf('P%02d',person), [sprintf('P%02d_Trail',person), sprintf('%03d.txt',videonum)]);
            if exist(txtloc, 'file')
                %modified the following line to match the txt file format
                [time,model,trialnum,diax, diay, x_screen,y_screen,event]=textread(txtloc,'%f%s%f%f%f%f%f%s','headerlines',1);
                if size(time,1)
                    time = time-time(1);
                    event = cellfun(@(x) x(1), event);
                    for index = 1:nframe
                            eff = find( ((index-1)<rate*time/1000000)&(rate*time/1000000<index)&event=='F'); %framerate = 10;
                            x_stimulus=int32(a*x_screen(eff));
                            y_stimulus=int32(a*(y_screen(eff)-b));
                            t = x_stimulus<=0|x_stimulus>=video_res_x|y_stimulus<=0|y_stimulus>=video_res_y;
                            all_fixation(y_stimulus(~t),x_stimulus(~t),index) = 1;
                    end
                end
            end
        end 
end

@prashnani Hi! Since I met the same issue, could you tell me how to resolve the above issue?

wenguanwang commented 4 years ago

@KID0203 Sorry for the inconvenience, but it was done three years ago. Some parameter settings may be different, and I really cannot find the original ones : (