0
교육에 사용할 사용자 지정 7 (높이) 및 24 (너비) 행렬 입력이 있습니다. 출력은 Age (Young, Mature, Old) 레이블이 있습니다. Deeplearning4J Convolutional Neural Networks와 함께 가고 싶습니다.DeepLearning4J 맞춤 매트릭스가있는 CNN의 경우 IllegalArgumentException
매우 기본적인 컨볼 루션 신경망을 구축 한 후에 매우 첫 번째 훈련 항목에 다음과 같은 오류가 발생하며 이에 대한 단서가 없습니다.
Exception in thread "main" java.lang.IllegalArgumentException: Invalid size index 2 wher it's >= rank 2
at org.nd4j.linalg.api.ndarray.BaseNDArray.size(BaseNDArray.java:4066)
at org.deeplearning4j.nn.layers.convolution.ConvolutionLayer.preOutput(ConvolutionLayer.java:192)
at org.deeplearning4j.nn.layers.convolution.ConvolutionLayer.activate(ConvolutionLayer.java:247)
at org.deeplearning4j.nn.graph.vertex.impl.LayerVertex.doForward(LayerVertex.java:88)
at org.deeplearning4j.nn.graph.ComputationGraph.feedForward(ComputationGraph.java:983)
at org.deeplearning4j.nn.graph.ComputationGraph.computeGradientAndScore(ComputationGraph.java:889)
내 DL4J 코드
//Model Config here
MultiLayerConfiguration.Builder builder = new NeuralNetConfiguration.Builder()
.seed(seed)
.iterations(iterations)
.regularization(true).l2(0.0005)
.learningRate(0.01)//.biasLearningRate(0.02)
//.learningRateDecayPolicy(LearningRatePolicy.Inverse).lrPolicyDecayRate(0.001).lrPolicyPower(0.75)
.weightInit(WeightInit.XAVIER)
.optimizationAlgo(OptimizationAlgorithm.STOCHASTIC_GRADIENT_DESCENT)
.updater(Updater.NESTEROVS).momentum(0.9)
.list()
.layer(0, new ConvolutionLayer.Builder(4, 1)
//nIn and nOut specify depth. nIn here is the nChannels and nOut is the number of filters to be applied
.name("hzvt1")
.nIn(nChannels)
.stride(1, 1)
.nOut(26)
.activation("relu")//.activation("identity")
.build())
.layer(1, new OutputLayer.Builder(LossFunctions.LossFunction.NEGATIVELOGLIKELIHOOD)
.nOut(outputNum)
.activation("softmax")
.build())
.setInputType(InputType.convolutional(nChannels,height,width))
.backprop(true).pretrain(false);
//Model build here
model.fit(wmTrain);MultiLayerConfiguration conf = builder.build();
model.fit(wmTrain);MultiLayerNetwork model = new MultiLayerNetwork(conf);
model.init();
//Training data creation here
INDArray weekMatrix = Nd4j.ones(DLAgeGender.nChannels,DLAgeGender.height*DLAgeGender.width);
double[] vector = new double[] { 0.0, 1.0, 0.0 };
INDArray intLabels = Nd4j.create(vector);
DataSet ds=new DataSet(weekMatrix,intLabels);
//Train the first item
model.fit(wmTrain);
내가 DL4J 버전 0.6을 사용하고, 자바 버전 1.8, Maven은 3.3 이상
나는 도서관에서 버그를 생각한다.