DetectionModel.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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 FloatVector;
  15. @class IntVector;
  16. @class Mat;
  17. @class Net;
  18. @class Rect2i;
  19. NS_ASSUME_NONNULL_BEGIN
  20. // C++: class DetectionModel
  21. /**
  22. * This class represents high-level API for object detection networks.
  23. *
  24. * DetectionModel allows to set params for preprocessing input image.
  25. * DetectionModel creates net from file with trained weights and config,
  26. * sets preprocessing input, runs forward pass and return result detections.
  27. * For DetectionModel SSD, Faster R-CNN, YOLO topologies are supported.
  28. *
  29. * Member of `Dnn`
  30. */
  31. CV_EXPORTS @interface DetectionModel : Model
  32. #ifdef __cplusplus
  33. @property(readonly)cv::Ptr<cv::dnn::DetectionModel> nativePtrDetectionModel;
  34. #endif
  35. #ifdef __cplusplus
  36. - (instancetype)initWithNativePtr:(cv::Ptr<cv::dnn::DetectionModel>)nativePtr;
  37. + (instancetype)fromNative:(cv::Ptr<cv::dnn::DetectionModel>)nativePtr;
  38. #endif
  39. #pragma mark - Methods
  40. //
  41. // cv::dnn::DetectionModel::DetectionModel(String model, String config = "")
  42. //
  43. /**
  44. * Create detection model from network represented in one of the supported formats.
  45. * An order of @p model and @p config arguments does not matter.
  46. * @param model Binary file contains trained weights.
  47. * @param config Text file contains network configuration.
  48. */
  49. - (instancetype)initWithModel:(NSString*)model config:(NSString*)config;
  50. /**
  51. * Create detection model from network represented in one of the supported formats.
  52. * An order of @p model and @p config arguments does not matter.
  53. * @param model Binary file contains trained weights.
  54. */
  55. - (instancetype)initWithModel:(NSString*)model;
  56. //
  57. // cv::dnn::DetectionModel::DetectionModel(Net network)
  58. //
  59. /**
  60. * Create model from deep learning network.
  61. * @param network Net object.
  62. */
  63. - (instancetype)initWithNetwork:(Net*)network;
  64. //
  65. // DetectionModel cv::dnn::DetectionModel::setNmsAcrossClasses(bool value)
  66. //
  67. /**
  68. * nmsAcrossClasses defaults to false,
  69. * such that when non max suppression is used during the detect() function, it will do so per-class.
  70. * This function allows you to toggle this behaviour.
  71. * @param value The new value for nmsAcrossClasses
  72. */
  73. - (DetectionModel*)setNmsAcrossClasses:(BOOL)value NS_SWIFT_NAME(setNmsAcrossClasses(value:));
  74. //
  75. // bool cv::dnn::DetectionModel::getNmsAcrossClasses()
  76. //
  77. /**
  78. * Getter for nmsAcrossClasses. This variable defaults to false,
  79. * such that when non max suppression is used during the detect() function, it will do so only per-class
  80. */
  81. - (BOOL)getNmsAcrossClasses NS_SWIFT_NAME(getNmsAcrossClasses());
  82. //
  83. // void cv::dnn::DetectionModel::detect(Mat frame, vector_int& classIds, vector_float& confidences, vector_Rect& boxes, float confThreshold = 0.5f, float nmsThreshold = 0.0f)
  84. //
  85. /**
  86. * Given the @p input frame, create input blob, run net and return result detections.
  87. * @param classIds Class indexes in result detection.
  88. * @param confidences A set of corresponding confidences.
  89. * @param boxes A set of bounding boxes.
  90. * @param confThreshold A threshold used to filter boxes by confidences.
  91. * @param nmsThreshold A threshold used in non maximum suppression.
  92. */
  93. - (void)detect:(Mat*)frame classIds:(IntVector*)classIds confidences:(FloatVector*)confidences boxes:(NSMutableArray<Rect2i*>*)boxes confThreshold:(float)confThreshold nmsThreshold:(float)nmsThreshold NS_SWIFT_NAME(detect(frame:classIds:confidences:boxes:confThreshold:nmsThreshold:));
  94. /**
  95. * Given the @p input frame, create input blob, run net and return result detections.
  96. * @param classIds Class indexes in result detection.
  97. * @param confidences A set of corresponding confidences.
  98. * @param boxes A set of bounding boxes.
  99. * @param confThreshold A threshold used to filter boxes by confidences.
  100. */
  101. - (void)detect:(Mat*)frame classIds:(IntVector*)classIds confidences:(FloatVector*)confidences boxes:(NSMutableArray<Rect2i*>*)boxes confThreshold:(float)confThreshold NS_SWIFT_NAME(detect(frame:classIds:confidences:boxes:confThreshold:));
  102. /**
  103. * Given the @p input frame, create input blob, run net and return result detections.
  104. * @param classIds Class indexes in result detection.
  105. * @param confidences A set of corresponding confidences.
  106. * @param boxes A set of bounding boxes.
  107. */
  108. - (void)detect:(Mat*)frame classIds:(IntVector*)classIds confidences:(FloatVector*)confidences boxes:(NSMutableArray<Rect2i*>*)boxes NS_SWIFT_NAME(detect(frame:classIds:confidences:boxes:));
  109. @end
  110. NS_ASSUME_NONNULL_END