use of com.simiacryptus.mindseye.layers.cudnn.ActivationLayer in project MindsEye by SimiaCryptus.
the class VGG16_HDF5 method addConvolutionLayer.
/**
* Add convolution layer.
*
* @param radius the radius
* @param inputBands the input bands
* @param outputBands the output bands
* @param activationMode the activation mode
* @param hdf_group the hdf group
*/
protected void addConvolutionLayer(final int radius, final int inputBands, final int outputBands, final ActivationLayer.Mode activationMode, final String hdf_group) {
add(new ConvolutionLayer(radius, radius, inputBands, outputBands).setPaddingXY(0, 0).setAndFree(hdf5.readDataSet("param_0", hdf_group).permuteDimensionsAndFree(convolutionOrder)));
add(new ImgBandBiasLayer(outputBands).setAndFree((hdf5.readDataSet("param_1", hdf_group))));
add(new ActivationLayer(activationMode));
}
use of com.simiacryptus.mindseye.layers.cudnn.ActivationLayer in project MindsEye by SimiaCryptus.
the class VGG16_HDF5 method phase2b.
/**
* Phase 2 b.
*/
protected void phase2b() {
if (large) {
add(new ImgModulusPaddingLayer(7, 7));
} else {
add(new ImgModulusPaddingLayer(-7, -7));
}
if (dense) {
add(new ConvolutionLayer(7, 7, 512, 4096).setStrideXY(1, 1).setPaddingXY(0, 0).setAndFree(hdf5.readDataSet("param_0", "layer_32").reshapeCast(7, 7, 512, 4096).permuteDimensionsAndFree(0, 1, 3, 2)));
} else {
add(new ImgModulusPaddingLayer(7, 7));
add(new ImgReshapeLayer(7, 7, false));
add(new ConvolutionLayer(1, 1, 25088, 4096).setPaddingXY(0, 0).setAndFree(hdf5.readDataSet("param_0", "layer_32").permuteDimensionsAndFree(fullyconnectedOrder)));
}
add(new ImgBandBiasLayer(4096).setAndFree((hdf5.readDataSet("param_1", "layer_32"))));
add(new ActivationLayer(ActivationLayer.Mode.RELU));
}
use of com.simiacryptus.mindseye.layers.cudnn.ActivationLayer in project MindsEye by SimiaCryptus.
the class VGG19_HDF5 method phase2b.
/**
* Phase 2 b.
*/
protected void phase2b() {
if (large) {
add(new ImgModulusPaddingLayer(7, 7));
} else {
add(new ImgModulusPaddingLayer(-7, -7));
}
if (dense) {
add(new ConvolutionLayer(7, 7, 512, 4096).setStrideXY(1, 1).setPaddingXY(0, 0).setAndFree(hdf5.readDataSet("param_0", "layer_38").reshapeCast(7, 7, 512, 4096).permuteDimensionsAndFree(0, 1, 3, 2)));
} else {
add(new ImgModulusPaddingLayer(7, 7));
add(new ImgReshapeLayer(7, 7, false));
add(new ConvolutionLayer(1, 1, 25088, 4096).setPaddingXY(0, 0).setAndFree(hdf5.readDataSet("param_0", "layer_38").permuteDimensionsAndFree(fullyconnectedOrder)));
}
add(new ImgBandBiasLayer(4096).setAndFree((hdf5.readDataSet("param_1", "layer_38"))));
add(new ActivationLayer(ActivationLayer.Mode.RELU));
}
use of com.simiacryptus.mindseye.layers.cudnn.ActivationLayer in project MindsEye by SimiaCryptus.
the class VGG19_HDF5 method addConvolutionLayer.
/**
* Add convolution layer.
*
* @param radius the radius
* @param inputBands the input bands
* @param outputBands the output bands
* @param activationMode the activation mode
* @param hdf_group the hdf group
*/
protected void addConvolutionLayer(final int radius, final int inputBands, final int outputBands, final ActivationLayer.Mode activationMode, final String hdf_group) {
add(new ConvolutionLayer(radius, radius, inputBands, outputBands).setPaddingXY(0, 0).setAndFree(hdf5.readDataSet("param_0", hdf_group).permuteDimensionsAndFree(convolutionOrder)));
add(new ImgBandBiasLayer(outputBands).setAndFree((hdf5.readDataSet("param_1", hdf_group))));
add(new ActivationLayer(activationMode));
}
use of com.simiacryptus.mindseye.layers.cudnn.ActivationLayer in project MindsEye by SimiaCryptus.
the class VGG19_HDF5 method phase3a.
/**
* Phase 3 a.
*/
protected void phase3a() {
add(new ConvolutionLayer(1, 1, 4096, 4096).setPaddingXY(0, 0).setAndFree(hdf5.readDataSet("param_0", "layer_40").permuteDimensionsAndFree(fullyconnectedOrder)));
add(new ImgBandBiasLayer(4096).setAndFree((hdf5.readDataSet("param_1", "layer_40"))));
add(new ActivationLayer(ActivationLayer.Mode.RELU));
add(new ConvolutionLayer(1, 1, 4096, 1000).setPaddingXY(0, 0).setAndFree(hdf5.readDataSet("param_0", "layer_42").permuteDimensionsAndFree(fullyconnectedOrder)));
add(new ImgBandBiasLayer(1000).setAndFree((hdf5.readDataSet("param_1", "layer_42"))));
}
Aggregations