Commit de24dbb0 authored by Davis King's avatar Davis King

Fixed the serialization code for the kkmeans object so that it actually works.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402481
parent f311e46d
......@@ -138,14 +138,27 @@ namespace dlib
friend void serialize(const kkmeans& item, std::ostream& out)
{
serialize(item.centers, out);
serialize(item.centers.size(),out);
for (unsigned long i = 0; i < item.centers.size(); ++i)
{
serialize(*item.centers[i], out);
}
serialize(item.kc, out);
serialize(item.assignments, out);
}
friend void deserialize(kkmeans& item, std::istream& in)
{
deserialize(item.centers, in);
unsigned long num;
deserialize(num, in);
item.centers.expand(num);
for (unsigned long i = 0; i < item.centers.size(); ++i)
{
scoped_ptr<kcentroid<kernel_type> > temp(new kcentroid<kernel_type>(kernel_type()));
deserialize(*temp, in);
item.centers[i].swap(temp);
}
deserialize(item.kc, in);
deserialize(item.assignments, in);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment