Skip to content

image-processing-api

Unified interface for image processing services.

Main functionality:

  • connect to served tensorflow networks and process images through them
  • postprocess the results using flexible config files
  • provide image manipulation tools (ex` trimming)

Endpoints:

Health

  • /health/check_status - Check the status of API
  • /health/health_check - Check the status of API and its dependencies

Image tagging

  • /predict/tagger- Tag the image with 61 classes via Tagger multilabel network
  • /predict/exterior_styles - Predict the architectural style of a house by the image of its facade via Exterior Styles network
  • /predict/process_house_images - Tag all images of the house via Tagger network, pass facade images to Exterior Styles network and process those predictions to get full information on the house
  • /predict/encoder Encode images into vectors via Encoder network
  • /api/get_info - Provide information about networks, such as

Image processing tools

  • /tools/trim_image Trim the padding from image & return trimmed version

Schemas and documentation are available in {api_address}/docs or {api_address}/redoc in any browser

Deployment

Store the .env file in the project folder. It should contain the urls to served models and configuration to connecting to the Vector Database:

Now you can deploy the api:

with unicorn

API is build with FastAPI & is run with uvicorn. Also you'll need pydantic for data validation and some other packages.

To install the requirements, run:

pip install poetry==1.5.1
poetry install

and to run it:

uvicorn src.app.main:app --host 0.0.0.0 --port 8000

Alongside the Swagger docs generated by FastAPI, we generate a detailed code documentation using mkdocs. To deploy the docs:

poetry install --with docs

Then run

mkdocs serve --a localhost:8001

with docker and docker-compose:

 docker compose up --build

This will host the api on port 8000 & mkdocs documentation on 8001.

Configuration

API needs to connect to 3 networks: Tagger, ExteriorStyles classifier and Encoder.