1 #ifndef CAFFE_INFOGAIN_LOSS_LAYER_HPP_ 2 #define CAFFE_INFOGAIN_LOSS_LAYER_HPP_ 6 #include "caffe/blob.hpp" 7 #include "caffe/layer.hpp" 8 #include "caffe/proto/caffe.pb.h" 10 #include "caffe/layers/loss_layer.hpp" 11 #include "caffe/layers/softmax_layer.hpp" 47 template <
typename Dtype>
70 virtual inline const char*
type()
const {
return "InfogainLoss"; }
110 const vector<bool>& propagate_down,
const vector<
Blob<Dtype>*>& bottom);
117 LossParameter_NormalizationMode normalization_mode,
int valid_count);
140 int infogain_axis_, outer_num_, inner_num_, num_labels_;
145 #endif // CAFFE_INFOGAIN_LOSS_LAYER_HPP_ virtual int MinTopBlobs() const
Returns the minimum number of top blobs required by the layer, or -1 if no minimum number is required...
Definition: infogain_loss_layer.hpp:67
virtual void LayerSetUp(const vector< Blob< Dtype > *> &bottom, const vector< Blob< Dtype > *> &top)
Does layer-specific setup: your layer should implement this function as well as Reshape.
Definition: infogain_loss_layer.cpp:12
vector< Blob< Dtype > * > softmax_bottom_vec_
bottom vector holder used in call to the underlying SoftmaxLayer::Forward
Definition: infogain_loss_layer.hpp:126
int ignore_label_
The label indicating that an instance should be ignored.
Definition: infogain_loss_layer.hpp:136
Blob< Dtype > prob_
prob stores the output probability predictions from the SoftmaxLayer.
Definition: infogain_loss_layer.hpp:124
A layer factory that allows one to register layers. During runtime, registered layers can be called b...
Definition: blob.hpp:14
virtual int ExactNumTopBlobs() const
Returns the exact number of top blobs required by the layer, or -1 if no exact number is required...
Definition: infogain_loss_layer.hpp:66
virtual const char * type() const
Returns the layer type.
Definition: infogain_loss_layer.hpp:70
LossParameter_NormalizationMode normalization_
How to normalize the output loss.
Definition: infogain_loss_layer.hpp:138
A generalization of MultinomialLogisticLossLayer that takes an "information gain" (infogain) matrix s...
Definition: infogain_loss_layer.hpp:48
virtual void Backward_cpu(const vector< Blob< Dtype > *> &top, const vector< bool > &propagate_down, const vector< Blob< Dtype > *> &bottom)
Computes the infogain loss error gradient w.r.t. the predictions.
Definition: infogain_loss_layer.cpp:168
shared_ptr< Layer< Dtype > > softmax_layer_
The internal SoftmaxLayer used to map predictions to a distribution.
Definition: infogain_loss_layer.hpp:122
virtual int MaxBottomBlobs() const
Returns the maximum number of bottom blobs required by the layer, or -1 if no maximum number is requi...
Definition: infogain_loss_layer.hpp:62
bool has_ignore_label_
Whether to ignore instances with a certain label.
Definition: infogain_loss_layer.hpp:134
vector< Blob< Dtype > * > softmax_top_vec_
top vector holder used in call to the underlying SoftmaxLayer::Forward
Definition: infogain_loss_layer.hpp:128
virtual void Forward_cpu(const vector< Blob< Dtype > *> &bottom, const vector< Blob< Dtype > *> &top)
A generalization of MultinomialLogisticLossLayer that takes an "information gain" (infogain) matrix s...
Definition: infogain_loss_layer.cpp:129
virtual int ExactNumBottomBlobs() const
Returns the exact number of bottom blobs required by the layer, or -1 if no exact number is required...
Definition: infogain_loss_layer.hpp:60
virtual int MaxTopBlobs() const
Returns the maximum number of top blobs required by the layer, or -1 if no maximum number is required...
Definition: infogain_loss_layer.hpp:68
virtual void sum_rows_of_H(const Blob< Dtype > *H)
fill sum_rows_H_ according to matrix H
Definition: infogain_loss_layer.cpp:115
An interface for Layers that take two Blobs as input – usually (1) predictions and (2) ground-truth ...
Definition: loss_layer.hpp:23
virtual Dtype get_normalizer(LossParameter_NormalizationMode normalization_mode, int valid_count)
Definition: infogain_loss_layer.cpp:85
virtual int MinBottomBlobs() const
Returns the minimum number of bottom blobs required by the layer, or -1 if no minimum number is requi...
Definition: infogain_loss_layer.hpp:61
virtual void Reshape(const vector< Blob< Dtype > *> &bottom, const vector< Blob< Dtype > *> &top)
Adjust the shapes of top blobs and internal buffers to accommodate the shapes of the bottom blobs...
Definition: infogain_loss_layer.cpp:51
A wrapper around SyncedMemory holders serving as the basic computational unit through which Layers...
Definition: blob.hpp:24