LBANN  0.103.0
LivermoreBigArtificialNeuralNetworkToolkit
lbann::transform::cutout Class Reference

#include <cutout.hpp>

Inheritance diagram for lbann::transform::cutout:
[legend]
Collaboration diagram for lbann::transform::cutout:
[legend]

Public Member Functions

 cutout (size_t num_holes, size_t length)
 
transformcopy () const override
 
std::string get_type () const override
 
void apply (utils::type_erased_matrix &data, std::vector< size_t > &dims) override
 
- Public Member Functions inherited from lbann::transform::transform
 transform ()=default
 
 transform (const transform &)=default
 
transformoperator= (const transform &)=default
 
virtual ~transform ()=default
 
virtual description get_description () const
 
virtual bool supports_non_inplace () const
 
virtual void apply (utils::type_erased_matrix &data, CPUMat &out, std::vector< size_t > &dims)
 

Private Attributes

size_t m_num_holes
 
size_t m_length
 

Additional Inherited Members

- Static Protected Member Functions inherited from lbann::transform::transform
static float get_uniform_random (float a, float b)
 
static bool get_bool_random (float p)
 
static El::Int get_uniform_random_int (El::Int a, El::Int b)
 

Detailed Description

Cutout data augmentation which randomly masks out square regions of input.

See:

DeVries and Taylor. "Improved Regularization of Convolutional Neural
Networks with Cutout". arXiv preprint arXiv:1708.04552 (2017).

This will randomly select a center pixel for each square and set all pixels within that square to 0. It is permissible for portions of the masks to lie outside of the image.

Normalization about 0 should be applied after applying cutout.

Definition at line 51 of file transforms/vision/cutout.hpp.

Constructor & Destructor Documentation

◆ cutout()

lbann::transform::cutout::cutout ( size_t  num_holes,
size_t  length 
)
inline

Cutout with a given number of squares of a given size.

Parameters
num_holesNumber of squares to mask out (must be positive).
lengthLength of a side of the square (must be positive).

Definition at line 59 of file transforms/vision/cutout.hpp.

Here is the caller graph for this function:

Member Function Documentation

◆ apply()

void lbann::transform::cutout::apply ( utils::type_erased_matrix data,
std::vector< size_t > &  dims 
)
overridevirtual

Apply the transform to data.

Parameters
dataThe input data to transform, which is modified in-place. The matrix shuold be contiguous.
dimsThe dimensions of the data tensor. For "plain data", dims should have one entry, giving its size. For images, dims should have three entries: channels, height, width.
Note
dims is a hack until we have proper tensors.

Implements lbann::transform::transform.

Here is the caller graph for this function:

◆ copy()

transform* lbann::transform::cutout::copy ( ) const
inlineoverridevirtual

Create a copy of the transform instance.

Implements lbann::transform::transform.

Definition at line 70 of file transforms/vision/cutout.hpp.

Here is the call graph for this function:

◆ get_type()

std::string lbann::transform::cutout::get_type ( ) const
inlineoverridevirtual

Human-readable type name.

Implements lbann::transform::transform.

Definition at line 72 of file transforms/vision/cutout.hpp.

Here is the call graph for this function:

Member Data Documentation

◆ m_length

size_t lbann::transform::cutout::m_length
private

Length of a side of each square that will be masked out.

Definition at line 81 of file transforms/vision/cutout.hpp.

◆ m_num_holes

size_t lbann::transform::cutout::m_num_holes
private

Number of squares that will be masked out.

Definition at line 79 of file transforms/vision/cutout.hpp.


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