1
0
mirror of https://github.com/opencv/opencv_contrib.git synced 2025-10-23 18:09:25 +08:00

Added possibility of getting any intermediate blob with thrifty memory management

This commit is contained in:
Aleksandr Rybnikov
2017-06-13 16:23:01 +03:00
committed by Maksim Shabunin
parent b18e35793a
commit aa0d8060de
18 changed files with 351 additions and 206 deletions

View File

@@ -73,32 +73,19 @@ int main(int argc, char **argv)
//! [Prepare blob]
//! [Set input blob]
net.setBlob("", inputBlob); //set the network input
net.setInput(inputBlob, ""); //set the network input
//! [Set input blob]
const int N = 3;
TickMeter tm;
//! [Make forward pass]
for( int i = 0; i < N; i++ )
{
TickMeter tm_;
tm_.start();
net.forward(); //compute output
tm_.stop();
if( i == 0 || tm_.getTimeTicks() < tm.getTimeTicks() )
tm = tm_;
}
//! [Gather output]
String oBlob = net.getLayerNames().back();
if (!parser.get<String>("o_blob").empty())
{
oBlob = parser.get<String>("o_blob");
}
Mat result = net.getBlob(oBlob); //gather output of "prob" layer
//! [Make forward pass]
Mat result = net.forward(oBlob);
if (!resultFile.empty()) {
CV_Assert(result.isContinuous());