TFNetHandler.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file TFNetHandler.h
3 /// \brief TFNetHandler for CVN
4 /// \author Leigh Whitehead
5 ////////////////////////////////////////////////////////////////////////
6 
7 #ifndef CVN_TFNETHANDLER_H
8 #define CVN_TFNETHANDLER_H
9 
10 #include <vector>
11 #include <memory>
12 
15 #include "fhiclcpp/ParameterSet.h"
17 
18 namespace cvn
19 {
20 
21  /// Wrapper for caffe::Net which handles construction and prediction
23  {
24  public:
25 
26  /// Constructor which takes a pset with DeployProto and ModelFile fields
27  TFNetHandler(const fhicl::ParameterSet& pset);
28 
29  /// Number of outputs in neural net
30  int NOutput() const;
31 
32  /// Number of outputs in neural net
33  int NFeatures() const;
34 
35  /// Return prediction arrays for PixelMap
36  std::vector< std::vector<float> > Predict(const PixelMap& pm);
37 
38  /// Return four element vector with summed numu, nue, nutau and NC elements
39  std::vector<float> PredictFlavour(const PixelMap& pm);
40 
41  private:
42 
43  std::string fLibPath; ///< Library path (typically dune_pardata...)
44  std::string fTFProtoBuf; ///< location of the tf .pb file in the above path
45  bool fUseLogChargeScale; ///< Is the charge using a log scale?
46  unsigned int fImageWires; ///< Number of wires for the network to classify
47  unsigned int fImageTDCs; ///< Number of tdcs for the network to classify
48  std::vector<bool> fReverseViews; ///< Do we need to reverse any views?
49  std::unique_ptr<tf::Graph> fTFGraph; ///< Tensorflow graph
50 
51  };
52 
53 }
54 
55 #endif // CVN_TFNETHANDLER_H
TFNetHandler(const fhicl::ParameterSet &pset)
Constructor which takes a pset with DeployProto and ModelFile fields.
std::vector< std::vector< float > > Predict(const PixelMap &pm)
Return prediction arrays for PixelMap.
std::string string
Definition: nybbler.cc:12
Wrapper for caffe::Net which handles construction and prediction.
Definition: TFNetHandler.h:22
unsigned int fImageWires
Number of wires for the network to classify.
Definition: TFNetHandler.h:46
int NOutput() const
Number of outputs in neural net.
PixelMap for CVN.
Utility class for truth labels.
std::unique_ptr< tf::Graph > fTFGraph
Tensorflow graph.
Definition: TFNetHandler.h:49
int NFeatures() const
Number of outputs in neural net.
unsigned int fImageTDCs
Number of tdcs for the network to classify.
Definition: TFNetHandler.h:47
std::vector< float > PredictFlavour(const PixelMap &pm)
Return four element vector with summed numu, nue, nutau and NC elements.
std::string fLibPath
Library path (typically dune_pardata...)
Definition: TFNetHandler.h:43
bool fUseLogChargeScale
Is the charge using a log scale?
Definition: TFNetHandler.h:45
std::vector< bool > fReverseViews
Do we need to reverse any views?
Definition: TFNetHandler.h:48
PixelMap, basic input to CVN neural net.
Definition: PixelMap.h:22
std::string fTFProtoBuf
location of the tf .pb file in the above path
Definition: TFNetHandler.h:44