mlpack  master
Public Member Functions | Private Member Functions | Private Attributes | List of all members
mlpack::ann::Glimpse< InputDataType, OutputDataType > Class Template Reference

The glimpse layer returns a retina-like representation (down-scaled cropped images) of increasing scale around a given location in a given image. More...

Public Member Functions

 Glimpse (const size_t inSize, const size_t size, const size_t depth=3, const size_t scale=2, const size_t inputWidth=0, const size_t inputHeight=0)
 Create the GlimpseLayer object using the specified ratio and rescale parameter. More...
 
template<typename eT >
void Backward (const arma::Mat< eT > &&, arma::Mat< eT > &&gy, arma::Mat< eT > &&g)
 Ordinary feed backward pass of the glimpse layer. More...
 
OutputDataType & Delta () const
 Get the detla. More...
 
OutputDataType & Delta ()
 Modify the delta. More...
 
bool Deterministic () const
 Get the value of the deterministic parameter. More...
 
bool & Deterministic ()
 Modify the value of the deterministic parameter. More...
 
template<typename eT >
void Forward (const arma::Mat< eT > &&input, arma::Mat< eT > &&output)
 Ordinary feed forward pass of the glimpse layer. More...
 
size_t const & InputHeight () const
 Get the input height. More...
 
size_t & InputHeight ()
 Modify the input height. More...
 
InputDataType & InputParameter () const
 Get the input parameter. More...
 
InputDataType & InputParameter ()
 Modify the input parameter. More...
 
size_t const & InputWidth () const
 Get the input width. More...
 
size_t & InputWidth ()
 Modify input the width. More...
 
void Location (const arma::mat &location)
 Set the locationthe x and y coordinate of the center of the output glimpse. More...
 
size_t const & OutputHeight () const
 Get the output height. More...
 
size_t & OutputHeight ()
 Modify the output height. More...
 
OutputDataType & OutputParameter () const
 Get the output parameter. More...
 
OutputDataType & OutputParameter ()
 Modify the output parameter. More...
 
size_t const & OutputWidth () const
 Get the output width. More...
 
size_t & OutputWidth ()
 Modify the output width. More...
 
template<typename Archive >
void Serialize (Archive &ar, const unsigned int)
 Serialize the layer. More...
 

Private Member Functions

template<typename eT >
void DownwardReSampling (const arma::Mat< eT > &input, const arma::Mat< eT > &error, arma::Mat< eT > &output)
 Apply DownwardReSampling to the input and store the results into the output parameter. More...
 
template<typename eT >
void Pooling (const size_t kSize, const arma::Mat< eT > &input, arma::Mat< eT > &output)
 Apply pooling to the input and store the results to the output parameter. More...
 
template<typename eT >
void ReSampling (const arma::Mat< eT > &input, arma::Mat< eT > &output)
 Apply ReSampling to the input and store the results in the output parameter. More...
 
void Transform (arma::mat &w)
 
void Transform (arma::cube &w)
 
template<typename eT >
void Unpooling (const arma::Mat< eT > &input, const arma::Mat< eT > &error, arma::Mat< eT > &output)
 Apply unpooling to the input and store the results. More...
 

Private Attributes

OutputDataType delta
 Locally-stored delta object. More...
 
size_t depth
 The number of patches to crop per glimpse. More...
 
bool deterministic
 If true use maximum a posteriori during the forward pass. More...
 
arma::cube gTemp
 Location-stored transformed gradient paramter. More...
 
size_t inputDepth
 Locally-stored depth of the input. More...
 
size_t inputHeight
 Locally-stored input height. More...
 
InputDataType inputParameter
 Locally-stored input parameter object. More...
 
arma::cube inputTemp
 Locally-stored transformed input parameter. More...
 
size_t inputWidth
 Locally-stored input width. More...
 
size_t inSize
 The size of the input units. More...
 
arma::mat location
 The x and y coordinate of the center of the output glimpse. More...
 
std::vector< arma::mat > locationParameter
 Location-stored module location parameter. More...
 
size_t outputHeight
 Locally-stored output height. More...
 
OutputDataType outputParameter
 Locally-stored output parameter object. More...
 
arma::cube outputTemp
 Locally-stored transformed output parameter. More...
 
size_t outputWidth
 Locally-stored output width. More...
 
MeanPoolingRule pooling
 Locally-stored object to perform the mean pooling operation. More...
 
size_t scale
 The scale fraction. More...
 
size_t size
 The used glimpse size (height = width). More...
 

Detailed Description

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
class mlpack::ann::Glimpse< InputDataType, OutputDataType >

The glimpse layer returns a retina-like representation (down-scaled cropped images) of increasing scale around a given location in a given image.

Template Parameters
InputDataTypeType of the input data (arma::colvec, arma::mat, arma::sp_mat or arma::cube).
OutputDataTypeType of the output data (arma::colvec, arma::mat, arma::sp_mat or arma::cube).

Definition at line 82 of file glimpse.hpp.

