13 #include "larrecodnn/ImagePatternAlgs/ToolInterfaces/IPointIdAlg.h" 26 std::vector<float>
Run(
std::vector<std::vector<float>>
const& inp2d)
const override;
28 int samples = -1)
const override;
31 std::unique_ptr<keras::KerasModel>
m;
33 std::string
findFile(
const char* fileName)
const;
40 fNNetOutputs = config.NNetOutputs();
41 fPatchSizeW = config.PatchSizeW();
42 fPatchSizeD = config.PatchSizeD();
43 fCurrentWireIdx = 99999;
44 fCurrentScaledDrift = 99999;
56 mf::LogInfo(
"PointIdAlgKeras") <<
"Keras model loaded.";
59 mf::LogError(
"PointIdAlgKeras") <<
"File name extension not supported.";
68 std::string fname_out;
69 cet::search_path sp(
"FW_SEARCH_PATH");
70 if (!sp.find_file(fileName, fname_out)) {
72 if (stat(fileName, &buffer) == 0) { fname_out = fileName; }
83 std::vector<std::vector<std::vector<float>>> inp3d;
84 inp3d.push_back(inp2d);
88 return m->compute_output(&sample);
97 if ((samples == 0) || inps.empty() || inps.front().empty() || inps.front().front().empty()) {
98 return std::vector<std::vector<float>>();
101 if ((samples == -1) || (samples > (
long long int)inps.size())) { samples = inps.size(); }
103 std::vector<std::vector<float>> out;
105 for (
long long int s = 0; s < samples; ++s) {
106 std::vector<std::vector<std::vector<float>>> inp3d;
107 inp3d.push_back(inps[s]);
111 out.push_back(
m->compute_output(sample));
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
virtual void set_data(std::vector< std::vector< std::vector< float >>> const &)
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
virtual void set_data(std::vector< std::vector< std::vector< float >>> const &d)
map< int, array< map< int, double >, 2 >> Table