Skip to content

MulticlassNms/MatrixNms: transformations and CPU implementation#6653

Merged
ilyachur merged 120 commits intoopenvinotoolkit:masterfrom
luo-cheng2021:luocheng/cpu_nms_ops
Jul 30, 2021
Merged

MulticlassNms/MatrixNms: transformations and CPU implementation#6653
ilyachur merged 120 commits intoopenvinotoolkit:masterfrom
luo-cheng2021:luocheng/cpu_nms_ops

Conversation

@luo-cheng2021
Copy link
Copy Markdown
Contributor

Details:

  • Transformation: convert MulticlassNms/MatrixNms dynamic shape output to static shape
  • CPU implementation

Tickets:

  • 56900
  • 56916
  • 56917
  • 56901

luo-cheng2021 and others added 30 commits June 3, 2021 09:39
…o_impl

implemented multiclass_nms reference.
…1/openvino into cecilia/multiclass_nms/algo_impl
@luo-cheng2021
Copy link
Copy Markdown
Contributor Author

General
MulticlassNMS and MatrixNMS have many of the same class members and do many the same action.
So maybe better create some NmsBase class and move to it:

  1. Same class members
  2. Extracting ngraph NMS attributes and conversion into mkldnn attributes.
  3. Checks for number of inputs/outpus, precisions and shapes for inputs/outpus
  4. Final sorting according to sort_result attribute
  5. Outputs filling

Yes, it's a nice idea and we'll refactor it in a separate PR.

Question
Are all three outputs required for MulticlassNMS and MatrixNMS?

The output format remains consistent with NonMaxSuppression_5 and the third output is useful when using static shape - can easily get the real valid numbers per batch.

@luo-cheng2021 luo-cheng2021 requested a review from mandrono July 23, 2021 05:00
@mandrono
Copy link
Copy Markdown

mandrono commented Jul 23, 2021

General
MulticlassNMS and MatrixNMS have many of the same class members and do many the same action.
So maybe better create some NmsBase class and move to it:

  1. Same class members
  2. Extracting ngraph NMS attributes and conversion into mkldnn attributes.
  3. Checks for number of inputs/outpus, precisions and shapes for inputs/outpus
  4. Final sorting according to sort_result attribute
  5. Outputs filling

Yes, it's a nice idea and we'll refactor it in a separate PR.

Question
Are all three outputs required for MulticlassNMS and MatrixNMS?

The output format remains consistent with NonMaxSuppression_5 and the third output is useful when using static shape - can easily get the real valid numbers per batch.

could you create ticket for refactoring please?

@luo-cheng2021
Copy link
Copy Markdown
Contributor Author

General
MulticlassNMS and MatrixNMS have many of the same class members and do many the same action.
So maybe better create some NmsBase class and move to it:

  1. Same class members
  2. Extracting ngraph NMS attributes and conversion into mkldnn attributes.
  3. Checks for number of inputs/outpus, precisions and shapes for inputs/outpus
  4. Final sorting according to sort_result attribute
  5. Outputs filling

Yes, it's a nice idea and we'll refactor it in a separate PR.

Question
Are all three outputs required for MulticlassNMS and MatrixNMS?

The output format remains consistent with NonMaxSuppression_5 and the third output is useful when using static shape - can easily get the real valid numbers per batch.

could you create ticket for refactoring please?

Created, ticket 61088.

@luo-cheng2021 luo-cheng2021 requested a review from mandrono July 26, 2021 03:41
@luo-cheng2021 luo-cheng2021 requested a review from mandrono July 27, 2021 01:21
@mandrono mandrono assigned dmitry-gorokhov and unassigned mandrono Jul 27, 2021
@mandrono
Copy link
Copy Markdown

@iefode could you take a look at test part please?

@mandrono mandrono requested a review from iefode July 28, 2021 11:07
Copy link
Copy Markdown
Contributor

@GlebKazantaev GlebKazantaev left a comment

Choose a reason for hiding this comment

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

Transformations part looks good!

Copy link
Copy Markdown

@dmitry-gorokhov dmitry-gorokhov left a comment

Choose a reason for hiding this comment

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

CPU part looks good

@ilyachur ilyachur merged commit 86bb056 into openvinotoolkit:master Jul 30, 2021
rnugmanx pushed a commit to rnugmanx/openvino that referenced this pull request Aug 26, 2021
…vinotoolkit#6653)

* init version, need revise: opset7

* add convert testcase

* multiclass_nms support spec

* init version

* matrixnms support spec

* init support for matrix_nms

* impl matirx_nms

* implemented multiclass_nms reference.

TODO: more test cases.

* support dynamic shape in test

* update to spec 0611

* update to spec 0611

* fixes.

* fix: now sort by class_id and score work.

* fix clang check error

* more test cases verified.

* fixes in ref impl.

* attribute nms_eta works

* test cross_batch and output_type i32.

* enable multiclass-nms cpu plugin fallback ngraph

* keep topk typo