Constructor & Destructor Documentation

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
mlpack::ann::Glimpse< InputDataType, OutputDataType >::Glimpse ( const size_t  inSize,
const size_t  size,
const size_t  depth = 3,
const size_t  scale = 2,
const size_t  inputWidth = 0,
const size_t  inputHeight = 0 
)

Create the GlimpseLayer object using the specified ratio and rescale parameter.

Parameters
inSizeThe size of the input units.
sizeThe used glimpse size (height = width).
depthThe number of patches to crop per glimpse.
scaleThe scaling factor used to create the increasing retina-like representation.
inputWidthThe input width of the given input data.
inputHeightThe input height of the given input data.

Member Function Documentation

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
template<typename eT >
void mlpack::ann::Glimpse< InputDataType, OutputDataType >::Backward ( const arma::Mat< eT > &&  ,
arma::Mat< eT > &&  gy,
arma::Mat< eT > &&  g 
)

Ordinary feed backward pass of the glimpse layer.

Parameters
inputThe propagated input activation.
gyThe backpropagated error.
gThe calculated gradient.
template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
OutputDataType& mlpack::ann::Glimpse< InputDataType, OutputDataType >::Delta ( ) const
inline

Get the detla.

Definition at line 137 of file glimpse.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
OutputDataType& mlpack::ann::Glimpse< InputDataType, OutputDataType >::Delta ( )
inline

Modify the delta.

Definition at line 139 of file glimpse.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
bool mlpack::ann::Glimpse< InputDataType, OutputDataType >::Deterministic ( ) const
inline

Get the value of the deterministic parameter.

Definition at line 169 of file glimpse.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
bool& mlpack::ann::Glimpse< InputDataType, OutputDataType >::Deterministic ( )
inline

Modify the value of the deterministic parameter.

Definition at line 171 of file glimpse.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
template<typename eT >
void mlpack::ann::Glimpse< InputDataType, OutputDataType >::DownwardReSampling ( const arma::Mat< eT > &  input,
const arma::Mat< eT > &  error,
arma::Mat< eT > &  output 
)
inlineprivate

Apply DownwardReSampling to the input and store the results into the output parameter.

Parameters
inputThe input to be apply the DownwardReSampling rule.
errorThe error used to perform the DownwardReSampling operation.
outputThe DownwardReSampled result.

Definition at line 324 of file glimpse.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
template<typename eT >
void mlpack::ann::Glimpse< InputDataType, OutputDataType >::Forward ( const arma::Mat< eT > &&  input,
arma::Mat< eT > &&  output 
)

Ordinary feed forward pass of the glimpse layer.

Parameters
inputInput data used for evaluating the specified function.
outputResulting output activation.
template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
size_t const& mlpack::ann::Glimpse< InputDataType, OutputDataType >::InputHeight ( ) const
inline

Get the input height.

Definition at line 154 of file glimpse.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
size_t& mlpack::ann::Glimpse< InputDataType, OutputDataType >::InputHeight ( )
inline

Modify the input height.

Definition at line 156 of file glimpse.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
InputDataType& mlpack::ann::Glimpse< InputDataType, OutputDataType >::InputParameter ( ) const
inline

Get the input parameter.

Definition at line 127 of file glimpse.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
InputDataType& mlpack::ann::Glimpse< InputDataType, OutputDataType >::InputParameter ( )
inline

Modify the input parameter.

Definition at line 129 of file glimpse.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
size_t const& mlpack::ann::Glimpse< InputDataType, OutputDataType >::InputWidth ( ) const
inline

Get the input width.

Definition at line 149 of file glimpse.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
size_t& mlpack::ann::Glimpse< InputDataType, OutputDataType >::InputWidth ( )
inline

Modify input the width.

Definition at line 151 of file glimpse.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
void mlpack::ann::Glimpse< InputDataType, OutputDataType >::Location ( const arma::mat &  location)
inline

Set the locationthe x and y coordinate of the center of the output glimpse.

Definition at line 143 of file glimpse.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
size_t const& mlpack::ann::Glimpse< InputDataType, OutputDataType >::OutputHeight ( ) const
inline

Get the output height.

Definition at line 164 of file glimpse.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
size_t& mlpack::ann::Glimpse< InputDataType, OutputDataType >::OutputHeight ( )
inline

Modify the output height.

Definition at line 166 of file glimpse.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
OutputDataType& mlpack::ann::Glimpse< InputDataType, OutputDataType >::OutputParameter ( ) const
inline

Get the output parameter.

Definition at line 132 of file glimpse.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
OutputDataType& mlpack::ann::Glimpse< InputDataType, OutputDataType >::OutputParameter ( )
inline

Modify the output parameter.

Definition at line 134 of file glimpse.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
size_t const& mlpack::ann::Glimpse< InputDataType, OutputDataType >::OutputWidth ( ) const
inline

Get the output width.

Definition at line 159 of file glimpse.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
size_t& mlpack::ann::Glimpse< InputDataType, OutputDataType >::OutputWidth ( )
inline

Modify the output width.

Definition at line 161 of file glimpse.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
template<typename eT >
void mlpack::ann::Glimpse< InputDataType, OutputDataType >::Pooling ( const size_t  kSize,
const arma::Mat< eT > &  input,
arma::Mat< eT > &  output 
)
inlineprivate

