{"id":30714732,"url":"https://github.com/shervinnd/persian_alphabet_detection","last_synced_at":"2025-09-03T05:15:09.946Z","repository":{"id":310782954,"uuid":"1041199021","full_name":"shervinnd/Persian_Alphabet_Detection","owner":"shervinnd","description":"🧠 Persian_Alphabet_Detection is a deep learning project for recognizing Persian alphabet characters using Dense \u0026 CNN models in Keras/TensorFlow. It includes dataset preprocessing, model training, accuracy and ROC curve visualization, and real-world testing for 43 distinct character classes.","archived":false,"fork":false,"pushed_at":"2025-08-20T06:26:52.000Z","size":923,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-20T08:27:10.285Z","etag":null,"topics":["computer-vision","convolutional-neural-networks","data-visualization","deep-learning","image-classification","keras","machine-learning","neural-networks","persian-nlp","python"],"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/shervinnd.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,"zenodo":null}},"created_at":"2025-08-20T06:11:13.000Z","updated_at":"2025-08-20T06:29:44.000Z","dependencies_parsed_at":"2025-08-20T08:27:46.597Z","dependency_job_id":"6a4017d0-e7d9-47a9-86fd-36ddcf8aba7a","html_url":"https://github.com/shervinnd/Persian_Alphabet_Detection","commit_stats":null,"previous_names":["shervinnd/persian_alphabet_detection"],"tags_count":null,"template":true,"template_full_name":null,"purl":"pkg:github/shervinnd/Persian_Alphabet_Detection","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shervinnd%2FPersian_Alphabet_Detection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shervinnd%2FPersian_Alphabet_Detection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shervinnd%2FPersian_Alphabet_Detection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shervinnd%2FPersian_Alphabet_Detection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shervinnd","download_url":"https://codeload.github.com/shervinnd/Persian_Alphabet_Detection/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shervinnd%2FPersian_Alphabet_Detection/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273392297,"owners_count":25097259,"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-09-03T02:00:09.631Z","response_time":76,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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":["computer-vision","convolutional-neural-networks","data-visualization","deep-learning","image-classification","keras","machine-learning","neural-networks","persian-nlp","python"],"created_at":"2025-09-03T05:15:07.373Z","updated_at":"2025-09-03T05:15:09.936Z","avatar_url":"https://github.com/shervinnd.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# **Persian_Alphabet_Detection**📚✨\n\nWelcome to the **Alphabet Recognition** project! This repository\nimplements a deep learning-based solution for recognizing Persian\nalphabet characters using both **Fully Connected Neural Networks** and\n**Convolutional Neural Networks (CNNs)**. Built with Python and Keras,\nthis project showcases the power of machine learning in image\nclassification tasks. 🚀\n\n------------------------------------------------------------------------\n\n## 📖 Overview\n\nThis project focuses on classifying Persian alphabet characters from\nimages using two distinct neural network architectures:\n\n-   **Model 1**: A fully connected neural network with multiple dense\n    layers.\n-   **Model 2**: A convolutional neural network (CNN) with\n    convolutional, batch normalization, max-pooling, and dropout layers.\n\nThe models are trained and evaluated on custom datasets, with additional\ntesting on real-world images. The project includes data preprocessing,\nmodel training, performance evaluation, and visualization of results\nlike ROC curves and sample predictions. 📊\n\n------------------------------------------------------------------------\n\n## 🛠️ Features\n\n-   **Data Preprocessing**: Custom `DataLoader` class for loading,\n    resizing, normalizing, and augmenting images (zoom, invert, etc.).\n    🖼️\n-   **Model Architectures**:\n    -   **Model 1**: Sequential dense layers with ReLU activation and\n        softmax output for 43 classes.\n    -   **Model 2**: CNN with Conv2D, BatchNormalization, MaxPooling,\n        and Dropout for robust feature extraction.\n-   **Training \u0026 Evaluation**:\n    -   Trained on three datasets (`DS-01`, `DS-02`, `DS-03`) with\n        validation splits.\n    -   Performance metrics: Accuracy, Loss, ROC curves, and AUC for\n        each class.\n-   **Visualization**:\n    -   Sample images from training and test sets.\n    -   Training/validation accuracy and loss plots.\n    -   ROC curves for each class in a 7x7 grid.\n    -   Real-world image predictions with side-by-side model\n        comparisons.\n-   **Real-World Testing**: Preprocesses and predicts on real-world\n    images using both models. 🌍\n\n------------------------------------------------------------------------\n\n## 📂 Project Structure\n\n``` plaintext\nAlphabet-Recognition/\n├── Datasets/\n│   ├── DS-01/                # Dataset 1\n│   ├── DS-02/                # Dataset 2\n│   ├── DS-03/                # Dataset 3\n│   └── Real Data/            # Real-world test images\n├── Models/\n│   └── Neural Network/       # Saved model files\n├── Datasets/\n│   └── DataLoader/           # DataLoader class\n├── alphabet_recognition.py    # Main script\n└── README.md                 # Project documentation\n```\n\n------------------------------------------------------------------------\n\n## 🚀 Getting Started\n\n### Prerequisites\n\n-   Python 3.8+ 🐍\n\n-   Required libraries:\n\n    ``` bash\n    pip install keras matplotlib numpy pandas scikit-learn opencv-python\n    ```\n\n### Installation\n\n1.  Clone the repository:\n\n    ``` bash\n    git clone https://github.com/shervinnd/Alphabet-Recognition.git\n    cd Alphabet-Recognition\n    ```\n\n2.  Install dependencies:\n\n    ``` bash\n    pip install -r requirements.txt\n    ```\n\n3.  Download or prepare the datasets (`DS-01`, `DS-02`, `DS-03`, and\n    `Real Data`) and place them in the `Datasets/` folder.\n\n### Running the Project\n\n1.  Update the dataset paths in `alphabet_recognition.py` to match your\n    local setup:\n\n    ``` python\n    DATASET1 = \"path/to/DS-01\"\n    DATASET2 = \"path/to/DS-02\"\n    DATASET3 = \"path/to/DS-03\"\n    REAL_DATA = \"path/to/Real Data\"\n    ```\n\n2.  Run the main script:\n\n    ``` bash\n    python alphabet_recognition.py\n    ```\n\n------------------------------------------------------------------------\n\n## 📈 Model Details\n\n### Model 1: Fully Connected Neural Network\n\n-   **Architecture**:\n    -   Input: 64x64 grayscale images\n    -   Layers: Flatten → Dense (2048, 1024, 512, 256, 64, 43) with ReLU\n        and softmax\n-   **Training**: Adam optimizer, sparse categorical crossentropy loss,\n    20 epochs\n-   **Performance**: Evaluated with accuracy, loss, and ROC curves\n\n### Model 2: Convolutional Neural Network\n\n-   **Architecture**:\n    -   Input: 64x64 grayscale images (reshaped to 1x64x64)\n    -   Layers: Conv2D → BatchNorm → MaxPooling → Dropout (x2) → Flatten\n        → Dense (512, 256, 43)\n-   **Training**: Adam optimizer, sparse categorical crossentropy loss,\n    20 epochs\n-   **Performance**: Higher accuracy due to convolutional feature\n    extraction\n\n------------------------------------------------------------------------\n\n## 📊 Results\n\n-   **Training/Validation Accuracy \u0026 Loss**:\n    -   Visualized for both models using Matplotlib.\n-   **Test Accuracy**:\n    -   Model 1: \\~\\[Insert test accuracy from script\\]\n    -   Model 2: \\~\\[Insert test accuracy from script\\]\n-   **ROC Curves**:\n    -   Plotted for all 43 classes, showing AUC for each.\n-   **Real-World Predictions**:\n    -   Both models predict on real-world images, displayed side-by-side\n        for comparison.\n\n------------------------------------------------------------------------\n\n## 🖼️ Visualizations\n\n### Sample Images\n\nThe script visualizes one image per class from the training set and 10\ntest images with true and predicted labels.\n\n### Training Plots\n\nTraining and validation accuracy/loss are plotted to analyze model\nperformance over epochs.\n\n### ROC Curves\n\nA 7x7 grid of ROC curves shows the performance of each class, with AUC\nvalues for detailed insights.\n\n------------------------------------------------------------------------\n\n## 🔧 Usage\n\n1.  **Training**: Run `alphabet_recognition.py` to train both models and\n    generate visualizations.\n2.  **Testing**: The script evaluates models on test data and real-world\n    images.\n3.  **Customization**:\n    -   Adjust `EPOCHS`, `IMAGE_SIZE`, or `SHRINK` in the script for\n        experimentation.\n    -   Modify the `DataLoader` parameters (e.g., `zoom`, `contrast`)\n        for different preprocessing.\n\n------------------------------------------------------------------------\n\n## 🤝 Contributing\n\nContributions are welcome! 🙌 To contribute:\n\n1.  Fork the repository.\n2.  Create a new branch (`git checkout -b feature/your-feature`).\n3.  Commit your changes (`git commit -m \"Add your feature\"`).\n4.  Push to the branch (`git push origin feature/your-feature`).\n5.  Open a Pull Request.\n\n------------------------------------------------------------------------\n\n## 📜 License\n\nThis project is licensed under the MIT License. See the LICENSE file for\ndetails.\n\n------------------------------------------------------------------------\n\n## 🙏 Acknowledgments\n\n-   Inspired by Persian alphabet recognition challenges.\n-   Thanks to the open-source community for libraries like Keras,\n    Matplotlib, and OpenCV.\n-   Dataset credits: \\[Insert dataset source or credit if applicable\\].\n\n------------------------------------------------------------------------\n\n## 📬 Contact\n\nFor questions or feedback, reach out via GitHub Issues or connect with\nthe project maintainer at \\[shervindanesh8282@gmail.com\\].\n\nHappy coding! 🎉\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshervinnd%2Fpersian_alphabet_detection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshervinnd%2Fpersian_alphabet_detection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshervinnd%2Fpersian_alphabet_detection/lists"}