How would I export a Random Forest model created with R into OpenCV?I ask because I prototype in R (specifically Random Forest), but would like to be able to run my model in OpenCV due to the latter's speed with processing large images. 解决方案 Effectively, PMML is a one-way street. It is rather easy to export models from any framework-specific representation (eg. OpenCV, R) to PMML representation, but not so easy to do the opposite. The idea is that once you have your model in PMML representation, you should typically consume it using a dedicated PMML scoring engine, not some other technology.In your case, what you want to do is to translate between OpenCV's CvRTrees class and R's randomForest data structure. You are probably better off by developing a direct two-way converter (ie. CvRTrees <-> randomForest) than using PMML as a middleman (ie. CvRTrees <-> PMML <-> randomForest). This decision is easy to rationalize, because at the moment, there is only the randomForest -> PMML conversion component available. Therefore, it is probably less effort to develop two missing conversion components (ie. the former "direct" conversion scenario) than three missing conversion components (ie. the latter "mediated" conversion scenario).To keep things simple, I would recommend to achieve "model portability" by using a shared training dataset. That is, if you need a OpenCV's RF model, then you would train it directly using the CvRTrees::train method call, and if you need a R's RF model, then you would train it directly using the randomForest() method call. 这篇关于将随机森林模型从R导出到OpenCV的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-13 18:50