This demo is not supposed to represent a production-ready server. It is not secure for the web, and is not setup to be responsive (server-client responses and model evaluation run in the same thread instead of asyncronously). Rather, this is a quick demonstration of how to utilize a pretrained Inception-ResNet model and quickly put together a prototype with it.
- Make sure you have the above dependencies installed (
pip install ...
) - Clone the repo, move into the directory, and execute
run_server.sh
:
$ git clone https://github.com/samjabrahams/inception-resnet-flask-demo.git
$ cd inception-resnet-flask-demo
$ ./run_server.sh
- The main file, runs the preprocessing of files and then launches the Flask server
- You must run this script from its directory, not from a parent or child directory. ie. this:
$ ./run_server.sh
not:
$ ../run_server.sh
or:
$ inception-resnet-flask-demo/run_server.sh
- Downloads Inception-ResNet model and checkpoint files and converts them into a frozen and optimized protobuf file in
serving/static
- Creates
descriptions.txt
, which is a line separated file that provides text descriptions of the outputs of the pretrained Inception-ResNet modeel. The first line corresponds to the output at index 0, the second line corresponds to the output at index 1 etc.
- Starts up the Flask server and TensorFlow model Session
- Contains route functions for the server
- Functions and singleton Session class for the Inception-ResNet Model
- Singleton is used to preserve optimizations and prevent users from reloading the model from memory
- Jinja2 template files for the basic client interface.
The TENSORFLOW_LICENSE applies to the following files:
- Constructs the Inception ResNet V2 model
- From the [TensorFlow Models repository](https://github .com/tensorflow/models/blob/master/slim/nets/inception_resnet_v2.py)
- Creates image steps to preprocess image data for both training and inference
- From the TensorFlow Models repository
- Tool for "freezing" a TensorFlow graph. Converts Variable objects into constants.
- From the TensorFlow repository
- Tool that removes unnecessary operations from a graph.
- From the TensorFlow repository
- Utility functions needed for
optimize_for_inference.py
- From the TensorFlow repository