Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Implement some ONNX exports, needed for SSD #18055

Closed
wants to merge 7 commits into from
Closed

Implement some ONNX exports, needed for SSD #18055

wants to merge 7 commits into from

Conversation

RuRo
Copy link
Contributor

@RuRo RuRo commented Apr 14, 2020

Description

This is a WIP pull request for implementing exports for some ONNX operators, which are needed to successfully export the SSD model from gluocv. The only 2 operators, which are not yet implemented are _contrib_box_decode, which can be sidestepped by using SSD(minimal_opset=True) and _contrib_box_nms, which could be potentially implemented with the NonMaxSuppression ONNX operator, but this is a big enough undertaking to be its own separate PR.

This PR assumes that #18054 is merged (ruro/onnx_version_bump), since it uses some ONNX operators only available in v1.5.0. (The first commit is a squashed version of that PR and will be dropped after it gets merged into master)

If you actually want to try exporting SSD, you should also merge #17827 (QueensGambit/onnx_export_slice_fix or ruro/onnx_export_slice_fix).

Changes

  • eagerly check onnx conversion availability in verbose mode
    The export_model method now warns about all nodes, that don't have a registered conversion before trying to export the model, if verbose=True. This is a simple quality of life change, which helps potential contributors to estimate, how many layers are missing until a model can be exported.
  • implement _arange op
    (doesn't support the repeat attribute for now)
  • implement ones_like and zeros_like ops
  • implement _lesser_scalar, _greater_scalar and _equal_scalar ops
    also fixes the issue, where the scalar_op_helper would fail, if the input is a non-1D initializer
  • implement slice_like op
    (doesn't support the implicit axes variation right now)
  • implement where op

@mxnet-bot
Copy link

Hey @RuRo , Thanks for submitting the PR
All tests are already queued to run once. If tests fail, you can trigger one or more tests again with the following commands:

  • To trigger all jobs: @mxnet-bot run ci [all]
  • To trigger specific jobs: @mxnet-bot run ci [job1, job2]

CI supported jobs: [windows-gpu, centos-gpu, windows-cpu, miscellaneous, clang, unix-gpu, centos-cpu, website, sanity, edge, unix-cpu]


Note:
Only following 3 categories can trigger CI :PR Author, MXNet Committer, Jenkins Admin.
All CI tests must pass before the PR can be merged.

commit bc7426a
Author: Andrey Stotskiy <[email protected]>
Date:   Thu Apr 16 15:46:55 2020 +0300

    add export only test cases for topk and slice_axis

commit 7252018
Author: Andrey Stotskiy <[email protected]>
Date:   Tue Apr 14 17:59:11 2020 +0300

    bump onnx version to 1.5

commit b1672cb
Author: Andrey Stotskiy <[email protected]>
Date:   Sun Mar 1 11:45:45 2020 +0300

    implement onnx translation helpers
@mxnet-bot
Copy link

Jenkins CI successfully triggered : [unix-gpu]

@VisionZQ
Copy link

VisionZQ commented Jul 7, 2020

Hi,
Thanks for you kindness.
We have converted the mxnet to onnx 1.5, and the 'slice_like' is work.
But, When I from onnx convert to TensorRT6.0, the program crash. can you give me any suggestion?
While parsing node number 205 [Gather -> "yolov30__mulscalar0__shape__gathered"]: ERROR: /home/jakin/songzq/onnx-tensorrt/onnx2trt_utils.hpp:412 In function convert_axis: [8] Assertion failed: axis >= 0 && axis < nbDims
Thanks a lot.

@RuRo
Copy link
Contributor Author

RuRo commented Jul 7, 2020

@VisionZQ This PR currently has WIP status (it's not ready) and it's main purpose was to implement the needed ops to convert SSD models from mxnet to ONNX. There's been a lot of breakage recently with onnx2mx, so some further work may be required. I am not sure, I can help you with converting yolov3. I don't currently have the free time to even finish this PR.

I would recommend, that you open an issue, describing, which layers needed for yolov3 don't have a conversion in mxnet 1.6.0 and which conversion functions are currently missing in mxnet 2.0.0, but I wouldn't get your hopes up, that somebody will implement the conversions for you. Afaik, most mxnet contributors are currently very busy with mxnet 2 API changes.

@chinakook
Copy link
Contributor

It's a great job!

@Aktcob
Copy link

Aktcob commented Jul 14, 2020

Really good job!

When I convert yolov3 model in gluoncv to ONNX, I'm faced with the same problem.

@RuRo RuRo closed this May 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants