Encapsulation of cells inside microfluidic droplets is central to several applications involving cellular analysis. Although, theoretically the encapsulation statistics are expected to follow Poisson distribution, experimentally this may not be achieved due to lack of full control of the experimental variables and conditions. Therefore, there is a need to automatically detect droplets and enumerate cell counts within droplets so that this can be used as process control feedback to adjust experimental conditions. In this study, we use a deep learning object detector called You Only Look Once (YOLO), an influential class of object detectors with several benefits over traditional methods. This paper investigates the application of both YOLOv3 and YOLOv5 object detectors in the development of an automated droplet and cell detector. Experimental data was obtained from a microfluidic flow focusing device with a dispersed phase of cancer cells. The microfluidic device contained an expansion chamber downstream of the droplet generator, allowing for visualization and recording of cell-encapsulated droplet images. In the procedure, a droplet bounding box is predicted, then cropped from the original image for the individual cells to be detected through a separate model for further examination. The system includes a production set for additional performance analysis with Poisson statistics while providing an experimental workflow with both droplet and cell models. The training set is collected and preprocessed before labeling and applying image augmentations, allowing for a generalizable object detector. Precision and recall were utilized as a validation and test set metric, resulting in a high mean average precision (mAP) metric for an accurate droplet detector. To examine model limitations, the predictions were compared to ground truth labels, illustrating that the YOLO predictions closely matched with the droplet and cell labels. Furthermore, it is demonstrated that droplet enumeration from the YOLOv3 model is consistent with hand counted ratios and the Poisson distribution, confirming that the platform can be used in real-time experiments for encapsulation optimization.
Instructions (click to expand)
-
First create a folder in your google drive account called droplet_classification (This step is important in order to keep the directories in check)
-
At the top there will be a dropdown arrow after the folder location (Shared with me > data_files): click on this dropdown arrow
-
Click on the "Add shortcut to Drive" button then navigate to inside your droplet_classification folder and click the blue "Add Shortcut" button. This will add a shortcut to the shared google drive folder in your droplet_classification folder.
-
Open the yolov3 colab notebook from the colab badge provided, then click "Save a copy in Drive" under File > Save a copy in Drive. Do the same for the provided yolov5 colab notebook.
-
This will save the two notebooks in the "Colab Notebooks" folder in your google drive. Move these two notebooks to the droplet_classification folder and rename them yolov3.ipynb and yolov5.ipynb respectively in order for the directories to be correct. The final droplet_classification folder should look like this:
-
Find the droplet model dataset here: and you will see two datasets (No_Augmentation and final_dataset). Start with the final_dataset and click on "Download" in the upper right corner. Then, click "Sign in with Github" and follow the prompts to allow roboflow to sign in with github. Or you may create a different account with roboflow. Then, the download link will bring you to a pop up that says Export. For the "Format" click on the YOLO v5 PyTorch and "show download code" on the bottom. You will then see a link that you can use to enter in the colab notebook. The final page should look like this but with your own link under the red stripe: Then copy this link into the section of both notebooks (yolov3.ipynb and yolov5.ipynb) that says "Curl droplet data from roboflow > Data with Augmentation for Training > [ROBOFLOW-API-KEY]": Copy your download link inside of the double quaotations as in the red box in the image provided.
-
Repeat step 7 for the droplet dataset with no augmentations (No_Augmentation):
-
You can now use both notebooks to perform more testing or contribute to the project. You can find the code written for many of the figures in the final paper: https://doi.org/10.1039/D2LC00462C
Testing (click to expand)
Nearly all figures and tables from the paper are outlined in yolov3.ipynb and yolov5.ipynb colab notebooks. For example Table 2 displays the annotation summary for cell and droplet models before augmentations. This can be shown in section 2.1 of the colab notebook:
You may run this for example by first uncommenting section 1.1 labeled "Data with No Augmentation (No_Augmentation)":
then uncommenting section 2. labeled: "For droplet model". Then the following output will be printed:
The same procedure can be used for the cell model to produce the following result:
This matches Table 2 in the publication:
Contributions
Publication Authors:
Karl Gardner, Md Mezbah Uddin, Linh Tran, Thanh Pham, Siva Vanapalli, and Wei Li
Publication Acknowledgements:
WL acknowledge support from National Science Foundation (CBET, Grant No. 1935792) and National Institute of Health (IMAT, Grant No. 1R21CA240185-01).