Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Expand ie::Params to support config#18701

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
Remove comments from tests
  • Loading branch information
@TolyaTalamanov
TolyaTalamanov committedNov 2, 2020
commitb9604dafd22844e7567fae22d2c35ea622020db5
38 changes: 23 additions & 15 deletionsmodules/gapi/include/opencv2/gapi/infer/ie.hpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -50,7 +50,6 @@ namespace detail {
std::string model_path;
std::string weights_path;
std::string device_id;
IEConfig config;

// NB: Here order follows the `Net` API
std::vector<std::string> input_names;
Expand All@@ -67,6 +66,7 @@ namespace detail {
enum class Kind { Load, Import };
Kind kind;
bool is_generic;
IEConfig config;
};
} // namespace detail

Expand All@@ -85,23 +85,23 @@ template<typename Net> class Params {
public:
Params(const std::string &model,
const std::string &weights,
const std::string &device,
const IEConfig &config = {})
: desc{ model, weights, device, config, {}, {}, {}
const std::string &device)
: desc{ model, weights, device, {}, {}, {}
, std::tuple_size<typename Net::InArgs>::value // num_in
, std::tuple_size<typename Net::OutArgs>::value // num_out
, detail::ParamDesc::Kind::Load
, false} {
, false
, {}} {
};

Params(const std::string &model,
const std::string &device,
const IEConfig &config = {})
: desc{ model, {}, device, config, {}, {}, {}
const std::string &device)
: desc{ model, {}, device, {}, {}, {}
, std::tuple_size<typename Net::InArgs>::value // num_in
, std::tuple_size<typename Net::OutArgs>::value // num_out
, detail::ParamDesc::Kind::Import
, false} {
, false
, {}} {
};

Params<Net>& cfgInputLayers(const typename PortCfg<Net>::In &ll) {
Expand All@@ -127,6 +127,11 @@ template<typename Net> class Params {
return *this;
}

Params& cfgPlugin(IEConfig cfg) {
desc.config = std::move(cfg);
return *this;
}

// BEGIN(G-API's network parametrization API)
GBackend backend() const { return cv::gapi::ie::backend(); }
std::string tag() const { return Net::tag(); }
Expand All@@ -143,18 +148,21 @@ class Params<cv::gapi::Generic> {
Params(const std::string &tag,
const std::string &model,
const std::string &weights,
const std::string &device,
const IEConfig &config = {})
: desc{ model, weights, device, config, {}, {}, {}, 0u, 0u, detail::ParamDesc::Kind::Load, true}, m_tag(tag) {
const std::string &device)
: desc{ model, weights, device, {}, {}, {}, 0u, 0u, detail::ParamDesc::Kind::Load, true, {}}, m_tag(tag) {
};

Params(const std::string &tag,
const std::string &model,
const std::string &device,
const IEConfig &config = {})
: desc{ model, {}, device, config, {}, {}, {}, 0u, 0u, detail::ParamDesc::Kind::Import, true}, m_tag(tag) {
const std::string &device)
: desc{ model, {}, device, {}, {}, {}, 0u, 0u, detail::ParamDesc::Kind::Import, true, {}}, m_tag(tag) {
};

Params& cfgPlugin(IEConfig cfg) {
desc.config = std::move(cfg);
return *this;
}

// BEGIN(G-API's network parametrization API)
GBackend backend() const { return cv::gapi::ie::backend(); }
std::string tag() const { return m_tag; }
Expand Down
16 changes: 6 additions & 10 deletionsmodules/gapi/test/infer/gapi_infer_ie_test.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -355,11 +355,8 @@ TEST(TestAgeGenderIE, GenericInfer)
initDLDTDataPath();

cv::gapi::ie::detail::ParamDesc params;
//params.model_path = findDataFile(SUBDIR + "age-gender-recognition-retail-0013.xml");
//params.weights_path = findDataFile(SUBDIR + "age-gender-recognition-retail-0013.bin");
//params.device_id = "CPU";
params.model_path = "/home/atalaman/workspace/opencv_extra/testdata/dnn/omz_intel_models/intel/age-gender-recognition-retail-0013/FP32/age-gender-recognition-retail-0013.xml";
params.weights_path = "/home/atalaman/workspace/opencv_extra/testdata/dnn/omz_intel_models/intel/age-gender-recognition-retail-0013/FP32/age-gender-recognition-retail-0013.bin";
params.model_path = findDataFile(SUBDIR + "age-gender-recognition-retail-0013.xml");
params.weights_path = findDataFile(SUBDIR + "age-gender-recognition-retail-0013.bin");
params.device_id = "CPU";

cv::Mat in_mat(cv::Size(320, 240), CV_8UC3);
Expand DownExpand Up@@ -424,11 +421,10 @@ TEST(TestAgeGenderIE, InvalidConfig)
auto gender = outputs.at("prob");
cv::GComputation comp(cv::GIn(in), cv::GOut(age, gender));

cv::gapi::ie::Params<cv::gapi::Generic> pp{"age-gender-generic",
model_path,
weights_path,
device_id,
{{"unsupported_config", "some_value"}}};
auto pp = cv::gapi::ie::Params<cv::gapi::Generic>{"age-gender-generic",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

would not this test should be extended to test generic version ofParams ?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

It is alreadygeneric, is it ?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Added tests onnon-generic

model_path,
weights_path,
device_id}.cfgPlugin({{"unsupported_config", "some_value"}});

EXPECT_ANY_THROW(comp.compile(cv::GMatDesc{CV_8U,3,cv::Size{320, 240}},
cv::compile_args(cv::gapi::networks(pp))));
Comment on lines +427 to +430
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

BTW is it possible to create positive test ?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

For which option, for example ?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Added test

Expand Down

[8]ページ先頭

©2009-2026 Movatter.jp