此類表示分類模型的高階 API。 更多...
#include <opencv2/dnn/dnn.hpp>
|
| | ClassificationModel (分類模型) () |
| |
| | ClassificationModel (const Net &network) |
| | 從深度學習網路建立模型。
|
| |
| | ClassificationModel (CV_WRAP_FILE_PATH const String &model, CV_WRAP_FILE_PATH const String &config="") |
| | 從以支援的格式之一表示的網路建立分類模型。 model 和 config 引數的順序無關緊要。
|
| |
| std::pair< int, float > | classify (InputArray frame) |
| | 給定 input 幀,建立輸入 blob,執行網路並返回 top-1 預測。
|
| |
| void | classify (InputArray frame, int &classId, float &conf) |
| |
| bool | getEnableSoftmaxPostProcessing () const |
| | 獲取啟用/停用 softmax 後處理選項。
|
| |
| ClassificationModel & | setEnableSoftmaxPostProcessing (bool enable) |
| | 設定啟用/停用 softmax 後處理選項。
|
| |
| | Model (模型) () |
| |
| | Model (const Model &)=default |
| |
| | Model (const Net &network) |
| | 從深度學習網路建立模型。
|
| |
| | Model (CV_WRAP_FILE_PATH const String &model, CV_WRAP_FILE_PATH const String &config="") |
| | 從以支援的格式之一表示的深度學習網路建立模型。 model 和 config 引數的順序無關緊要。
|
| |
| | Model (Model &&)=default |
| |
| Model & | enableWinograd (bool useWinograd) |
| |
| Impl * | getImpl () const |
| |
| Impl & | getImplRef () const |
| |
| Net & | getNetwork_ () |
| |
| Net & | getNetwork_ () const |
| |
| | operator Net & () const |
| |
| Model & | operator= (const Model &)=default |
| |
| Model & | operator= (Model &&)=default |
| |
| void | predict (InputArray frame, OutputArrayOfArrays outs) const |
| | 給定 input 幀,建立輸入 blob,執行網路並返回輸出 blobs。
|
| |
| Model & | setInputCrop (bool crop) |
| | 設定幀的 crop 標誌。
|
| |
| Model & | setInputMean (const Scalar &mean) |
| | 設定幀的均值。
|
| |
| void | setInputParams (double scale=1.0, const Size &size=Size(), const Scalar &mean=Scalar(), bool swapRB=false, bool crop=false) |
| | 設定幀的預處理引數。
|
| |
| Model & | setInputScale (const Scalar &scale) |
| | 設定幀的 scalefactor 值。
|
| |
| Model & | setInputSize (const Size &size) |
| | 設定幀的輸入大小。
|
| |
| Model & | setInputSize (int width, int height) |
| |
| Model & | setInputSwapRB (bool swapRB) |
| | 設定幀的 swapRB 標誌。
|
| |
| Model & | setOutputNames (const std::vector< String > &outNames) |
| | 設定幀的輸出名稱。
|
| |
| Model & | setPreferableBackend (dnn::Backend backendId) |
| |
| Model & | setPreferableTarget (dnn::Target targetId) |
| |
此類表示分類模型的高階 API。
ClassificationModel 允許為預處理輸入影像設定引數。 ClassificationModel 從包含訓練權重和配置的檔案建立網路,設定預處理輸入,執行前向傳遞並返回 top-1 預測。
◆ ClassificationModel() [1/3]
| cv::dnn::ClassificationModel::ClassificationModel |
( |
| ) |
|
| Python |
|---|
| cv.dnn.ClassificationModel( | model[, config] | ) -> | <dnn_ClassificationModel 物件> |
| cv.dnn.ClassificationModel( | 網路 | ) -> | <dnn_ClassificationModel 物件> |
◆ ClassificationModel() [2/3]
| Python |
|---|
| cv.dnn.ClassificationModel( | model[, config] | ) -> | <dnn_ClassificationModel 物件> |
| cv.dnn.ClassificationModel( | 網路 | ) -> | <dnn_ClassificationModel 物件> |
從以支援的格式之一表示的網路建立分類模型。 model 和 config 引數的順序無關緊要。
- 引數
-
| [輸入] | model | 二進位制檔案包含訓練權重。 |
| [輸入] | config | 文字檔案包含網路配置。 |
◆ ClassificationModel() [3/3]
| cv::dnn::ClassificationModel::ClassificationModel |
( |
const Net & | 網路 | ) |
|
| Python |
|---|
| cv.dnn.ClassificationModel( | model[, config] | ) -> | <dnn_ClassificationModel 物件> |
| cv.dnn.ClassificationModel( | 網路 | ) -> | <dnn_ClassificationModel 物件> |
◆ classify() [1/2]
| std::pair< int, float > cv::dnn::ClassificationModel::classify |
( |
InputArray | frame | ) |
|
| Python |
|---|
| cv.dnn.ClassificationModel.classify( | frame | ) -> | classId, conf |
給定 input 幀,建立輸入 blob,執行網路並返回 top-1 預測。
- 引數
-
◆ classify() [2/2]
| void cv::dnn::ClassificationModel::classify |
( |
InputArray | frame, |
|
|
int & | classId, |
|
|
float & | conf ) |
| Python |
|---|
| cv.dnn.ClassificationModel.classify( | frame | ) -> | classId, conf |
這是一個過載的成員函式,為了方便而提供。 它與上面的函式僅在於它接受的引數。
◆ getEnableSoftmaxPostProcessing()
| bool cv::dnn::ClassificationModel::getEnableSoftmaxPostProcessing |
( |
| ) |
const |
| Python |
|---|
| cv.dnn.ClassificationModel.getEnableSoftmaxPostProcessing( | | ) -> | retval |
獲取啟用/停用 softmax 後處理選項。
此選項預設為 false,softmax 後處理未在 classify() 函式中應用。
◆ setEnableSoftmaxPostProcessing()
| Python |
|---|
| cv.dnn.ClassificationModel.setEnableSoftmaxPostProcessing( | 啟用 | ) -> | retval |
設定啟用/停用 softmax 後處理選項。
如果此選項為 true,則在 classify() 函式中的前向推理之後應用 softmax,以將置信度範圍轉換為 [0.0-1.0]。 此函式允許您切換此行為。 如果模型中不包含 softmax 層,請設定為 true。
- 引數
-
此類文件由以下檔案生成