mirror of
https://github.com/opencv/opencv.git
synced 2024-12-16 18:39:12 +08:00
f0c411d8b5
* G-API: Introduce a new gapi::infer2 overload + gaze estimation sample * G-API/infer2: Introduced static type checking for infer2 - Also added extra tests on the type check routine * G-API/infer2: Addressed self-review comments in the sample app - Also fix build on Linux; * G-API/infer2: Remove incorrect SetLayout(HWC) + dead code - Also fixed comments in the backend * G-API/infer2: Continue with self-review - Fix warnings/compile errors in gaze estimation - Dropped the use of RTTI (VectorRef::holds()) from the giebackend - Replaced it with a trait-based enums for GArray<T> and std::vector<T> - The enums and traits are temporary and need to be unified with the S11N when it comes * G-API/infer2: Final self-review items - Refactored ROIList test to cover 70% for infer<> and infer2<>; - Fixed the model data discovery routine to be compatible with new OpenVINO; - Hopefully fixed the final issues (warnings) with the sample. * G-API/infer2: address review problems - Fixed typo in comments; - Fixed public (Doxygen) comment on GArray<GMat> input case for infer2; - Made model lookup more flexible to allow new & old OMZ dir layouts. * G-API/infer2: Change the model paths again * G-API/infer2: Change the lookup path for test data * G-API/infer2: use randu instead of imread. CI war is over
80 lines
3.2 KiB
C++
80 lines
3.2 KiB
C++
// This file is part of OpenCV project.
|
|
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
|
// of this distribution and at http://opencv.org/license.html.
|
|
//
|
|
// Copyright (C) 2020 Intel Corporation
|
|
|
|
#include "../test_precomp.hpp"
|
|
|
|
// These tests verify some parts of cv::gapi::infer<> API
|
|
// regardless of the backend used
|
|
|
|
namespace opencv_test {
|
|
namespace {
|
|
template<class A, class B> using Check = cv::detail::valid_infer2_types<A, B>;
|
|
|
|
TEST(Infer, ValidInfer2Types)
|
|
{
|
|
// Compiled == passed!
|
|
|
|
// Argument block 1
|
|
static_assert(Check< std::tuple<cv::GMat> // Net
|
|
, std::tuple<cv::GMat> > // Call
|
|
::value == true, "Must work");
|
|
|
|
static_assert(Check< std::tuple<cv::GMat, cv::GMat> // Net
|
|
, std::tuple<cv::GMat, cv::GMat> > // Call
|
|
::value == true, "Must work");
|
|
|
|
// Argument block 2
|
|
static_assert(Check< std::tuple<cv::GMat> // Net
|
|
, std::tuple<cv::Rect> > // Call
|
|
::value == true, "Must work");
|
|
|
|
static_assert(Check< std::tuple<cv::GMat, cv::GMat> // Net
|
|
, std::tuple<cv::Rect, cv::Rect> > // Call
|
|
::value == true, "Must work");
|
|
|
|
// Argument block 3 (mixed cases)
|
|
static_assert(Check< std::tuple<cv::GMat, cv::GMat> // Net
|
|
, std::tuple<cv::GMat, cv::Rect> > // Call
|
|
::value == true, "Must work");
|
|
|
|
static_assert(Check< std::tuple<cv::GMat, cv::GMat> // Net
|
|
, std::tuple<cv::Rect, cv::GMat> > // Call
|
|
::value == true, "Must work");
|
|
|
|
// Argument block 4 (super-mixed)
|
|
static_assert(Check< std::tuple<cv::GMat, cv::GMat, cv::GMat> // Net
|
|
, std::tuple<cv::Rect, cv::GMat, cv::Rect> > // Call
|
|
::value == true, "Must work");
|
|
|
|
// Argument block 5 (mainly negative)
|
|
static_assert(Check< std::tuple<cv::GMat> // Net
|
|
, std::tuple<int> > // Call
|
|
::value == false, "This type(s) shouldn't pass");
|
|
|
|
static_assert(Check< std::tuple<cv::GMat, cv::GMat> // Net
|
|
, std::tuple<int, cv::Rect> > // Call
|
|
::value == false, "This type(s) shouldn't pass");
|
|
|
|
static_assert(Check< std::tuple<cv::GMat, cv::GMat> // Net
|
|
, std::tuple<cv::Rect, cv::Point> >// Call
|
|
::value == false, "This type(s) shouldn't pass");
|
|
|
|
// Argument block 5 (wrong args length)
|
|
static_assert(Check< std::tuple<cv::GMat, cv::GMat> // Net
|
|
, std::tuple<cv::GMat> > // Call
|
|
::value == false, "Should fail -- not enough args");
|
|
|
|
static_assert(Check< std::tuple<cv::GMat, cv::GMat> // Net
|
|
, std::tuple<cv::Rect> > // Call
|
|
::value == false, "Should fail -- not enough args");
|
|
|
|
static_assert(Check< std::tuple<cv::GMat, cv::GMat> // Net
|
|
, std::tuple<cv::Rect, cv::Rect, cv::GMat> > // Call
|
|
::value == false, "Should fail -- too much args");
|
|
}
|
|
} // anonymous namespace
|
|
} // namespace opencv_test
|