【发布时间】:2017-01-10 03:30:38
【问题描述】:
我使用 Python API 在 CNTK 中训练了一个模型。我想在 Android 设备上用代码实现网络。
有没有一种方法可以让我访问网络权重,然后直接对网络进行编码而不使用 CNTK 库?
我能否以人类可读的形式访问模型?
【问题讨论】:
我使用 Python API 在 CNTK 中训练了一个模型。我想在 Android 设备上用代码实现网络。
有没有一种方法可以让我访问网络权重,然后直接对网络进行编码而不使用 CNTK 库?
我能否以人类可读的形式访问模型?
【问题讨论】:
是的,你当然可以。该信息可以在 CNTK github 上找到(“我如何”部分)。
https://github.com/Microsoft/CNTK/wiki/Load-model-and-access-network-weights-(parameters)
【讨论】:
您可以使用 CNTK 的 dumpnode 命令将 CNTK 训练的模型转换为 txt 格式。这是内容配置文件txt.conf:
command = convert2txt
convert2txt = [
action = "dumpnode"
modelPath="./cntkSpeechFF.dnn.5"
nodeName = "Prior" # if not specified, all nodes will be printed
outputFile = "./cntkSpeechFF.dnn.5.txt" # the path to the output file. If not specified a file name will be automatically generated based on the modelPath.
printValues = true
printMetadata = true
]
然后你运行cntk作为
cntk configFile=txt.conf
【讨论】: