package cunist.mnist.cunistNN;

import basicUtils.BasicImageConvertor;
import basicUtils.featureExtractor.ContourExtractor;
import basicUtils.featureExtractor.FeatureExtractor;
import basicUtils.Matrix;
import basicUtils.featureExtractor.IdenticalExtractor;
import dataInterface.BasicDataProvider;
import dataInterface.semeionInterfaces.MulticolumnDigitDataProvider;
import dataInterface.semeionInterfaces.SemeionDataProvider;
import examples.ReLUActivationFunction;
import examples.SigmoidActivationFunction;
import mlalgorithms.CNNetwork;
import mlalgorithms.FullConnectionLayer;

/**
 * Created by Xiangxi on 2017/1/6.
 * Contact him on zxx_1996@qq.com
 */
public class CalculateByGPU {
    CNNetwork NN;
    FeatureExtractor featureExtractor = new IdenticalExtractor();
    public CalculateByGPU(){
    //    SemeionDataProvider semeionDataProvider = new SemeionDataProvider("data\\semeion.data", featureExtractor);
     //   BasicDataProvider basicDataProvider = new BasicDataProvider(semeionDataProvider.getFeatureMatrix(), semeionDataProvider.getLabelMatrix());
      //  MulticolumnDigitDataProvider multicolumnDigitDataProvider = new MulticolumnDigitDataProvider(basicDataProvider);
       // NN = new CNNetwork();
       // NN.insertLayer(new FullConnectionLayer(256,128, new ReLUActivationFunction()));
       // NN.insertLayer(new FullConnectionLayer(128,64, new ReLUActivationFunction()));
       // NN.insertLayer(new FullConnectionLayer(64,10,new SigmoidActivationFunction()));
       // NN.setImgs(multicolumnDigitDataProvider);
       // try {
       //     NN.train();
       // } catch (Exception e) {
       //     e.printStackTrace();
    //    }
    }

    public int get(byte[] b, double[] pros){
        int sta = 1;//inference(b,pros);

        return sta;
    }

    public int get(Matrix matrix, double[] pros){
     //   BasicImageConvertor basicImageConvertor = new BasicImageConvertor(16,16);
      //  Matrix feature = featureExtractor.dataToFeature(basicImageConvertor.toRowMatrix(matrix));
      //  for (int i = 0; i<= 9;i++) {
        //    pros[i] = NN.test(feature).get(0,i);
        //}
        return 1;
    }
}

@@ -796,26 +796,24 @@
 yGPU()%7B%0A    
-//
     SemeionD
@@ -912,26 +912,24 @@
 ctor);%0A     
-//
    BasicData
@@ -1064,18 +1064,16 @@
 ;%0A      
-//
   Multic
@@ -1186,18 +1186,16 @@
 %0A       
-//
  NN = ne
@@ -1208,34 +1208,32 @@
 twork();%0A       
-//
  NN.insertLayer(
@@ -1296,34 +1296,32 @@
 ion()));%0A       
-//
  NN.insertLayer(
@@ -1387,26 +1387,24 @@
 )));%0A       
-//
  NN.insertLa
@@ -1479,18 +1479,16 @@
 %0A       
-//
  NN.setI
@@ -1529,18 +1529,16 @@
 %0A       
-//
  try %7B%0A 
@@ -1539,26 +1539,24 @@
 ry %7B%0A       
-//
      NN.trai
@@ -1567,18 +1567,16 @@
 %0A       
-//
  %7D catch
@@ -1595,26 +1595,24 @@
 e) %7B%0A       
-//
      e.print
@@ -1625,26 +1625,24 @@
 race();%0A    
-//
     %7D%0A    %7D%0A
@@ -1811,18 +1811,16 @@
 )%7B%0A     
-//
    Basic
@@ -1894,18 +1894,16 @@
 ;%0A      
-//
   Matrix
@@ -1992,18 +1992,16 @@
 ;%0A      
-//
   for (i
@@ -2031,18 +2031,16 @@
         
-//
     pros
@@ -2080,18 +2080,16 @@
         
-//
 %7D%0A      

add 28 option