An intelligent flower classification system powered by machine learning
FloraMind is a full-stack web app that uses machine learning to classify flowers from user measurements. Powered by the Iris dataset and K-Nearest Neighbors, it predicts species through an intuitive interface.
- Clean, responsive Bootstrap 5-based design
- Real-time input validation
- Live measurement preview
- Mobile-friendly interface
- K-Nearest Neighbors (KNN) algorithm implementation
- Trained on the classic Iris dataset
- Predicts three species: Iris Setosa, Iris Versicolor, Iris Virginica
- High accuracy classification
- Color-coded species predictions
- Icon-based visual feedback
- Detailed classification confidence scores
- Responsive result cards
- MySQL database integration
- Automatic prediction logging
- Timestamp tracking
- Historical data storage
- Prediction history tracking
- Usage statistics
- Model performance insights
- Admin dashboard (optional)
| Layer | Technologies |
|---|---|
| Frontend | HTML5, CSS3, Bootstrap 5, JavaScript (ES6) |
| Backend | PHP 8, PHP-ML Library |
| Database | MySQL 8 |
| ML Algorithm | K-Nearest Neighbors (KNN) |
| Dataset | Iris Dataset (CSV) |
-
Enter Measurements
- Sepal Length (cm): 4.0 - 8.0
- Sepal Width (cm): 2.0 - 5.0
- Petal Length (cm): 1.0 - 7.0
- Petal Width (cm): 0.1 - 3.0
-
Submit for Classification
- Click the "Classify Flower" button
- Wait for the prediction results
-
View Results
- Species name displayed
- Confidence score shown
- Visual indicators provided
Iris Setosa
- Typically small petals
- Wide sepals
- Color: Purple theme
Iris Versicolor
- Medium-sized features
- Balanced proportions
- Color: Blue theme
Iris Virginica
- Large petals
- Narrow sepals
- Color: Pink theme
floramind/
├── index.php # Main application entry (HTML UI)
├── predict.php # Backend API for predictions
├── script.js # Frontend logic & AJAX
├── style.css # Custom styles
├── iris.csv # Training dataset (150 samples)
├── database/
│ └── schema.sql # Database schema
├── vendor/ # Composer dependencies
│ └── php-ai/php-ml/ # PHP Machine Learning library
├── composer.json # Dependency manifest
└── composer.phar # Local Composer (if installed locally)
The application uses the Iris dataset, containing 150 samples with four features each:
- Sepal length and width
- Petal length and width
The KNN algorithm is trained using PHP-ML:
$classifier = new KNearestNeighbors($k = 3);
$classifier->train($samples, $labels);User input is processed and classified:
$prediction = $classifier->predict($userInput);Results are logged to MySQL for analytics:
INSERT INTO predictions (sepal_length, sepal_width,
petal_length, petal_width, predicted_species, timestamp)
VALUES (?, ?, ?, ?, ?, NOW());- Understanding supervised machine learning
- Implementing KNN algorithm
- Full-stack web development
- Database design and integration
- RESTful API concepts
- Data validation and sanitization
- Computer Science students
- Web development learners
- Machine learning beginners
- Full-stack bootcamp projects
- Multi-Model Support: Add SVM, Decision Trees, Random Forest
- Image Classification: Integrate CNN for flower image recognition
- User Authentication: Add login and personalized history
- Real-time Charts: Visualize predictions with Chart.js
- Export Functionality: Download prediction history as CSV
- API Rate Limiting: Implement request throttling
- Caching Layer: Use Redis for faster predictions
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
For questions and support:
- 🐛 Issues: GitHub Issues
- Basic KNN implementation
- Web interface
- Database integration
- Analytics dashboard
- Multi-model support
- Docker containerization
- API authentication
- Image classification
Built with ❤️ for education and innovation