{"id":26864641,"url":"https://github.com/rahul-samedavar/doodlemind","last_synced_at":"2025-07-12T19:37:57.331Z","repository":{"id":282107004,"uuid":"947450335","full_name":"Rahul-Samedavar/DoodleMind","owner":"Rahul-Samedavar","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-26T08:50:23.000Z","size":25164,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-26T09:40:52.837Z","etag":null,"topics":["cnn","convolutional-neural-networks","machine-learning","multiclass-classification"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Rahul-Samedavar.png","metadata":{"files":{"readme":"readme.MD","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-12T17:50:58.000Z","updated_at":"2025-03-26T08:50:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"fad49efc-77ab-45fe-b223-02129501837c","html_url":"https://github.com/Rahul-Samedavar/DoodleMind","commit_stats":null,"previous_names":["rahul-samedavar/doodlemind"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rahul-Samedavar%2FDoodleMind","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rahul-Samedavar%2FDoodleMind/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rahul-Samedavar%2FDoodleMind/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rahul-Samedavar%2FDoodleMind/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rahul-Samedavar","download_url":"https://codeload.github.com/Rahul-Samedavar/DoodleMind/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246413250,"owners_count":20773053,"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":["cnn","convolutional-neural-networks","machine-learning","multiclass-classification"],"created_at":"2025-03-31T03:39:54.820Z","updated_at":"2025-03-31T03:39:55.343Z","avatar_url":"https://github.com/Rahul-Samedavar.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Doodle Classification using CNN\n\nThis project focuses on developing a Convolutional Neural Network (CNN) model for classifying hand-drawn doodles into 35 different categories. The model is trained using a subset of [Google's Quick, Draw!](https://quickdraw.withgoogle.com/data) dataset and aims to recognize user-drawn sketches with high accuracy. The Project contains trained models, weights and an Interactive UI.\n\n![](Images/smiley.png)\n\n## Features\n- Hand-drawn sketch recognition with real-time classification\n- Preprocessing pipeline to normalize input data\n- Custom-trained CNN model for efficient doodle classification\n- Interactive UI with Dark Neon theme\n- Confidence-based prediction results with a probability bar visualization\n\n## Deployment\n- The Model and GUI has been deployed in HuggingFace space.\n- Access it from [here](https://huggingface.co/spaces/Rahul-Samedavar/DoodleClassifier)\n\n## 🛠 Installation \u0026 Setup\n\n### 1️⃣ **Clone the Repository**\n```bash\ngit clone https://github.com/Rahul-Samedavar/DoodleMind.git\ncd DoodleMind\n```\n\n### 2️⃣ **Create Virtual Environment(Optional)**\ncreate virtual environment to avoi version conflicts.\n```bash\npython -m venv env\n```\nThis creates a Virtual environment called env in the current directory. You need to activate this virtual environment to use the project.\n\nwindows users\n```bash\nenv/Scripts/activate\n```\nLinux, Unix and Mac users\n```bash\nsource env/bin/activate\n```\n\n### 3️⃣ **Install Dependencies**\n\nto install the dependencies run:\n```bash\npip install -r requirements.txt\n```\n\n### 4️⃣ **Run the Application**\n```bash\npython app.py\n```\nThe application will be available at `http://localhost:5000`.\n\n\n## Methodology of Training the Model\n### **1. Dataset Preparation**\n- The dataset consists of 35 doodle categories from Google's Quick, Draw!\n\n  ![](Images/Original-Data-Distribution.png)\n- Subset containing 12000 doodles for each class was choosen too balance the dataset.\n  ![](Images/Balanced-Data-Distribution.png)\n- Images were resized to **28x28 grayscale** format for model compatibility.\n- Data was normalized to a **[0,1]** range to improve generalization.\n- numpy.float16 data type was used for memory efficiency.\n- Test split : 0.15\n\n![](Images/Sample-Data.png)\n\n### **2. Model Architecture**\nA CNN architecture was designed with the following layers:\n```python\nmodel = Sequential([\n    Conv2D(16, (3,3), activation='relu', input_shape=(28, 28, 1)),\n    MaxPooling2D(2,2),\n    Conv2D(64, (3,3), activation='relu'),\n    MaxPooling2D(2,2),\n    Flatten(),\n    Dropout(0.2),\n    Dense(128, activation='relu'),\n    Dropout(0.2),\n    Dense(64, activation='relu'),\n    Dropout(0.2),\n    Dense(35, activation='softmax') \n])\n```\n![](Images/model-visual.png)\n```bash\nModel: \"sequential\"\n_________________________________________________________________\n Layer (type)                Output Shape              Param #   \n=================================================================\n conv2d (Conv2D)             (None, 26, 26, 16)        160       \n                                                                 \n max_pooling2d(MaxPooling2D) (None, 13, 13, 16)       0         \n                                                                \n                                                                 \n conv2d_1 (Conv2D)           (None, 11, 11, 64)        9280      \n                                                                 \n max_pooling2d_1 (MaxPooling  (None, 5, 5, 64)         0         \n 2D)                                                             \n                                                                 \n flatten (Flatten)           (None, 1600)              0         \n                                                                 \n dropout (Dropout)           (None, 1600)              0         \n                                                                 \n dense (Dense)               (None, 128)               204928    \n                                                                 \n dropout_1 (Dropout)         (None, 128)               0         \n                                                                 \n dense_1 (Dense)             (None, 64)                8256      \n                                                                 \n dropout_2 (Dropout)         (None, 64)                0         \n                                                                 \n dense_2 (Dense)             (None, 35)                2275      \n                                                                 \n=================================================================\nTotal params: 224,899\nTrainable params: 224,899\nNon-trainable params: 0\n_________________________________________________________________\n```\n\n![](Images/model.png)\n\n### **3. Loss Function \u0026 Optimization**\n- **Loss Function**: Categorical Crossentropy (since it's a multi-class classification problem)\n- **Optimizer**: Adam (tuned for better convergence)\n- **Learning Rate**: Tested over a range of values for initial learning rate and found sweet spot at 0.001\n```python\nmodel.compile(\n    optimizer=Adamax(0.001),\n    loss='categorical_crossentropy',\n    metrics=['accuracy',  TopKCategoricalAccuracy(3), Precision(), Recall()]\n)\n```\n\n### **4. Training Process**\n- **Training Data Split**: 80% training, 20% validation, \n- **Batch Size**: 32 for memory efficiency\n- **Epochs**: 50 epochs with saving model at each epoch through checkpoints.\n\n    ```python\n    from tensorflow.keras.callbacks import ModelCheckpoint\n\n    checkpoint = ModelCheckpoint(\n        filepath = \"Models/model_epoch_{epoch:02}.keras\",\n        save_weights_only = False,\n        save_best_only = False,\n        monitor = 'val_loss',\n        mode = 'min',\n        verbose = 0\n    )\n    ```\n- **Evaluation Metrics**: Accuracy, Top K Categorical Accuracy with k = 3, Precision, and Recall for model effectiveness\n\n![](Images/Training-Metrics.png)\n\n### **5. Testing and Model Selection**\n- Models saved in each epoch are evluated using the test dataset.\n\n![](Images/Testing-Metrics.png)\n\n- Model from epoch 50 showed the best accuracy of 86.29%.\n- Model from epoch 44 showed the best Top K Categorical Accuracy of 95.31%.\n- This scores are acceptable as they not only indicate good predictions, but also indicate the similarities between some classes. This can be understood from Confusion Matrix.\n\n![](Images/confusion_matrix.png)\n\n- As an example, we can see that the model predicted nearly half of the school busses as bus and 523 busses as school bus\n- Although this reduces accuracy, it's a good sign considering both classes look nearly the same in doodles.\n\n### **6. Deployment Considerations**\n- Model and Weights exported in Keras and h5 format respectively.\n- Integrated with a real-time drawing interface for inference\n- Optimized preprocessing to match training data conditions (grid-based downscaling to 28x28 format)\n\n![](Images/ant.png)\n---\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frahul-samedavar%2Fdoodlemind","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frahul-samedavar%2Fdoodlemind","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frahul-samedavar%2Fdoodlemind/lists"}