Live Inference 🐱 🐢

16. Live Inference 🐱 🐢#

16.1. Pre-Reading#

16.1.1. Objectives#

  • Close the loop on the ML workflow with cats and dogs

  • Conduct inference on real-life critters!

16.2. The lab#

We will have a live cat and dog for you to test your system on!

Recall that the machine learning workflow is:

  1. Decide on a goal

  2. Collect a dataset

    • Examine and understand the data

  3. Design a model architecture

    • Consider the data input pipeline

  4. Train the model

  5. Convert the model

  6. Run inference

  7. Evaluate and troubleshoot

You have accomplished most of this in a sterile testing environment. Now it’s time to use a physical input pipeline and add in real-world chaos!

16.2.1. Starting point#

Complete the following code and get it to your Pi 4.

# A script that uses TensorFlow Lite and Picamera
# to classify a Cat vs. Dog.
#
# Designed to use a pre-converted fine-tuned MobilenetV2 model.