Outlier Detection with CIFAR10 Image Classifier

Launch an image classifier model and detect outlier prediction requests.

This demo is based on VAE outlier detection in the alibi detect project. Here we will :

  • Launch an image classifier model trianed on the CIFAR10 dataset
  • Setup an outlier detector for this particular model
  • Send a request to get a image classification
  • Send a perturbed request to get a outlier detection

Create Model

Create the model in its own dedicated namespace (needed for outlier detection). It should be a knative eventing namespace (labelled knative-eventing-injection=enabled). For example as cluster admin for the namespace outlier:

kubectl create namespace outlier
kubectl label namespace outlier knative-eventing-injection=enabled
kubectl label namespace outlier seldon.restricted=false
kubectl label namespace outlier serving.kubeflow.org/inferenceservice=enabled

Use the following model url

gs://seldon-models/tfserving/cifar10/resnet32

Configure the predictor log and set url as “http://default-broker":

create_model

Setup Request Logger

Go to ‘Setup Request Logger’ and enter:

Logger Name: seldon-request-logger
Logger Image URI: docker.io/seldonio/seldon-request-logger:0.3.1

Environment Variables

ELASTICSEARCH_HOST: elasticsearch-master.seldon-logs.svc.cluster.local
ELASTICSEARCH_PORT: 9200
ELASTICSEARCH_PROTOCOL: http

setup_request_logger

Setup Outlier detector

Setup an outlier detector with model name cifar10 using the default settings (which sets Reply URL as seldon-request-logger in current namespace) and storage URI as follows:

gs://seldon-models/alibi-detect/od/OutlierVAE/cifar10

setup_detector

Make Predictions

Run a single prediction using the tensorflow payload format of an image truck. Also a perturbed image of the truck in the same format at outlier truck image. Make a couple of these requests at random using the predict tool in the UI.

classif_images

Monitor outliers on the Requests Screen

Go to the requests screen to view all the historical requests. You can see the outlier value on each instance. Also you can highlight outliers based on this score and also use the filter to see only the outliers as needed.

outlier_detection

Notes

A dedicated namespace is recommended as knative eventing sends all requests to the outlier detector as well as the logger. In a shared namespace requests from other models would also go to the outlier detector, which is for cifar10.


Last modified September 6, 2020: Update titles (ba35537)