protected override float Outputs(OutputVector result, Floatarray v) { result.Clear(); charclass.Object.XOutputs(result, v); CHECK_ARG(result.nKeys() > 0, "result.nKeys() > 0"); if (PGetb("junk") && !DisableJunk && !junkclass.IsEmpty) { result.Normalize(); OutputVector jv = new OutputVector(); junkclass.Object.XOutputs(jv, v); for (int i = 0; i < result.nKeys(); i++) { result.Values[i] *= jv.Value(0); } result[jc()] = jv.Value(1); } if (PGeti("ul") > 0 && !ulclass.IsEmpty) { throw new Exception("ulclass not implemented"); } return(0.0f); }
protected override float Outputs(OutputVector result, Floatarray v) { result.Clear(); charclass.Object.XOutputs(result, v); CHECK_ARG(result.nKeys() > 0, "result.nKeys() > 0"); if (PGetb("junk") && !DisableJunk && !junkclass.IsEmpty) { result.Normalize(); OutputVector jv = new OutputVector(); junkclass.Object.XOutputs(jv, v); for (int i = 0; i < result.nKeys(); i++) result.Values[i] *= jv.Value(0); result[jc()] = jv.Value(1); } if (PGeti("ul") > 0 && !ulclass.IsEmpty) { throw new Exception("ulclass not implemented"); } return 0.0f; }
private void DoTestRecognize(LenetClassifier classifier) { OutputVector ov = new OutputVector(); Floatarray v = new Floatarray(); Bytearray ba = new Bytearray(1, 1); ImgIo.read_image_gray(ba, testPngFileName); NarrayUtil.Sub(255, ba); v.Copy(ba); v /= 255.0; classifier.XOutputs(ov, v); Console.WriteLine("Featured output class '{0}', score '{1}'", (char)ov.Key(ov.BestIndex), ov.Value(ov.BestIndex)); }