Skip to content

Instantly share code, notes, and snippets.

@jzstark
Last active August 21, 2019 11:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jzstark/68ddce17fe8a8748815fd23b67a9aff9 to your computer and use it in GitHub Desktop.
Save jzstark/68ddce17fe8a8748815fd23b67a9aff9 to your computer and use it in GitHub Desktop.

Owl-Tensorflow Converter Example: MNIST CNN

This example is a example of MNIST-based CNN.

  • Step 1 : running OCaml script tfgraph_inf.ml, which generates a file tf_convert_mnist.pbtxt in current directory.
  • Step 2 : make sure tf_convert_mnist.pbtxt and tfgraph_inf.py in the same graph; make sure Tensorflow/numpy etc. is installed.
  • Step 3 : execute python tf_converter_mnist.py, and the expected output in screen is an array of size [100], each element is a boolean value. There is also an value to indicate the inference accuracy.

Here we only assume the python script writer knows where to find the output node (in collection "result") and the placeholder names (x:0).

There could be many posssible source of error at this stage, one of which could be incompatible tensorflow version; in that case, probably find this line in test_cgraph.pbtxt : tensorflow_version: "1.12.0" and then change the version number. Also, Tensorflow may yield some warning messages about version/dataset etc. Current scripts may also ignore some factors like file/directory location.

model_checkpoint_path: "owl_model.ckpt"
all_model_checkpoint_paths: "owl_model.ckpt"
View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment