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"
48 template <
typename Dtype>
71 virtual inline const char*
type()
const {
return "InfogainLoss"; }
111 const vector<bool>& propagate_down,
const vector<
Blob<Dtype>*>& bottom);
118 LossParameter_NormalizationMode normalization_mode,
int valid_count);
141 int infogain_axis_, outer_num_, inner_num_, num_labels_;
146 #endif // CAFFE_INFOGAIN_LOSS_LAYER_HPP_
Blob< Dtype > prob_
prob stores the output probability predictions from the SoftmaxLayer.
Definition: infogain_loss_layer.hpp:125
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:63
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:62
LossParameter_NormalizationMode normalization_
How to normalize the output loss.
Definition: infogain_loss_layer.hpp:139
virtual const char * type() const
Returns the layer type.
Definition: infogain_loss_layer.hpp:71
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:69
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
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:127
int ignore_label_
The label indicating that an instance should be ignored.
Definition: infogain_loss_layer.hpp:137
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
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:61
A wrapper around SyncedMemory holders serving as the basic computational unit through which Layers,...
Definition: blob.hpp:24
vector< Blob< Dtype > * > softmax_top_vec_
top vector holder used in call to the underlying SoftmaxLayer::Forward
Definition: infogain_loss_layer.hpp:129
An interface for Layers that take two Blobs as input – usually (1) predictions and (2) ground-truth l...
Definition: loss_layer.hpp:23
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:67
virtual void sum_rows_of_H(const Blob< Dtype > *H)
fill sum_rows_H_ according to matrix H
Definition: infogain_loss_layer.cpp:115
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:68
A generalization of SoftmaxWithLossLayer that takes an "information gain" (infogain) matrix specifyin...
Definition: infogain_loss_layer.hpp:49
virtual void Forward_cpu(const vector< Blob< Dtype > * > &bottom, const vector< Blob< Dtype > * > &top)
A generalization of SoftmaxWithLossLayer that takes an "information gain" (infogain) matrix specifyin...
Definition: infogain_loss_layer.cpp:129
shared_ptr< Layer< Dtype > > softmax_layer_
The internal SoftmaxLayer used to map predictions to a distribution.
Definition: infogain_loss_layer.hpp:123
virtual Dtype get_normalizer(LossParameter_NormalizationMode normalization_mode, int valid_count)
Definition: infogain_loss_layer.cpp:85
A layer factory that allows one to register layers. During runtime, registered layers can be called b...
Definition: blob.hpp:14
bool has_ignore_label_
Whether to ignore instances with a certain label.
Definition: infogain_loss_layer.hpp:135