5 #include "datahandler.h"
19 ConvNet(
const string& model_file);
21 void SetupDataset(
const string& train_data_config_file);
22 virtual void SetupDataset(
const string& train_data_config_file,
const string& val_data_config_file);
31 void Validate(
DataHandler* dataset, vector<float>& error);
36 void Validate(vector<float>& error);
42 void Save(
const string& output_file);
48 void Load(
const string& input_file);
63 void DumpOutputs(
const string& output_file,
DataHandler* dataset,
const vector<string>& layer_names);
72 void DumpOutputs(
const string& output_file,
const vector<string>& layer_names);
77 void AllocateMemory(
bool fprop_only);
87 void AllocateLayerMemory();
92 void AllocateEdgeMemory(
bool fprop_only);
94 string GetCheckpointFilename();
95 void TimestampModel();
107 void Fprop(
Layer& input,
Layer& output,
Edge& edge,
bool overwrite);
119 virtual void Bprop(
Layer& output,
Layer& input,
Edge& edge,
bool overwrite,
bool update_weights);
126 virtual void Fprop(
bool train);
129 virtual void Bprop(
bool update_weights);
132 virtual void ComputeDeriv();
135 virtual void GetLoss(vector<float>& error);
144 void DumpOutputs(
const string& output_file,
DataHandler* dataset, vector<Layer*>& layers) ;
148 virtual void TrainOneBatch(vector<float>& error);
149 void DisplayLayers();
152 void LoadPolyakWeights();
153 void LoadCurrentWeights();
154 void WriteLog(
int current_iter,
float time,
float training_error);
155 void WriteLog(
int current_iter,
float time,
const vector<float>& training_error);
156 void WriteValLog(
int current_iter,
const vector<float>& error);
157 Layer* GetLayerByName(
const string& name);
160 bool CheckReduceLearningRate(
const vector<float>& val_error);
163 void ReduceLearningRate(
const float factor);
165 config::Model model_;
171 int max_iter_, batch_size_, current_iter_, lr_reduce_counter_;
173 string checkpoint_dir_, output_file_, model_name_;
175 string model_filename_, timestamp_, log_file_, val_log_file_;
178 static void AddVectors(vector<float>& a, vector<float>& b);
The base class for all layers.
Definition: layer.h:9
vector< Layer * > output_layers_
Input layers.
Definition: convnet.h:169
vector< Layer * > data_layers_
The layers in the network.
Definition: convnet.h:167
This class is intended to be used as a base class for implementing edges.
Definition: edge.h:13
A Convolutional Net Model.
Definition: convnet.h:14
vector< Layer * > input_layers_
Layers which have data associated with them.
Definition: convnet.h:168
vector< Edge * > edges_
Output layers.
Definition: convnet.h:170
int max_iter_
The edges in the network.
Definition: convnet.h:171
Makes data accessible to the model.
Definition: datahandler.h:14
vector< Layer * > layers_
The model protobuf config.
Definition: convnet.h:166