{"id":30360524,"url":"https://github.com/amr-f-ramadan/python-flowers-classifier","last_synced_at":"2026-04-14T04:02:15.252Z","repository":{"id":308709322,"uuid":"1033688285","full_name":"amr-f-ramadan/python-flowers-classifier","owner":"amr-f-ramadan","description":"🌸 Complete Udacity ML TensorFlow Image Classifier Project - Flower species classification using MobileNetV2 transfer learning with 102 Oxford flower classes. Enhanced with automated conda setup, cross-platform GPU detection, and Apple Silicon support. Achieves 80%+ accuracy.","archived":false,"fork":false,"pushed_at":"2025-08-07T11:27:36.000Z","size":4487,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-19T14:40:03.723Z","etag":null,"topics":["apple-silicon","artificial-intelligence","computer-vision","conda-environment","cross-platform","deep-learning","flower-classification","image-classification","jupyter-notebook","machine-learning","macos","mobilenetv2","neural-networks","oxford-flowers","python","tensorflow","transfer-learning","udacity-nanodegree"],"latest_commit_sha":null,"homepage":null,"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/amr-f-ramadan.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-08-07T07:41:57.000Z","updated_at":"2025-08-07T11:27:39.000Z","dependencies_parsed_at":"2025-08-07T13:08:22.263Z","dependency_job_id":"df88a13e-5612-4500-a34b-7513d4c46c2d","html_url":"https://github.com/amr-f-ramadan/python-flowers-classifier","commit_stats":null,"previous_names":["amr-f-ramadan/python-flowers-classifier"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/amr-f-ramadan/python-flowers-classifier","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amr-f-ramadan%2Fpython-flowers-classifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amr-f-ramadan%2Fpython-flowers-classifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amr-f-ramadan%2Fpython-flowers-classifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amr-f-ramadan%2Fpython-flowers-classifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amr-f-ramadan","download_url":"https://codeload.github.com/amr-f-ramadan/python-flowers-classifier/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amr-f-ramadan%2Fpython-flowers-classifier/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31781292,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-14T02:24:21.117Z","status":"ssl_error","status_checked_at":"2026-04-14T02:24:20.627Z","response_time":153,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["apple-silicon","artificial-intelligence","computer-vision","conda-environment","cross-platform","deep-learning","flower-classification","image-classification","jupyter-notebook","machine-learning","macos","mobilenetv2","neural-networks","oxford-flowers","python","tensorflow","transfer-learning","udacity-nanodegree"],"created_at":"2025-08-19T14:23:00.426Z","updated_at":"2026-04-14T04:02:15.222Z","avatar_url":"https://github.com/amr-f-ramadan.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🌸 Flower Image Classifier - Udacity ML Nanodegree Project\n\n**This Project was first submitted on September 11, 2024. Later on, it went through some enhancements that are listed below.**\n\n![TensorFlow](https://img.shields.io/badge/TensorFlow-2.17.1-orange?logo=tensorflow)\n![Python](https://img.shields.io/badge/Python-3.9-blue?logo=python)\n![Conda](https://img.shields.io/badge/Conda-Environment-green?logo=anaconda)\n![Jupyter](https://img.shields.io/badge/Jupyter-Notebook-orange?logo=jupyter)\n![License](https://img.shields.io/badge/License-Educational-lightgrey)\n\n**Keywords**: `machine learning`, `deep learning`, `tensorflow`, `image classification`, `transfer learning`, `mobilenetv2`, `computer vision`, `neural networks`, `udacity nanodegree`, `flower classification`, `oxford flowers 102`, `conda environment`, `jupyter notebook`, `python`, `artificial intelligence`\n\n## 📋 Project Overview\n\nThis repository contains a **complete solution** to the **Introduction to Machine Learning with TensorFlow Nanodegree** Image Classifier Project. The project implements a deep learning model using transfer learning to classify 102 different flower species with high accuracy.\n\n## 🎯 Project Objectives\n\n- Build an image classifier using TensorFlow and pre-trained neural networks\n- Implement transfer learning with MobileNetV2 architecture\n- Create a robust data preprocessing pipeline\n- Develop inference functions for real-world image classification\n- Achieve \u003e70% accuracy on unseen test data\n\n## 🚀 Key Contributions \u0026 Improvements\n\n### ✨ **Enhanced Architecture**\n- **Replaced TensorFlow Hub with Keras Applications**: Solved compatibility issues by using `tf.keras.applications.MobileNetV2` instead of TensorFlow Hub\n- **Improved Model Structure**: Added GlobalAveragePooling2D and Dropout layers for better performance and regularization\n- **Functional API Implementation**: Used TensorFlow's Functional API for more stable model creation\n\n### 🔧 **Development Environment Setup**\n- **Conda Virtual Environment**: Created isolated environment `flower-classifier` with Python 3.9\n- **Dependency Management**: Properly managed TensorFlow, TensorFlow Datasets, and all required packages\n- **Cross-Platform Compatibility**: Enhanced GPU detection for macOS (Intel \u0026 Apple Silicon) and other platforms\n\n### 🖥️ **System Optimization**\n- **Apple Silicon Support**: Added Metal Performance Shaders (MPS) detection for Apple Silicon Macs\n- **Smart GPU Detection**: Implemented platform-aware GPU detection and memory management\n- **Comprehensive System Info**: Enhanced system information display for better debugging\n\n### 📊 **Code Quality Improvements**\n- **Error Handling**: Added robust error handling throughout the codebase\n- **Code Documentation**: Comprehensive comments and documentation\n- **Modular Design**: Clean separation of concerns in data processing, model building, and inference\n\n## 🛠️ Technical Stack\n\n- **Framework**: TensorFlow 2.17.1\n- **Architecture**: MobileNetV2 (Transfer Learning)\n- **Dataset**: Oxford Flowers 102 (via TensorFlow Datasets)\n- **Environment**: Conda Virtual Environment\n- **Platform**: Cross-platform (macOS, Linux, Windows)\n\n## 📁 Project Structure\n\n```\nimage_classifier/\n├── Project_Image_Classifier_Project_Solution.ipynb  # Main notebook complete solution\n├── predict.py                                       # Command-line prediction script\n├── setup_environment.sh                             # Automated environment setup script\n├── label_map.json                                   # Flower class mappings\n├── README.md                                        # This file\n├── .gitignore                                       # Git ignore rules for Python/ML projects\n├── *.keras                                          # Trained model files (generated after training)\n├── assets/                                          # Project images and resources\n│   ├── Flowers.png\n│   └── inference_example.png\n└── test_images/                                     # Sample images for testing\n    ├── cautleya_spicata.jpg\n    ├── hard-leaved_pocket_orchid.jpg\n    ├── orange_dahlia.jpg\n    └── wild_pansy.jpg\n```\n\n## 🏗️ Setup Instructions\n\n### Quick Setup (Recommended)\nRun the automated setup script:\n```bash\nchmod +x setup_environment.sh\n./setup_environment.sh\n```\n\n### Manual Setup (Alternative)\n\n### 1. Create Conda Environment\n```bash\nconda create -n flower-classifier python=3.9 -y\nconda activate flower-classifier\n```\n\n### 2. Install Dependencies\n```bash\nconda install matplotlib numpy pillow jupyter ipykernel -c conda-forge -y\npip install tensorflow==2.17.1 tensorflow-datasets\n```\n\n### 3. Register Jupyter Kernel\n```bash\npython -m ipykernel install --user --name flower-classifier --display-name \"Python (flower-classifier)\"\n```\n\n### 4. Launch Jupyter Notebook\n```bash\njupyter notebook Project_Image_Classifier_Project.ipynb\n```\n\n### 5. Verify Installation\n```bash\npython -c \"import tensorflow as tf; print('TensorFlow version:', tf.__version__)\"\n```\n\n## 🎯 Model Performance\n\n- **Training Accuracy**: ~95%+\n- **Validation Accuracy**: ~85%+\n- **Test Accuracy**: ~80%+ (exceeds 70% requirement)\n- **Model Size**: Optimized for deployment\n- **Inference Time**: Fast prediction on single images\n\n## 💡 Key Features\n\n### 🔍 **Data Pipeline**\n- Automatic dataset download and preprocessing\n- Image normalization and resizing to 224x224\n- Efficient batching and prefetching\n- Data augmentation ready\n\n### 🧠 **Model Architecture**\n```python\nModel: MobileNetV2 + Custom Classifier\n├── Input Layer (224, 224, 3)\n├── MobileNetV2 Base (frozen)\n├── GlobalAveragePooling2D\n├── Dropout(0.2)\n└── Dense(102, softmax)\n```\n\n### 📈 **Training Strategy**\n- Transfer learning with frozen base model\n- Adam optimizer with sparse categorical crossentropy\n- 10 epochs training with validation monitoring\n- Early stopping capability\n\n### 🔮 **Inference Pipeline**\n- Image preprocessing function\n- Top-K predictions with probabilities\n- Visual prediction results with matplotlib\n- Command-line interface for batch processing\n\n## 📊 Results \u0026 Visualizations\n\nThe notebook includes comprehensive visualizations:\n- Training/validation accuracy and loss curves\n- Sample predictions with confidence scores\n- Confusion matrix analysis\n- Model architecture summary\n\n## 🎓 Learning Outcomes\n\nThis project demonstrates proficiency in:\n- **Deep Learning**: Transfer learning, fine-tuning, model evaluation\n- **TensorFlow**: Model building, training, saving/loading\n- **Data Science**: Data preprocessing, visualization, analysis\n- **Software Engineering**: Environment management, code organization\n- **Problem Solving**: Debugging compatibility issues, optimization\n\n## 🌟 Beyond the Requirements\n\nThis solution goes beyond the basic project requirements by:\n- ✅ **Automated Setup Script**: One-command environment setup with `setup_environment.sh`\n- ✅ Enhanced error handling and debugging capabilities\n- ✅ Cross-platform compatibility (macOS/Linux/Windows)\n- ✅ Modern TensorFlow best practices\n- ✅ Comprehensive documentation and comments\n- ✅ Production-ready code structure\n- ✅ Conda environment for reproducibility\n\n## 📝 Usage Examples\n\n### Jupyter Notebook\n1. Run the setup script: `./setup_environment.sh`\n2. Activate environment: `conda activate flower-classifier`\n3. Open `Project_Image_Classifier_Project.ipynb`\n4. Select \"Python (flower-classifier)\" kernel\n5. Run all cells sequentially\n\n### Command Line\n```bash\npython predict.py ./test_images/wild_pansy.jpg ./model.keras --top_k 5\n```\n\n## 🤝 Acknowledgments\n\n- **Udacity**: For the excellent Machine Learning Nanodegree program\n- **TensorFlow Team**: For the robust deep learning framework\n- **Oxford VGG Group**: For the Flowers 102 dataset\n\n## 📄 License\n\nThis project is part of the Udacity Machine Learning Nanodegree program and is intended for educational purposes.\n\n---\n\n**Author**: Amr Ramadan  \n**Program**: Udacity Introduction to Machine Learning with TensorFlow Nanodegree  \n**Project**: Image Classifier  \n**Date**: 2025\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famr-f-ramadan%2Fpython-flowers-classifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famr-f-ramadan%2Fpython-flowers-classifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famr-f-ramadan%2Fpython-flowers-classifier/lists"}