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

Merge pull request #21692 from UnaNancyOwen:add_softmax

* add apply softmax option to ClassificationModel

* remove default arguments of ClassificationModel::setSoftMax()

* fix build for python

* fix docs warning for setSoftMax()

* add impl for ClassficationModel()

* fix failed build for docs by trailing whitespace

* move to implement classify() to ClassificationModel_Impl

* move to implement softmax() to ClassificationModel_Impl

* remove softmax from public method in ClassificationModel
This commit is contained in:
Tsukasa Sugiura
2022-03-08 05:26:15 +09:00
committed by GitHub
parent 901e0ddfe4
commit 8db7d435b9
2 changed files with 99 additions and 11 deletions
+21
View File
@@ -1310,6 +1310,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 +1327,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.
*/