Author: Not specified Language: text
Description: Not specified Timestamp: 2017-10-11 22:17:42 +0000
View raw paste Reply
  1.  
  2. %% Create traning & testing list for the Pascal-S images using 2-fold cross validation
  3. %%
  4. clear all; clc;
  5.  
  6. folder = '/mnt/vana/amirul/datasets/Pascal-S/images/';
  7. image_files=dir([folder '*.jpg']);
  8.  
  9. train_file = fopen('/mnt/vana/amirul/projects/salient_instance_ranking/data/pascal-s/train_cv_1.txt', 'w');
  10. test_file = fopen('/mnt/vana/amirul/projects/salient_instance_ranking/data/pascal-s/test_cv_1.txt', 'w');
  11.  
  12. cv=cvpartition(850,'kfold',2);
  13. idx=training(cv,1);
  14.  
  15. for i = 1 : length(image_files)
  16.    
  17.     img_file = image_files(i).name;
  18.    
  19.     gt_file = [img_file(1:end-4) '.png'];
  20.    
  21.     if idx(i) == 1
  22.         fprintf(train_file, '/mnt/vana/amirul/datasets/Pascal-S/images/%s /mnt/vana/amirul/datasets/Pascal-S/gt_original/%s\n', img_file, gt_file);  
  23.    
  24.     else
  25.         fprintf(test_file, '/mnt/vana/amirul/datasets/Pascal-S/images/%s /mnt/vana/amirul/datasets/Pascal-S/gt_original/%s\n', img_file, gt_file);  
  26.    
  27.     end
  28.    
  29. end
  30.  
  31. fclose(train_file);
  32. fclose(test_file);
  33.  
View raw paste Reply