A lightweight, CNN-based droplet classification system optimized for resource-limited, field-deployable imaging flow cytometry. This repository contains code and model weights for running a customized YoloV4-tiny on a Raspberry Pi 5 (RPi5), achieving real-time classification of microfluidic droplets.
- Fast inference: Classifies “no cell”, “one cell”, or “multiple cells” in ~13 ms per frame on RPi5.
- High accuracy: 99.95 % mAP@0.5 on custom microfluidic dataset.
- Portable: All dependencies optimized for Raspberry Pi OS on RPi5.
- Comparison suite: Scripts to benchmark against alternative platforms (e.g., MaixCam + YoloV5s).
If you use this code, please cite: Afrin, F., Le Moullec, Y., Pardy, T., & Rang, T. (2025). Lightweight CNN-based microfluidic droplet classification for portable imaging flow cytometry. [Proceedings of the Estonian Academy of Sciences].
This project uses OpenCV's DNN module with a custom YoloV4-tiny model for droplet classification
Custom YoloV4-tiny-inference/
├── infer.py
├── dnn_model/
│ ├── yolov4-tiny-custom_6000.weights
│ ├── yolov4-tiny-custom.cfg
├── classes.txt
├── Testing/
│ ├── test1(1).jpg
│ └── ...
├── Processed_Images/
├── training_data/
│ ├── images/
│ │ ├── 1_frame_0.jpg
│ │ ├── 1_frame_1.jpg
│ │ └── ...
│ └── labels/
│ ├── 1_frame_0.txt
│ ├── 1_frame_1.txt
│ └── ...
├── requirements.txt
├── README.md
Install required packages:
pip install -r requirements.txt
Run the inference:
python infer.py
This project uses a MobileNet-based model to evaluate the aesthetic quality of images using the NIMA (Neural Image Assessment) approach.
image-aesthetic-evaluation/
├── evaluate.py
├── weights/
│ └── weights.h5
├── utils/
│ └── score_utils.py
├── requirements.txt
└── README.md
Install dependencies with:
pip install -r requirements.txt
Evaluate images or directories:
# Evaluate a single image
python evaluate.py -img path/to/image.jpg
# Evaluate a directory of images
python evaluate.py -dir path/to/images/
# Optional arguments
-resize true # Resize images to 224x224
-rank false # Do not rank images by score
- Prints NIMA score (mean and std) for each image.
- Optionally ranks all images from most to least aesthetically pleasing.