The inference REST API works on CPU. It's only supported on Linux Operating systems.
This repository offers three services:
- Optical Character Recognition service using Tesseract to extract text boxes from images
- Data Matrix decoding service using Libdmtx to extract and decode Data Matrices from images
- QR Code decoding service using Zbar to extract and decode QR codes from images
This repo can be deployed using either docker or docker swarm.
Please use docker swarm only if you need to:
-
Provide redundancy in terms of API containers: In case a container went down, the incoming requests will be redirected to another running instance.
-
Coordinate between the containers: Swarm will orchestrate between the APIs and choose one of them to listen to the incoming request.
-
Scale up the Inference service in order to get a faster prediction especially if there's traffic on the service.
If none of the aforementioned requirements are needed, simply use docker.
- Ubuntu 18.04
- Docker CE latest stable release
To check if you have docker-ce installed:
docker --version
Use the following command to install docker on Ubuntu:
chmod +x install_prerequisites.sh && source install_prerequisites.sh
In order to build the project run the following command from the project's root directory:
sudo docker build -t optical_objects_recognition_api -f docker/dockerfile .
sudo docker build --build-arg http_proxy='' --build-arg https_proxy='' -t optical_objects_recognition_api -f ./docker/dockerfile .
As mentioned before, this container can be deployed using either docker or docker swarm.
If you wish to deploy this API using docker, please issue the following run command.
If you wish to deploy this API using docker swarm, please refer to following link docker swarm documentation. After deploying the API with docker swarm, please consider returning to this documentation for further information about the API endpoints as well as the model structure sections.
To run the API, go the to the API's directory and run the following:
sudo docker run -p <docker_host_port>:4343 optical_objects_recognition_api
The <docker_host_port> can be any unique port of your choice.
The API file will be run automatically, and the service will listen to http requests on the chosen port.
To see all available endpoints, open your favorite browser and navigate to:
http://<machine_IP>:<docker_host_port>/docs
Takes an image and returns extracted text boxes
Takes an image and decodes extracted data matrices
Takes an image and decodes extracted QR codes
Anis Ismail, Beirut, Lebanon