public class MnistTraining { /* * ARGS Organization: * 0 -> Number of Train Images * 1 -> Number of cells for HorizontalCelledProjection * 2 -> Number of cells for VerticalCelledProjection */ public static void main(String[] args) throws IOException{ int numTrainImages = new Integer(args[0]); double[][] actual = new double[numTrainImages][]; double[][] ideal = new double[numTrainImages][]; MnistManager m = new MnistManager(Config.MNIST_TRAIN_IMAGES, Config.MNIST_TRAIN_LABELS); FeatureExtraction fe = FeatureExtractionBuilder .create() .children(new HorizontalCelledProjection(new Integer(args[1])), new VerticalCelledProjection(new Integer(args[2]))) .build(); // Build Training Data for(int i = 1; i <= numTrainImages; ++i) { // Get Pixel Matrix m.setCurrent(i); int[][] image = m.readPixelMatrix(); fe.setPixelMatrix(image); fe.compute(); // Add to Training Data double[] idealVector = new double[Config.OUTPUT_NEURONS]; idealVector[m.readLabel()] = 1; actual[i-1] = fe.getFeatureVector(); ideal[i-1] = idealVector; } int inputNeurons = fe.getFeatureVector().length; int hiddenNeurons = (2/3) * inputNeurons; NeuralNetwork nn = NeuralNetworkBuilder .create() .inputNeurons(inputNeurons) .hiddenNeurons(hiddenNeurons) .outputNeurons(Config.OUTPUT_NEURONS) .build(); nn.trainNetwork(actual, ideal); nn.persistNetwork(); } }
int numTrainImages = new Integer(args[0]);
args
main
hello guys I am working on speech recognition using sphinx 4 and i tried to develop live speech recognition interface but java says at runtime error "Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 101" when i used small "myLanguageModel.lm" it also shows error "NullPointerException" and also sometimes there is no output or results. I tried both eclipse and netbeans, my jar files are sphinx4 -5prealpha and downloaded from known site of sphinx. pls help me
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)