How to do it...

  1. Create ImagePreProcessingScaler for image normalization:
DataNormalization scaler = new ImagePreProcessingScaler(0,1);

  1. Create a neural network configuration and add default hyperparameters:
MultiLayerConfiguration.Builder builder = new NeuralNetConfiguration.Builder().weightInit(WeightInit.DISTRIBUTION)
.dist(new NormalDistribution(0.0, 0.01))
.activation(Activation.RELU)
.updater(new Nesterovs(new StepSchedule(ScheduleType.ITERATION, 1e-2, 0.1, 100000), 0.9))
.biasUpdater(new Nesterovs(new StepSchedule(ScheduleType.ITERATION, 2e-2, 0.1, 100000), 0.9))
.gradientNormalization(GradientNormalization.RenormalizeL2PerLayer) // normalize to prevent vanishing or exploding gradients
.l2(l2RegularizationParam)
.list();
  1. Create convolution layers for a CNN using ConvolutionLayer
builder.layer(new ConvolutionLayer.Builder(11,11)
.nIn(channels)
.nOut(96)
.stride(1,1)
.activation(Activation.RELU)
.build());
  1. Configure subsampling layers using SubsamplingLayer
builder.layer(new SubsamplingLayer.Builder(PoolingType.MAX)
.kernelSize(kernelSize,kernelSize)
.build());
  1. Normalize activation between layers using LocalResponseNormalization:
 builder.layer(1, new LocalResponseNormalization.Builder().name("lrn1").build());
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset