Pet’s Facial Expression Detection App

code
Published

July 2024

A tiny web app

that classify a pet’s emotions by a photo. Upload an image, get the predicted emotion + confidence. Trained EfficientNetB5 CNN on Kaggle’s pet’s facial expression dataset.

End-to-end pipeline:
1. Training of model
2. Wrapping in web interface
3. Deployment

1. Training

Base model -ResNet50. Then transfer learning on InceptionV3, then balanced dataset, EfficientNetB5.

The final training colab notebook.

2. Web interface and Deployment

A FastAPI backend serves a POST/predict/image endpoint that runs uploaded images through a pre-trained EfficientNETB5 Keras model and returns on of four pet emotions (angry, other, sad, happy) with confidence score. A React frontend uploads the image and displays the prediction.

Almost identical Gradio App was deployed on Hugging Face Space (free CPU tier).

Web-app code here.