Outlier Detection on CIFAR10

In this example we will deploy an image classification model along with an outlier detector trained on the same dataset. For in depth details on creating an outlier detection model for your own dataset see the alibi-detect project and associated documentation. You can find details for this CIFAR10 example in their documentation as well.
Prequisites:
Ensure the istio-ingressgateway is exposed as a loadbalancer (no auth in this demo)
Ensure you install for istio, e.g. for the helm chart
--set istio.enabled=true
Tested on GKE and Kind with Knative 0.18 and Istio 1.7.3
Ensure istio gateway installed
Setup Resources
Create the SeldonDeployment image classification model for Cifar10. We add in a logger for requests - the default destination is the namespace Knative Broker.
Create the pretrained VAE Cifar10 Outlier Detector. We forward replies to the message-dumper we started.
Here we configure seldonio/alibi-detect-server to use rclone for downloading the artifact. If RCLONE_ENABLED=true environmental variable is set or any of the environmental variables contain RCLONE_CONFIG in their name then rclone will be used to download the artifacts. If RCLONE_ENABLED=false or no RCLONE_CONFIG variables are present then kfserving storage.py logic will be used to download the artifacts.
Create a Knative trigger to forward logging events to our Outlier Detector.
Get the IP address of the Istio Ingress Gateway. This assumes you have installed istio with a LoadBalancer.
Optionally add an authorization token here if you need one.Acquiring this token will be dependent on your auth setup.
If you are using Kind or Minikube you will need to port-forward to the istio ingressgateway and uncomment the following
Normal Prediction
Lets check the message dumper for an outlier detection prediction. This should be false.
Outlier Prediction
Now lets check the message dumper for a new message. This should show we have found an outlier.
We will now call our outlier detector directly and ask for the feature scores to gain more information about why it predicted this instance was an outlier.
We now plot those feature scores returned by the outlier detector along with our original image.
Tear Down
Last updated
Was this helpful?