sreenathsree1578 commited on
Commit
d367457
Β·
verified Β·
1 Parent(s): be71ec4

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +50 -10
README.md CHANGED
@@ -1,10 +1,50 @@
1
- ---
2
- tags:
3
- - model_hub_mixin
4
- - pytorch_model_hub_mixin
5
- ---
6
-
7
- This model has been pushed to the Hub using the [PytorchModelHubMixin](https://huggingface.co/docs/huggingface_hub/package_reference/mixins#huggingface_hub.PyTorchModelHubMixin) integration:
8
- - Code: [More Information Needed]
9
- - Paper: [More Information Needed]
10
- - Docs: [More Information Needed]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Facial Emotion Recognition – SimpleCNN
2
+
3
+ A lightweight convolutional neural network (CNN) for **facial emotion recognition**.
4
+ The model is trained to classify grayscale facial images into **7 emotion categories**.
5
+
6
+ ## Model Details
7
+ - **Model type:** SimpleCNN (custom lightweight CNN)
8
+ - **Framework:** PyTorch
9
+ - **Task:** Image Classification
10
+ - **Input shape:** 1 Γ— 48 Γ— 48 (grayscale image)
11
+ - **Number of classes:** 7
12
+ - **Classes:**
13
+ - 0 β†’ Angry
14
+ - 1 β†’ Disgust
15
+ - 2 β†’ Fear
16
+ - 3 β†’ Happy
17
+ - 4 β†’ Sad
18
+ - 5 β†’ Surprise
19
+ - 6 β†’ Neutral
20
+
21
+ ## Intended Uses & Limitations
22
+ - βœ… Educational projects, demos, prototypes.
23
+ - ❌ Not suitable for medical, psychological, or safety-critical applications.
24
+ - ❌ May not generalize well outside datasets like FER2013.
25
+
26
+ ## How to Use
27
+ ```python
28
+ from huggingface_hub import hf_hub_download
29
+ import torch
30
+ import json
31
+
32
+ from facial_emotion import SimpleCNN # your model class
33
+
34
+ # Load config
35
+ config = json.load(open("config.json"))
36
+
37
+ # Build model
38
+ model = SimpleCNN(num_classes=config["num_classes"], in_channels=config["in_channels"])
39
+
40
+ # Load weights
41
+ checkpoint = hf_hub_download(repo_id="sreenathsree1578/facial_emotion", filename="pytorch_model.bin")
42
+ model.load_state_dict(torch.load(checkpoint, map_location="cpu"))
43
+ model.eval()
44
+
45
+ # Example inference
46
+ dummy = torch.randn(1, 1, 48, 48) # dummy grayscale image
47
+ with torch.no_grad():
48
+ out = model(dummy)
49
+ pred = torch.argmax(out, dim=1).item()
50
+ print("Predicted emotion:", config["labels"][str(pred)])