demoRelease.m in standardmodelrelease
Sponsored links
%demoRelease.m
%demonstrates how to use C2 standard model features in a pattern classification framework
addpath ~/scratch2/osusvm/ %put your own path to osusvm here
useSVM = 1; %if you do not have osusvm installed you can turn this
%to 0, so that the classifier would be a NN classifier
%note: NN is not a great classifier for these features
READPATCHESFROMFILE = 0; %use patches that were already computed
%(e.g., from natural images)
patchSizes = [4 8 12 16]; %other sizes might be better, maybe not
%all sizes are required
numPatchSizes = length(patchSizes);
%specify directories for training and testing images
train_set.pos = 'Image_Datasets/airTr';
train_set.neg = 'Image_Datasets/bckgTr';
test_set.pos = 'Image_Datasets/airTe';
test_set.neg = 'Image_Datasets/bckgTe';
cI = readAllImages(train_set,test_set); %cI is a cell containing
%all training and testing images
if isempty(cI{1}) | isempty(cI{2})
error(['No training images were loaded -- did you remember to' ...
' change the path names?']);
end
%below the c1 prototypes are extracted from the images/ read from file
if ~READPATCHESFROMFILE
tic
numPatchesPerSize = 250; %more will give better results, but will
%take more time to compute
cPatches = extractRandC1Patches(cI{1}, numPatchSizes, ...
numPatchesPerSize, patchSizes); %fix: extracting from positive only
...
...
... to be continued.
This is a preview. To get the complete source file,
please click here to download the whole source code package.