The input_rgb_image_sized is supposed to be convertible to input_rgb_image,

which it was in all ways except you couldn't deserialize directly like you
would expect.  This has now been fixed.
This commit is contained in:
Davis King 2017-08-20 07:14:40 -04:00
parent ba430be591
commit 618f1084d2
1 changed files with 9 additions and 1 deletions

View File

@ -125,11 +125,19 @@ namespace dlib
{
std::string version;
deserialize(version, in);
if (version != "input_rgb_image")
if (version != "input_rgb_image" && version != "input_rgb_image_sized")
throw serialization_error("Unexpected version found while deserializing dlib::input_rgb_image.");
deserialize(item.avg_red, in);
deserialize(item.avg_green, in);
deserialize(item.avg_blue, in);
// read and discard the sizes if this was really a sized input layer.
if (version == "input_rgb_image_sized")
{
size_t nr, nc;
deserialize(nr, in);
deserialize(nc, in);
}
}
friend std::ostream& operator<<(std::ostream& out, const input_rgb_image& item)