Branch: master
Find file History
Latest commit f6c6f99 Dec 6, 2018
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
Properties Shuffle samples Feb 1, 2017
ExampleInceptionInference.csproj Move to 4.7.1 Dec 6, 2018
Program.cs Object detection sample (#138) Sep 7, 2017
README.md Shuffle samples Feb 1, 2017
packages.config Shuffle samples Feb 1, 2017

README.md

An example for using the TensorFlow C# API for image recognition using a pre-trained inception model (http://arxiv.org/abs/1512.00567).

Sample usage:

mono ExampleInceptionInference.exe [--dir=/tmp/modeldir] imagefile...

The pre-trained model takes input in the form of a 4-dimensional
tensor with shape [ BATCH_SIZE, IMAGE_HEIGHT, IMAGE_WIDTH, 3 ],
where:

- BATCH_SIZE allows for inference of multiple images in one pass through the graph
- IMAGE_HEIGHT is the height of the images on which the model was trained
- IMAGE_WIDTH is the width of the images on which the model was trained
- 3 is the (R, G, B) values of the pixel colors represented as a float.

And produces as output a vector with shape [ NUM_LABELS ].
output[i] is the probability that the input image was recognized as
having the i-th label.

A separate file contains a list of string labels corresponding to the
integer indices of the output.

This example:
- Loads the serialized representation of the pre-trained model into a Graph
- Creates a Session to execute operations on the Graph
- Converts an image file to a Tensor to provide as input to a Session run
- Executes the Session and prints out the label with the highest probability

To convert an image file to a Tensor suitable for input to the Inception model,
this example:
- Constructs another TensorFlow graph to normalize the image into a
  form suitable for the model (for example, resizing the image)
- Creates an executes a Session to obtain a Tensor in this normalized form.