GithubHelp home page GithubHelp logo

Comments (5)

vshampor avatar vshampor commented on May 28, 2024

Greetings, @HFVladimir!

Indeed, it is required in general to export the NNCF-compressed models to ONNX using the compression controller's method, and not via the regular torch.onnx.export path. Look towards the bottom of the usage code snippet in the README.md.

It seems that the corresponding code is missing in the mmdetection integration patch, which we will be fixing soon. What you would have to do in the mmdetection code is basically this - replace the mmdetection's original torch.onnx.export call with the comp_ctrl.export_model taking a single parameter specifying the path to the output ONNX model. Make sure you pass the comp_ctrl compression controller object to wherever that call occurs. See sample code for examples on where this is done in various training pipelines.

from nncf.

lzrvch avatar lzrvch commented on May 28, 2024

Hi @HFVladimir, actually you can have a look at the export_model method of the compression controller: https://github.com/openvinotoolkit/nncf_pytorch/blob/develop/nncf/compression_method_api.py#L197-221

We use this method to export quantized models - as you can see, it's not much different from the tools/pytorch2onnx.py script in mmdetection. You can use the mmdetection script to export you model, just mind the torch.onnx.export arguments (e.g. opset_version).

BTW, do you have the FakeQuantize layers properly inserted in your model graph in PyTorch? Could you please share the compressed_graph.dot file which is dumped to your log directory (you should be able to see FakeQuantize layers present there)?

from nncf.

kshpv avatar kshpv commented on May 28, 2024

@HFVladimir

Our patch for mmdetection is just a simple demonstration of how to include NNCF into a big project. This patch doesn't aim to provide a full function to a user. It is just a demonstration.

If you would like to get full NNCF support in mmdetection I highly recommend you to use mmdetection fork, on which our team is working. There is a readme that expresses instructions on how to export a model to ONNX or OpenVINO and to evaluate these models.

While currently we haven't tested Cascade R-CNN support, in our mmdetection fork we will cover all possible models.

@vshampor
I suppose we can close this issue

from nncf.

vshampor avatar vshampor commented on May 28, 2024

@aleksei-kashapov is this resolved by #363?

from nncf.

kshpv avatar kshpv commented on May 28, 2024

@aleksei-kashapov is this resolved by #363?

We can not guarantee the support of Cascade R-CNN as export to ONNX is currently unavailable in the official mmdetetction repo. But this model will have an export in our fork, which is here https://github.com/openvinotoolkit/mmdetection

from nncf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.