-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finished A3 Q1 roughly, might revisit
- Loading branch information
Showing
539 changed files
with
98,613 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,33 @@ | ||
run('../vlfeat-0.9.20/toolbox/vl_setup') | ||
load('pos_neg_feats.mat') | ||
%% Run if VLFeat is not set up | ||
run('vlfeat-0.9.20/toolbox/vl_setup'); | ||
|
||
feats = cat(1,pos_feats,neg_feats); | ||
labels = cat(1,ones(pos_nImages,1),-1*ones(neg_nImages,1)); | ||
%% Split into training and validation | ||
close all; | ||
clear; | ||
|
||
lambda = 0.1; | ||
[w,b] = vl_svmtrain(feats',labels',lambda); | ||
load('pos_neg_feats.mat'); | ||
|
||
percentTraining = 80; | ||
numOfTraining = floor((percentTraining/100)*pos_nImages); | ||
|
||
trainFeats = cat(1,pos_feats(1:numOfTraining,:), ... | ||
neg_feats(1:numOfTraining,:)); | ||
validFeats = cat(1,pos_feats(1+numOfTraining:end,:), ... | ||
neg_feats(1+numOfTraining:end,:)); | ||
trainLabels = cat(1,ones(numOfTraining,1), ... | ||
-1*ones(numOfTraining,1)); | ||
validLabels = cat(1,ones(pos_nImages-numOfTraining,1), ... | ||
-1*ones(pos_nImages-numOfTraining,1)); | ||
|
||
%% Train | ||
|
||
lambda = 0.06; | ||
[w,b] = vl_svmtrain(trainFeats',trainLabels',lambda); | ||
|
||
fprintf('Classifier performance on train data:\n') | ||
confidences = [pos_feats; neg_feats]*w + b; | ||
confidences = [pos_feats(1:numOfTraining,:); neg_feats(1:numOfTraining,:)]*w + b; | ||
[tp_rate, fp_rate, tn_rate, fn_rate] = report_accuracy(confidences, trainLabels); | ||
|
||
[tp_rate, fp_rate, tn_rate, fn_rate] = report_accuracy(confidences, labels); | ||
fprintf('Classifier performance on validation data:\n') | ||
confidences = [pos_feats(1+numOfTraining:end,:); neg_feats(1+numOfTraining:end,:)]*w + b; | ||
[tp_rate, fp_rate, tn_rate, fn_rate] = report_accuracy(confidences, validLabels); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*.manifest -crlf -diff -merge | ||
*.vcproj binary | ||
*.sln binary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Mac OS X Finder | ||
.DS_Store | ||
|
||
# MEX files | ||
*.mexglx | ||
*.mexmac | ||
*.mexmaci | ||
*.mexmaci64 | ||
*.mexa64 | ||
*.mex | ||
|
||
# Python | ||
*.pyc | ||
|
||
# Other generated files and directories | ||
VERSION | ||
docsrc/version.html | ||
bin | ||
results | ||
doc | ||
build | ||
toolbox/mexw32 | ||
toolbox/mexmaci | ||
toolbox/mexmaci64 | ||
toolbox/mexmac | ||
toolbox/mexglx | ||
toolbox/mexa64 | ||
toolbox/mexw64 | ||
toolbox/mex | ||
toolbox/noprefix | ||
|
||
# Xcode | ||
vlfeat.xcodeproj/*.mode1 | ||
vlfeat.xcodeproj/*.mode1v3 | ||
vlfeat.xcodeproj/*.mode2v3 | ||
vlfeat.xcodeproj/*.pbxuser | ||
vlfeat.xcodeproj/*.perspective* | ||
vlfeat.xcodeproj/*.xcworkspace | ||
vlfeat.xcodeproj/xcuserdata | ||
|
||
# Visual C++ | ||
vlfeat.suo | ||
vlfeat.ncb | ||
vlfeat.vcproj.*.user | ||
vc/* | ||
|
||
# Emacs backups | ||
*~ | ||
|
||
# Vim swap files | ||
.*.swp | ||
|
||
# Opt directory | ||
opt/* | ||
|
||
# iDraw files | ||
*.idraw |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Copyright (C) 2007-11, Andrea Vedaldi and Brian Fulkerson | ||
Copyright (C) 2012-13, The VLFeat Team | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are | ||
met: | ||
1. Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
2. Redistributions in binary form must reproduce the above copyright | ||
notice, this list of conditions and the following disclaimer in the | ||
documentation and/or other materials provided with the | ||
distribution. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Oops, something went wrong.