* enable matrix-nms cpu plugin fallback ngraph

* support sort_result_across_batch

* Add matrix_nms unit test

* Add cross batch test cases

* fix typo

* move multiclass to opset8

* move matrixnms to opset8

* Reference implementations for MulticlassNms and MatrixNms ops

* fix name conflict

* remove unused var
sort_result_across_batch default set to false

* avoid float overflow

* fix clang check error

* info for mac fail

* change testcase due to unstable sort

* nms add 'normalized' attribute

* multiclass cpu test support 'normalized'

* nms add 'normalized' attribute

* fixes: 1. normalized support. 2. sort by score before keep_top_k inside a batch.

* fixes: 1. normalized support. 2. sort by score before keep_top_k inside a batch.

* fix sort order in matrix_nms

* fix review comments

* add matrix_nms MKLDNN extension layer

* parallel in matirx nms

* separate filtered_box

* separate class_nms result

* parallel in class

* parallel in batch

* partial new nms

* partial remove useless function

* debug & fix

* debug in indexing

* fix test cases

* remove logging

* fix code-style

* fix typo

* add matrix_nms extension

* nms python api

* remove unused testcases

* refactor transformation

* transform dynamic shape to static shape

* Update inference-engine/src/transformations/include/ngraph_ops/nms_static_shape_ie.hpp

Co-authored-by: Ilya Churaev <ilyachur@gmail.com>

* remove register_pass call

* [MKLDNN]migrate matrix_nms to MKLDNNNode

* bug fix in matrix_nms

* padding on matrix_nms

* remove logging

* test case refine

* merged transform_matrix_nms branch

* refine matrixnms testcase

* multiclass nms cpu plugin implement for static shape, rebased on Reference implementations PR

* rebase to new multi-classs transform provided by lc

* Name style algin with matrix-nms

* static shape padding style to batch inside,new unit test method, real classnum shape

* fix format

* fix ci error

* multi-class NMS modification based on PR reviewer opinion: code format, copyright, delete unused include and funciton way

* explicit template instantiation due to mac ci fail

