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

Merge branch 4.x

This commit is contained in:
OpenCV Developers
2022-04-23 21:42:17 +00:00
324 changed files with 34982 additions and 9803 deletions
+38 -2
View File
@@ -262,7 +262,7 @@ CV__DNN_INLINE_NS_BEGIN
{
public:
int input_zp, output_zp;
float output_sc;
float input_sc, output_sc;
static Ptr<BaseConvolutionLayer> create(const LayerParams& params);
};
@@ -322,9 +322,24 @@ CV__DNN_INLINE_NS_BEGIN
{
public:
int input_zp, output_zp;
float input_sc, output_sc;
static Ptr<PoolingLayerInt8> create(const LayerParams& params);
};
class CV_EXPORTS ReduceLayer : public Layer
{
public:
int reduceType;
std::vector<size_t> reduceDims;
static Ptr<ReduceLayer> create(const LayerParams& params);
};
class CV_EXPORTS ReduceLayerInt8 : public ReduceLayer
{
public:
static Ptr<ReduceLayerInt8> create(const LayerParams& params);
};
class CV_EXPORTS SoftmaxLayer : public Layer
{
public:
@@ -351,7 +366,8 @@ CV__DNN_INLINE_NS_BEGIN
class CV_EXPORTS InnerProductLayerInt8 : public InnerProductLayer
{
public:
int output_zp;
int input_zp, output_zp;
float input_sc, output_sc;
static Ptr<InnerProductLayerInt8> create(const LayerParams& params);
};
@@ -778,6 +794,26 @@ CV__DNN_INLINE_NS_BEGIN
static Ptr<ActivationLayerInt8> create(const LayerParams &params);
};
class CV_EXPORTS SignLayer : public ActivationLayer
{
public:
static Ptr<SignLayer> create(const LayerParams &params);
};
class CV_EXPORTS ShrinkLayer : public ActivationLayer
{
public:
float bias;
float lambd;
static Ptr<ShrinkLayer> create(const LayerParams &params);
};
class CV_EXPORTS ReciprocalLayer : public ActivationLayer
{
public:
static Ptr<ReciprocalLayer> create(const LayerParams &params);
};
/* Layers used in semantic segmentation */
class CV_EXPORTS CropLayer : public Layer
+39 -3
View File
@@ -75,6 +75,7 @@ CV__DNN_INLINE_NS_BEGIN
DNN_BACKEND_VKCOM,
DNN_BACKEND_CUDA,
DNN_BACKEND_WEBNN,
DNN_BACKEND_TIMVX,
#ifdef __OPENCV_BUILD
DNN_BACKEND_INFERENCE_ENGINE_NGRAPH = 1000000, // internal - use DNN_BACKEND_INFERENCE_ENGINE + setInferenceEngineBackendType()
DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019, // internal - use DNN_BACKEND_INFERENCE_ENGINE + setInferenceEngineBackendType()
@@ -95,7 +96,8 @@ CV__DNN_INLINE_NS_BEGIN
DNN_TARGET_FPGA, //!< FPGA device with CPU fallbacks using Inference Engine's Heterogeneous plugin.
DNN_TARGET_CUDA,
DNN_TARGET_CUDA_FP16,
DNN_TARGET_HDDL
DNN_TARGET_HDDL,
DNN_TARGET_NPU,
};
CV_EXPORTS std::vector< std::pair<Backend, Target> > getAvailableBackends();
@@ -321,6 +323,19 @@ CV__DNN_INLINE_NS_BEGIN
const std::vector<Ptr<BackendWrapper>>& outputs
);
/**
* @brief Returns a TimVX backend node
*
* @param timVxInfo void pointer to CSLContext object
* @param inputsWrapper layer inputs
* @param outputsWrapper layer outputs
* @param isLast if the node is the last one of the TimVX Graph.
*/
virtual Ptr<BackendNode> initTimVX(void* timVxInfo,
const std::vector<Ptr<BackendWrapper> > &inputsWrapper,
const std::vector<Ptr<BackendWrapper> > &outputsWrapper,
bool isLast);
/**
* @brief Automatic Halide scheduling based on layer hyper-parameters.
* @param[in] node Backend node with Halide functions.
@@ -389,7 +404,7 @@ CV__DNN_INLINE_NS_BEGIN
/**
* @brief "Deattaches" all the layers, attached to particular layer.
* @brief "Detaches" all the layers, attached to particular layer.
*/
virtual void unsetAttached();
@@ -1310,6 +1325,9 @@ CV__DNN_INLINE_NS_BEGIN
class CV_EXPORTS_W_SIMPLE ClassificationModel : public Model
{
public:
CV_DEPRECATED_EXTERNAL // avoid using in C++ code, will be moved to "protected" (need to fix bindings first)
ClassificationModel();
/**
* @brief Create classification model from network represented in one of the supported formats.
* An order of @p model and @p config arguments does not matter.
@@ -1324,6 +1342,24 @@ CV__DNN_INLINE_NS_BEGIN
*/
CV_WRAP ClassificationModel(const Net& network);
/**
* @brief Set enable/disable softmax post processing option.
*
* If this option is true, softmax is applied after forward inference within the classify() function
* to convert the confidences range to [0.0-1.0].
* This function allows you to toggle this behavior.
* Please turn true when not contain softmax layer in model.
* @param[in] enable Set enable softmax post processing within the classify() function.
*/
CV_WRAP ClassificationModel& setEnableSoftmaxPostProcessing(bool enable);
/**
* @brief Get enable/disable softmax post processing option.
*
* This option defaults to false, softmax post processing is not applied within the classify() function.
*/
CV_WRAP bool getEnableSoftmaxPostProcessing() const;
/** @brief Given the @p input frame, create input blob, run net and return top-1 prediction.
* @param[in] frame The input image.
*/
@@ -1558,7 +1594,7 @@ public:
* - top-right
* - bottom-right
*
* Use cv::getPerspectiveTransform function to retrive image region without perspective transformations.
* Use cv::getPerspectiveTransform function to retrieve image region without perspective transformations.
*
* @note If DL model doesn't support that kind of output then result may be derived from detectTextRectangles() output.
*