{"id":26870788,"url":"https://github.com/nithin1729s/kannada-cnn","last_synced_at":"2026-03-15T16:43:13.779Z","repository":{"id":282432288,"uuid":"947487410","full_name":"Nithin1729S/Kannada-CNN","owner":"Nithin1729S","description":"This project recognizes 49 Kannada letters using a CNN classifier (TensorFlow/Keras). A FastAPI backend and Next.js (TypeScript) frontend enable users to draw letters and get predictions.","archived":false,"fork":false,"pushed_at":"2025-04-13T02:21:58.000Z","size":5016,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-17T07:47:55.082Z","etag":null,"topics":["cnn","cnn-classification","fastapi","kannada","kannada-mnist","keras","nextjs","tensorflow","typescript"],"latest_commit_sha":null,"homepage":"https://kannada-cnn.vercel.app","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/Nithin1729S.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}},"created_at":"2025-03-12T19:07:22.000Z","updated_at":"2025-04-13T12:29:56.000Z","dependencies_parsed_at":"2025-04-06T12:35:01.013Z","dependency_job_id":null,"html_url":"https://github.com/Nithin1729S/Kannada-CNN","commit_stats":null,"previous_names":["nithin1729s/kannada-cnn"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Nithin1729S/Kannada-CNN","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nithin1729S%2FKannada-CNN","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nithin1729S%2FKannada-CNN/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nithin1729S%2FKannada-CNN/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nithin1729S%2FKannada-CNN/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Nithin1729S","download_url":"https://codeload.github.com/Nithin1729S/Kannada-CNN/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nithin1729S%2FKannada-CNN/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266477152,"owners_count":23935390,"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","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cnn","cnn-classification","fastapi","kannada","kannada-mnist","keras","nextjs","tensorflow","typescript"],"created_at":"2025-03-31T07:17:06.572Z","updated_at":"2026-03-15T16:43:13.686Z","avatar_url":"https://github.com/Nithin1729S.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kannada Alphabet Recognition using CNN\n\nThis project implements a complete pipeline to recognize 49 Kannada letters. It combines deep learning for classification with a modern web application stack. The CNN classifier is built using TensorFlow/Keras, while a FastAPI backend and Next.js (TypeScript) frontend provide a interface where users can draw a letter and receive a prediction.\n\n## Demo\n\n\n[Screencast from 2025-03-13 01-00-34.webm](https://github.com/user-attachments/assets/2ac763ac-1f91-41d5-849c-864a2a288d87)\n\n[Watch it on Youtube](https://youtu.be/YmIuzqwVocw)\n\n## Overview\n\nThe project has two main components:\n\n1. **Model Training \u0026 Evaluation:**   \n   A convolutional neural network (CNN) is trained on a dataset of 49 Kannada alphabets. The training process involves data loading, augmentation, network construction, training with callbacks, and model evaluation.\n\n2. **Web Application:**  \n   - **FastAPI Backend:** Serves the trained model for real-time inference via API endpoints.\n   - **Next.js Frontend:** Provides a canvas for users to draw a letter. The drawn image is sent to the FastAPI backend, and the predicted output is displayed.\n\n## Training Process\n\n### Data Loading and Preprocessing\n\n- **Dataset:**  \n  The dataset can be obtained from [IEEE Dataport](https://ieee-dataport.org/documents/kannada-language-image-dataset).\n  \n- **Image Configuration:**  \n  Images are converted to grayscale and resized to 28x28 pixels.  \n  The dataset is split into training (80%) and validation (20%) sets using `tf.keras.utils.image_dataset_from_directory`, with labels one-hot encoded.\n\n### Data Augmentation\n\nTo improve the generalization of the model, data augmentation is applied **only on the training set**:\n- **Random Rotation**\n- **Random Zoom**\n- **Random Translation**\n\nThis augmentation is implemented using a Keras `Sequential` model.\n\n### CNN Architecture\n\nThe CNN model consists of three convolutional blocks:\n\n- **Block 1:**\n  - Two convolutional layers (32 filters, 3×3 kernel, ReLU activation) with batch normalization.\n  - Max pooling layer and dropout (25%).\n\n- **Block 2:**\n  - Two convolutional layers (64 filters, 3x3 kernel, ReLU activation) with batch normalization.\n  - Max pooling and dropout (25%).\n\n- **Block 3:**\n  - Two convolutional layers (128 filters, 3x3 kernel, ReLU activation) with batch normalization.\n  - Max pooling and dropout (25%).\n\nFollowing the convolutional layers, the network is flattened and fed through dense layers:\n- A dense layer with 128 neurons (ReLU activation) with batch normalization and dropout (50%).\n- A final dense layer with a softmax activation that outputs probabilities for the 49 classes.\n\n![422607033-8427b259-3d2b-47be-8270-04bcfd536b11](https://github.com/user-attachments/assets/90dbe440-ed3c-45f4-9b24-a2387f6cd678)\n\n\n### Compilation and Training\n\n- **Compilation:**  \n  The model is compiled with the Adam optimizer and categorical crossentropy loss.\n\n- **Callbacks:**   \n  - **EarlyStopping:** Monitors the validation loss and stops training if no improvement is seen for 5 epochs.\n  - **ReduceLROnPlateau:** Reduces the learning rate when the validation loss plateaus.\n  \n- **Training:**  \n  The model is set to train for up to 480 epochs; however, early stopping typically halts training sooner if the model converges.\n\n- **Model Saving:**  \n  Once training is complete, the model (both architecture and weights) is saved as `full_model.h5` for later use in inference.\n\n## Inference and Evaluation\n\nThe trained model achieved 98.45% test accuracy.\n\n## Setup and Installation\n\n### Model Training\n\nModel training can be found in Jupyter Notebook present in the notebooks folder.\n\n### Environmental Variables\n\nCreate a `.env` file in the frontend directory with the following variables:\n\n```env\nNEXT_PUBLIC_BACKEND_URL=fastapi_address # URL of the FastAPI Backend Server\n```\n\n### FastAPI Backend\n\n1. **Navigate to the `backend` Directory:**\n\n   ```bash\n   cd backend\n   ```\n\n2. **Install Dependencies:**\n\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n3. **Run the FastAPI Server:**\n\n   ```bash\n   uvicorn api.main:app --reload\n   ```\n\n### Next.js Frontend\n\n1. **Navigate to the `frontend` Directory:**\n\n   ```bash\n   cd frontend\n   ```\n\n2. **Install Dependencies:**\n\n   ```bash\n   npm install\n   ```\n\n3. **Start the Development Server:**\n\n   ```bash\n   npm run dev\n   ```\n\n4. **Open in Browser:**  \n   Visit `http://localhost:3000` to interact with the application.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnithin1729s%2Fkannada-cnn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnithin1729s%2Fkannada-cnn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnithin1729s%2Fkannada-cnn/lists"}