1 | initial version |
Thank you, berak. For info, in the simple case of writing and reading, this works: cv::FileStorage fs; fs.open("mlp.xml", cv::FileStorage::WRITE); mlp->write(fs); fs.release();
mlp2 = ANN_MLP::create();
fs.open("mlp.xml", cv::FileStorage::READ);
mlp2->read(fs.root());
fs.release();
If the network is to be saved as a node in a larger hierarchy, write with: fs << "StructureAndWeights" << "{"; mlp->write(fs); fs << "}"; and read with: cv::FileNode node0 = fs.root(); cv::FileNode node1 = node0["StructureAndWeights"]; mlp2->read(node1);
2 | No.2 Revision |
Thank you, berak. For info, in the simple case of writing and reading, this works:
cv::FileStorage fs;
fs.open("mlp.xml", cv::FileStorage::WRITE);
mlp->write(fs);
fs.release();works:
cv::FileStorage fs;
fs.open("mlp.xml", cv::FileStorage::WRITE);
mlp->write(fs);
fs.release();
mlp2 = ANN_MLP::create();
fs.open("mlp.xml", cv::FileStorage::READ);
mlp2->read(fs.root());
fs.release();
If the network is to be saved as a node in a larger hierarchy, write with:
with:
fs << "StructureAndWeights" << "{";
mlp->write(fs);
fs << "}";
and read with:
with:
cv::FileNode node0 = fs.root();
cv::FileNode node1 = node0["StructureAndWeights"];
mlp2->read(node1);mlp2->read(node1);