This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public ComputationGraphConfiguration.GraphBuilder unetBuilder() { | |
ComputationGraphConfiguration.GraphBuilder graph = new NeuralNetConfiguration.Builder().seed(seed) | |
.optimizationAlgo(OptimizationAlgorithm.STOCHASTIC_GRADIENT_DESCENT) | |
.updater(updater) | |
.weightInit(weightInit) | |
.l2(5e-5) | |
.miniBatch(true) | |
.cacheMode(cacheMode) | |
.trainingWorkspaceMode(workspaceMode) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/******************************************************************************* | |
* Copyright (c) 2015-2018 Skymind, Inc. | |
* | |
* This program and the accompanying materials are made available under the | |
* terms of the Apache License, Version 2.0 which is available at | |
* https://www.apache.org/licenses/LICENSE-2.0. | |
* | |
* Unless required by applicable law or agreed to in writing, software | |
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | |
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Exception in thread "main" org.deeplearning4j.exception.DL4JInvalidInputException: Got rank 4 array as input to Convolution3DLayer (layer name = conv1-1, layer index = 1) with shape [1, 1, 256, 256]. Expected rank 5 array with shape [minibatchSize, numChannels, inputHeight, inputWidth, inputDepth]. (layer name: conv1-1, layer index: 1, layer type: Convolution3DLayer) | |
at org.deeplearning4j.nn.layers.convolution.Convolution3DLayer.preOutput(Convolution3DLayer.java:189) | |
at org.deeplearning4j.nn.layers.convolution.ConvolutionLayer.activate(ConvolutionLayer.java:437) | |
at org.deeplearning4j.nn.graph.vertex.impl.LayerVertex.doForward(LayerVertex.java:111) | |
at org.deeplearning4j.nn.graph.ComputationGraph.ffToLayerActivationsInWS(ComputationGraph.java:2116) | |
at org.deeplearning4j.nn.graph.ComputationGraph.computeGradientAndScore(ComputationGraph.java:1369) | |
at org.deeplearning4j.nn.graph.ComputationGraph.computeGradientAndScore(ComputationGraph.java:1338) | |
at org.deeplearning4j.optimize.solvers.BaseOptimizer.gradien |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Exception in thread "main" org.deeplearning4j.nn.modelimport.keras.exceptions.InvalidKerasConfigurationException: Model configuration attribute missing from C:\Users\bismi\AppData\Local\Temp\DL4JKerasModelImport3875863276192533560.bin archive.. For more information, see http://deeplearning4j.org/model-import-keras. | |
at org.deeplearning4j.nn.modelimport.keras.utils.KerasModelBuilder.modelHdf5Filename(KerasModelBuilder.java:230) | |
at org.deeplearning4j.nn.modelimport.keras.KerasModelImport.importKerasModelAndWeights(KerasModelImport.java:171) | |
at org.deeplearning4j.nn.modelimport.keras.KerasModelImport.importKerasModelAndWeights(KerasModelImport.java:73) | |
at ma.enset.brain_tumor_segmentation.SemanticSegmentationLoadKeras.run(SemanticSegmentationLoadKeras.java:49) | |
at ma.enset.brain_tumor_segmentation.SemanticSegmentationLoadKeras.main(SemanticSegmentationLoadKeras.java:132) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Exception in thread "main" org.deeplearning4j.nn.modelimport.keras.exceptions.InvalidKerasConfigurationException: Model configuration attribute missing from C:\Users\bismi\AppData\Local\Temp\DL4JKerasModelImport3875863276192533560.bin archive.. For more information, see http://deeplearning4j.org/model-import-keras. | |
at org.deeplearning4j.nn.modelimport.keras.utils.KerasModelBuilder.modelHdf5Filename(KerasModelBuilder.java:230) | |
at org.deeplearning4j.nn.modelimport.keras.KerasModelImport.importKerasModelAndWeights(KerasModelImport.java:171) | |
at org.deeplearning4j.nn.modelimport.keras.KerasModelImport.importKerasModelAndWeights(KerasModelImport.java:73) | |
at ma.enset.brain_tumor_segmentation.SemanticSegmentationLoadKeras.run(SemanticSegmentationLoadKeras.java:49) | |
at ma.enset.brain_tumor_segmentation.SemanticSegmentationLoadKeras.main(SemanticSegmentationLoadKeras.java:132) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Exception in thread "main" org.deeplearning4j.nn.modelimport.keras.exceptions.InvalidKerasConfigurationException: Requires model configuration as either JSON or YAML string.. For more information, see http://deeplearning4j.org/model-import-keras. | |
at org.deeplearning4j.nn.modelimport.keras.utils.KerasModelUtils.parseModelConfig(KerasModelUtils.java:333) | |
at org.deeplearning4j.nn.modelimport.keras.KerasModel.<init>(KerasModel.java:120) | |
at org.deeplearning4j.nn.modelimport.keras.KerasModel.<init>(KerasModel.java:96) | |
at org.deeplearning4j.nn.modelimport.keras.utils.KerasModelBuilder.buildModel(KerasModelBuilder.java:307) | |
at ma.enset.brain_tumor_segmentation.SemanticSegmentationLoadKeras.run(SemanticSegmentationLoadKeras.java:55) | |
at ma.enset.brain_tumor_segmentation.SemanticSegmentationLoadKeras.main(SemanticSegmentationLoadKeras.java:138) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Exception in thread "main" java.lang.IllegalStateException: Input and label arrays do not have same shape: [24, 3, 96, 96] vs. [24, 1, 96, 96] | |
at org.nd4j.base.Preconditions.throwStateEx(Preconditions.java:641) | |
at org.nd4j.base.Preconditions.checkState(Preconditions.java:340) | |
at org.deeplearning4j.nn.layers.convolution.CnnLossLayer.backpropGradient(CnnLossLayer.java:80) | |
at org.deeplearning4j.nn.graph.vertex.impl.LayerVertex.doBackward(LayerVertex.java:149) | |
at org.deeplearning4j.nn.graph.ComputationGraph.calcBackpropGradients(ComputationGraph.java:2663) | |
at org.deeplearning4j.nn.graph.ComputationGraph.computeGradientAndScore(ComputationGraph.java:1378) | |
at org.deeplearning4j.nn.graph.ComputationGraph.computeGradientAndScore(ComputationGraph.java:1338) | |
at org.deeplearning4j.optimize.solvers.BaseOptimizer.gradientAndScore(BaseOptimizer.java:160) | |
at org.deeplearning4j.optimize.solvers.StochasticGradientDescent.optimize(StochasticGradientDescent.java:63) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ImageRecordReader recordReader = new ImageRecordReader(height, width, channels, labelMaker); | |
recordReader.initialize(train); | |
Field f = BaseImageRecordReader.class.getDeclaredField("imageLoader"); | |
f.setAccessible(true); | |
f.set(recordReader, new NativeImageLoader(height, width, 1, BaseImageLoader.MultiPageMode.MINIBATCH)); | |
int labelIndex = 1; //You have 2 Writables ("columns") - index 0 is features image NDArrayWritable, index 1 is labels image NDArrayWritable | |
// DataSet Iterator | |
DataSetIterator dataIter = new RecordReaderDataSetIterator(recordReader, batchSize, labelIndex, labelIndex, true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ma.enset.brain_tumor_segmentation; | |
import java.io.File; | |
import java.io.IOException; | |
import java.net.URI; | |
import java.util.Arrays; | |
import org.datavec.api.io.labels.PathLabelGenerator; | |
import org.datavec.api.writable.NDArrayWritable; | |
import org.datavec.api.writable.Writable; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while (Iter.hasNext()) { | |
DataSet next = Iter.next(); | |
INDArray out2d = modelT.outputSingle(next.getFeatures()).permute(0,2,3,1).dup().reshape('c',height*width,1); | |
INDArray labels2d = next.getLabels().permute(0,2,3,1).dup().reshape('c',height*width,1); | |
if(k==0) { | |
e.eval(labels2d, out2d); | |
log.info(e.stats()); | |
} | |
k++; | |
} |
OlderNewer