MCPcopy Create free account
hub / github.com/davisking/dlib / deserialize

Method deserialize

dlib/svm/sequence_segmenter.h:426–456  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

424 }
425
426 friend void deserialize(sequence_segmenter& item, std::istream& in)
427 {
428 int version = 0;
429 deserialize(version, in);
430 if (version != 1)
431 throw serialization_error("Unexpected version found while deserializing dlib::sequence_segmenter.");
432
433 // Try to check if the saved model is compatible with the current feature
434 // extractor.
435 bool use_BIO_model, use_high_order_features;
436 unsigned long dims;
437 deserialize(use_BIO_model, in);
438 deserialize(use_high_order_features, in);
439 deserialize(dims, in);
440 deserialize(item.labeler, in);
441 if (use_BIO_model != feature_extractor::use_BIO_model)
442 {
443 throw serialization_error("Incompatible feature extractor found while deserializing "
444 "dlib::sequence_segmenter. Wrong value of use_BIO_model.");
445 }
446 if (use_high_order_features != feature_extractor::use_high_order_features)
447 {
448 throw serialization_error("Incompatible feature extractor found while deserializing "
449 "dlib::sequence_segmenter. Wrong value of use_high_order_features.");
450 }
451 if (dims != total_feature_vector_size(item.get_feature_extractor()))
452 {
453 throw serialization_error("Incompatible feature extractor found while deserializing "
454 "dlib::sequence_segmenter. Wrong value of total_feature_vector_size().");
455 }
456 }
457
458 private:
459 sequence_labeler<impl_ss::feature_extractor<feature_extractor> > labeler;

Callers

nothing calls this directly

Calls 3

serialization_errorClass · 0.85
deserializeFunction · 0.70

Tested by

no test coverage detected