Commit d0da1ada authored by Davis King's avatar Davis King

Made the serialization formats for scan_image_boxes and scan_image_pyramid

include some extra data to validate the state of the object.
parent 3711b278
......@@ -245,6 +245,7 @@ namespace dlib
serialize(item.loaded_with_image, out);
serialize(item.num_spatial_pyramid_levels, out);
serialize(item.detect_boxes, out);
serialize(item.get_num_dimensions(), out);
}
// ----------------------------------------------------------------------------------------
......@@ -265,6 +266,15 @@ namespace dlib
deserialize(item.loaded_with_image, in);
deserialize(item.num_spatial_pyramid_levels, in);
deserialize(item.detect_boxes, in);
// When developing some feature extractor, it's easy to accidentally change its
// number of dimensions and then try to deserialize data from an older version of
// your extractor into the current code. This check is here to catch that kind of
// user error.
long dims;
deserialize(dims, in);
if (item.get_num_dimensions() != dims)
throw serialization_error("Number of dimensions in serialized scan_image_pyramid don't match the expected number.");
}
// ----------------------------------------------------------------------------------------
......
......@@ -243,6 +243,7 @@ namespace dlib
serialize(item.max_pyramid_levels, out);
serialize(item.min_pyramid_layer_width, out);
serialize(item.min_pyramid_layer_height, out);
serialize(item.get_num_dimensions(), out);
}
// ----------------------------------------------------------------------------------------
......@@ -265,6 +266,15 @@ namespace dlib
deserialize(item.max_pyramid_levels, in);
deserialize(item.min_pyramid_layer_width, in);
deserialize(item.min_pyramid_layer_height, in);
// When developing some feature extractor, it's easy to accidentally change its
// number of dimensions and then try to deserialize data from an older version of
// your extractor into the current code. This check is here to catch that kind of
// user error.
long dims;
deserialize(dims, in);
if (item.get_num_dimensions() != dims)
throw serialization_error("Number of dimensions in serialized scan_image_pyramid don't match the expected number.");
}
// ----------------------------------------------------------------------------------------
......
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