ANN_MLP.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869
  1. 
  2. using OpenCVForUnity.CoreModule;
  3. using OpenCVForUnity.UtilsModule;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Runtime.InteropServices;
  7. namespace OpenCVForUnity.MlModule
  8. {
  9. // C++: class ANN_MLP
  10. //javadoc: ANN_MLP
  11. public class ANN_MLP : StatModel
  12. {
  13. protected override void Dispose (bool disposing)
  14. {
  15. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  16. try {
  17. if (disposing) {
  18. }
  19. if (IsEnabledDispose) {
  20. if (nativeObj != IntPtr.Zero)
  21. ml_ANN_1MLP_delete(nativeObj);
  22. nativeObj = IntPtr.Zero;
  23. }
  24. } finally {
  25. base.Dispose (disposing);
  26. }
  27. #else
  28. return;
  29. #endif
  30. }
  31. protected internal ANN_MLP (IntPtr addr) : base (addr) { }
  32. // internal usage only
  33. public static new ANN_MLP __fromPtr__ (IntPtr addr) { return new ANN_MLP (addr); }
  34. // C++: enum TrainFlags
  35. public const int UPDATE_WEIGHTS = 1;
  36. public const int NO_INPUT_SCALE = 2;
  37. public const int NO_OUTPUT_SCALE = 4;
  38. // C++: enum TrainingMethods
  39. public const int BACKPROP = 0;
  40. public const int RPROP = 1;
  41. public const int ANNEAL = 2;
  42. // C++: enum ActivationFunctions
  43. public const int IDENTITY = 0;
  44. public const int SIGMOID_SYM = 1;
  45. public const int GAUSSIAN = 2;
  46. public const int RELU = 3;
  47. public const int LEAKYRELU = 4;
  48. //
  49. // C++: Mat cv::ml::ANN_MLP::getLayerSizes()
  50. //
  51. //javadoc: ANN_MLP::getLayerSizes()
  52. public Mat getLayerSizes ()
  53. {
  54. ThrowIfDisposed ();
  55. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  56. Mat retVal = new Mat(ml_ANN_1MLP_getLayerSizes_10(nativeObj));
  57. return retVal;
  58. #else
  59. return null;
  60. #endif
  61. }
  62. //
  63. // C++: Mat cv::ml::ANN_MLP::getWeights(int layerIdx)
  64. //
  65. //javadoc: ANN_MLP::getWeights(layerIdx)
  66. public Mat getWeights (int layerIdx)
  67. {
  68. ThrowIfDisposed ();
  69. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  70. Mat retVal = new Mat(ml_ANN_1MLP_getWeights_10(nativeObj, layerIdx));
  71. return retVal;
  72. #else
  73. return null;
  74. #endif
  75. }
  76. //
  77. // C++: static Ptr_ANN_MLP cv::ml::ANN_MLP::create()
  78. //
  79. //javadoc: ANN_MLP::create()
  80. public static ANN_MLP create ()
  81. {
  82. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  83. ANN_MLP retVal = ANN_MLP.__fromPtr__(ml_ANN_1MLP_create_10());
  84. return retVal;
  85. #else
  86. return null;
  87. #endif
  88. }
  89. //
  90. // C++: static Ptr_ANN_MLP cv::ml::ANN_MLP::load(String filepath)
  91. //
  92. //javadoc: ANN_MLP::load(filepath)
  93. public static ANN_MLP load (string filepath)
  94. {
  95. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  96. ANN_MLP retVal = ANN_MLP.__fromPtr__(ml_ANN_1MLP_load_10(filepath));
  97. return retVal;
  98. #else
  99. return null;
  100. #endif
  101. }
  102. //
  103. // C++: TermCriteria cv::ml::ANN_MLP::getTermCriteria()
  104. //
  105. //javadoc: ANN_MLP::getTermCriteria()
  106. public TermCriteria getTermCriteria ()
  107. {
  108. ThrowIfDisposed ();
  109. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  110. double[] tmpArray = new double[3];
  111. ml_ANN_1MLP_getTermCriteria_10(nativeObj, tmpArray);
  112. TermCriteria retVal = new TermCriteria (tmpArray);
  113. return retVal;
  114. #else
  115. return null;
  116. #endif
  117. }
  118. //
  119. // C++: double cv::ml::ANN_MLP::getAnnealCoolingRatio()
  120. //
  121. //javadoc: ANN_MLP::getAnnealCoolingRatio()
  122. public double getAnnealCoolingRatio ()
  123. {
  124. ThrowIfDisposed ();
  125. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  126. double retVal = ml_ANN_1MLP_getAnnealCoolingRatio_10(nativeObj);
  127. return retVal;
  128. #else
  129. return -1;
  130. #endif
  131. }
  132. //
  133. // C++: double cv::ml::ANN_MLP::getAnnealFinalT()
  134. //
  135. //javadoc: ANN_MLP::getAnnealFinalT()
  136. public double getAnnealFinalT ()
  137. {
  138. ThrowIfDisposed ();
  139. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  140. double retVal = ml_ANN_1MLP_getAnnealFinalT_10(nativeObj);
  141. return retVal;
  142. #else
  143. return -1;
  144. #endif
  145. }
  146. //
  147. // C++: double cv::ml::ANN_MLP::getAnnealInitialT()
  148. //
  149. //javadoc: ANN_MLP::getAnnealInitialT()
  150. public double getAnnealInitialT ()
  151. {
  152. ThrowIfDisposed ();
  153. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  154. double retVal = ml_ANN_1MLP_getAnnealInitialT_10(nativeObj);
  155. return retVal;
  156. #else
  157. return -1;
  158. #endif
  159. }
  160. //
  161. // C++: double cv::ml::ANN_MLP::getBackpropMomentumScale()
  162. //
  163. //javadoc: ANN_MLP::getBackpropMomentumScale()
  164. public double getBackpropMomentumScale ()
  165. {
  166. ThrowIfDisposed ();
  167. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  168. double retVal = ml_ANN_1MLP_getBackpropMomentumScale_10(nativeObj);
  169. return retVal;
  170. #else
  171. return -1;
  172. #endif
  173. }
  174. //
  175. // C++: double cv::ml::ANN_MLP::getBackpropWeightScale()
  176. //
  177. //javadoc: ANN_MLP::getBackpropWeightScale()
  178. public double getBackpropWeightScale ()
  179. {
  180. ThrowIfDisposed ();
  181. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  182. double retVal = ml_ANN_1MLP_getBackpropWeightScale_10(nativeObj);
  183. return retVal;
  184. #else
  185. return -1;
  186. #endif
  187. }
  188. //
  189. // C++: double cv::ml::ANN_MLP::getRpropDW0()
  190. //
  191. //javadoc: ANN_MLP::getRpropDW0()
  192. public double getRpropDW0 ()
  193. {
  194. ThrowIfDisposed ();
  195. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  196. double retVal = ml_ANN_1MLP_getRpropDW0_10(nativeObj);
  197. return retVal;
  198. #else
  199. return -1;
  200. #endif
  201. }
  202. //
  203. // C++: double cv::ml::ANN_MLP::getRpropDWMax()
  204. //
  205. //javadoc: ANN_MLP::getRpropDWMax()
  206. public double getRpropDWMax ()
  207. {
  208. ThrowIfDisposed ();
  209. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  210. double retVal = ml_ANN_1MLP_getRpropDWMax_10(nativeObj);
  211. return retVal;
  212. #else
  213. return -1;
  214. #endif
  215. }
  216. //
  217. // C++: double cv::ml::ANN_MLP::getRpropDWMin()
  218. //
  219. //javadoc: ANN_MLP::getRpropDWMin()
  220. public double getRpropDWMin ()
  221. {
  222. ThrowIfDisposed ();
  223. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  224. double retVal = ml_ANN_1MLP_getRpropDWMin_10(nativeObj);
  225. return retVal;
  226. #else
  227. return -1;
  228. #endif
  229. }
  230. //
  231. // C++: double cv::ml::ANN_MLP::getRpropDWMinus()
  232. //
  233. //javadoc: ANN_MLP::getRpropDWMinus()
  234. public double getRpropDWMinus ()
  235. {
  236. ThrowIfDisposed ();
  237. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  238. double retVal = ml_ANN_1MLP_getRpropDWMinus_10(nativeObj);
  239. return retVal;
  240. #else
  241. return -1;
  242. #endif
  243. }
  244. //
  245. // C++: double cv::ml::ANN_MLP::getRpropDWPlus()
  246. //
  247. //javadoc: ANN_MLP::getRpropDWPlus()
  248. public double getRpropDWPlus ()
  249. {
  250. ThrowIfDisposed ();
  251. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  252. double retVal = ml_ANN_1MLP_getRpropDWPlus_10(nativeObj);
  253. return retVal;
  254. #else
  255. return -1;
  256. #endif
  257. }
  258. //
  259. // C++: int cv::ml::ANN_MLP::getAnnealItePerStep()
  260. //
  261. //javadoc: ANN_MLP::getAnnealItePerStep()
  262. public int getAnnealItePerStep ()
  263. {
  264. ThrowIfDisposed ();
  265. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  266. int retVal = ml_ANN_1MLP_getAnnealItePerStep_10(nativeObj);
  267. return retVal;
  268. #else
  269. return -1;
  270. #endif
  271. }
  272. //
  273. // C++: int cv::ml::ANN_MLP::getTrainMethod()
  274. //
  275. //javadoc: ANN_MLP::getTrainMethod()
  276. public int getTrainMethod ()
  277. {
  278. ThrowIfDisposed ();
  279. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  280. int retVal = ml_ANN_1MLP_getTrainMethod_10(nativeObj);
  281. return retVal;
  282. #else
  283. return -1;
  284. #endif
  285. }
  286. //
  287. // C++: void cv::ml::ANN_MLP::setActivationFunction(int type, double param1 = 0, double param2 = 0)
  288. //
  289. //javadoc: ANN_MLP::setActivationFunction(type, param1, param2)
  290. public void setActivationFunction (int type, double param1, double param2)
  291. {
  292. ThrowIfDisposed ();
  293. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  294. ml_ANN_1MLP_setActivationFunction_10(nativeObj, type, param1, param2);
  295. return;
  296. #else
  297. return;
  298. #endif
  299. }
  300. //javadoc: ANN_MLP::setActivationFunction(type, param1)
  301. public void setActivationFunction (int type, double param1)
  302. {
  303. ThrowIfDisposed ();
  304. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  305. ml_ANN_1MLP_setActivationFunction_11(nativeObj, type, param1);
  306. return;
  307. #else
  308. return;
  309. #endif
  310. }
  311. //javadoc: ANN_MLP::setActivationFunction(type)
  312. public void setActivationFunction (int type)
  313. {
  314. ThrowIfDisposed ();
  315. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  316. ml_ANN_1MLP_setActivationFunction_12(nativeObj, type);
  317. return;
  318. #else
  319. return;
  320. #endif
  321. }
  322. //
  323. // C++: void cv::ml::ANN_MLP::setAnnealCoolingRatio(double val)
  324. //
  325. //javadoc: ANN_MLP::setAnnealCoolingRatio(val)
  326. public void setAnnealCoolingRatio (double val)
  327. {
  328. ThrowIfDisposed ();
  329. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  330. ml_ANN_1MLP_setAnnealCoolingRatio_10(nativeObj, val);
  331. return;
  332. #else
  333. return;
  334. #endif
  335. }
  336. //
  337. // C++: void cv::ml::ANN_MLP::setAnnealFinalT(double val)
  338. //
  339. //javadoc: ANN_MLP::setAnnealFinalT(val)
  340. public void setAnnealFinalT (double val)
  341. {
  342. ThrowIfDisposed ();
  343. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  344. ml_ANN_1MLP_setAnnealFinalT_10(nativeObj, val);
  345. return;
  346. #else
  347. return;
  348. #endif
  349. }
  350. //
  351. // C++: void cv::ml::ANN_MLP::setAnnealInitialT(double val)
  352. //
  353. //javadoc: ANN_MLP::setAnnealInitialT(val)
  354. public void setAnnealInitialT (double val)
  355. {
  356. ThrowIfDisposed ();
  357. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  358. ml_ANN_1MLP_setAnnealInitialT_10(nativeObj, val);
  359. return;
  360. #else
  361. return;
  362. #endif
  363. }
  364. //
  365. // C++: void cv::ml::ANN_MLP::setAnnealItePerStep(int val)
  366. //
  367. //javadoc: ANN_MLP::setAnnealItePerStep(val)
  368. public void setAnnealItePerStep (int val)
  369. {
  370. ThrowIfDisposed ();
  371. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  372. ml_ANN_1MLP_setAnnealItePerStep_10(nativeObj, val);
  373. return;
  374. #else
  375. return;
  376. #endif
  377. }
  378. //
  379. // C++: void cv::ml::ANN_MLP::setBackpropMomentumScale(double val)
  380. //
  381. //javadoc: ANN_MLP::setBackpropMomentumScale(val)
  382. public void setBackpropMomentumScale (double val)
  383. {
  384. ThrowIfDisposed ();
  385. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  386. ml_ANN_1MLP_setBackpropMomentumScale_10(nativeObj, val);
  387. return;
  388. #else
  389. return;
  390. #endif
  391. }
  392. //
  393. // C++: void cv::ml::ANN_MLP::setBackpropWeightScale(double val)
  394. //
  395. //javadoc: ANN_MLP::setBackpropWeightScale(val)
  396. public void setBackpropWeightScale (double val)
  397. {
  398. ThrowIfDisposed ();
  399. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  400. ml_ANN_1MLP_setBackpropWeightScale_10(nativeObj, val);
  401. return;
  402. #else
  403. return;
  404. #endif
  405. }
  406. //
  407. // C++: void cv::ml::ANN_MLP::setLayerSizes(Mat _layer_sizes)
  408. //
  409. //javadoc: ANN_MLP::setLayerSizes(_layer_sizes)
  410. public void setLayerSizes (Mat _layer_sizes)
  411. {
  412. ThrowIfDisposed ();
  413. if (_layer_sizes != null) _layer_sizes.ThrowIfDisposed ();
  414. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  415. ml_ANN_1MLP_setLayerSizes_10(nativeObj, _layer_sizes.nativeObj);
  416. return;
  417. #else
  418. return;
  419. #endif
  420. }
  421. //
  422. // C++: void cv::ml::ANN_MLP::setRpropDW0(double val)
  423. //
  424. //javadoc: ANN_MLP::setRpropDW0(val)
  425. public void setRpropDW0 (double val)
  426. {
  427. ThrowIfDisposed ();
  428. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  429. ml_ANN_1MLP_setRpropDW0_10(nativeObj, val);
  430. return;
  431. #else
  432. return;
  433. #endif
  434. }
  435. //
  436. // C++: void cv::ml::ANN_MLP::setRpropDWMax(double val)
  437. //
  438. //javadoc: ANN_MLP::setRpropDWMax(val)
  439. public void setRpropDWMax (double val)
  440. {
  441. ThrowIfDisposed ();
  442. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  443. ml_ANN_1MLP_setRpropDWMax_10(nativeObj, val);
  444. return;
  445. #else
  446. return;
  447. #endif
  448. }
  449. //
  450. // C++: void cv::ml::ANN_MLP::setRpropDWMin(double val)
  451. //
  452. //javadoc: ANN_MLP::setRpropDWMin(val)
  453. public void setRpropDWMin (double val)
  454. {
  455. ThrowIfDisposed ();
  456. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  457. ml_ANN_1MLP_setRpropDWMin_10(nativeObj, val);
  458. return;
  459. #else
  460. return;
  461. #endif
  462. }
  463. //
  464. // C++: void cv::ml::ANN_MLP::setRpropDWMinus(double val)
  465. //
  466. //javadoc: ANN_MLP::setRpropDWMinus(val)
  467. public void setRpropDWMinus (double val)
  468. {
  469. ThrowIfDisposed ();
  470. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  471. ml_ANN_1MLP_setRpropDWMinus_10(nativeObj, val);
  472. return;
  473. #else
  474. return;
  475. #endif
  476. }
  477. //
  478. // C++: void cv::ml::ANN_MLP::setRpropDWPlus(double val)
  479. //
  480. //javadoc: ANN_MLP::setRpropDWPlus(val)
  481. public void setRpropDWPlus (double val)
  482. {
  483. ThrowIfDisposed ();
  484. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  485. ml_ANN_1MLP_setRpropDWPlus_10(nativeObj, val);
  486. return;
  487. #else
  488. return;
  489. #endif
  490. }
  491. //
  492. // C++: void cv::ml::ANN_MLP::setTermCriteria(TermCriteria val)
  493. //
  494. //javadoc: ANN_MLP::setTermCriteria(val)
  495. public void setTermCriteria (TermCriteria val)
  496. {
  497. ThrowIfDisposed ();
  498. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  499. ml_ANN_1MLP_setTermCriteria_10(nativeObj, val.type, val.maxCount, val.epsilon);
  500. return;
  501. #else
  502. return;
  503. #endif
  504. }
  505. //
  506. // C++: void cv::ml::ANN_MLP::setTrainMethod(int method, double param1 = 0, double param2 = 0)
  507. //
  508. //javadoc: ANN_MLP::setTrainMethod(method, param1, param2)
  509. public void setTrainMethod (int method, double param1, double param2)
  510. {
  511. ThrowIfDisposed ();
  512. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  513. ml_ANN_1MLP_setTrainMethod_10(nativeObj, method, param1, param2);
  514. return;
  515. #else
  516. return;
  517. #endif
  518. }
  519. //javadoc: ANN_MLP::setTrainMethod(method, param1)
  520. public void setTrainMethod (int method, double param1)
  521. {
  522. ThrowIfDisposed ();
  523. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  524. ml_ANN_1MLP_setTrainMethod_11(nativeObj, method, param1);
  525. return;
  526. #else
  527. return;
  528. #endif
  529. }
  530. //javadoc: ANN_MLP::setTrainMethod(method)
  531. public void setTrainMethod (int method)
  532. {
  533. ThrowIfDisposed ();
  534. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  535. ml_ANN_1MLP_setTrainMethod_12(nativeObj, method);
  536. return;
  537. #else
  538. return;
  539. #endif
  540. }
  541. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  542. const string LIBNAME = "__Internal";
  543. #else
  544. const string LIBNAME = "opencvforunity";
  545. #endif
  546. // C++: Mat cv::ml::ANN_MLP::getLayerSizes()
  547. [DllImport (LIBNAME)]
  548. private static extern IntPtr ml_ANN_1MLP_getLayerSizes_10 (IntPtr nativeObj);
  549. // C++: Mat cv::ml::ANN_MLP::getWeights(int layerIdx)
  550. [DllImport (LIBNAME)]
  551. private static extern IntPtr ml_ANN_1MLP_getWeights_10 (IntPtr nativeObj, int layerIdx);
  552. // C++: static Ptr_ANN_MLP cv::ml::ANN_MLP::create()
  553. [DllImport (LIBNAME)]
  554. private static extern IntPtr ml_ANN_1MLP_create_10 ();
  555. // C++: static Ptr_ANN_MLP cv::ml::ANN_MLP::load(String filepath)
  556. [DllImport (LIBNAME)]
  557. private static extern IntPtr ml_ANN_1MLP_load_10 (string filepath);
  558. // C++: TermCriteria cv::ml::ANN_MLP::getTermCriteria()
  559. [DllImport (LIBNAME)]
  560. private static extern void ml_ANN_1MLP_getTermCriteria_10 (IntPtr nativeObj, double[] retVal);
  561. // C++: double cv::ml::ANN_MLP::getAnnealCoolingRatio()
  562. [DllImport (LIBNAME)]
  563. private static extern double ml_ANN_1MLP_getAnnealCoolingRatio_10 (IntPtr nativeObj);
  564. // C++: double cv::ml::ANN_MLP::getAnnealFinalT()
  565. [DllImport (LIBNAME)]
  566. private static extern double ml_ANN_1MLP_getAnnealFinalT_10 (IntPtr nativeObj);
  567. // C++: double cv::ml::ANN_MLP::getAnnealInitialT()
  568. [DllImport (LIBNAME)]
  569. private static extern double ml_ANN_1MLP_getAnnealInitialT_10 (IntPtr nativeObj);
  570. // C++: double cv::ml::ANN_MLP::getBackpropMomentumScale()
  571. [DllImport (LIBNAME)]
  572. private static extern double ml_ANN_1MLP_getBackpropMomentumScale_10 (IntPtr nativeObj);
  573. // C++: double cv::ml::ANN_MLP::getBackpropWeightScale()
  574. [DllImport (LIBNAME)]
  575. private static extern double ml_ANN_1MLP_getBackpropWeightScale_10 (IntPtr nativeObj);
  576. // C++: double cv::ml::ANN_MLP::getRpropDW0()
  577. [DllImport (LIBNAME)]
  578. private static extern double ml_ANN_1MLP_getRpropDW0_10 (IntPtr nativeObj);
  579. // C++: double cv::ml::ANN_MLP::getRpropDWMax()
  580. [DllImport (LIBNAME)]
  581. private static extern double ml_ANN_1MLP_getRpropDWMax_10 (IntPtr nativeObj);
  582. // C++: double cv::ml::ANN_MLP::getRpropDWMin()
  583. [DllImport (LIBNAME)]
  584. private static extern double ml_ANN_1MLP_getRpropDWMin_10 (IntPtr nativeObj);
  585. // C++: double cv::ml::ANN_MLP::getRpropDWMinus()
  586. [DllImport (LIBNAME)]
  587. private static extern double ml_ANN_1MLP_getRpropDWMinus_10 (IntPtr nativeObj);
  588. // C++: double cv::ml::ANN_MLP::getRpropDWPlus()
  589. [DllImport (LIBNAME)]
  590. private static extern double ml_ANN_1MLP_getRpropDWPlus_10 (IntPtr nativeObj);
  591. // C++: int cv::ml::ANN_MLP::getAnnealItePerStep()
  592. [DllImport (LIBNAME)]
  593. private static extern int ml_ANN_1MLP_getAnnealItePerStep_10 (IntPtr nativeObj);
  594. // C++: int cv::ml::ANN_MLP::getTrainMethod()
  595. [DllImport (LIBNAME)]
  596. private static extern int ml_ANN_1MLP_getTrainMethod_10 (IntPtr nativeObj);
  597. // C++: void cv::ml::ANN_MLP::setActivationFunction(int type, double param1 = 0, double param2 = 0)
  598. [DllImport (LIBNAME)]
  599. private static extern void ml_ANN_1MLP_setActivationFunction_10 (IntPtr nativeObj, int type, double param1, double param2);
  600. [DllImport (LIBNAME)]
  601. private static extern void ml_ANN_1MLP_setActivationFunction_11 (IntPtr nativeObj, int type, double param1);
  602. [DllImport (LIBNAME)]
  603. private static extern void ml_ANN_1MLP_setActivationFunction_12 (IntPtr nativeObj, int type);
  604. // C++: void cv::ml::ANN_MLP::setAnnealCoolingRatio(double val)
  605. [DllImport (LIBNAME)]
  606. private static extern void ml_ANN_1MLP_setAnnealCoolingRatio_10 (IntPtr nativeObj, double val);
  607. // C++: void cv::ml::ANN_MLP::setAnnealFinalT(double val)
  608. [DllImport (LIBNAME)]
  609. private static extern void ml_ANN_1MLP_setAnnealFinalT_10 (IntPtr nativeObj, double val);
  610. // C++: void cv::ml::ANN_MLP::setAnnealInitialT(double val)
  611. [DllImport (LIBNAME)]
  612. private static extern void ml_ANN_1MLP_setAnnealInitialT_10 (IntPtr nativeObj, double val);
  613. // C++: void cv::ml::ANN_MLP::setAnnealItePerStep(int val)
  614. [DllImport (LIBNAME)]
  615. private static extern void ml_ANN_1MLP_setAnnealItePerStep_10 (IntPtr nativeObj, int val);
  616. // C++: void cv::ml::ANN_MLP::setBackpropMomentumScale(double val)
  617. [DllImport (LIBNAME)]
  618. private static extern void ml_ANN_1MLP_setBackpropMomentumScale_10 (IntPtr nativeObj, double val);
  619. // C++: void cv::ml::ANN_MLP::setBackpropWeightScale(double val)
  620. [DllImport (LIBNAME)]
  621. private static extern void ml_ANN_1MLP_setBackpropWeightScale_10 (IntPtr nativeObj, double val);
  622. // C++: void cv::ml::ANN_MLP::setLayerSizes(Mat _layer_sizes)
  623. [DllImport (LIBNAME)]
  624. private static extern void ml_ANN_1MLP_setLayerSizes_10 (IntPtr nativeObj, IntPtr _layer_sizes_nativeObj);
  625. // C++: void cv::ml::ANN_MLP::setRpropDW0(double val)
  626. [DllImport (LIBNAME)]
  627. private static extern void ml_ANN_1MLP_setRpropDW0_10 (IntPtr nativeObj, double val);
  628. // C++: void cv::ml::ANN_MLP::setRpropDWMax(double val)
  629. [DllImport (LIBNAME)]
  630. private static extern void ml_ANN_1MLP_setRpropDWMax_10 (IntPtr nativeObj, double val);
  631. // C++: void cv::ml::ANN_MLP::setRpropDWMin(double val)
  632. [DllImport (LIBNAME)]
  633. private static extern void ml_ANN_1MLP_setRpropDWMin_10 (IntPtr nativeObj, double val);
  634. // C++: void cv::ml::ANN_MLP::setRpropDWMinus(double val)
  635. [DllImport (LIBNAME)]
  636. private static extern void ml_ANN_1MLP_setRpropDWMinus_10 (IntPtr nativeObj, double val);
  637. // C++: void cv::ml::ANN_MLP::setRpropDWPlus(double val)
  638. [DllImport (LIBNAME)]
  639. private static extern void ml_ANN_1MLP_setRpropDWPlus_10 (IntPtr nativeObj, double val);
  640. // C++: void cv::ml::ANN_MLP::setTermCriteria(TermCriteria val)
  641. [DllImport (LIBNAME)]
  642. private static extern void ml_ANN_1MLP_setTermCriteria_10 (IntPtr nativeObj, int val_type, int val_maxCount, double val_epsilon);
  643. // C++: void cv::ml::ANN_MLP::setTrainMethod(int method, double param1 = 0, double param2 = 0)
  644. [DllImport (LIBNAME)]
  645. private static extern void ml_ANN_1MLP_setTrainMethod_10 (IntPtr nativeObj, int method, double param1, double param2);
  646. [DllImport (LIBNAME)]
  647. private static extern void ml_ANN_1MLP_setTrainMethod_11 (IntPtr nativeObj, int method, double param1);
  648. [DllImport (LIBNAME)]
  649. private static extern void ml_ANN_1MLP_setTrainMethod_12 (IntPtr nativeObj, int method);
  650. // native support for java finalize()
  651. [DllImport (LIBNAME)]
  652. private static extern void ml_ANN_1MLP_delete (IntPtr nativeObj);
  653. }
  654. }