Update config.json
Browse files- config.json +31 -2
config.json
CHANGED
|
@@ -1,3 +1,32 @@
|
|
| 1 |
{
|
| 2 |
-
"
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
{
|
| 2 |
+
"model_name": "facial_emotion_simplecnn",
|
| 3 |
+
"model_type": "simple_cnn",
|
| 4 |
+
"framework": "pytorch",
|
| 5 |
+
"task": "image-classification",
|
| 6 |
+
|
| 7 |
+
"num_classes": 7,
|
| 8 |
+
"labels": {
|
| 9 |
+
"0": "angry",
|
| 10 |
+
"1": "disgust",
|
| 11 |
+
"2": "fear",
|
| 12 |
+
"3": "happy",
|
| 13 |
+
"4": "sad",
|
| 14 |
+
"5": "surprise",
|
| 15 |
+
"6": "neutral"
|
| 16 |
+
},
|
| 17 |
+
|
| 18 |
+
"in_channels": 1,
|
| 19 |
+
"input_size": [48, 48],
|
| 20 |
+
"preprocessing": {
|
| 21 |
+
"resize": [48, 48],
|
| 22 |
+
"normalize_mean": [0.5],
|
| 23 |
+
"normalize_std": [0.5],
|
| 24 |
+
"color_mode": "grayscale"
|
| 25 |
+
},
|
| 26 |
+
|
| 27 |
+
"training_dataset": "FER2013 (or similar facial emotion dataset)",
|
| 28 |
+
"author": "sreenathsree1578",
|
| 29 |
+
"license": "mit",
|
| 30 |
+
|
| 31 |
+
"example_usage": "from facial_emotion import SimpleCNN\nfrom huggingface_hub import hf_hub_download\nimport torch\n\n# Load config\nimport json\nconfig = json.load(open('config.json'))\n\n# Build model\nmodel = SimpleCNN(num_classes=config['num_classes'], in_channels=config['in_channels'])\n\n# Load weights from hub\ncheckpoint = hf_hub_download(repo_id='sreenathsree1578/facial_emotion', filename='pytorch_model.bin')\nmodel.load_state_dict(torch.load(checkpoint, map_location='cpu'))\nmodel.eval()\n\n# Example inference\ntensor = torch.randn(1, 1, 48, 48) # dummy grayscale image\nwith torch.no_grad():\n output = model(tensor)\n pred = torch.argmax(output, dim=1).item()\n print('Predicted class:', config['labels'][str(pred)])"
|
| 32 |
+
}
|