We made a Cell Identifier Model, an open-source web-based tool for automated detection and quantification of GFP fluorescence in bacterial cell images. It uses classical computer vision to detect cells, measure intensity, and classify brightness levels without requiring AI training or expensive commercial software.
Quantifying fluorescence and cell count given an image sample is time consuming and inconsistent. We made a Cell Identifier to automate this process using simple classical computer vision techniques, which allows users to quickly analyze bacteria populations for any reason!
Technology Stack: Flask 2.0+ | OpenCV 4.5+ | NumPy/SciPy/scikit-learn | HTML/CSS/JavaScript
The tool can be accessed at https://cell-identifier-ij23.onrender.com/.
The GitHub repository is located at https://github.com/delnorte-sd/Cell-Identifier/.
One part of this tool is a synthetic image generator. With this, users are able to create semirealistic images of fluorescent bacteria with a known ground truth. By customizing key variables such as cell count (from 1 to 200), morphological shape (pill-shaped like E. coli or simple ellipses), noise level, and whether or not cells can overlap. Once generated, the app will output a synthetic image that can be used for analysis!
The app uses a robust automated detection pipeline with classical computer vision techniques to analyze cell images. There are multiple steps in this process which are sequenced to reliably segment the microscopy image and identify fluorescent cells. First, a Gaussian blur is applied onto the image to reduce any noise while preserving the edges of each cell. Intensity thresholding is then applied to create a binary mask of fluorescent regions. Then, the mask is cleaned with morphological operations that close up gaps within cells and remove small non-cellular artifacts. Finally, contour detection is used to identify the boundaries of each potential cell.
Classifying the identified cells into brightness categories based on their mean fluorescence intensity is a key feature of this app. Thresholds may be adjusted, but by default, "low" is below 73, "medium" is 73-80, and "high" is over 80. This feature is critical as it can be used to find the bacteria's expression in the scenario. This feature also allows for analysis of dose-response curves by providing a clear breakdown of the cell's response.
The detection algorithm uses a straightforward computer vision approach optimized for fluorescence microscopy:
1. Gaussian blur → Reduce noise (kernel size: 3-21) 2. Intensity threshold → Segment fluorescent regions (0-255) 3. Morphological close → Fill gaps in cells 4. Morphological open → Remove small artifacts 5. Contour detection → Find cell boundaries 6. Area filtering → Remove debris (50-3000 px default) 7. Feature extraction → Calculate centroid, area, mean intensity
| Parameter | Range | Default | Purpose |
|---|---|---|---|
| Min cell area | 10-10000 px | 50 | Filter small debris |
| Max cell area | 50-50000 px | 3000 | Filter large clumps |
| Intensity threshold | 0-255 | 50 | Brightness cutoff |
| Blur kernel | 3-21 (odd) | 5 | Smoothing strength |
git clone [repository_url] pip install -r requirements.txt python app.py # Access at http://localhost:5000
1. Optimize parameters: Generate synthetic image → upload → adjust until detected count ≈ ground truth
2. Analyze samples: Upload experimental images → apply optimized parameters → export data
3. Statistical analysis: Use CSV export for dose-response curves, time-series, etc.
| Problem | Solution |
|---|---|
| Too many detections | Increase intensity threshold |
| Too few detections | Decrease intensity threshold |
| Small artifacts | Increase min area |
| Touching cells merged | Decrease blur kernel |
| Noisy detections | Increase blur kernel |
| Condition | Accuracy | False Positive Rate |
|---|---|---|
| No overlap, low noise | 95% | < 2% |
| No overlap, high noise | 88% | < 5% |
| Moderate overlap | 90% | < 5% |
| Severe overlap | 65% | 10-15% |
This tool is versatile and can be used for any reasons for quantitative fluorescence microscopy in microbiology and synthetic biology research. We hope that other iGEM teams and researchers will be able to use our tool to eliminate subjective manual counting and brightness classification across experiments.
Gene expression studies: Quantify reporter fluorescence to compare promoter strengths, RBS efficiencies, or regulatory element activity
Biosensor characterization: Generate dose-response curves, calculate EC50 values, and validate logic gate behavior
Population-level analysis: Measure expression heterogeneity, identify subpopulations, and track cell-to-cell variability
Quality control: Assess transformation efficiency, verify plasmid stability over generations, and screen for contamination
Time-course experiments: Monitor dynamic fluorescence changes during induction, stress response, or growth phases
High-throughput screening: Rapidly evaluate libraries of mutants, strains, or culture conditions to identify optimal variants
Educational settings: Demonstrate image analysis principles and quantitative biology concepts in teaching labs
The simple open-source codebase allows for straightforward customization depending on the fluorescent protein of interest (GFP, YFP, RFP, mCherry, etc.), bacterial species (E. coli, B. subtilis, etc.), multi-channel imaging, or integration with automated microscopy workflows.
The model has several limitations that we hope to address in future iterations. The type of sample image can greatly affect the model's performance:
Severe overlap: Multiple cells may count as one → use diluted samples
Uneven illumination: Fixed threshold struggles → apply flat-field correction preprocessing
Out-of-focus cells: Reduced intensity may cause misses → ensure proper focus during imaging
Debris/artifacts: Can trigger false positives → adjust area parameters carefully
Non-fluorescent cells: Invisible to detection → tool measures expressing population only
This is an example of a real image of cells that led to false results, even with calibration:
Keeping the idea of a Cell Identifier model, one of the main future directives is to implement machine learning techniques to improve detection accuracy, as our model did not perform well in challenging scenarios like high cell density or uneven illumination. We would like to train convolutional neural networks using tools like U-Net or Mask R-CNN on diverse datasets of microscopy images to recognize complex patterns and cell boundaries that our current model built on classical computer vision techniques cannot. Additionally, domain adaptation techniques could be used to address the differences between synthetically generated training images and real experimental data. Although our current model prioritizes accessibility and ease of use regardless of device specs, these enhancements would help to make the Cell Identifier much more robust and helpful.