* Yi3/fix review (#16)

* fix coding style

* use parallel_for2d

* fix ci fail

* unify 'copyright 2021'

* mkldnn_multiclass_nms node update based on PR review (#17)

* [MKLDNN] apply suggestion for matrix_nms (#18)

* fix bug

* apply review comments

* apply review comments

* apply review comments

* apply review comments

* skip only Nms test, not MatrixNms MulticlassNms test

Co-authored-by: Zhang Yi3 <yi3.zhang@intel.com>
Co-authored-by: jialipen <cecilia.peng@intel.com>
Co-authored-by: mangguo <mang.guo@intel.com>
Co-authored-by: Ilya Churaev <ilyachur@gmail.com>
Co-authored-by: liubo-intel <bo4.liu@intel.com>
andrei-cv pushed a commit to andrei-cv/openvino that referenced this pull request Aug 30, 2021
…vinotoolkit#6653)

* init version, need revise: opset7

* add convert testcase

* multiclass_nms support spec

* init version

* matrixnms support spec

* init support for matrix_nms

* impl matirx_nms

* implemented multiclass_nms reference.

TODO: more test cases.

* support dynamic shape in test

* update to spec 0611

* update to spec 0611

* fixes.

* fix: now sort by class_id and score work.

* fix clang check error

* more test cases verified.

* fixes in ref impl.

* attribute nms_eta works

* test cross_batch and output_type i32.

* enable multiclass-nms cpu plugin fallback ngraph

* keep topk typo

* enable matrix-nms cpu plugin fallback ngraph

* support sort_result_across_batch

* Add matrix_nms unit test

* Add cross batch test cases

* fix typo

* move multiclass to opset8

* move matrixnms to opset8

* Reference implementations for MulticlassNms and MatrixNms ops

* fix name conflict

* remove unused var
sort_result_across_batch default set to false

* avoid float overflow

* fix clang check error

* info for mac fail

* change testcase due to unstable sort

* nms add 'normalized' attribute

* multiclass cpu test support 'normalized'

* nms add 'normalized' attribute

* fixes: 1. normalized support. 2. sort by score before keep_top_k inside a batch.

* fixes: 1. normalized support. 2. sort by score before keep_top_k inside a batch.

* fix sort order in matrix_nms

* fix review comments

* add matrix_nms MKLDNN extension layer

* parallel in matirx nms

* separate filtered_box

* separate class_nms result

* parallel in class

* parallel in batch

* partial new nms

* partial remove useless function

* debug & fix

* debug in indexing

* fix test cases

* remove logging

* fix code-style

* fix typo

* add matrix_nms extension

* nms python api

* remove unused testcases

* refactor transformation

* transform dynamic shape to static shape

* Update inference-engine/src/transformations/include/ngraph_ops/nms_static_shape_ie.hpp

Co-authored-by: Ilya Churaev <ilyachur@gmail.com>

* remove register_pass call

* [MKLDNN]migrate matrix_nms to MKLDNNNode

* bug fix in matrix_nms

* padding on matrix_nms

* remove logging

* test case refine

* merged transform_matrix_nms branch

* refine matrixnms testcase

* multiclass nms cpu plugin implement for static shape, rebased on Reference implementations PR

* rebase to new multi-classs transform provided by lc

* Name style algin with matrix-nms

* static shape padding style to batch inside,new unit test method, real classnum shape

* fix format

* fix ci error

* multi-class NMS modification based on PR reviewer opinion: code format, copyright, delete unused include and funciton way

* explicit template instantiation due to mac ci fail

* Yi3/fix review (#16)

* fix coding style

* use parallel_for2d

* fix ci fail

* unify 'copyright 2021'

* mkldnn_multiclass_nms node update based on PR review (#17)

* [MKLDNN] apply suggestion for matrix_nms (#18)

* fix bug

* apply review comments

* apply review comments

* apply review comments

* apply review comments

* skip only Nms test, not MatrixNms MulticlassNms test

Co-authored-by: Zhang Yi3 <yi3.zhang@intel.com>
Co-authored-by: jialipen <cecilia.peng@intel.com>
Co-authored-by: mangguo <mang.guo@intel.com>
Co-authored-by: Ilya Churaev <ilyachur@gmail.com>
Co-authored-by: liubo-intel <bo4.liu@intel.com>
akuporos pushed a commit to akuporos/openvino that referenced this pull request Sep 29, 2021
…vinotoolkit#6653)

* init version, need revise: opset7

* add convert testcase

* multiclass_nms support spec

* init version

* matrixnms support spec

* init support for matrix_nms

* impl matirx_nms

* implemented multiclass_nms reference.

TODO: more test cases.

* support dynamic shape in test

* update to spec 0611

* update to spec 0611

* fixes.

* fix: now sort by class_id and score work.

* fix clang check error

* more test cases verified.

* fixes in ref impl.

* attribute nms_eta works

* test cross_batch and output_type i32.

* enable multiclass-nms cpu plugin fallback ngraph

* keep topk typo

* enable matrix-nms cpu plugin fallback ngraph

* support sort_result_across_batch

* Add matrix_nms unit test

* Add cross batch test cases

* fix typo

* move multiclass to opset8

* move matrixnms to opset8

* Reference implementations for MulticlassNms and MatrixNms ops

* fix name conflict

* remove unused var
sort_result_across_batch default set to false

* avoid float overflow

* fix clang check error

* info for mac fail

* change testcase due to unstable sort

* nms add 'normalized' attribute

* multiclass cpu test support 'normalized'

* nms add 'normalized' attribute

* fixes: 1. normalized support. 2. sort by score before keep_top_k inside a batch.

* fixes: 1. normalized support. 2. sort by score before keep_top_k inside a batch.

* fix sort order in matrix_nms

* fix review comments

* add matrix_nms MKLDNN extension layer

* parallel in matirx nms

* separate filtered_box

* separate class_nms result

* parallel in class

* parallel in batch

* partial new nms

* partial remove useless function

* debug & fix

* debug in indexing

* fix test cases

* remove logging

* fix code-style

* fix typo

* add matrix_nms extension

* nms python api

* remove unused testcases

* refactor transformation

* transform dynamic shape to static shape

* Update inference-engine/src/transformations/include/ngraph_ops/nms_static_shape_ie.hpp

Co-authored-by: Ilya Churaev <ilyachur@gmail.com>

* remove register_pass call

* [MKLDNN]migrate matrix_nms to MKLDNNNode

* bug fix in matrix_nms

* padding on matrix_nms

* remove logging

* test case refine

* merged transform_matrix_nms branch

* refine matrixnms testcase

* multiclass nms cpu plugin implement for static shape, rebased on Reference implementations PR

* rebase to new multi-classs transform provided by lc

* Name style algin with matrix-nms

* static shape padding style to batch inside,new unit test method, real classnum shape

* fix format

* fix ci error

* multi-class NMS modification based on PR reviewer opinion: code format, copyright, delete unused include and funciton way

* explicit template instantiation due to mac ci fail

* Yi3/fix review (#16)

* fix coding style

* use parallel_for2d

* fix ci fail

* unify 'copyright 2021'

* mkldnn_multiclass_nms node update based on PR review (#17)

* [MKLDNN] apply suggestion for matrix_nms (#18)

* fix bug

* apply review comments

* apply review comments

* apply review comments

* apply review comments

* skip only Nms test, not MatrixNms MulticlassNms test

Co-authored-by: Zhang Yi3 <yi3.zhang@intel.com>
Co-authored-by: jialipen <cecilia.peng@intel.com>
Co-authored-by: mangguo <mang.guo@intel.com>
Co-authored-by: Ilya Churaev <ilyachur@gmail.com>
Co-authored-by: liubo-intel <bo4.liu@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: CPU OpenVINO CPU plugin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants