├── Facial_Expression_Recognition_with_PyTorch.ipynb ├── LICENSE ├── README.md └── face-expression-recognition-dataset-metadata.json /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 Abbireddy Venkata Chandu 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Facial-Expression-Recognition-PyTorch 2 | 3 | ![Screenshot 2024-01-12 111917](https://github.com/Sudhanshu21xx/Facial-Expression-Recognition-PyTorch/assets/113416452/de93987a-5dec-4b66-9f2a-405e4ef577e5) 4 | 5 | 6 | ## Overview 7 | 8 | Within this repository, an adept implementation of Facial Expression Recognition using PyTorch is provided. The model is skillfully trained to categorize facial expressions into various emotions, encompassing happiness, sadness, anger, surprise, fear, disgust, and neutrality. Leveraging the power of deep learning, the project capitalizes on PyTorch, a dynamic and versatile deep learning framework, surpassing the capabilities of TensorFlow. PyTorch's dynamic computational graph and intuitive design make it an excellent choice for this task, offering flexibility and ease of use during model development and training. The project's focus on emotion classification caters to a broad spectrum of applications, from human-computer interaction to sentiment analysis in various fields. By combining the rich feature set of PyTorch with the nuanced task of recognizing facial expressions, this implementation stands as a testament to the efficiency and effectiveness of PyTorch in the realm of deep learning-based facial expression recognition systems. 9 | 10 | ## Features 11 | 12 | The repository is equipped with a powerful pre-trained model, namely "efficientnet_b0," tailored specifically for facial expression recognition tasks. This model has demonstrated exceptional performance, boasting an impressive accuracy rate of 93%, surpassing the majority of existing models accessible on the internet. The use of the efficientnet_b0 architecture signifies a commitment to efficiency and effectiveness in handling complex visual recognition tasks, making it a standout choice for facial expression recognition. Leveraging state-of-the-art techniques, this model not only achieves high accuracy but also offers a user-friendly interface, facilitating easy integration into various applications and projects. With its robust capabilities, the efficientnet_b0 model becomes a valuable asset for researchers, developers, and practitioners seeking top-tier solutions in the realm of facial expression recognition. With higher computational capabalities "efficientnet_b7" could be used which will provide even higher accuracy. 13 | 14 | ## Comparision of Efficientnet Models 15 | ![](https://github.com/Sudhanshu21xx/Facial-Expression-Recognition-PyTorch/assets/113416452/71726e59-55f8-415a-b83e-61cafac3a3eb) 16 | 17 | ### Resources on Efficientnet [[1]](https://keras.io/api/applications/efficientnet/) [[2]](https://paperswithcode.com/method/efficientnet#:~:text=Introduced%20by%20Tan%20et%20al,resolution%20using%20a%20compound%20coefficient.) [[3]](https://medium.com/mlearning-ai/understanding-efficientnet-the-most-powerful-cnn-architecture-eaeb40386fad) 18 | 19 | ![1](https://github.com/Sudhanshu21xx/Facial-Expression-Recognition-PyTorch/assets/113416452/581327ef-6595-4da8-99d9-426e33318c0c) 20 | 21 | 22 | ## :warning: Requirements 23 | 24 | - [Python 3.x](https://www.python.org/downloads/) 25 | - [PyTorch](https://pytorch.org/) 26 | - [NumPy](https://numpy.org/) 27 | - [OpenCV](https://opencv.org/) 28 | - [Matplotlib](https://matplotlib.org/) 29 | - [Albumentations](https://github.com/albumentations-team/albumentations) 30 | - [timm](https://github.com/huggingface/pytorch-image-models) 31 | 32 | ## :bulb: Workflow 33 | 34 | ![3](https://github.com/Sudhanshu21xx/Facial-Expression-Recognition-PyTorch/assets/113416452/3c9c03db-67b5-43cd-a501-28088f4ee62b) 35 | 36 | ## :key: Results 37 | ![Screenshot 2024-01-12 105356](https://github.com/Sudhanshu21xx/Facial-Expression-Recognition-PyTorch/assets/113416452/5e3dfd13-6a60-4d68-b8ad-bdd676b185f4) 38 | 39 | ![Screenshot 2024-01-12 105502](https://github.com/Sudhanshu21xx/Facial-Expression-Recognition-PyTorch/assets/113416452/953b6ec0-5333-4785-b25d-e08483d91479) 40 | 41 | ![Screenshot 2024-01-12 105555](https://github.com/Sudhanshu21xx/Facial-Expression-Recognition-PyTorch/assets/113416452/d872199f-96a2-429e-b117-6a995c92cd00) 42 | 43 | ![Screenshot 2024-01-12 105613](https://github.com/Sudhanshu21xx/Facial-Expression-Recognition-PyTorch/assets/113416452/f13a46ce-8552-43c5-97aa-9c84430a99fa) 44 | 45 | ![Screenshot 2024-01-12 105631](https://github.com/Sudhanshu21xx/Facial-Expression-Recognition-PyTorch/assets/113416452/f273c307-14aa-4234-83e4-ad19b3658381) 46 | 47 | ![Screenshot 2024-01-12 105807](https://github.com/Sudhanshu21xx/Facial-Expression-Recognition-PyTorch/assets/113416452/d9e940df-8ebb-4a98-a003-0086aa0f608e) 48 | 49 | ![Screenshot 2024-01-12 110114](https://github.com/Sudhanshu21xx/Facial-Expression-Recognition-PyTorch/assets/113416452/846a116f-34ba-487e-b4f4-d5bb91555150) 50 | 51 | -------------------------------------------------------------------------------- /face-expression-recognition-dataset-metadata.json: -------------------------------------------------------------------------------- 1 | {"@context":{"@language":"en","@vocab":"https://schema.org/","citeAs":"cr:citeAs","column":"cr:column","conformsTo":"dct:conformsTo","cr":"http://mlcommons.org/croissant/","data":{"@id":"cr:data","@type":"@json"},"dataBiases":"cr:dataBiases","dataCollection":"cr:dataCollection","dataType":{"@id":"cr:dataType","@type":"@vocab"},"dct":"http://purl.org/dc/terms/","extract":"cr:extract","field":"cr:field","fileProperty":"cr:fileProperty","fileObject":"cr:fileObject","fileSet":"cr:fileSet","format":"cr:format","includes":"cr:includes","isEnumeration":"cr:isEnumeration","jsonPath":"cr:jsonPath","key":"cr:key","md5":"cr:md5","parentField":"cr:parentField","path":"cr:path","personalSensitiveInformation":"cr:personalSensitiveInformation","recordSet":"cr:recordSet","references":"cr:references","regex":"cr:regex","repeated":"cr:repeated","replace":"cr:replace","sc":"https://schema.org/","separator":"cr:separator","source":"cr:source","subField":"cr:subField","transform":"cr:transform","wd":"https://www.wikidata.org/wiki/"},"alternateName":"","conformsTo":"http://mlcommons.org/croissant/1.0","license":{"@type":"sc:CreativeWork","name":"Unknown"},"distribution":[{"contentUrl":"https://www.kaggle.com/api/v1/datasets/download/jonathanoheix/face-expression-recognition-dataset?datasetVersionNumber=1","contentSize":"120.505 MB","md5":"31DRmdToGZoub9fi2tiSkg==","encodingFormat":"application/zip","@id":"archive.zip","@type":"cr:FileObject","name":"archive.zip","description":"Archive containing all the contents of the Face expression recognition dataset dataset"},{"includes":"*.jpg","containedIn":{"@id":"archive.zip"},"encodingFormat":"image/jpeg","@id":"image-jpeg_fileset","@type":"cr:FileSet","name":"image/jpeg files","description":"image/jpeg files contained in archive.zip"}],"version":1,"keywords":[],"isAccessibleForFree":true,"includedInDataCatalog":{"@type":"sc:DataCatalog","name":"Kaggle","url":"https://www.kaggle.com"},"creator":{"@type":"sc:Person","name":"Jonathan Oheix","url":"/jonathanoheix","image":"https://storage.googleapis.com/kaggle-avatars/thumbnails/2599129-kg.jpeg"},"publisher":{"@type":"sc:Organization","name":"Kaggle","url":"https://www.kaggle.com/organizations/kaggle","image":"https://storage.googleapis.com/kaggle-organizations/4/thumbnail.png"},"thumbnailUrl":"https://storage.googleapis.com/kaggle-datasets-images/new-version-temp-images/default-backgrounds-40.png-2599129/dataset-card.png","dateModified":"2019-01-03T08:16:53.387","datePublished":"2019-02-04T07:14:20.1710838","@type":"sc:Dataset","name":"Face expression recognition dataset","url":"https://www.kaggle.com/datasets/jonathanoheix/face-expression-recognition-dataset/versions/1","description":""} --------------------------------------------------------------------------------