The project is a Flask backend serving objection detection apis provided from TensorFlow serving. Both are deployed using Docker. A live demo can be found at DigitalOcean.
Flask And Tensorflow Serving using Docker is using Flask as backend server, PostgreSQL as database, TensorFlow Serving as image detection service.
The project is replying on SQLAlchemy and Flask-Migrate to manage database tables.
Flask-Uploads and Flask-Dropzone are used for handling image uploads. Flask-Uploads mainly manages image datastore while Flask-Dropzone handling frontend js.
Flask-Login is for user registration, login and logout, and api authorizations. Currently functions like email confirmations are not implemented in this demo.
The model used for this demo can be found in this Github Repository Model Zoo, which is ssd_inception_v2_coco.
For any other models in the model zoo repository or your own trained ones, change the build args in launch.sh
, like docker-compose build --build-arg model_url="http://download.tensorflow.org/models/object_detection/ssd_inception_v2_coco_2018_01_28.tar.gz"
For running demo without Docker, you need Python 3.6 or later and PostgreSQL database set up accordingly. To setup Tensorflow Serving, you can find more details at this Medium post.
Install dependencies listed in the requirements by pip install -r requirements.txt
. Inside the app folder, execute Flask db upgrade
and Flask run
or python run.py
. After defining environment variables needed for configuration, you should be able to see a Flask instance up and running.
If you are running demo with Docker (recommended), you can clone this project and do the following:
$ cd Flask_Demo_with_Inceptions_on_COCO/
$ sh launch.sh
In another terminal tab, initialize database on the first time:
$ cd Flask_Demo_with_Inceptions_on_COCO/
$ sh init_db.sh
Another note: Please change demo > pg > configuration.py
UPLOADS_DEFAULT_URL = 'http://<your ip address>:5000/static/img/'
. Ex. On you local machine, replace the ip address with localhost
. Same for UPLOADED_PHOTOS_URL
.
If you have any questions, feel free to raise an issue. Good luck!