Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Commit

Permalink
allow switching out classifier with 'classifier' option
Browse files Browse the repository at this point in the history
  • Loading branch information
harthur committed Mar 25, 2013
1 parent 6551274 commit 3f330c7
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions kittydar.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var hog = require("hog-descriptor"),
nms = require("./nms"),
nnOptions = require("./classifiers/nn-options");
nnOptions = require("./classifiers/nn-options"),
svmOptions = require("./classifiers/svm-options");

if (process.arch) { // in node
var Canvas = (require)('canvas');
Expand Down Expand Up @@ -35,15 +36,22 @@ var params = {
};
}
}
// use the neural network backend
extend(params, nnOptions);

var kittydar = {
detectCats: function(canvas, options) {
if (options) {
extend(params, options);
}

if (options && options.classifier == "svm") {
// use the support vector machine as the classifier
extend(params, svmOptions);
}
else {
// use the neural network as the classifier
extend(params, nnOptions);
}

// get canvases of the image at different scales
var resizes = this.getAllSizes(canvas, params.minSize);

Expand Down

0 comments on commit 3f330c7

Please sign in to comment.