CoolFace
Apppublic

braiml/cloud

sourceHugging Facemitupdated 3y agoView on Hugging Face
0likes
exp_recognition_model.py31 linesDownload Raw Back to Hackathon_setup
1import torch2import torchvision3import torch.nn as nn4from torchvision import transforms5## Add more imports if required6 7####################################################################################################################8# Define your model and transform and all necessary helper functions here                                          #9# They will be imported to the exp_recognition.py file                                                             #10####################################################################################################################11 12# Definition of classes as dictionary13classes = {0: 'ANGER', 1: 'DISGUST', 2: 'FEAR', 3: 'HAPPINESS', 4: 'NEUTRAL', 5: 'SADNESS', 6: 'SURPRISE'}14 15# Example Network16class facExpRec(torch.nn.Module):17    def __init__(self):18        pass   # remove 'pass' once you have written your code19        #YOUR CODE HERE20        21    def forward(self, x):22        pass   # remove 'pass' once you have written your code23        #YOUR CODE HERE24        25# Sample Helper function26def rgb2gray(image):27    return image.convert('L')28    29# Sample Transformation function30#YOUR CODE HERE for changing the Transformation values.31trnscm = transforms.Compose([rgb2gray, transforms.Resize((48,48)), transforms.ToTensor()])