YAML Metadata
Warning:
empty or missing yaml metadata in repo card
(https://huggingface.co/docs/hub/model-cards#model-card-metadata)
Facial Emotion Recognition β SimpleCNN
A lightweight convolutional neural network (CNN) for facial emotion recognition.
The model is trained to classify grayscale facial images into 7 emotion categories.
Model Details
- Model type: SimpleCNN (custom lightweight CNN)
- Framework: PyTorch
- Task: Image Classification
- Input shape: 1 Γ 48 Γ 48 (grayscale image)
- Number of classes: 7
- Classes:
- 0 β Angry
- 1 β Disgust
- 2 β Fear
- 3 β Happy
- 4 β Sad
- 5 β Surprise
- 6 β Neutral
Intended Uses & Limitations
- β Educational projects, demos, prototypes.
- β Not suitable for medical, psychological, or safety-critical applications.
- β May not generalize well outside datasets like FER2013.
How to Use
from huggingface_hub import hf_hub_download
import torch
import json
from facial_emotion import SimpleCNN # your model class
# Load config
config = json.load(open("config.json"))
# Build model
model = SimpleCNN(num_classes=config["num_classes"], in_channels=config["in_channels"])
# Load weights
checkpoint = hf_hub_download(repo_id="sreenathsree1578/facial_emotion", filename="pytorch_model.bin")
model.load_state_dict(torch.load(checkpoint, map_location="cpu"))
model.eval()
# Example inference
dummy = torch.randn(1, 1, 48, 48) # dummy grayscale image
with torch.no_grad():
out = model(dummy)
pred = torch.argmax(out, dim=1).item()
print("Predicted emotion:", config["labels"][str(pred)])
- Downloads last month
- 93
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
π
Ask for provider support