Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Faster R-CNN #128

Open
ryoyoko opened this issue Mar 5, 2019 · 3 comments
Open

Support Faster R-CNN #128

ryoyoko opened this issue Mar 5, 2019 · 3 comments

Comments

@ryoyoko
Copy link

ryoyoko commented Mar 5, 2019

__call__ method of Faster R-CNN returns (Variable, Variable, array, array). src
This causes the following exception.

File "[path to]chainer/function_node.py", line 783, in grad
    v.node._check_old_style_gradient()
AttributeError: 'numpy.ndarray' object has no attribute 'node'

Is it possible for onnx-chainer to support Faster R-CNN ?

@shinh
Copy link
Member

shinh commented Mar 5, 2019

Two stage networks do not work well with current ONNX-chainer. ONNX-chainer depends on Chainer's graph for backprop, but graphs are disconnected between the two stages. Here is the code the graph is disconnected by Variable.array: https://github.com/chainer/chainercv/blob/master/chainercv/links/model/faster_rcnn/region_proposal_network.py#L135

We are working on this issue these days, so hopefully the situation better in near future.

That said, I think you'll need to somehow fill the gap between two stages. I'm doing some experimental work to export a two stage network (FPN) so I could share my experience if you can tell me your usecase scenario.

My hacky code is

https://github.com/shinh/chainercv/commits/export-fpn

shinh@3850c46

@ryoyoko
Copy link
Author

ryoyoko commented Mar 6, 2019

Thank you for your comments.

I would like to compile Chainer models by tvm.
But as for Chainer, I think chainer-compiler + ChainerX would be better.
I'm looking forward to the release of chainer-compiler.

@disktnk
Copy link
Member

disktnk commented Apr 15, 2019

To export Faster RCNN model, such as FasterRCNNVGG16, we nee to resolve some points.

  1. Support ROIAverageAlign2D function node which is not supported in ONNX.
  2. Fix to return all output value as chainer.Variable, output code is here
  3. Not to cut variable node stream, cutting code is here
  4. Connect all function as chainer.FunctionNode

How to resolve

  1. By using external_converters option on exporting, ONNX-Chainer can export the function, Support external converter for custom operator #129. Of course runtime has to support the operator.
  2. Need to fix the model code, currently. An error message is more detectable, Add output type check #145
  3. Need to fix the model code, currently.
  4. Even if the model is resolved point 2 and 3, ONNX-Chainer cannot make an ONNX graph because calculation nodes are not consist of chainer.FunctionNode. To solve it, we have a plan to replace the function to fake as chainer.FunctionNode. Function util to connect variable node #143 is under discussion and API will be changed but easier to handle those models.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants