cherubicXN / afm_cvpr2019

Official implementation of paper "Learning Attraction Field Map for Robust Line Segment Detection" (CVPR 2019)
MIT License
296 stars 66 forks source link

第二个数据预处理跑不了 #1

Closed 718155407 closed 5 years ago

718155407 commented 5 years ago

York Urban的数据格式编排,有些歧义,整理过后还是跑不了预处理,望您能给终于帮助,万分感谢

cherubicXN commented 5 years ago

You need to use matlab to read the YorkUrban dataset and write the images and line segments into "filename_rgb.png" and "filename.mat". The line segments in the mat file should be saved with the variable 'line'. In our evaluation, we only use the test data (51 images). You can read the guideline of YorkUrban dataset for the format.

718155407 commented 5 years ago

Thank u very much,I will try it again。

BrianPugh commented 5 years ago

Here's a MATLAB script I wrote to do the preprocessing. Since YorkUrban is such a small dataset, it might be worthwhile just to reupload it in the preprocessed format.

This is to be ran in the york_raw directory with the YorkUrbanDB unzipped to that directory.

york_urban_db_path = 'YorkUrbanDB';
load(fullfile(york_urban_db_path, 'Manhattan_Image_DB_Names.mat'));
load(fullfile(york_urban_db_path,'ECCV_TrainingAndTestImageNumbers.mat'));

n_exemplars = length(Manhattan_Image_DB_Names);
for i = 1:n_exemplars
    name = Manhattan_Image_DB_Names{i}(1:end-1);
    fprintf('Processing %d/%d\r', i, n_exemplars);

    %% Image Ontology Preprocess
    input_im_path = fullfile(york_urban_db_path, name, [name, '.jpg']);
    output_im_path = [name, '_rgb.png'];

    im = imread(input_im_path);
    imwrite(im, output_im_path);

    %% Line Segment Ontology Preprocess
    input_contents_path = fullfile(york_urban_db_path, name, [name, 'LinesAndVP.mat']);
    output_contents_path = [name, '.mat'];

    contents = load(input_contents_path);
    line = contents.lines;

    save(output_contents_path, 'line');
end