ClassificationModel.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. //
  2. // This file is auto-generated. Please don't modify it!
  3. //
  4. #pragma once
  5. #ifdef __cplusplus
  6. //#import "opencv.hpp"
  7. #import "opencv2/dnn.hpp"
  8. #import "opencv2/dnn/dnn.hpp"
  9. #else
  10. #define CV_EXPORTS
  11. #endif
  12. #import <Foundation/Foundation.h>
  13. #import "Model.h"
  14. @class Mat;
  15. @class Net;
  16. NS_ASSUME_NONNULL_BEGIN
  17. // C++: class ClassificationModel
  18. /**
  19. * This class represents high-level API for classification models.
  20. *
  21. * ClassificationModel allows to set params for preprocessing input image.
  22. * ClassificationModel creates net from file with trained weights and config,
  23. * sets preprocessing input, runs forward pass and return top-1 prediction.
  24. *
  25. * Member of `Dnn`
  26. */
  27. CV_EXPORTS @interface ClassificationModel : Model
  28. #ifdef __cplusplus
  29. @property(readonly)cv::Ptr<cv::dnn::ClassificationModel> nativePtrClassificationModel;
  30. #endif
  31. #ifdef __cplusplus
  32. - (instancetype)initWithNativePtr:(cv::Ptr<cv::dnn::ClassificationModel>)nativePtr;
  33. + (instancetype)fromNative:(cv::Ptr<cv::dnn::ClassificationModel>)nativePtr;
  34. #endif
  35. #pragma mark - Methods
  36. //
  37. // cv::dnn::ClassificationModel::ClassificationModel(String model, String config = "")
  38. //
  39. /**
  40. * Create classification model from network represented in one of the supported formats.
  41. * An order of @p model and @p config arguments does not matter.
  42. * @param model Binary file contains trained weights.
  43. * @param config Text file contains network configuration.
  44. */
  45. - (instancetype)initWithModel:(NSString*)model config:(NSString*)config;
  46. /**
  47. * Create classification model from network represented in one of the supported formats.
  48. * An order of @p model and @p config arguments does not matter.
  49. * @param model Binary file contains trained weights.
  50. */
  51. - (instancetype)initWithModel:(NSString*)model;
  52. //
  53. // cv::dnn::ClassificationModel::ClassificationModel(Net network)
  54. //
  55. /**
  56. * Create model from deep learning network.
  57. * @param network Net object.
  58. */
  59. - (instancetype)initWithNetwork:(Net*)network;
  60. //
  61. // ClassificationModel cv::dnn::ClassificationModel::setEnableSoftmaxPostProcessing(bool enable)
  62. //
  63. /**
  64. * Set enable/disable softmax post processing option.
  65. *
  66. * If this option is true, softmax is applied after forward inference within the classify() function
  67. * to convert the confidences range to [0.0-1.0].
  68. * This function allows you to toggle this behavior.
  69. * Please turn true when not contain softmax layer in model.
  70. * @param enable Set enable softmax post processing within the classify() function.
  71. */
  72. - (ClassificationModel*)setEnableSoftmaxPostProcessing:(BOOL)enable NS_SWIFT_NAME(setEnableSoftmaxPostProcessing(enable:));
  73. //
  74. // bool cv::dnn::ClassificationModel::getEnableSoftmaxPostProcessing()
  75. //
  76. /**
  77. * Get enable/disable softmax post processing option.
  78. *
  79. * This option defaults to false, softmax post processing is not applied within the classify() function.
  80. */
  81. - (BOOL)getEnableSoftmaxPostProcessing NS_SWIFT_NAME(getEnableSoftmaxPostProcessing());
  82. //
  83. // void cv::dnn::ClassificationModel::classify(Mat frame, int& classId, float& conf)
  84. //
  85. - (void)classify:(Mat*)frame classId:(int*)classId conf:(float*)conf NS_SWIFT_NAME(classify(frame:classId:conf:));
  86. @end
  87. NS_ASSUME_NONNULL_END