#include <keras_model.h>
Definition at line 214 of file keras_model.h.
keras::KerasModel::KerasModel |
( |
const std::string & |
input_fname | ) |
|
Definition at line 116 of file keras_model.cc.
void load_weights(const std::string &input_fname)
keras::KerasModel::~KerasModel |
( |
| ) |
|
Definition at line 400 of file keras_model.cc.
416 if (inp != dc)
delete inp;
424 std::vector<float> flat_out = out->
get_1d();
std::vector< Layer * > m_layers
virtual std::vector< float > const & get_1d() const
unsigned int keras::KerasModel::get_input_cols |
( |
| ) |
const |
|
inline |
Definition at line 221 of file keras_model.h.
221 {
return m_layers.front()->get_input_cols(); }
std::vector< Layer * > m_layers
unsigned int keras::KerasModel::get_input_rows |
( |
| ) |
const |
|
inline |
Definition at line 220 of file keras_model.h.
220 {
return m_layers.front()->get_input_rows(); }
std::vector< Layer * > m_layers
int keras::KerasModel::get_output_length |
( |
| ) |
const |
Definition at line 475 of file keras_model.cc.
478 while ((i > 0) && (
m_layers[i]->get_output_units() == 0)) --i;
479 return m_layers[i]->get_output_units();
std::vector< Layer * > m_layers
void keras::KerasModel::load_weights |
( |
const std::string & |
input_fname | ) |
|
|
private |
Definition at line 430 of file keras_model.cc.
431 cout <<
"Reading model from " << input_fname <<
endl;
432 ifstream fin(input_fname.c_str());
433 string layer_type =
"";
438 cout <<
"Layers " << m_layers_cnt <<
endl;
441 fin >> tmp_str >> tmp_int >> layer_type;
442 cout <<
"Layer " << tmp_int <<
" " << layer_type <<
endl;
445 if(layer_type ==
"Convolution2D") {
446 l =
new LayerConv2D();
447 }
else if(layer_type ==
"Activation") {
448 l =
new LayerActivation();
449 }
else if(layer_type ==
"MaxPooling2D") {
450 l =
new LayerMaxPooling();
451 }
else if(layer_type ==
"Flatten") {
452 l =
new LayerFlatten();
453 }
else if(layer_type ==
"Dense") {
454 l =
new LayerDense();
455 }
else if(layer_type ==
"Dropout") {
459 cout <<
"Layer is empty, maybe it is not defined? Cannot define network." <<
endl;
462 l->load_weights(fin);
std::vector< Layer * > m_layers
QTextStream & endl(QTextStream &s)
int keras::KerasModel::m_layers_cnt |
|
private |
The documentation for this class was generated from the following files: