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

Merge remote-tracking branch 'upstream/master' into merge-4.x

This commit is contained in:
Alexander Alekhin
2020-11-27 18:14:53 +00:00
457 changed files with 30205 additions and 4172 deletions
@@ -248,8 +248,6 @@ CV__DNN_INLINE_NS_BEGIN
int type;
std::vector<size_t> kernel_size, strides;
std::vector<size_t> pads_begin, pads_end;
CV_DEPRECATED_EXTERNAL Size kernel, stride, pad;
CV_DEPRECATED_EXTERNAL int pad_l, pad_t, pad_r, pad_b;
bool globalPooling; //!< Flag is true if at least one of the axes is global pooled.
std::vector<bool> isGlobalPooling;
bool computeMaxIdx;
+39 -11
View File
@@ -93,7 +93,8 @@ CV__DNN_INLINE_NS_BEGIN
DNN_TARGET_VULKAN,
DNN_TARGET_FPGA, //!< FPGA device with CPU fallbacks using Inference Engine's Heterogeneous plugin.
DNN_TARGET_CUDA,
DNN_TARGET_CUDA_FP16
DNN_TARGET_CUDA_FP16,
DNN_TARGET_HDDL
};
CV_EXPORTS std::vector< std::pair<Backend, Target> > getAvailableBackends();
@@ -364,9 +365,12 @@ CV__DNN_INLINE_NS_BEGIN
const int requiredOutputs,
std::vector<MatShape> &outputs,
std::vector<MatShape> &internals) const;
virtual int64 getFLOPS(const std::vector<MatShape> &inputs,
const std::vector<MatShape> &outputs) const {CV_UNUSED(inputs); CV_UNUSED(outputs); return 0;}
virtual bool updateMemoryShapes(const std::vector<MatShape> &inputs);
CV_PROP String name; //!< Name of the layer instance, can be used for logging or other internal purposes.
CV_PROP String type; //!< Type name which was used for creating layer by layer factory.
CV_PROP int preferableTarget; //!< prefer target for layer forwarding
@@ -571,6 +575,7 @@ CV__DNN_INLINE_NS_BEGIN
* | DNN_TARGET_FPGA | | + | | |
* | DNN_TARGET_CUDA | | | | + |
* | DNN_TARGET_CUDA_FP16 | | | | + |
* | DNN_TARGET_HDDL | | + | | |
*/
CV_WRAP void setPreferableTarget(int targetId);
@@ -1072,14 +1077,17 @@ CV__DNN_INLINE_NS_BEGIN
* Model creates net from file with trained weights and config,
* sets preprocessing input and runs forward pass.
*/
class CV_EXPORTS_W_SIMPLE Model : public Net
class CV_EXPORTS_W_SIMPLE Model
{
public:
/**
* @brief Default constructor.
*/
CV_DEPRECATED_EXTERNAL // avoid using in C++ code, will be moved to "protected" (need to fix bindings first)
Model();
Model(const Model&) = default;
Model(Model&&) = default;
Model& operator=(const Model&) = default;
Model& operator=(Model&&) = default;
/**
* @brief Create model from deep learning network represented in one of the supported formats.
* An order of @p model and @p config arguments does not matter.
@@ -1100,13 +1108,12 @@ CV__DNN_INLINE_NS_BEGIN
*/
CV_WRAP Model& setInputSize(const Size& size);
/** @brief Set input size for frame.
/** @overload
* @param[in] width New input width.
* @param[in] height New input height.
* @note If shape of the new blob less than 0,
* then frame size not change.
*/
CV_WRAP Model& setInputSize(int width, int height);
CV_WRAP inline
Model& setInputSize(int width, int height) { return setInputSize(Size(width, height)); }
/** @brief Set mean value for frame.
* @param[in] mean Scalar with mean values which are subtracted from channels.
@@ -1143,10 +1150,31 @@ CV__DNN_INLINE_NS_BEGIN
* @param[in] frame The input image.
* @param[out] outs Allocated output blobs, which will store results of the computation.
*/
CV_WRAP void predict(InputArray frame, OutputArrayOfArrays outs);
CV_WRAP void predict(InputArray frame, OutputArrayOfArrays outs) const;
// ============================== Net proxy methods ==============================
// Never expose methods with network implementation details, like:
// - addLayer, addLayerToPrev, connect, setInputsNames, setInputShape, setParam, getParam
// - getLayer*, getUnconnectedOutLayers, getUnconnectedOutLayersNames, getLayersShapes
// - forward* methods, setInput
/// @sa Net::setPreferableBackend
CV_WRAP Model& setPreferableBackend(dnn::Backend backendId);
/// @sa Net::setPreferableTarget
CV_WRAP Model& setPreferableTarget(dnn::Target targetId);
CV_DEPRECATED_EXTERNAL
operator Net&() const { return getNetwork_(); }
//protected: - internal/tests usage only
Net& getNetwork_() const;
inline Net& getNetwork_() { return const_cast<const Model*>(this)->getNetwork_(); }
protected:
struct Impl;
inline Impl* getImpl() const { return impl.get(); }
inline Impl& getImplRef() const { CV_DbgAssert(impl); return *impl.get(); }
protected:
Ptr<Impl> impl;
};
@@ -58,6 +58,11 @@ CV_EXPORTS_W void resetMyriadDevice();
CV_EXPORTS_W cv::String getInferenceEngineVPUType();
/** @brief Release a HDDL plugin.
*/
CV_EXPORTS_W void releaseHDDLPlugin();
CV__DNN_INLINE_NS_END
}} // namespace
+1 -1
View File
@@ -6,7 +6,7 @@
#define OPENCV_DNN_VERSION_HPP
/// Use with major OpenCV version only.
#define OPENCV_DNN_API_VERSION 20200908
#define OPENCV_DNN_API_VERSION 20201117
#if !defined CV_DOXYGEN && !defined CV_STATIC_ANALYSIS && !defined CV_DNN_DONT_ADD_INLINE_NS
#define CV__DNN_INLINE_NS __CV_CAT(dnn5_v, OPENCV_DNN_API_VERSION)