神经网络有没有通用的格式 [英] Is there a common format for neural networks
问题描述
不同的团队使用不同的库来训练和运行神经网络(caffe、torch、theano...).这使得共享变得困难:每个库都有自己的格式来存储网络,并且每次要测试其他团队的工作时都必须安装一个新库.
Different teams use different libraries to train and run neural networks (caffe, torch, theano...). This makes sharing difficult: each library has its own format to store networks and you have to install a new library each time you want to test other teams' work.
我正在寻找解决方案以减少繁琐:- 是否有首选(共享?)格式来存储神经网络?- 是否有可以帮助处理不同类型网络/或将一种类型转换为另一种类型的服务或库?
I am looking for solutions to make this less tedious: - Is there a preferred (shared?) format to store neural networks? - Is there a service or library that can help handle different types of networks / or transform one type into another?
谢谢!
推荐答案
是否有首选(共享?)格式来存储神经网络?
Is there a preferred (shared?) format to store neural networks?
每个库/框架都有自己的序列化,例如Caffe 使用协议缓冲区,Torch 有一个内置序列化方案和Theano对象可以用pickle 序列化.
Each library / framework has its own serialization, e.g. Caffe uses Protocol Buffers, Torch has a built-in serialization scheme and Theano objects can be serialized with pickle.
在某些情况下,例如 OverFeat 或 darknet 权重和偏差通过对应 float
的普通 fwrite
-s 以二进制格式存储在磁盘上(或 double
) 连续数组(有关详细信息,请参阅此答案).请注意,这不包括必须单独知道或表示的网络/模型的架构(例如 在加载时明确声明).
In some cases like OverFeat or darknet the weights and biases are stored on-disk in binary format via plain fwrite
-s of the corresponding float
(or double
) contiguous arrays (see this answer for more details). Note that this does not cover the architecture of the network / model which has to be known or represented separately (like declared explicitly at load time).
此外:像 libccv 这样的库将结构和权重存储在 SQLite 数据库.
Also: a library like libccv stores the structure and the weights in a SQLite database.
是否有可以帮助处理不同类型网络/或将一种类型转换为另一种类型的服务或库?
Is there a service or library that can help handle different types of networks / or transform one type into another?
我认为没有一个(元)库声称这样做.但它存在提供方便转换器的不同项目.
I don't think there is a single (meta) library that claims to do so. But it exists distinct projects that provide convenient converters.
一些示例(非详尽无遗):
Some examples (non exhaustive):
- Caffe -> Torch:https://github.com/szagoruyko/loadcaffe
- Torch -> Caffe:https://github.com/facebook/fb-caffe-exts
- Caffe -> TensorFlow:https://github.com/ethereon/caffe-tensorflow
--
更新(2017-09):两个值得注意的举措是:
UPDATE (2017-09): two noticeable initiatives are:
(1) ONNX 格式(又名开放神经网络交换):
(1) the ONNX format (a.k.a. Open Neural Network Exchange):
[...] 表示深度学习模型的标准,使模型能够在框架之间转移
[...] a standard for representing deep learning models that enables models to be transferred between frameworks
(2) Apple 引入的 CoreML 格式:
(2) the CoreML format introduced by Apple:
[...] 一种广泛的机器学习方法的公共文件格式 (.mlmodel
) [...] 这种格式的模型可以通过 Xcode 直接集成到应用程序中.>
[...] a public file format (
.mlmodel
) for a broad set of ML methods [...] Models in this format can be directly integrated into apps through Xcode.
这篇关于神经网络有没有通用的格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!