π hCG Test Strip Detection and Analysis using YOLOv8 and XGBoost
This project provides a comprehensive solution for automated pregnancy test strip analysis using YOLOv8 for object detection and XGBoost for hCG concentration prediction via image-based colorimetry.
Developed as part of an M.Tech thesis at IIT Delhi, the system performs both qualitative and quantitative analysis of hCG test strips captured via a smartphone or imaging system.
π Features
π YOLOv8 Object Detection: Detects Region of Interest (ROI), Control Line (C), and Test Line (T) π§ͺ Qualitative Analysis: Generates intensity profiles from test strip lines π Quantitative Analysis: Predicts hCG concentration in mIU/mL using trained XGBoost model π§ AI-Powered: Utilizes deep learning and machine learning for fast, accurate analysis π» Streamlit GUI: User-friendly interface for real-time image upload and testing ποΈ Project Structure image
π§ Installation Instructions
Clone the Repository
(Optional) Create Virtual Environment python -m venv venv source venv/bin/activate # On macOS/Linux venv\Scripts\activate # On Windows
Install Dependencies pip install -r requirements.txt βΆοΈ Running the App Launch the Streamlit app: streamlit run test.py Visit http://localhost:8501 in your browser to use the GUI.
π§ Model Summary
YOLOv8 (Ultralytics) Detects: ROI (Test strip area) Control Line (C) Test Line (T)
XGBoost Regressor Input: Extracted color space features (RGB, HSV, LAB) from cropped C and T lines Output: hCG concentration in mIU/mL
Trained on labeled dataset using manual annotations and lab-calibrated values
π Modes of Operation
β Qualitative Analysis Extracts and plots intensity values across C and T lines. Used for visual validation and line strength analysis.
π Quantitative Analysis Predicts actual hCG concentration using a trained machine learning model. Interprets result: Positive if concentration > threshold Negative if below threshold Invalid if C-line is missing
πΌοΈ Sample Output Screenshot 2025-03-05 152532 Screenshot 2025-04-16 170102 Screenshot 2025-03-05 152551
Streamlit link for app: https://hcgdetectionapp-jjss2yoggzzurpwnbuoh9w.streamlit.app/
π§βπ» Author
Akash Verma M.Tech, Instrument Technology (SeNSE), IIT Delhi π https://www.linkedin.com/in/akash-verma-525a88145/ π» https://github.com/Akashhverma
π License This project is licensed under the MIT License.