Animal Classification CNN (Howest MLOps)
A small convolutional neural network that classifies images into three classes: cats, dogs and pandas. Trained in an automated Azure Machine Learning pipeline as part of the MLOps course at Howest.
Model details
- Architecture: CNN built with Keras (TensorFlow backend)
- Input: RGB image resized to 64 × 64 × 3
- Output: softmax over 3 classes, in this order:
['Cat', 'Dog', 'Panda'] - Loss / optimizer: categorical cross-entropy, SGD (initial learning rate 0.01)
- Training: data augmentation (rotation, shift, shear, zoom, horizontal flip), early stopping and learning-rate reduction on plateau
Dataset
Images of cats, dogs and pandas, resized to 64 × 64 and split into train and test sets inside the Azure ML pipeline.
How to use
import keras
import numpy as np
from PIL import Image
model = keras.saving.load_model("hf://Hiradinho/howest-hf-ai")
ANIMALS = ['Cat', 'Dog', 'Panda']
img = Image.open("my_image.jpg").convert("RGB").resize((64, 64))
prediction = model.predict(np.expand_dims(np.array(img), axis=0))
print(ANIMALS[prediction.argmax(axis=1)[0]])
Limitations
Only trained on three animal classes and low-resolution (64 × 64) images. Any other input will still be classified as one of these three classes.