% boston_from_classer.m % % Downloads boston dataset in Classer's format, % runs Classer's preprocessing scripts, % and puts strip data into a form usable by SelfSupAM_crossValidation % % This first cell in this script requires that Classer be installed % and that the classer executable "csd" to be on the operating system path. % Since Classer runs only on Windows, so does this cell. % % ***INSTEAD OF RUNNING THIS SCRIPT*** % Consider downloading the mat file as done in SelfSupAM_Boston.m % % Greg Amis % Technology Lab % Dept. of Cognitive & Neural Systems % Boston University % 6 April 2009 % % Licensing Policy % This implementation is made available to the general public under the terms % of Copyleft, as defined by the Free Software Foundation % (see discussion here for example). % As such, it is available free of charge, and may be copied, redistributed, or modified, % as long as any resulting work is distributed under the same terms of Copyleft. %% Download raw data, and run Classer preprocessing RAW_DATA_URL = 'http://cns.bu.edu/techlab/classer/datasets/d_Boston.zip'; originalDir = pwd; cd(tempdir); try unzip(RAW_DATA_URL); catch e = lasterror; if strfind(e.identifier,'urlwriteError') error(e.identifier,... ['Either there is a problem with your internet connection '... 'or the boston dataset is no longer available at '... 'the expected url, %s. Please check the tech lab website '... 'for updates, http://cns.bu.edu/techlab'],RAW_DATA_URL); else error(e); end; end; unzip(); cd('d_Boston'); !unWrap.bat %unWrap runs classer scripts for scaling and preprocessing data cd('PubNN'); %% Create strips for use by SelfSupAM_crossValidation strips = struct([]); for i = 1:4 s = dlmread(sprintf('Strip%d.txt',i-1),'',10,0); strips(i).labels = int8(s(:,1)'-1); %Subtracting 1 moves unlabeled points from 0 to -1 %No points were labeled 1 ("miss"), so ~any(strips(i).labels==0) strips(i).inputs = single( s(:,5:end-1)' ); %Trims leading visualization dims and trailing 0. end; cd(tempdir); rmdir('d_Boston','s'); cd(originalDir); classNames = {'beach','ocean','ice','river','road','park','residential','industrial'}'; featureNames = {... '4. Blue';'5. Green';'6. Red';... '7. NIR';'8. Mid IR 1';'9. Thermal IR 1';'10. Thermal IR 2';'11. Mid IR 2';... '12. Panchromatic';'13. Conditioned Blue';'14. Cond. Green';'15. Cond. Red';... '16. Cond. NIR';'17. Cond. Mid IR 1';'18. Cond. Thermal IR 1';... '19. Cond. Thermal IR 2';'20. Cond. Mid IR 2';'21. Cond. Panchromatic';... '22. RG Single Opponent';'23. GR Single Opponent';'24. RG Double Opponent';... '25. BY Single Opponent';'26. YB Single Opponent';'27. BY Double Opponent';... '28. BCS even combined';'29. BCS even combined 0';'30. BCS even combined 1';... '31. BCS even combined 2';'32. BCS odd combined';'33. BCS odd combined 0';... '34. BCS odd combined 1';'35. BCS odd combined 2';... '36. Periodic Texture Even/Odd 0';'37. Periodic Texture Even/Odd 1';... '38. Periodic Texture Even/Odd 2';'39. Gray Texture Even 0';... '40. Gray Texture Even 1';'41. Gray Texture Even 2'; }; description = ['Pixel data from the Boston testbed, ',... 'based on d_Boston/PubNN/Strip#.txt from Classer. Unlabeled points ',... 'have label -1 instead of 0, and all other labels are shifted down 1, ',... 'since no ground-truth points are mapped to class 1 ("miss"). The first ',... '3 features are removed, as they''re only for visualization, and the last ',... 'feature is removed, since it is 0 for all points.']; save('boston_strips.mat','strips','classNames','featureNames','description'); disp('Boston strips created successfully.');