Animal classifier (cat / dog / panda)

Small CNN trained in an Azure Machine Learning pipeline for the Howest MLOps course (lab 1.3). Input is a 64x64 RGB image, output is a softmax over [cat, dog, panda].

Preprocessing contract

See contract.json. Resize to 64x64 with PIL bicubic resampling, convert to RGB, keep uint8 0-255 values. Do not divide by 255: training used raw pixels and the model has no rescaling layer.

Usage

import os
os.environ["KERAS_BACKEND"] = "tensorflow"
import keras, numpy as np
from PIL import Image

model = keras.saving.load_model("hf://Totmaat/howest-hf-ai")
x = np.array(Image.open("panda.jpg").convert("RGB").resize((64, 64), Image.Resampling.BICUBIC))[None]
print(["cat", "dog", "panda"][model.predict(x).argmax()])

Quality

5 epochs, 1800 training images, 600 test images. Test accuracy 61.7%. Cats and dogs get mixed up a lot; pandas are recognised well.

Downloads last month
17
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support