1 #ifndef MTF_NET_UTILS_H 2 #define MTF_NET_UTILS_H 4 #include <caffe/layers/memory_data_layer.hpp> 5 #include "mtf/Macros/common.h" 6 #include <caffe/caffe.hpp> 8 #include <opencv2/core/core.hpp> 9 #include <opencv2/highgui/highgui.hpp> 10 #include <opencv2/imgproc/imgproc.hpp> 13 #include "boost/scoped_ptr.hpp" 14 #include "caffe/util/db.hpp" 15 #include "caffe/util/io.hpp" 16 #include "mtf/SM/RegNetParams.h" 18 using boost::scoped_ptr;
19 using namespace caffe;
27 MTFNet(RegNetParams _rgparams);
29 boost::shared_ptr<caffe::Net<float> > net_;
30 boost::shared_ptr<caffe::Solver<float > > solver_;
31 cv::Size input_geometry_;
33 cv::Scalar channel_mean_;
35 RegNetParams rgparams;
39 void getGPUs(vector<int>* gpus);
43 void preprocessBatch(std::vector<cv::Mat>& batch);
46 void extractBatch(
int bs,
int bi, std::vector<cv::Mat> t_data, std::vector<cv::Mat> t_labels, std::vector<cv::Mat> &t_data_b, std::vector<cv::Mat> &t_labels_b);
52 MTFNet *
createNetwork(RegNetParams rgparams,
char *conv_model =
nullptr,
char *last_conv_layer =
nullptr,
53 int n_layers = 2,
int *n_neurons =
nullptr,
char *activ_fn =
nullptr);
59 void train(
MTFNet *network, std::vector<cv::Mat> training_data, std::vector<cv::Mat> training_labels);
MTFNet * createNetwork(RegNetParams rgparams, char *conv_model=nullptr, char *last_conv_layer=nullptr, int n_layers=2, int *n_neurons=nullptr, char *activ_fn=nullptr)
Creates Network with first conv layers from conv_model till name of last_conv_layer.
void testingInputBlobs(boost::shared_ptr< caffe::Net< float > > net_)
Tests the Input Blobs and shows images and Label.
void train(MTFNet *network, std::vector< cv::Mat > training_data, std::vector< cv::Mat > training_labels)
Train the network with training_data and labels as input.
float * forwardPass(MTFNet *network, cv::Mat patch)
Forward Pass the patch into the network after being resized to image_size.
basic functions for preprocessing the raw input image using filtering, resizing and histogram equaliz...
Definition: histUtils.h:20
Definition: netUtils.h:24