Public Member Functions | Private Attributes | List of all members
nnet::KerasModelInterface Class Reference

#include <PointIdAlg.h>

Inheritance diagram for nnet::KerasModelInterface:
nnet::ModelInterface

Public Member Functions

 KerasModelInterface (const char *modelFileName)
 
std::vector< float > Run (std::vector< std::vector< float >> const &inp2d) override
 
- Public Member Functions inherited from nnet::ModelInterface
virtual ~ModelInterface ()
 
virtual std::vector< std::vector< float > > Run (std::vector< std::vector< std::vector< float >>> const &inps, int samples=-1)
 

Private Attributes

keras::KerasModel m
 

Additional Inherited Members

- Protected Member Functions inherited from nnet::ModelInterface
std::string findFile (const char *fileName) const
 

Detailed Description

Definition at line 64 of file PointIdAlg.h.

Constructor & Destructor Documentation

nnet::KerasModelInterface::KerasModelInterface ( const char *  modelFileName)

Definition at line 67 of file PointIdAlg.cxx.

68  : m(nnet::ModelInterface::findFile(modelFileName).c_str())
69 {
70  mf::LogInfo("KerasModelInterface") << "Keras model loaded.";
71 }
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
keras::KerasModel m
Definition: PointIdAlg.h:71
std::string findFile(const char *fileName) const
Definition: PointIdAlg.cxx:49

Member Function Documentation

std::vector< float > nnet::KerasModelInterface::Run ( std::vector< std::vector< float >> const &  inp2d)
overridevirtual

Implements nnet::ModelInterface.

Definition at line 75 of file PointIdAlg.cxx.

76 {
77  std::vector<std::vector<std::vector<float>>> inp3d;
78  inp3d.push_back(inp2d); // lots of copy, should add 2D to keras...
79 
80  keras::DataChunk* sample = new keras::DataChunk2D();
81  sample->set_data(inp3d); // and more copy...
82  std::vector<float> out = m.compute_output(sample);
83  delete sample;
84  return out;
85 }
virtual void set_data(std::vector< std::vector< std::vector< float > > > const &)
Definition: keras_model.h:47
std::vector< float > compute_output(keras::DataChunk *dc)
Definition: keras_model.cc:400
keras::KerasModel m
Definition: PointIdAlg.h:71

Member Data Documentation

keras::KerasModel nnet::KerasModelInterface::m
private

Definition at line 71 of file PointIdAlg.h.


The documentation for this class was generated from the following files: