13 #define cimg_use_lapack
15 #include "cudamat.cuh"
17 #include <google/protobuf/text_format.h>
18 #include "convnet_config.pb.h"
33 string GetStringError(
int err_code);
35 void ReadModel(
const string& model_file, config::Model& model);
36 void ReadModelText(
const string& model_file, config::Model& model);
37 void ReadDataConfig(
const string& data_config_file, config::DatasetConfig& data_config);
38 void ReadLayerConfig(
const string& layer_config_file, config::Layer& layer_config);
39 void WriteModelBinary(
const string& output_file,
const config::Model& model);
40 void ReadModelBinary(
const string& input_file, config::Model& model);
41 void WriteHDF5CPU(hid_t file,
float* mat,
int rows,
int cols,
const string& name);
42 void ReadHDF5IntAttr(hid_t file,
const string& name,
int* val);
43 void WriteHDF5IntAttr(hid_t file,
const string& name,
const int* val);
46 void ReadHDF5CPU(hid_t file,
float* mat,
int size,
const string& name);
47 void ReadHDF5Shape(hid_t file,
const string& name,
int* rows,
int* cols);
48 void ReadHDF5ShapeFromFile(
const string& file_name,
const string& dataset_name,
int* rows,
int* cols);
50 void SetupBackTraceHandler();
52 int Bound(
int val,
int lb,
int ub);
53 string GetTimeStamp();
54 void TimestampModelFile(
const string& src_file,
const string& dest_file,
const string& timestamp);
56 bool ReadLines(
const string& filename, vector<string>& lines);
62 ImageDisplayer(
int width,
int height,
int num_colors,
bool show_separate,
const string& name);
64 void SetTitle(
const string& title) {title_ = title;}
65 void DisplayImage(
float* data,
int spacing,
int image_id);
66 void DisplayWeights(
float* data,
int size,
int num_filters,
int display_size,
bool yuv =
false);
69 CImgDisplay* main_disp, *disp;
71 static void YUVToRGB(
const float* yuv,
float* rgb,
int spacing);
72 static void RGBToYUV(
const float* rgb,
float* yuv,
int spacing);
75 int width, height, num_colors;