Conversation
| // If layer said that it could work in-place and layers after it | ||
| // no longer use input blob, we'll set output = input. | ||
| bool supportInPlace; | ||
| LayerShapes() {supportInPlace = false;} |
There was a problem hiding this comment.
Code is moved without changes. No plan to refactor it now.
| String model = _model; | ||
| String config = _config; |
There was a problem hiding this comment.
If we make a copy of input parameters either way, it makes more sense to pass them by value instead(const String& model -> String model)
| else if (framework == "torch") | ||
| CV_Error(Error::StsNotImplemented, "Reading Torch models from buffers"); | ||
| else if (framework == "dldt") | ||
| return readNetFromModelOptimizer(bufferConfig, bufferModel); |
There was a problem hiding this comment.
We can also add onnx buffer support, which is useful for ONNXBackendAPI implementation.
else if (framework == "onnx")
return readNetFromONNX(bufferModel); | { | ||
| if (crop) | ||
| { | ||
| float resizeFactor = std::max(size.width / (float)imgSize.width, |
There was a problem hiding this comment.
I propose to use this opportunity to replace such instances of c-style casts witho static_casts everywhere. You can grep for (float), (int), etc.
| CV__DNN_INLINE_NS_BEGIN | ||
|
|
||
|
|
||
| Layer::Layer() { preferableTarget = DNN_TARGET_CPU; } |
| bool equal(const LayerPin& r) const | ||
| { | ||
| return (lid == r.lid && oid == r.oid); | ||
| } |
There was a problem hiding this comment.
We have an operator ==, std::tie?
|
|
||
| bool operator<(const LayerPin& r) const | ||
| { | ||
| return lid < r.lid || (lid == r.lid && oid < r.oid); |
|
|
||
| static Ptr<BackendWrapper> create(Mat& m) | ||
| { | ||
| return Ptr<BackendWrapper>(new OpenCLBackendWrapper(m)); |
There was a problem hiding this comment.
Should we grep for new and replace it with makePtr?
| CV_TRACE_FUNCTION(); | ||
| if (preferableBackend == DNN_BACKEND_OPENCV) | ||
| { | ||
| CV_Assert(preferableTarget == DNN_TARGET_CPU || IS_DNN_OPENCL_TARGET(preferableTarget)); |
There was a problem hiding this comment.
We could add initOpenCVBackend() as well. This would help get rid of copies in situations where blob preparation is destructive, so we have to keep a copy for some other backend to act on.
| const int qmin = -128; // INT8_MIN | ||
| const int qmax = 127; // INT8_MAX |
There was a problem hiding this comment.
we can replace this magic constants
Net::Implinterface into header (future PRs will add inheritance and plugin support)Netmethods implementation are just wrappers overNet::Implmethods without any logic insideTODO:
Validate:
Details