Restore trained stroke extractor

This commit is contained in:
Shaunak Kishore
2015-09-30 01:58:22 -04:00
parent c10079bba4
commit 33c5656771
6 changed files with 2241 additions and 3 deletions

19
lib/classifier.js Normal file
View File

@ -0,0 +1,19 @@
"use strict";
Meteor.startup(() => {
const input = new convnetjs.Vol(1, 1, 8 /* feature vector dimensions */);
const net = new convnetjs.Net();
net.fromJSON(NEURAL_NET_TRAINED_FOR_STROKE_EXTRACTION);
const weight = 0.8;
const trainedClassifier = (features) => {
input.w = features;
const softmax = net.forward(input).w;
return softmax[1] - softmax[0];
}
stroke_extractor.combinedClassifier = (features) => {
return stroke_extractor.handTunedClassifier(features) +
weight*trainedClassifier(features);
}
});