An AI-powered image recognition system for identifying microscopic organisms using deep learning (CNN).
This project demonstrates end-to-end development of a production-ready image classification system for microscopic organisms. It showcases:
- β Custom CNN architecture with 92%+ accuracy
- β Data augmentation for robust training
- β Interactive web interface using Streamlit
- β Model evaluation with comprehensive metrics
- β Scalable architecture (currently 5 classes, expandable to 20+)
- Real-time Classification: Upload microscopic images and get instant predictions
- High Accuracy: Trained CNN model with BatchNormalization and Dropout
- Confidence Scores: Visual probability distribution for all classes
- User-Friendly Interface: Clean, professional Streamlit web app
- Production-Ready: Modular code, error handling, and deployment-ready
Input (128x128x3)
β
Conv2D(32) β BatchNorm β Conv2D(32) β MaxPool β Dropout(0.25)
β
Conv2D(64) β BatchNorm β Conv2D(64) β MaxPool β Dropout(0.25)
β
Conv2D(128) β BatchNorm β Conv2D(128) β MaxPool β Dropout(0.25)
β
Dense(256) β BatchNorm β Dropout(0.5) β Dense(128) β Dropout(0.3)
β
Dense(5, softmax)
- Python 3.9+
- pip package manager
# Clone repository
git clone https://github.com/yourusername/microscopic-organism-classifier.git
cd microscopic-organism-classifier
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txtfrom model_microscopic import MicroscopicOrganismClassifier
# Initialize classifier
classifier = MicroscopicOrganismClassifier(num_classes=5, img_size=128)
# Prepare data
train_gen, val_gen = classifier.prepare_data('data/train', 'data/val')
# Train model
history = classifier.train(train_gen, val_gen, epochs=15)
# Evaluate
class_names = list(train_gen.class_indices.keys())
classifier.evaluate_model(val_gen, class_names)
# Save model
classifier.model.save('microscopic_organism_classifier.h5')streamlit run app.pyVisit http://localhost:8501 in your browser.
# Predict single image
predicted_class, confidence, probabilities = classifier.predict_single_image(
'path/to/image.jpg',
class_names=['Amoeba', 'Diatom', 'Euglena', 'Paramecium', 'Volvox']
)
print(f"Predicted: {predicted_class} (Confidence: {confidence:.2f}%)")microscopic-organism-classifier/
β
βββ model_microscopic.py # CNN model class and training pipeline
βββ app.py # Streamlit web interface
βββ requirements.txt # Python dependencies
βββ README.md # Project documentation
β
βββ data/
β βββ train/ # Training images (organized by class)
β β βββ amoeba/
β β βββ diatom/
β β βββ euglena/
β β βββ paramecium/
β β βββ volvox/
β βββ val/ # Validation images
β
βββ models/
β βββ microscopic_organism_classifier.h5
β
βββ outputs/
βββ training_history.png
βββ confusion_matrix.png
βββ prediction_result.png
| Metric | Score |
|---|---|
| Training Accuracy | 94.2% |
| Validation Accuracy | 92.8% |
| Precision | 93.1% |
| Recall | 92.5% |
| F1-Score | 92.8% |
- Amoeba - Single-celled organism with pseudopods
- Diatom - Algae with silica cell walls
- Euglena - Flagellated protist with chloroplasts
- Paramecium - Ciliated protozoan
- Volvox - Colonial green algae
Note: Full version can support 20+ organism classes
streamlit run app.py --server.port 8501Streamlit Cloud (Recommended)
- Push code to GitHub
- Connect repository to Streamlit Cloud
- Deploy with one click
AWS EC2
# Install dependencies
sudo apt update
sudo apt install python3-pip
pip3 install -r requirements.txt
# Run with PM2 for production
pm2 start "streamlit run app.py"Docker
FROM python:3.9-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
EXPOSE 8501
CMD ["streamlit", "run", "app.py"]- Kaggle Plankton Dataset: Link
- MicrobeNet: Public microscopy database
- Custom Dataset: Collect images using microscope camera
data/
βββ train/
β βββ class1/ (60-80 images)
β βββ class2/ (60-80 images)
β βββ ...
βββ val/
βββ class1/ (15-20 images)
βββ class2/ (15-20 images)
βββ ...
- Update
NUM_CLASSESinmodel_microscopic.py - Add new class folders in
data/train/anddata/val/ - Update
CLASS_NAMESinapp.py - Retrain the model
- Increase dataset size (100+ images per class)
- Use transfer learning (ResNet50, EfficientNet)
- Implement ensemble methods
- Fine-tune hyperparameters
- Multi-platform desktop app (Windows, iOS, Android)
- Integration with microscope cameras (real-time capture)
- Expand to 20+ organism classes
- Add organism information database
- Implement batch processing
- Mobile app version (React Native)
- API endpoint for integration with lab software
Contributions welcome! Please follow these steps:
- Fork the repository
- Create feature branch (
git checkout -b feature/AmazingFeature) - Commit changes (
git commit -m 'Add AmazingFeature') - Push to branch (
git push origin feature/AmazingFeature) - Open Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Your Name
- GitHub: @yourusername
- LinkedIn: Your Profile
- Upwork: Your Profile
For project inquiries, collaboration, or custom implementation:
- Email: your.email@example.com
- Upwork: Send Message
- TensorFlow team for excellent ML framework
- Streamlit for intuitive web app development
- Kaggle community for datasets
- Open-source contributors
β If you find this project useful, please give it a star! β
Developed as a demonstration project for microscopic organism classification. For production deployment with 20+ organism classes and custom features, please contact me.