Python toolkit for automated droplet detection and flow regime classification in microfluidic experiments using computer vision and machine learning.
git clone git@github.com:FinOrr/auto-fluidics.git
cd auto-fluidics
pip install -r requirements.txt
streamlit run app.py- Droplet detection using Hough Circle Transform
- Flow regime classification: DRIPPING, JETTING, CO_FLOW, NO_FLOW
- ML classifier using MobileNetV2
- Real-time metrics: count, size distribution, uniformity, aspect ratio
- Interactive Streamlit dashboard and batch processing
- Processing speed: 10-100ms per image
streamlit run app.pyfrom processing.particle_detector import ParticleImageProcessor
from perception.regime_detector import RegimeDetector
processor = ParticleImageProcessor(um_per_pixel=2.0)
processor.process_image('img/sample-10.png')
detector = RegimeDetector()
regime, confidence, _ = detector.detect_regime(processor.particle_metrics)
print(f"Particles: {processor.particle_metrics['num_particles']}")
print(f"Regime: {regime.name} ({confidence:.0%})")Main:
app.py- Streamlit dashboardvalidate_detection.py- Batch validation
ML:
train_regime_classifier.py- Train ML classifierlabel_training_data.py- Label training imagescheck_ml_setup.py- Verify TensorFlow setup
Video:
batch_video_extract.py- Extract frames from videosextract_training_from_video.py- Extract and label video frames
Core:
processing/particle_detector.py- Droplet detection engineprocessing/channel_detector.py- Channel ROI extractionperception/regime_detector.py- Rule-based regime classificationperception/ml_regime_classifier.py- ML-based classification
Detection: Hough Circle Transform with adaptive parameters, watermark filtering, and outlier removal.
Classification: Rule-based uses particle count, aspect ratio, and size uniformity. ML classifier uses MobileNetV2 fine-tuned on labeled microfluidic images.
MIT License - see LICENSE