Computer vision for liquid samples in hospitals and medical labs using hierarchical image segmentation and relations prediction

Sagi Eppel, Haoping Xu, Alán Aspuru-GuzikarXiv 2021

Introduction

Medical laboratories are under increasing pressure to scale testing volumes while minimizing the manual workload of clinical staff. While robotics offers a solution for many laboratory tasks, the visual perception of fluids remains a significant challenge. Traditional computer vision techniques, such as simple edge detection for liquid level sensing, often fail in the complex environments of real hospitals. Transparent containers introduce reflections, liquids may be opaque or foamy, and vessels are frequently nested—such as a syringe inserted into a vial.

This research addresses these challenges by proposing a framework for hierarchical scene understanding. The goal is to identify not only the containers and their contents but also the structural and physical relationships between them, such as whether a pipette is inside a test tube or if an IV bag is physically linked to a drip chamber.

Hierarchical segmentation and relationship prediction for IV bags and vials, demonstrating the 'linked' property and part-based decomposition.

Methodology

The authors developed a modular, three-part neural network architecture designed to mimic human visual analysis of laboratory scenes:

  1. Vessel Detection (Net 1): Utilizing a Mask R-CNN, this stage identifies and segments individual containers (vessels), including tubes, syringes, and IV bags.
  2. Content Segmentation (Net 2): This "cascading" network operates on the vessel masks generated by Net 1. By focusing exclusively on the interior of a detected vessel, the model identifies materials (e.g., blood, urine, gel) and parts (e.g., corks, labels). This hierarchical approach ensures that if a pipette containing blood is inside a tube, the blood is correctly attributed to the pipette rather than the tube.
  3. Relationship Prediction (Net 3): A modified ResNet analyzes pairs of vessels to classify their connectivity. It predicts three non-exclusive relationship classes: inside, contain, or linked (indicating a physical connection allowing fluid transfer).

Dataset: LabPics Medical

The study introduces LabPics Medical, a novel dataset comprising 1,300 annotated images from clinical and laboratory settings. The dataset includes instance and semantic segmentation for various material phases (liquid, solid, foam, suspension), specific liquid types (blood, urine), and vessel properties. To bolster training, the authors supplemented this data with 6,500 images from the LabPics Chemistry dataset.

Semantic segmentation examples showing the identification of vessels (tubes, cups), parts (corks), and materials (blood, liquid).

Results and Discussion

The hierarchical approach demonstrated clear advantages over standard full-image segmentation. For "filled" vessels, the Mean Intersection over Union (mIOU) reached 0.65 with the hierarchical method, compared to 0.59 for a standard Fully Convolutional Network (FCN).

Key performance metrics include:

  • Relationship Accuracy: The relationship network achieved 95% precision for identifying "linked" vessels and 99% accuracy in identifying the absence of a relationship.
  • Material Detection: The system performed reliably on common materials like liquids and suspensions. However, it encountered difficulties with foam, which often appears in thin, sparse bands, and rare classes such as gel.

A critical insight of this work is the value of modularity. By decoupling vessel detection from content analysis, the system allows for flexible updates to specific components without requiring a full retrain. Furthermore, the ability to predict "linked" status is vital for robotic manipulation, as it informs the robot of physical connections necessary for fluid transfer.

Conclusion

While the current framework provides a robust foundation for automated fluid handling, the primary limitation remains the dataset size. The relatively small number of images led to lower classification accuracy for rarer vessel types and materials. Future research will focus on expanding the LabPics Medical dataset and refining models to handle more diverse lighting conditions and increasingly complex nested hierarchies in clinical environments.

Summary updated

BibTeX
@misc{eppel2021computer,
  author = {Sagi Eppel and Haoping Xu and Alán Aspuru-Guzik},
  title = {{Computer vision for liquid samples in hospitals and medical labs using hierarchical image segmentation and relations prediction}},
  year = {2021},
  eprint = {2105.01456},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2105.01456},
}
Figure