Conversation
d195d67 to
d4613e7
Compare
| class GAPI_EXPORTS_W IStreamSource { }; | ||
| } // namespace wip | ||
|
|
||
| namespace streaming { |
There was a problem hiding this comment.
put bracket on the next line
| switch (v.index()) | ||
| { | ||
| case GOptRunArg::index_of<cv::optional<cv::Mat>>(): | ||
| return pyopencv_from(*util::get<cv::optional<cv::Mat>>(v)); |
There was a problem hiding this comment.
Implement pyopencv_from(optional<>)
There was a problem hiding this comment.
Consider Py_RETURN_NONE
| } | ||
|
|
||
| template<> | ||
| PyObject* pyopencv_from(const GOptRunArgs& value) |
There was a problem hiding this comment.
Make it more generic
There was a problem hiding this comment.
Added generic variant of function.
| return pyopencv_from(util::get<cv::GOptRunArgs>(v)); | ||
| default: | ||
| PyErr_SetString(PyExc_TypeError, "Failed to recognize OptRunArgs"); | ||
| return Py_None; |
| PyErr_SetString(PyExc_TypeError, "Failed to recognize OptRunArgs"); | ||
| return Py_None; | ||
| } | ||
| return Py_None; |
| if proc_num_frames == max_num_frames: | ||
| break | ||
|
|
||
| def test_desync(self): |
There was a problem hiding this comment.
Would be great to have more complicated test
| compiled.priv().setup(std::move(pE)); | ||
| } | ||
| else GAPI_Assert(false && "Impossible happened -- please report a bug"); | ||
| compiled.priv().getDesync() = cgr.metadata().contains<Desynchronized>(); |
There was a problem hiding this comment.
Let's start with a getter in GStreamingExecutor
|
PR rebase is required to resolve conflicts. |
|
@mpashchenkov please push an updated version so we prioritize the review. |
5fcbd34 to
6ceed68
Compare
TolyaTalamanov
left a comment
There was a problem hiding this comment.
BTW have already implemented desync to support arbitrary G-types ?
| } | ||
|
|
||
| template<> | ||
| PyObject* pyopencv_from(const GRunArgs& value) |
There was a problem hiding this comment.
template<>
PyObject* pyopencv_from(const GRunArgs& value)
{
return value.size() == 1 ? pyopencv_from(value[0]) : pyopencv_generic_vec_from(values);
}
|
|
||
| template<> | ||
| PyObject* pyopencv_from(const GRunArgs& value) | ||
| template<typename T> |
There was a problem hiding this comment.
I believe this function can be removed, see below
| template<> | ||
| PyObject* pyopencv_from(const GOptRunArgs& value) | ||
| { | ||
| return pyopencv_from_run_args(value); |
| { | ||
| return pyopencv_from(*opt); | ||
| } | ||
| else |
There was a problem hiding this comment.
Can it be without else branch ?
| } | ||
|
|
||
| template <> | ||
| PyObject* pyopencv_from(const cv::util::variant<cv::GRunArgs, cv::GOptRunArgs>& v) |
There was a problem hiding this comment.
Put a FIXME that variant can be wrapped once for all types
| { | ||
| OpaqueRef ref; | ||
| util::get<ConstructOpaque>(info.ctor)(ref); | ||
| args.emplace_back(cv::util::make_optional(ref)); |
There was a problem hiding this comment.
Can the ref be moved to make_optional ?
There was a problem hiding this comment.
Moved to make_optional now.
| bool is_over = false; | ||
|
|
||
| using runArgs = cv::util::variant<cv::GRunArgs, cv::GOptRunArgs>; | ||
| if (m_priv->isDesync()) { |
There was a problem hiding this comment.
I would name hasDesync
|
|
||
| void setInInfo(const GTypesInfo& info) { m_in_info = std::move(info); } | ||
| const GTypesInfo& inInfo() const { return m_in_info; } | ||
| bool isDesync() { return m_exec->isDesync(); }; |
There was a problem hiding this comment.
@dmatveev Is there any graceful way to check whether graph contains desync ?
We didn't find :(
There was a problem hiding this comment.
Removed. All logic in gstreamingexecutor now.
| EXPECT_EQ(1u, outputs.size()); | ||
| auto opt_mat = cv::util::get<cv::optional<cv::Mat>>(outputs[0]); | ||
| auto with_value = opt_mat.has_value(); | ||
| EXPECT_TRUE(with_value); |
There was a problem hiding this comment.
EXPECT_TRUE(opt_mat.has_value);
There was a problem hiding this comment.
Have a look how it's done in other test files
| EXPECT_EQ(0., cv::norm(out, out_ref, cv::NORM_INF)); | ||
| } | ||
|
|
||
| inline void checkPullOverload(const cv::Mat& ref, |
There was a problem hiding this comment.
I believe it must be inside anonymous namespace instead of inline.
6302d8e to
c0ef34d
Compare
| void start(); | ||
| bool pull(cv::GRunArgsP &&outs); | ||
| bool pull(cv::GOptRunArgsP &&outs); | ||
| std::tuple<bool, cv::util::variant<cv::GRunArgs, cv::GOptRunArgs>> pull(); |
There was a problem hiding this comment.
I believe there was already pull(void) introduced by @TolyaTalamanov back in the early Python binding development time - which allocated its outputs which are not optional. Is it gone now? Is it replaced by this version now?
There was a problem hiding this comment.
No, there was GStreamingCompiled::pull not Priv::pull.
39f9564 to
f05e7eb
Compare
|
|
||
| void wait_shutdown(); | ||
|
|
||
| cv::GTypesInfo out_info; |
There was a problem hiding this comment.
I believe it should start with m_ like other fields but please fix that LATER.
TolyaTalamanov
left a comment
There was a problem hiding this comment.
Great, we did it !!! 🔥 👍
| void start(); | ||
| bool pull(cv::GRunArgsP &&outs); | ||
| bool pull(cv::GOptRunArgsP &&outs); | ||
| std::tuple<bool, cv::util::variant<cv::GRunArgs, cv::GOptRunArgs>> pull(); |
There was a problem hiding this comment.
No, there was GStreamingCompiled::pull not Priv::pull.
| GAPI_Assert(m_collector_map.size() > 0u); | ||
| m_out_queue.set_capacity(queue_capacity * m_collector_map.size()); | ||
|
|
||
| // FIXME: The code duplicates logic of collectGraphInfo() |
There was a problem hiding this comment.
collectGraphInfo() can be moved to more general file.
| void start(); | ||
| bool pull(cv::GRunArgsP &&outs); | ||
| bool pull(cv::GOptRunArgsP &&outs); | ||
| std::tuple<bool, cv::util::variant<cv::GRunArgs, cv::GOptRunArgs>> pull(); |
There was a problem hiding this comment.
I would put that it used only for python
| const bool has_output, | ||
| cv::util::variant<cv::GRunArgs, cv::GOptRunArgs>& args) { | ||
| EXPECT_TRUE(has_output); | ||
| using runArgs = cv::util::variant<cv::GRunArgs, cv::GOptRunArgs>; |
| EXPECT_FALSE(ccomp.running()); | ||
| } | ||
|
|
||
| TEST(GAPI_Streaming_Desync, Python_Pull_Overload) |
There was a problem hiding this comment.
Let's discuss tests offline
G-API: Python. Desync. * Desync. GMat. * Alignment
Wrapping desync operation for Python.
Questionable place of m_desync flag.
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.
Magic commands: