一组实用程序,可以更轻松地使用bender。
benderthon的Python项目详细描述
一组易于使用的实用程序 Bender。
目前支持tensorflow和caffe,但我们正在努力 更多的东西!
使用TensorFlow 1.2+在Python2.7.+和3.+上工作。
要安装:
pip install benderthon
TensorFlow也是必需的。最简单的安装方法是:
pip install tensorflow
还有其他方法,请参见Installing Tensorflow。本登没有 默认情况下安装它以允许使用自定义安装。
tf冻结
将tensorflow检查点转换为最小冻结的实用程序 图。
使用量
在checkpoint_path.ckpt中获取检查点,其输出为 由名为Tanh的节点生成,并将其保存到 graph_with_weights.pb:
benderthon tf-freeze checkpoint_path.ckpt graph_with_weights.pb Tanh
样本
文件sample.py包含mnist数据集的网络示例 2个卷积层和2个密度层。如果你运行它,它会 生成前缀为checkpoints/mnist.ckpt:
的检查点文件./sample.py
然后你可以得到一个最小的protobuf版本,重量被冻结:
benderthon tf-freeze checkpoints/mnist.ckpt output/mnist.pb Prediction
生成的文件占用原始检查点(26MB到 13MB)。
您还可以只得到图形,它只占用13kb:
benderthon tf-freeze --no-weights checkpoints/mnist.ckpt output/mnist_only_graph.pb Prediction
要将权重保存在单独的路径中以供以后处理:
benderthon tf-freeze --only-weights checkpoints/mnist.ckpt weights/ Prediction
咖啡冷冻
无法从命令行实用程序访问此模块,它应该 从python代码中使用,导入benderthon.caffe_freeze。
您需要首先安装caffeflow包:
pip install -e git://github.com/xmartlabs/caffeflow.git@4618f89#egg=caffeflow
许可证
Copyright 2017 Xmartlabs SRL. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.