Zing Forum

Reading

HemoLens: A Non-Invasive Hemoglobin Detection System Based on Ocular Images

HemoLens is an innovative healthcare application that uses machine learning and computer vision technologies to achieve non-invasive estimation of hemoglobin levels by analyzing ocular images. The system adopts a FastAPI backend and React Native mobile application architecture, providing a convenient digital solution for anemia screening.

无创检测血红蛋白机器学习计算机视觉贫血筛查移动健康FastAPIReact Native医疗AI数字健康
Published 2026-05-20 13:45Recent activity 2026-05-20 13:53Estimated read 9 min
HemoLens: A Non-Invasive Hemoglobin Detection System Based on Ocular Images
1

Section 01

【Introduction】HemoLens: Core Introduction to the Non-Invasive Hemoglobin Detection System Based on Ocular Images

HemoLens is an innovative healthcare application. Addressing the practical challenges of global anemia detection (traditional testing requires blood sampling, has infection risks, is costly, and is difficult to popularize in resource-poor areas), it uses machine learning and computer vision technologies to achieve non-invasive estimation of hemoglobin levels by analyzing ocular images. The system adopts a FastAPI backend and React Native mobile application architecture, providing a convenient digital solution for anemia screening.

2

Section 02

Practical Challenges and Needs of Anemia Detection

Anemia is the most common nutritional deficiency globally, affecting over 2 billion people. Traditional hemoglobin testing requires collecting venous blood or fingertip blood, which has problems such as pain and inconvenience, infection risks, need for professional operation, and high cost. Regular testing in resource-poor areas is even more difficult to implement. Therefore, developing non-invasive, convenient, and low-cost detection methods has important clinical value and social significance.

3

Section 03

Technical Principles: Correlation Between Ocular Conjunctiva and Hemoglobin & Multimodal Feature Extraction

Correlation Between Ocular Conjunctiva and Hemoglobin

The human conjunctival tissue is rich in capillaries, and the depth of its color is closely related to hemoglobin concentration: when hemoglobin decreases, the conjunctiva becomes pale; when normal, it is pink, providing a theoretical basis for non-invasive detection.

Multimodal Feature Extraction

The system extracts 46-dimensional features from ocular images, including:

  • Color space features: Pixel distributions in multiple spaces such as RGB, LAB, HSV, YCrCb to improve robustness;
  • Statistical features: Mean, variance, skewness, kurtosis, etc., describing the overall characteristics of color distribution;
  • Edge and texture features: Vascular morphology information;
  • Contrast and histogram features: Local and global color features.
4

Section 04

System Architecture: FastAPI Backend and React Native Frontend Design

Adopts a front-end and back-end separation architecture:

FastAPI Backend Service

Core modules:

  • app.py: Main application, defining API routes and business logic;
  • eye_detector.py: Ocular detection and health classification;
  • feature_extraction.py: 46-dimensional feature calculation;
  • preprocessing.py: Image preprocessing (denoising, normalization, etc.);
  • models/: Stores trained machine learning models (in .pkl format).

React Native Mobile Application

The front-end is developed with React Native + Expo, supporting dual platforms:

  • App.js: Main entry, managing navigation and global state;
  • RealtimeCamera.js: Real-time camera component (photo taking, preview, cropping);
  • config.js: Configures parameters such as API address. Users can quickly get results by simply taking a photo.
5

Section 05

Machine Learning Model Selection and Performance Metrics

Algorithm Selection: Ridge Regression

Ridge regression (an extension of linear regression with L2 regularization to prevent overfitting) is adopted. Advantages: Fast training, small model size, strong interpretability, suitable for mobile scenarios.

Performance Metrics

Test set performance:

  • R² = 0.6267 (explains about 62.67% of hemoglobin variation);
  • MAE = 0.96 g/dL (meets the accuracy requirements for anemia screening).

Health Status Classification

Classified into four categories based on hemoglobin range (basically consistent with WHO standards):

Status Range (g/dL)
Low <12.0
Borderline 12.0-13.5
Normal 13.5-17.5
High >17.5
6

Section 06

Multimodal Detection Expansion: Fusion of Ocular + Nail + Palm Images

The system supports multimodal fusion detection of nail and palm images (the color of nail beds and palm skin capillaries also reflects hemoglobin levels), which can improve accuracy. API design supports flexible input:

  • /predict: Prediction with a single ocular image;
  • /predict/multimodal: Combined prediction with ocular + nail + palm images;
  • /predict/batch: Batch prediction with ocular images.
7

Section 07

Application Prospects and Clinical Value: Popularization of Anemia Screening and Digital Health

Popularization of Anemia Screening

Popularize professional screening tools to ordinary users; remote areas can perform self-screening via mobile phones, which is especially beneficial for high-risk groups such as pregnant women, children, and the elderly.

Auxiliary for Chronic Disease Management

As a supplement to traditional testing, it helps patients with chronic kidney disease and gastrointestinal bleeding to monitor long-term and adjust treatment plans in time.

Digital Health Trend

It represents a trend in the medical field: integrating professional testing into consumer-grade devices using computer vision and machine learning, and is expected to expand to monitoring indicators such as blood glucose and blood pressure in the future.

8

Section 08

Limitations and Future Improvement Directions

Current Limitations

  • The model's R² is about 0.63, 37% of the variation cannot be explained, and accuracy needs to be improved;
  • Sensitive to lighting, shooting angle, and ocular state, requiring users to follow shooting specifications;
  • Only suitable for screening and cannot completely replace clinical blood testing.

Improvement Directions

  • Introduce deep learning models (such as CNN) to capture complex features;
  • Expand the training dataset (more samples of different ages, races, and health conditions);
  • Optimize mobile algorithms to implement offline inference and protect privacy;
  • Develop health management functions (personalized nutrition advice, medical guidance).