1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 00:03:03 +04:00

Added function to get timings for layers

This commit is contained in:
Aleksandr Rybnikov
2017-08-02 17:27:58 +03:00
parent da0a36c323
commit 8b1146deb2
5 changed files with 98 additions and 52 deletions
@@ -101,17 +101,18 @@ int main(int argc, char** argv)
//! [Prepare blob]
//! [Set input blob]
net.setInput(inputBlob, "data"); //set the network input
net.setInput(inputBlob, "data"); //set the network input
//! [Set input blob]
TickMeter tm;
tm.start();
//! [Make forward pass]
Mat detection = net.forward("detection_out"); //compute output
tm.stop();
cout << "Inference time, ms: " << tm.getTimeMilli() << endl;
Mat detection = net.forward("detection_out"); //compute output
//! [Make forward pass]
std::vector<double> layersTimings;
double freq = getTickFrequency() / 1000;
double time = net.getPerfProfile(layersTimings) / freq;
cout << "Inference time, ms: " << time << endl;
Mat detectionMat(detection.size[2], detection.size[3], CV_32F, detection.ptr<float>());
frame = frame(crop);