1 #ifndef CAFFE_ACCURACY_LAYER_HPP_
2 #define CAFFE_ACCURACY_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"
18 template <
typename Dtype>
30 :
Layer<Dtype>(param) {}
36 virtual inline const char*
type()
const {
return "Accuracy"; }
77 const vector<bool>& propagate_down,
const vector<
Blob<Dtype>*>& bottom) {
78 for (
int i = 0; i < propagate_down.size(); ++i) {
79 if (propagate_down[i]) { NOT_IMPLEMENTED; }
83 const vector<bool>& propagate_down,
const vector<
Blob<Dtype>*>& bottom);
85 int label_axis_, outer_num_, inner_num_;
99 #endif // CAFFE_ACCURACY_LAYER_HPP_
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: accuracy_layer.cpp:11
Blob< Dtype > nums_buffer_
Keeps counts of the number of samples per class.
Definition: accuracy_layer.hpp:94
virtual void Forward_gpu(const vector< Blob< Dtype > * > &bottom, const vector< Blob< Dtype > * > &top)
Using the GPU device, compute the layer output. Fall back to Forward_cpu() if unavailable.
virtual int ExactNumBottomBlobs() const
Returns the exact number of bottom blobs required by the layer, or -1 if no exact number is required.
Definition: accuracy_layer.hpp:37
bool has_ignore_label_
Whether to ignore instances with a certain label.
Definition: accuracy_layer.hpp:90
virtual int MinTopBlobs() const
Returns the minimum number of top blobs required by the layer, or -1 if no minimum number is required...
Definition: accuracy_layer.hpp:41
A wrapper around SyncedMemory holders serving as the basic computational unit through which Layers,...
Definition: blob.hpp:24
virtual void Forward_cpu(const vector< Blob< Dtype > * > &bottom, const vector< Blob< Dtype > * > &top)
Definition: accuracy_layer.cpp:48
An interface for the units of computation which can be composed into a Net.
Definition: layer.hpp:33
AccuracyLayer(const LayerParameter ¶m)
Definition: accuracy_layer.hpp:29
virtual void Backward_cpu(const vector< Blob< Dtype > * > &top, const vector< bool > &propagate_down, const vector< Blob< Dtype > * > &bottom)
Not implemented – AccuracyLayer cannot be used as a loss.
Definition: accuracy_layer.hpp:76
Computes the classification accuracy for a one-of-many classification task.
Definition: accuracy_layer.hpp:19
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: accuracy_layer.cpp:23
virtual int MaxTopBlobs() const
Returns the maximum number of top blobs required by the layer, or -1 if no maximum number is required...
Definition: accuracy_layer.hpp:42
virtual void Backward_gpu(const vector< Blob< Dtype > * > &top, const vector< bool > &propagate_down, const vector< Blob< Dtype > * > &bottom)
Using the GPU device, compute the gradients for any parameters and for the bottom blobs if propagate_...
virtual const char * type() const
Returns the layer type.
Definition: accuracy_layer.hpp:36
A layer factory that allows one to register layers. During runtime, registered layers can be called b...
Definition: blob.hpp:14
int ignore_label_
The label indicating that an instance should be ignored.
Definition: accuracy_layer.hpp:92