← all repositories
amir-abdi/keras_to_tensorflow

When your Keras model needs to put on its big-boy TensorFlow pants

A no-frills converter that freezes Keras models into standalone TensorFlow protobufs for inference.

1.6k stars Python Inference · Serving
keras_to_tensorflow
Velocity · 7d
+0.5
★ / day
Trend
steady
star history

What it does Feed it a Keras .h5 (with or without a companion .json for architecture) and it spits out a frozen TensorFlow .pb file—variables converted to constants, dead nodes pruned, ready for deployment. Optionally exports checkpoint and metagraph files if you want to resume training later.

The interesting bit The README includes a frank admission rare in ML tooling: “NOT tailored for TensorFlow 2.0 it SEEMS to be working fine.” That hedge is doing more work than most marketing pages. The tool also handles multi-output networks and lets you rename output tensors via prefix flags—small conveniences that save post-conversion headaches.

Key highlights

  • Freezes graphs using graph_util.convert_variables_to_constants (the modern replacement for the old freeze_graph.py dance)
  • Supports both monolithic .h5 models and split weight/architecture setups
  • Optional checkpoint/metagraph export for training resumption
  • Node pruning happens automatically during freeze—no manual graph surgery
  • CLI flags for quantization and custom output node naming

Caveats

  • Explicitly not designed for TF 2.0; “seems to work” is the official compatibility statement
  • Dependencies list includes keras and tensorflow without version pinning—your mileage may vary
  • Legacy code section suggests the author kept old freeze_graph examples around as archaeological reference

Verdict Worth a look if you’re still maintaining TF 1.x inference pipelines or need .pb exports for embedded deployment. If you’re fully on TF 2.x and tf.saved_model, this is mostly a curiosity.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.