Skip to content

Latest commit

 

History

History
128 lines (78 loc) · 4.34 KB

readme.md

File metadata and controls

128 lines (78 loc) · 4.34 KB

Automatic Number Plate Recognition based on Knative

An auto-scaling ML-based number plate recognition system, running on Knative.

Demo of app inferring a number plate

This repo takes the Automatic Number Plate Recognition (ANPR) TensorFlow container detailed here: https://github.com/mylesagray/docker-tensorflow-s3, packages the TensorFlow Python client built to interact with the model and adds a "tensformation" component to deploy an event-based auto-scaling ANPR system on Knative.

Overview

Architecture Overview

This bridge starts with an event propagated by the s3 source.

This event is then consumed by tensformation, this service then performs the following actions:

  • Downloads the file.
  • Base64 encodes it.
  • Creates a request to the Tensorflow Server.
  • Returns an event containing the Tensorflow Server ANPR model's raw response.

The found plate event is then consumed by the label_analyser, this service then performs the following actions:

  • Performs the Tensorflow response analysis on the output from the model.
  • Updates the provided Google Sheet with the found plate info.
  • Returns an event back to the broker with the found plate.

Deploying the application

Prerequisites

Google

You need to set up a Google Cloud Project and service user to use the Google Sheets output, please follow the following two sections of documentation:

You will need both the JSON key output and the Google Sheet ID for this app to run, additionally - don't forget to share the Google Sheet you want to use as the target for this app with the service account email address created above.

Amazon

You will need to create an S3 bucket with public access enabled and get its ARN (take particular note in the below docs on where and how to add your region and account ID to the ARN provided by AWS):

Additionally, you will need to create or get your AWS Access Key and Secret:

Knative and TriggerMesh

It is required to run Knative and the TriggerMesh sources for this demo, you can find details on how to do that below:

You will need a Knative broker, we don't include one in the manifest as these are generally quite opinionated, so if you just want to get it up and running use the default broker:

kn broker create default

If you list the brokers, you'll find the URL for the broker you just created - just plug this into manifest.yaml under K_SINK:

$ kn broker list
NAME      URL                                                                        AGE     CONDITIONS   READY   REASON
default   http://broker-ingress.knative-eventing.svc.cluster.local/default/default   7d22h   5 OK / 5     True    

Deploy the app

1: Update the manifest.yaml file, replacing the placeholder "" marks with your information.

2: Deploy the app.

kubectl -n default apply -f manifest.yaml

Running the app

Drop an image of a car or vehicle with a US number plate into the S3 bucket targeted in the deployment above and watch the Google Sheet as a row containing the number plate, image URL and timestamp are populated.

Building the containers

Building tensformation

1: Move to the tensformation directory.

cd tensformation

2: Create the go.mod file.

go mod init tensformation

3: Build & submit the dockerfile.

docker build . -t harbor-repo.vmware.com/vspheretmm/tensformation:latest -t tensformation:latest
docker push harbor-repo.vmware.com/vspheretmm/tensformation:latest

## OR

gcloud builds submit --tag gcr.io/<project>/tensformation .

Building label_analyser

1: Move to the label_analyser directory.

cd label_analyser

2: Build & submit the dockerfile.

docker build . -t harbor-repo.vmware.com/vspheretmm/tfclient:latest -t tfclient:latest
docker push harbor-repo.vmware.com/vspheretmm/tfclient:latest

## OR

gcloud builds submit --tag gcr.io/<project>/tfclient .