- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tried to implement argmax via TopK-1
as codes attached below , but no matter I set sort to "value" or "index", no matter I use const auto result = std::make_shared<op::Result>(topk->output(1).get_node_shared_ptr())
or const auto result = std::make_shared<op::Result>(topk->output(0).get_node_shared_ptr())
, I can't get the index as output, I always get value as output. I think there is something wrong with the TopK-1. Please help, thanks very much!
const auto k = op::Constant::create(element::i64, Shape{}, {1});
auto topk = std::make_shared<op::v1::TopK>(inputNode, k, 1, "max", "index");
const auto result = std::make_shared<op::Result>(topk->output(1).get_node_shared_ptr());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, Munesh,
Thanks for your great help. I just solved this problem already. I share the method with you as below.
auto A = make_shared<op::Parameter>(element::f32, shape);
const auto k = op::Constant::create(element::i32, Shape{}, {2});
auto B = make_shared<op::v1::TopK>(A, k, 1, "max", "value", element::i32);
auto fun = make_shared<Function>(OutputVector{B->output(0), B->output(1)}, ParameterVector{A});
If we want to implement ArgMax with TopK, We should use the codes above to add TopK node, and then the second output of TopK
B->output(1)
will show the result of ArgMax. But if I used the
B->output(1)
to make function as below
auto fun = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A})
will failed. That's the root cause why I failed.
And deeplabv3 model for segmentation demo has been validated successfully.
Thanks again for your answer!
BR,
Mingming
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for reaching out.
Are you trying it in OpenVINO?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Starting from OpenVINO 2020.1, the Inference Engine use nGraph API to replace NNBuilder API, which uses a new way to represent a model in run time underneath of the conventional CNNNetwork API. To align with the new definition of nGraph operations in OpenVINO, I am using nGraph API under OpenVINO 2020.3 environment.
I tried to use TopK to implement the Argmax for running deeplab v3 model which is needed by this native demo Image Segmentation C++ Demo. So how does this Demo support deeplab v3 model? Does thie Demo also use TopK to implement Argmax?
BR,
Mingming
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
And I also tried use v0::ArgMax as below.
auto argmaxNode = std::make_shared<op::v0::ArgMax>
(inputNode,1,element::i32);
But I also failed and got exception error as below.
exception Error of validate layer: ArgMax_6567 with type: ArgMax. No such parameter name 'top_k' for layer ArgMax_6567
BR,
Mingming
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for the update.
We are moving this query to openvino forum for a faster response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Ming Ming Xu,
Image Segmentation C++ Demo is validated, and I’ve also validated on my end as well, using semantic-segmentation-adas-0001.xml model, as shown in the following page.
https://docs.openvinotoolkit.org/2020.4/omz_demos_segmentation_demo_README.html#running
Regarding your other question, please note that for CPU, the support for TopK and ArgMax layers are implemented via Extensibility Mechanism.
More information is available at the following page:
Lastly, for your query regarding DeeplabV3, we are currently investigating the compatibility of DeeplabV3 with this demo.
Regards,
Munesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, Munesh,
Thanks for your great help. I just solved this problem already. I share the method with you as below.
auto A = make_shared<op::Parameter>(element::f32, shape);
const auto k = op::Constant::create(element::i32, Shape{}, {2});
auto B = make_shared<op::v1::TopK>(A, k, 1, "max", "value", element::i32);
auto fun = make_shared<Function>(OutputVector{B->output(0), B->output(1)}, ParameterVector{A});
If we want to implement ArgMax with TopK, We should use the codes above to add TopK node, and then the second output of TopK
B->output(1)
will show the result of ArgMax. But if I used the
B->output(1)
to make function as below
auto fun = make_shared<Function>(OutputVector{B->output(0)}, ParameterVector{A})
will failed. That's the root cause why I failed.
And deeplabv3 model for segmentation demo has been validated successfully.
Thanks again for your answer!
BR,
Mingming
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page