1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 00:03:03 +04:00

Merge pull request #16616 from alalek:dnn_fix_input_shape

* dnn: fix processing of input shapes

- importer: avoid using of .setInput() => .setInputShape()
- setInput: shape limitation check (partial)

* dnn(test): test .setInput() in readNet()
This commit is contained in:
Alexander Alekhin
2020-02-21 22:39:54 +03:00
committed by GitHub
parent 966c2191cb
commit 01048e5603
8 changed files with 152 additions and 18 deletions
+4
View File
@@ -484,6 +484,10 @@ CV__DNN_EXPERIMENTAL_NS_BEGIN
*/
CV_WRAP void setInputsNames(const std::vector<String> &inputBlobNames);
/** @brief Specify shape of network input.
*/
CV_WRAP void setInputShape(const String &inputName, const MatShape& shape);
/** @brief Runs forward pass to compute output of layer with name @p outputName.
* @param outputName name for layer which output is needed to get
* @return blob for first output of specified layer.
@@ -138,6 +138,16 @@ static inline MatShape shape(const UMat& mat)
return shape(mat.size.p, mat.dims);
}
#if 0 // issues with MatExpr wrapped into InputArray
static inline
MatShape shape(InputArray input)
{
int sz[CV_MAX_DIM];
int ndims = input.sizend(sz);
return shape(sz, ndims);
}
#endif
namespace {inline bool is_neg(int i) { return i < 0; }}
static inline MatShape shape(int a0, int a1=-1, int a2=-1, int a3=-1)