Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mylesagray/anpr-knative

A research project on running ML inferencing on KNative
https://github.com/mylesagray/anpr-knative

anpr knative knative-eventing knative-serving tensorflow

Last synced: about 1 month ago
JSON representation

A research project on running ML inferencing on KNative

Awesome Lists containing this project

README

        

# 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](img/demo.gif)

This repo takes the Automatic Number Plate Recognition (ANPR) TensorFlow container detailed here: , 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](./img/overview.png)

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:

```sh
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`:

```sh
$ 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.

```sh
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.

```sh
cd tensformation
```

2: Create the go.mod file.

```sh
go mod init tensformation
```

3: Build & submit the dockerfile.

```sh
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//tensformation .
```

### Building `label_analyser`

1: Move to the `label_analyser` directory.

```sh
cd label_analyser
```

2: Build & submit the dockerfile.

```sh
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//tfclient .
```