partial support for quantized models in ONNX importer#20264
partial support for quantized models in ONNX importer#20264vpisarev wants to merge 3 commits intoopencv:masterfrom
Conversation
…Linear, QLinearAdd to support 2D blobs as well; make sure the smoke test passes
…a file to opencv_extra/testdata/dnn/onnx/models subdirectory
| static Ptr<DequantizeLinearLayer> create(const LayerParams& params); | ||
| }; | ||
|
|
||
| class CV_EXPORTS QLinearAddLayer : public Layer |
There was a problem hiding this comment.
It makes sense to add documentation with links on similar layers/nodes (e.g, from ONNX)
|
|
||
| CV_Assert((inputs.size() > outputs.size() && blobs.empty()) || | ||
| (!inputs.empty() && (blobs.size() == 1 || blobs.size() == 2))); | ||
| (!inputs.empty() && blobs.size() >= 1)); |
There was a problem hiding this comment.
what this class should do with blobs.size() = 3 ?
This is assertion check about the code below.
It is caller responsibility to properly call this code without assertions
| // Copyright (C) 2016, Intel Corporation, all rights reserved. | ||
| // Third party copyrights are property of their respective owners. |
| int sc_total = (int)scale.total(); | ||
| if (!scale.empty()) { | ||
| if(!((sc_total == 1 || (k == 1 && sc_total == outN)) && scale.type() == CV_32F)) | ||
| CV_Error(CV_StsError, |
There was a problem hiding this comment.
CV_StsError
C API constants should not be used. Here and below.
| ASSERT_FALSE(net.empty()); | ||
| net.setPreferableBackend(backend); | ||
| net.setPreferableTarget(target); | ||
| std::cout << net.dump() << "\n"; |
There was a problem hiding this comment.
if (cvtest::debugLevel > 0) or remove
| net.setInput(input); | ||
| Mat output = net.forward(); | ||
| //std::cout << output << std::endl; | ||
| ASSERT_EQ(output.size(), Size(128, 1)); |
There was a problem hiding this comment.
*_EQ(expected_value, actual_value)
| TEST_P(Test_ONNX_nets, QuantStatic) | ||
| { | ||
| if (backend != DNN_BACKEND_OPENCV || target != DNN_TARGET_CPU) | ||
| throw SkipTestException("Only the default backend; CPU target is supported"); |
There was a problem hiding this comment.
default backend
default backend in builds with IE is IE, so this message should be corrected to be accurate.
|
@vpisarev Friendly reminder. |
See #20188. Merge together with opencv/opencv_extra#878.
The PR is submitted to master branch, rather than 3.4, because the whole support for 8-bit compute paths will be added to master (see #20228)
Pull Request Readiness Checklist
Patch to opencv_extra has the same branch name.