Skip to content

[OV2.0] Preprocessing: support convert HWC->NCHW layout#9540

Merged
ilya-lavrenov merged 4 commits intoopenvinotoolkit:masterfrom
nosovmik:hwc_to_nchw
Jan 11, 2022
Merged

[OV2.0] Preprocessing: support convert HWC->NCHW layout#9540
ilya-lavrenov merged 4 commits intoopenvinotoolkit:masterfrom
nosovmik:hwc_to_nchw

Conversation

@nosovmik
Copy link
Copy Markdown
Contributor

Details:

  • With this PR user is able to pass 3D tensor in HWC layout (single RGB image) to 4D model (NCHW). E.g.
    • 'ppp.tensor().set_layout("HWC"); ppp.model().set_layout("NCHW"); ppp.build()' This will add 'unsqueeze' operation to add 'N' dimension at beginning, and then adds 'transpose' from NHWC to NCHW

Limitations:

  • User's tensor rank shall be 'smaller' than model's input. I.e. user is not able to convert NCDHW to NCHW even if 'D' dimension is '1'
  • Currently supported for 'preprocessing' only. Post-processor doesn't support convert NCHW->HWC as not needed (user can always convert it to NHWC and data will be the same)

Test:

  • Unit tests
  • template tests with hard-coded references
  • CPU + GPU reference test

Tickets:

  • 75287

@nosovmik nosovmik requested review from a team, ilya-lavrenov and ilyachur January 10, 2022 09:12
@openvino-pushbot openvino-pushbot added category: TEMPLATE OpenVINO Template plugin category: IE Tests OpenVINO Test: plugins and common category: Core OpenVINO Core (aka ngraph) labels Jan 10, 2022
@ilya-lavrenov ilya-lavrenov merged commit bd3a996 into openvinotoolkit:master Jan 11, 2022
@ilya-lavrenov ilya-lavrenov added this to the 2022.1 milestone Jan 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: Core OpenVINO Core (aka ngraph) category: IE Tests OpenVINO Test: plugins and common category: TEMPLATE OpenVINO Template plugin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants