MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
MyCaffe.fillers.BilinearFiller< T > Class Template Reference

Fills a Blob with coefficients for bilinear interpolation. More...

Inheritance diagram for MyCaffe.fillers.BilinearFiller< T >:
MyCaffe.fillers.Filler< T >

Public Member Functions

 BilinearFiller (CudaDnn< T > cuda, Log log, FillerParameter p)
 Constructor. More...
 
override void Fill (int nCount, long hMem, int nNumAxes=1, int nNumOutputs=1, int nNumChannels=1, int nHeight=1, int nWidth=1)
 Fill a memory with bilinear values. More...
 
- Public Member Functions inherited from MyCaffe.fillers.Filler< T >
 Filler (CudaDnn< T > cuda, Log log, FillerParameter p)
 Constructor. More...
 
void Fill (Blob< T > b)
 Fill the blob with values based on the actual filler used. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from MyCaffe.fillers.Filler< T >
static Filler< T > Create (CudaDnn< T > cuda, Log log, FillerParameter p)
 Create a new Filler instance. More...
 
- Protected Attributes inherited from MyCaffe.fillers.Filler< T >
CudaDnn< T > m_cuda
 Specifies the CudaDnn instance used to communicate to the low-level Cuda Dnn DLL. More...
 
Log m_log
 Specifies the output log. More...
 
FillerParameter m_param
 Specifies the filler parameters. More...
 

Detailed Description

Fills a Blob with coefficients for bilinear interpolation.

A common use case is with the DeconvolutionLayer acting as unsampling. You can upsample a feature amp with shape of (B, C, H, W) by any integer factor using the following proto:

layer {
name: "upsample", type: "Deconvolution"
bottom: "{{bottom_name}}" top: "{{top_name}}"
convolution_param {
kernel_size: {{2 * factor - factor % 2}} stride: {{factor}}
num_output: {{C}} group: {{C}}
pad: {{ceil((factor - 1) / 2.0)}}
weight_filler: { type: "bilinear" } bias_term: false
}
param { lr_mult: 0 decay_mult: 0 }
}

Please use this by replacing '{{}}' with your values. By specifying 'num_output: {{C}} group: {{C}}', it behaves as channel-wise convolution. The filter shape of this deconvolution layer will be (C, 1, K, K) where K is 'kernel_size', and this filler will set a (K, K) interpolation kernel for every channel of the filter identically. The resulting shape of the top featur emap will be (B, C, factor * H, factory * W).

Note, that the learning rate and the weight decay are set to 0 in order to keep coefficient values of bilinear interpolation uncahnged during training. If you apply this to an image, this operation is equivalent to the following call in Python with Scikit.Image:

out = skimage.transform.rescale(img, factor, mode='constant', cval=0)
Template Parameters
TThe base type float or double.

Definition at line 50 of file BilinearFiller.cs.

Constructor & Destructor Documentation

◆ BilinearFiller()

Constructor.

Parameters
cudaInstance of CudaDnn - connection to cuda.
logLog used for output.
pFiller parameter that defines the filler settings.

Definition at line 58 of file BilinearFiller.cs.

Member Function Documentation

◆ Fill()

override void MyCaffe.fillers.BilinearFiller< T >.Fill ( int  nCount,
long  hMem,
int  nNumAxes = 1,
int  nNumOutputs = 1,
int  nNumChannels = 1,
int  nHeight = 1,
int  nWidth = 1 
)
virtual

Fill a memory with bilinear values.

Parameters
nCountSpecifies the number of items to fill.
hMemSpecifies the handle to GPU memory to fill.
nNumAxesOptionally, specifies the number of axes (default = 1).
nNumOutputsOptionally, specifies the number of outputs (default = 1).
nNumChannelsOptionally, specifies the number of channels (default = 1).
nHeightOptionally, specifies the height (default = 1).
nWidthOptionally, specifies the width (default = 1).

Implements MyCaffe.fillers.Filler< T >.

Definition at line 73 of file BilinearFiller.cs.


The documentation for this class was generated from the following file: