Metadata-Version: 2.0
Name: benderthon
Version: 0.2.0
Summary: Set of utilities to work easier with Bender.
Home-page: https://github.com/xmartlabs/benderthon
Author: Santiago Castro
Author-email: santiago@xmartlabs.com
License: Apache 2.0
Keywords: Bender,machine learning,artificial intelligence,freeze,model,utility,utilities,TensorFlow
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Dist: tensorflow (>=1.2.0)

benderthon
==========

Set of utilities to work easier with
`Bender <https://github.com/xmartlabs/Bender>`__.

Currently there's support for TensorFlow and Caffe, but we are working
on more stuff!

Works on Python 2.7.+ and 3.+, with Tensorflow 1.2+.

To install:

.. code:: bash

    pip install benderthon

tf-freeze
---------

Utility to convert **TensorFlow** checkpoints into minimal frozen
**graphs**.

Usage
~~~~~

To take the checkpoint in ``checkpoint_path.ckpt``, whose output is
yielded by the node named ``Tanh``, and save it to
``graph_with_weights.pb``:

.. code:: bash

    benderthon tf-freeze checkpoint_path.ckpt graph_with_weights.pb Tanh

Sample
~~~~~~

The file ``sample.py`` contains a network example for MNIST dataset with
2 convolutional layers and 2 dens layers. If you run it, it will
generate checkpoints files with prefix ``checkpoints/mnist.ckpt``:

.. code:: bash

    ./sample.py

Then you can get a minimal protobuf version with the weights frozen:

.. code:: bash

    benderthon tf-freeze checkpoints/mnist.ckpt output/mnist.pb Prediction

The generated file occupies **half** the original checkpoints (26MB to
13MB).

You can also get only the graph, which occupies just **13kB**:

.. code:: bash

    benderthon tf-freeze --no-weights checkpoints/mnist.ckpt output/mnist_only_graph.pb Prediction

To save the weights in a separate path for later processing:

.. code:: bash

    benderthon tf-freeze --only-weights checkpoints/mnist.ckpt weights/ Prediction

caffe-freeze
------------

This module cannot be accessed from the command line utility, it should
be used from Python code, importing ``benderthon.caffe_freeze``.

You need ``caffeflow`` package installed first:

.. code:: bash

    pip install -e git://github.com/xmartlabs/caffeflow.git@4618f89#egg=caffeflow

Development
-----------

This utility is under development and the API **is not stable**. So, do
not heavily rely on it.

To install locally you should do ``./setup.py install``, but first have
`pandoc <http://pandoc.org/>`__ and
`pypandoc <https://github.com/bebraw/pypandoc>`__ installed.

License
-------

::

    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.