Apply pooling to the input and store the results to the output parameter.

Parameters
kSizethe kernel size used to perform the pooling operation.
inputThe input to be apply the pooling rule.
outputThe pooled result.

Definition at line 221 of file glimpse.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
template<typename eT >
void mlpack::ann::Glimpse< InputDataType, OutputDataType >::ReSampling ( const arma::Mat< eT > &  input,
arma::Mat< eT > &  output 
)
inlineprivate

Apply ReSampling to the input and store the results in the output parameter.

Parameters
inputThe input to be apply the ReSampling rule.
outputThe pooled result.

Definition at line 279 of file glimpse.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
template<typename Archive >
void mlpack::ann::Glimpse< InputDataType, OutputDataType >::Serialize ( Archive &  ar,
const unsigned  int 
)

Serialize the layer.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
void mlpack::ann::Glimpse< InputDataType, OutputDataType >::Transform ( arma::mat &  w)
inlineprivate

Definition at line 185 of file glimpse.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
void mlpack::ann::Glimpse< InputDataType, OutputDataType >::Transform ( arma::cube &  w)
inlineprivate

Definition at line 203 of file glimpse.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
template<typename eT >
void mlpack::ann::Glimpse< InputDataType, OutputDataType >::Unpooling ( const arma::Mat< eT > &  input,
const arma::Mat< eT > &  error,
arma::Mat< eT > &  output 
)
inlineprivate

Apply unpooling to the input and store the results.

Parameters
inputThe input to be apply the unpooling rule.
errorThe error used to perform the unpooling operation.
outputThe pooled result.

Definition at line 247 of file glimpse.hpp.

Member Data Documentation

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
OutputDataType mlpack::ann::Glimpse< InputDataType, OutputDataType >::delta
private

Locally-stored delta object.

Definition at line 391 of file glimpse.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
size_t mlpack::ann::Glimpse< InputDataType, OutputDataType >::depth
private

The number of patches to crop per glimpse.

Definition at line 373 of file glimpse.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
bool mlpack::ann::Glimpse< InputDataType, OutputDataType >::deterministic
private

If true use maximum a posteriori during the forward pass.

Definition at line 421 of file glimpse.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
arma::cube mlpack::ann::Glimpse< InputDataType, OutputDataType >::gTemp
private

Location-stored transformed gradient paramter.

Definition at line 418 of file glimpse.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
size_t mlpack::ann::Glimpse< InputDataType, OutputDataType >::inputDepth
private

Locally-stored depth of the input.

Definition at line 400 of file glimpse.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
size_t mlpack::ann::Glimpse< InputDataType, OutputDataType >::inputHeight
private

Locally-stored input height.

Definition at line 382 of file glimpse.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
InputDataType mlpack::ann::Glimpse< InputDataType, OutputDataType >::inputParameter
private

Locally-stored input parameter object.

Definition at line 394 of file glimpse.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
arma::cube mlpack::ann::Glimpse< InputDataType, OutputDataType >::inputTemp
private

Locally-stored transformed input parameter.

Definition at line 403 of file glimpse.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
size_t mlpack::ann::Glimpse< InputDataType, OutputDataType >::inputWidth
private

Locally-stored input width.

Definition at line 379 of file glimpse.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
size_t mlpack::ann::Glimpse< InputDataType, OutputDataType >::inSize
private

The size of the input units.

Definition at line 367 of file glimpse.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
arma::mat mlpack::ann::Glimpse< InputDataType, OutputDataType >::location
private

The x and y coordinate of the center of the output glimpse.

Definition at line 409 of file glimpse.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
std::vector<arma::mat> mlpack::ann::Glimpse< InputDataType, OutputDataType >::locationParameter
private

Location-stored module location parameter.

Definition at line 415 of file glimpse.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
size_t mlpack::ann::Glimpse< InputDataType, OutputDataType >::outputHeight
private

Locally-stored output height.

Definition at line 388 of file glimpse.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
OutputDataType mlpack::ann::Glimpse< InputDataType, OutputDataType >::outputParameter
private

Locally-stored output parameter object.

Definition at line 397 of file glimpse.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
arma::cube mlpack::ann::Glimpse< InputDataType, OutputDataType >::outputTemp
private

Locally-stored transformed output parameter.

Definition at line 406 of file glimpse.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
size_t mlpack::ann::Glimpse< InputDataType, OutputDataType >::outputWidth
private

Locally-stored output width.

Definition at line 385 of file glimpse.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
MeanPoolingRule mlpack::ann::Glimpse< InputDataType, OutputDataType >::pooling
private

Locally-stored object to perform the mean pooling operation.

Definition at line 412 of file glimpse.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
size_t mlpack::ann::Glimpse< InputDataType, OutputDataType >::scale
private

The scale fraction.

Definition at line 376 of file glimpse.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
size_t mlpack::ann::Glimpse< InputDataType, OutputDataType >::size
private

The used glimpse size (height = width).

Definition at line 370 of file glimpse.hpp.


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