@@ -403,6 +403,108 @@ TEST(TestAgeGenderIE, GenericInfer)
403
403
normAssert (cv::gapi::ie::util::to_ocv (ie_gender), gapi_gender, " Test gender output" );
404
404
}
405
405
406
+ TEST (TestAgeGenderIE, InvalidConfigGeneric)
407
+ {
408
+ initDLDTDataPath ();
409
+
410
+ std::string model_path = findDataFile (SUBDIR + " age-gender-recognition-retail-0013.xml" );
411
+ std::string weights_path = findDataFile (SUBDIR + " age-gender-recognition-retail-0013.bin" );
412
+ std::string device_id = " CPU" ;
413
+
414
+ // Configure & run G-API
415
+ cv::GMat in;
416
+ GInferInputs inputs;
417
+ inputs[" data" ] = in;
418
+
419
+ auto outputs = cv::gapi::infer<cv::gapi::Generic>(" age-gender-generic" , inputs);
420
+ auto age = outputs.at (" age_conv3" );
421
+ auto gender = outputs.at (" prob" );
422
+ cv::GComputation comp (cv::GIn (in), cv::GOut (age, gender));
423
+
424
+ auto pp = cv::gapi::ie::Params<cv::gapi::Generic>{" age-gender-generic" ,
425
+ model_path,
426
+ weights_path,
427
+ device_id}.pluginConfig ({{" unsupported_config" , " some_value" }});
428
+
429
+ EXPECT_ANY_THROW (comp.compile (cv::GMatDesc{CV_8U,3 ,cv::Size {320 , 240 }},
430
+ cv::compile_args (cv::gapi::networks (pp))));
431
+ }
432
+
433
+ TEST (TestAgeGenderIE, CPUConfigGeneric)
434
+ {
435
+ initDLDTDataPath ();
436
+
437
+ std::string model_path = findDataFile (SUBDIR + " age-gender-recognition-retail-0013.xml" );
438
+ std::string weights_path = findDataFile (SUBDIR + " age-gender-recognition-retail-0013.bin" );
439
+ std::string device_id = " CPU" ;
440
+
441
+ // Configure & run G-API
442
+ cv::GMat in;
443
+ GInferInputs inputs;
444
+ inputs[" data" ] = in;
445
+
446
+ auto outputs = cv::gapi::infer<cv::gapi::Generic>(" age-gender-generic" , inputs);
447
+ auto age = outputs.at (" age_conv3" );
448
+ auto gender = outputs.at (" prob" );
449
+ cv::GComputation comp (cv::GIn (in), cv::GOut (age, gender));
450
+
451
+ auto pp = cv::gapi::ie::Params<cv::gapi::Generic>{" age-gender-generic" ,
452
+ model_path,
453
+ weights_path,
454
+ device_id}.pluginConfig ({{" ENFORCE_BF16" , " NO" }});
455
+
456
+ EXPECT_NO_THROW (comp.compile (cv::GMatDesc{CV_8U,3 ,cv::Size {320 , 240 }},
457
+ cv::compile_args (cv::gapi::networks (pp))));
458
+ }
459
+
460
+ TEST (TestAgeGenderIE, InvalidConfig)
461
+ {
462
+ initDLDTDataPath ();
463
+
464
+ std::string model_path = findDataFile (SUBDIR + " age-gender-recognition-retail-0013.xml" );
465
+ std::string weights_path = findDataFile (SUBDIR + " age-gender-recognition-retail-0013.bin" );
466
+ std::string device_id = " CPU" ;
467
+
468
+ using AGInfo = std::tuple<cv::GMat, cv::GMat>;
469
+ G_API_NET (AgeGender, <AGInfo (cv::GMat)>, " test-age-gender" );
470
+
471
+ cv::GMat in;
472
+ cv::GMat age, gender;
473
+ std::tie (age, gender) = cv::gapi::infer<AgeGender>(in);
474
+ cv::GComputation comp (cv::GIn (in), cv::GOut (age, gender));
475
+
476
+ auto pp = cv::gapi::ie::Params<AgeGender> {
477
+ model_path, weights_path, device_id
478
+ }.cfgOutputLayers ({ " age_conv3" , " prob" }).pluginConfig ({{" unsupported_config" , " some_value" }});
479
+
480
+ EXPECT_ANY_THROW (comp.compile (cv::GMatDesc{CV_8U,3 ,cv::Size {320 , 240 }},
481
+ cv::compile_args (cv::gapi::networks (pp))));
482
+ }
483
+
484
+ TEST (TestAgeGenderIE, CPUConfig)
485
+ {
486
+ initDLDTDataPath ();
487
+
488
+ std::string model_path = findDataFile (SUBDIR + " age-gender-recognition-retail-0013.xml" );
489
+ std::string weights_path = findDataFile (SUBDIR + " age-gender-recognition-retail-0013.bin" );
490
+ std::string device_id = " CPU" ;
491
+
492
+ using AGInfo = std::tuple<cv::GMat, cv::GMat>;
493
+ G_API_NET (AgeGender, <AGInfo (cv::GMat)>, " test-age-gender" );
494
+
495
+ cv::GMat in;
496
+ cv::GMat age, gender;
497
+ std::tie (age, gender) = cv::gapi::infer<AgeGender>(in);
498
+ cv::GComputation comp (cv::GIn (in), cv::GOut (age, gender));
499
+
500
+ auto pp = cv::gapi::ie::Params<AgeGender> {
501
+ model_path, weights_path, device_id
502
+ }.cfgOutputLayers ({ " age_conv3" , " prob" }).pluginConfig ({{" ENFORCE_BF16" , " NO" }});
503
+
504
+ EXPECT_NO_THROW (comp.compile (cv::GMatDesc{CV_8U,3 ,cv::Size {320 , 240 }},
505
+ cv::compile_args (cv::gapi::networks (pp))));
506
+ }
507
+
406
508
} // namespace opencv_test
407
509
408
510
#endif // HAVE_INF_ENGINE
0 commit comments