{"id":27559134,"url":"https://github.com/hanugafathurc/imageclassificationforemotionrecognition","last_synced_at":"2026-05-07T18:11:23.727Z","repository":{"id":287879749,"uuid":"966086787","full_name":"HanugaFathurC/ImageClassificationForEmotionRecognition","owner":"HanugaFathurC","description":"Image classification model for emotion recognition using TensorFlow \u0026 Keras. Built with MobileNetV2 and supports deployment via TensorFlow Lite \u0026 TensorFlow.js.","archived":false,"fork":false,"pushed_at":"2025-04-14T12:00:42.000Z","size":54736,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-19T23:32:39.721Z","etag":null,"topics":["deep-learning","image-classification","keras","machine-learning","tensorflow"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HanugaFathurC.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-14T11:36:14.000Z","updated_at":"2025-04-16T12:10:03.000Z","dependencies_parsed_at":"2025-04-14T13:05:52.030Z","dependency_job_id":null,"html_url":"https://github.com/HanugaFathurC/ImageClassificationForEmotionRecognition","commit_stats":null,"previous_names":["hanugafathurc/imageclassificationforemotionrecognition"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HanugaFathurC%2FImageClassificationForEmotionRecognition","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HanugaFathurC%2FImageClassificationForEmotionRecognition/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HanugaFathurC%2FImageClassificationForEmotionRecognition/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HanugaFathurC%2FImageClassificationForEmotionRecognition/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HanugaFathurC","download_url":"https://codeload.github.com/HanugaFathurC/ImageClassificationForEmotionRecognition/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249830836,"owners_count":21331355,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deep-learning","image-classification","keras","machine-learning","tensorflow"],"created_at":"2025-04-19T23:32:49.337Z","updated_at":"2026-05-07T18:11:23.641Z","avatar_url":"https://github.com/HanugaFathurC.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Image Classification for Emotion Recognition\n\nThis project demonstrates how to build an image classification model for emotion recognition using TensorFlow and Keras. The model is trained on a dataset of facial expressions and can be converted to different formats for deployment. The notebook includes steps for data preparation, model training, evaluation, and inference.\n\n## Table of Contents\n1. [Overview](#overview)\n2. [Dataset](#dataset)\n3. [Installation](#installation)\n4. [Usage](#usage)\n5. [Model Conversion](#model-conversion)\n6. [Inference](#inference)\n7. [Results](#results)\n8. [License](#license)\n\n## Overview\nThe project aims to classify facial expressions into six emotion categories:\n- Angry\n- Happy\n- Neutral\n- Sad\n- Surprise\n- Ahegao\n\nThe model is built using a pre-trained MobileNetV2 as the base and fine-tuned for emotion recognition. It includes data augmentation, training, evaluation, and conversion to formats like TensorFlow Lite and TensorFlow.js for deployment.\n\n## Dataset\nThe dataset used for this project is the [Emotion Recognition Dataset](https://www.kaggle.com/datasets/sujaykapadnis/emotion-recognition-dataset). It contains images of facial expressions categorized into different emotion classes.\n\n## Installation\n1. Install the required Python packages:\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n2. Download the dataset:\n   The dataset is downloaded using the `kagglehub` library in the notebook.\n\n## Usage\n1. Open the notebook `ImageClassification.ipynb` in your preferred IDE (e.g., PyCharm or Jupyter Notebook).\n2. Follow the steps in the notebook:\n   - Data preparation\n   - Data augmentation\n   - Model training\n   - Evaluation and visualization\n   - Model conversion\n   - Inference\n\n3. Run the cells sequentially to train the model and test its performance.\n\n## Model Conversion\nThe trained model is converted into the following formats for deployment:\n- **TensorFlow Lite**: Saved in the `tflite_model` directory.\n- **TensorFlow.js**: Saved in the `tfjs_model` directory.\n- **SavedModel**: Saved in the `saved_model` directory.\n\n### Conversion Commands\n- TensorFlow Lite:\n  ```python\n  converter_tf_lite = tf.lite.TFLiteConverter.from_keras_model(model)\n  tflite_model = converter_tf_lite.convert()\n  with open('tflite_model/model.tflite', 'wb') as f:\n      f.write(tflite_model)\n  ```\n- TensorFlow.js:\n  ```bash\n  tensorflowjs_converter --input_format=keras model.h5 tfjs_model\n  ```\n\n## Inference\nThe notebook includes a sample inference pipeline using the TensorFlow Lite model. To test the model:\n1. Provide the path to a test image.\n2. Run the `predict_image_tflite` function to get the predicted class and probabilities.\n\nExample:\n```python\ntest_image_path = 'data/final_dataset/test/Angry/sample_image.png'\npredicted_class, predictions = predict_image_tflite(test_image_path)\nprint(f\"Predicted class: {predicted_class}\")\n```\n\n## Results\nThe model achieved high accuracy on the test set. Below is an example of the output for a test image:\n- **Predicted Class**: Angry\n- **Predicted Probabilities**:\n  ```\n  Ahegao: 0.0000\n  Angry: 0.9998\n  Happy: 0.0000\n  Neutral: 0.0001\n  Sad: 0.0000\n  Surprise: 0.0001\n  ```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhanugafathurc%2Fimageclassificationforemotionrecognition","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhanugafathurc%2Fimageclassificationforemotionrecognition","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhanugafathurc%2Fimageclassificationforemotionrecognition/lists"}