首页 > 解决方案 > Python:如何在 Python 中反序列化经过训练的 dlib 模型数据(.dat)?

问题描述

我正在研究 python 中的 dlib 模型,现在将 C++ dnn_mmod_dog_hipsterizer 代码转换为 python 代码,以便使用其他 python 模块。

在 C++ 代码中,给定的 hipsterizer 数据被反序列化为 net(network)、sp(shape predictor)、glasses 和 mustache。但我找不到任何自定义反序列化的函数。只有 get_frontal_face_detector()、shape_detector() 等。

net_type net;
shape_predictor sp;
matrix<rgb_alpha_pixel> glasses, mustache;
deserialize(argv[1]) >> net >> sp >> glasses >> mustaches;

你能建议如何在 Python 中使用这些数据吗?

标签: pythonc++deserializationdlib

解决方案


推荐阅读