OpenCV 3.0 Can't load neural network

时间秒杀一切 提交于 2019-11-28 13:53:27

You can use save and load, or write and read, but you shouldn't mix them.

So you either need to do:

// Save
neural_network->save("nn.yml");

// Load
Ptr<ANN_MLP> nn = Algorithm::load<ANN_MLP>("nn.yml");

or:

// Write
neural_network->write(fs);

// Read
FileStorage ffs("nn.yml", FileStorage::READ);
Ptr<ANN_MLP> nn = Algorithm::read<ANN_MLP>(ffs.root());
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!