public class ConvolutionUtils extends Object
Modifier and Type | Method and Description |
---|---|
static org.nd4j.linalg.api.ndarray.INDArray |
adapt2dMask(org.nd4j.linalg.api.ndarray.INDArray mask,
org.nd4j.linalg.api.ndarray.INDArray output) |
static int[] |
effectiveKernelSize(int[] kernel,
int[] dilation) |
static int[] |
getDeconvolutionOutputSize(org.nd4j.linalg.api.ndarray.INDArray inputData,
int[] kernel,
int[] strides,
int[] padding,
ConvolutionMode convolutionMode,
int[] dilation)
Get the output size of a deconvolution operation for given input data.
|
static int[] |
getHeightAndWidth(int[] shape)
Get the height and width
for an image
|
static int[] |
getHeightAndWidth(NeuralNetConfiguration conf)
Get the height and width
from the configuration
|
static int[] |
getHWDFromInputType(InputType inputType)
Get heigh/width/depth as length 3 int[] from the InputType
|
static int[] |
getOutputSize(org.nd4j.linalg.api.ndarray.INDArray inputData,
int[] kernel,
int[] strides,
int[] padding,
ConvolutionMode convolutionMode) |
static int[] |
getOutputSize(org.nd4j.linalg.api.ndarray.INDArray inputData,
int[] kernel,
int[] strides,
int[] padding,
ConvolutionMode convolutionMode,
int[] dilation)
Get the output size (height/width) for the given input data and CNN configuration
|
static int[] |
getSameModeBottomRightPadding(int[] outSize,
int[] inSize,
int[] kernel,
int[] strides,
int[] dilation)
Get bottom and right padding for same mode only.
|
static int[] |
getSameModeTopLeftPadding(int[] outSize,
int[] inSize,
int[] kernel,
int[] strides,
int[] dilation)
Get top and left padding for same mode only.
|
static int |
numChannels(int[] shape)
Returns the number of
feature maps for a given shape (must be at least 3 dimensions
|
static int |
numFeatureMap(NeuralNetConfiguration conf) |
static org.nd4j.linalg.api.ndarray.INDArray |
reshape2dTo4d(org.nd4j.linalg.api.ndarray.INDArray in2d,
int[] toShape) |
static org.nd4j.linalg.api.ndarray.INDArray |
reshape3dMask(org.nd4j.linalg.api.ndarray.INDArray mask) |
static org.nd4j.linalg.api.ndarray.INDArray |
reshape4dMask(org.nd4j.linalg.api.ndarray.INDArray mask) |
static org.nd4j.linalg.api.ndarray.INDArray |
reshape4dTo2d(org.nd4j.linalg.api.ndarray.INDArray in) |
static org.nd4j.linalg.api.ndarray.INDArray |
reshapeMaskIfRequired(org.nd4j.linalg.api.ndarray.INDArray mask,
org.nd4j.linalg.api.ndarray.INDArray output) |
static void |
validateCnnKernelStridePadding(int[] kernelSize,
int[] stride,
int[] padding)
Perform validation on the CNN layer kernel/stride/padding.
|
static void |
validateConvolutionModePadding(ConvolutionMode mode,
int[] padding)
Check that the convolution mode is consistent with the padding specification
|
static void |
validateShapes(org.nd4j.linalg.api.ndarray.INDArray inputData,
int[] eKernel,
int[] strides,
int[] padding,
ConvolutionMode convolutionMode,
int[] dilation,
int inH,
int inW,
boolean atrous) |
public static int[] getOutputSize(org.nd4j.linalg.api.ndarray.INDArray inputData, int[] kernel, int[] strides, int[] padding, ConvolutionMode convolutionMode)
public static int[] getDeconvolutionOutputSize(org.nd4j.linalg.api.ndarray.INDArray inputData, int[] kernel, int[] strides, int[] padding, ConvolutionMode convolutionMode, int[] dilation)
inputData
- Input datakernel
- Kernel size (height/width)strides
- Strides (height/width)padding
- Padding (height/width)convolutionMode
- Convolution mode (Same, Strict, Truncate)dilation
- Kernel dilation (height/width)public static int[] getOutputSize(org.nd4j.linalg.api.ndarray.INDArray inputData, int[] kernel, int[] strides, int[] padding, ConvolutionMode convolutionMode, int[] dilation)
inputData
- Input datakernel
- Kernel size (height/width)strides
- Strides (height/width)padding
- Padding (height/width)convolutionMode
- Convolution mode (Same, Strict, Truncate)dilation
- Kernel dilation (height/width)public static void validateShapes(org.nd4j.linalg.api.ndarray.INDArray inputData, int[] eKernel, int[] strides, int[] padding, ConvolutionMode convolutionMode, int[] dilation, int inH, int inW, boolean atrous)
public static int[] effectiveKernelSize(int[] kernel, int[] dilation)
public static int[] getSameModeTopLeftPadding(int[] outSize, int[] inSize, int[] kernel, int[] strides, int[] dilation)
outSize
- inSize
- kernel
- strides
- public static int[] getSameModeBottomRightPadding(int[] outSize, int[] inSize, int[] kernel, int[] strides, int[] dilation)
outSize
- inSize
- kernel
- strides
- public static int[] getHeightAndWidth(NeuralNetConfiguration conf)
conf
- the configuration to get height and width frompublic static int numFeatureMap(NeuralNetConfiguration conf)
conf
- the configuration to get
the number of kernels frompublic static int[] getHeightAndWidth(int[] shape)
shape
- the shape of the imagepublic static int numChannels(int[] shape)
shape
- the shape to get the
number of feature maps forpublic static void validateConvolutionModePadding(ConvolutionMode mode, int[] padding)
public static void validateCnnKernelStridePadding(int[] kernelSize, int[] stride, int[] padding)
kernelSize
- Kernel size array to checkstride
- Stride array to checkpadding
- Padding array to checkpublic static org.nd4j.linalg.api.ndarray.INDArray reshape4dTo2d(org.nd4j.linalg.api.ndarray.INDArray in)
public static org.nd4j.linalg.api.ndarray.INDArray reshape2dTo4d(org.nd4j.linalg.api.ndarray.INDArray in2d, int[] toShape)
public static org.nd4j.linalg.api.ndarray.INDArray reshapeMaskIfRequired(org.nd4j.linalg.api.ndarray.INDArray mask, org.nd4j.linalg.api.ndarray.INDArray output)
public static org.nd4j.linalg.api.ndarray.INDArray adapt2dMask(org.nd4j.linalg.api.ndarray.INDArray mask, org.nd4j.linalg.api.ndarray.INDArray output)
public static org.nd4j.linalg.api.ndarray.INDArray reshape3dMask(org.nd4j.linalg.api.ndarray.INDArray mask)
public static org.nd4j.linalg.api.ndarray.INDArray reshape4dMask(org.nd4j.linalg.api.ndarray.INDArray mask)
public static int[] getHWDFromInputType(InputType inputType)
inputType
- Input type to getCopyright © 2018. All rights reserved.