@@ -317,11 +317,44 @@ OCL_TEST(Test_TensorFlow, MobileNet_SSD)
317
317
std::vector<Mat> output;
318
318
net.forward (output, outNames);
319
319
320
- normAssert (target[0 ].reshape (1 , 1 ), output[0 ].reshape (1 , 1 ), " " , 1e-5 , 1.5e-4 );
320
+ normAssert (target[0 ].reshape (1 , 1 ), output[0 ].reshape (1 , 1 ));
321
321
normAssert (target[1 ].reshape (1 , 1 ), output[1 ].reshape (1 , 1 ), " " , 1e-5 , 3e-4 );
322
322
normAssert (target[2 ].reshape (1 , 1 ), output[2 ].reshape (1 , 1 ), " " , 4e-5 , 1e-2 );
323
323
}
324
324
325
+ OCL_TEST (Test_TensorFlow, Inception_v2_SSD)
326
+ {
327
+ std::string proto = findDataFile (" dnn/ssd_inception_v2_coco_2017_11_17.pbtxt" , false );
328
+ std::string model = findDataFile (" dnn/ssd_inception_v2_coco_2017_11_17.pb" , false );
329
+
330
+ Net net = readNetFromTensorflow (model, proto);
331
+ Mat img = imread (findDataFile (" dnn/street.png" , false ));
332
+ Mat blob = blobFromImage (img, 1 .0f / 127.5 , Size (300 , 300 ), Scalar (127.5 , 127.5 , 127.5 ), true , false );
333
+
334
+ net.setPreferableBackend (DNN_BACKEND_DEFAULT);
335
+ net.setPreferableTarget (DNN_TARGET_OPENCL);
336
+
337
+ net.setInput (blob);
338
+ // Output has shape 1x1xNx7 where N - number of detections.
339
+ // An every detection is a vector of values [id, classId, confidence, left, top, right, bottom]
340
+ Mat out = net.forward ();
341
+ out = out.reshape (1 , out.total () / 7 );
342
+
343
+ Mat detections;
344
+ for (int i = 0 ; i < out.rows ; ++i)
345
+ {
346
+ if (out.at <float >(i, 2 ) > 0.5 )
347
+ detections.push_back (out.row (i).colRange (1 , 7 ));
348
+ }
349
+
350
+ Mat ref = (Mat_<float >(5 , 6 ) << 1 , 0.90176028 , 0.19872092 , 0.36311883 , 0.26461923 , 0.63498729 ,
351
+ 3 , 0.93569964 , 0.64865261 , 0.45906419 , 0.80675775 , 0.65708131 ,
352
+ 3 , 0.75838411 , 0.44668293 , 0.45907149 , 0.49459291 , 0.52197015 ,
353
+ 10 , 0.95932811 , 0.38349164 , 0.32528657 , 0.40387636 , 0.39165527 ,
354
+ 10 , 0.93973452 , 0.66561931 , 0.37841269 , 0.68074018 , 0.42907384 );
355
+ normAssert (detections, ref);
356
+ }
357
+
325
358
TEST (Test_TensorFlow, lstm)
326
359
{
327
360
runTensorFlowNet (" lstm" , DNN_TARGET_CPU, true );
0 commit comments