Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🦐 Trematode Scanner

Python FastAPI YOLO License

AI-powered parasite detection tool for Petri dish analysis.

🎯 Problem

Biologists spend hours visually scanning Petri dishes with fish/sea urchin samples to detect trematode parasites (metacercariae). This is tedious, time-consuming, and leads to eye fatigue and missed detections.

💡 Solution

Trematode Scanner is a web application that uses computer vision (OpenCV + YOLOv8) to automatically detect suspicious circular objects in Petri dish images. It highlights potential parasites with green bounding boxes, significantly reducing manual screening time.

✨ Features

  • 📸 Upload photos of Petri dishes (drag & drop support)
  • 🧠 AI-powered detection of circular parasitic objects
  • 🟩 Visual highlighting with bounding boxes
  • 📊 Real-time detection count
  • 🔄 Clean and intuitive user interface
  • 🚀 FastAPI backend with async processing

🛠️ Tech Stack

Backend

  • FastAPI — Modern Python web framework
  • OpenCV — Image processing and contour detection
  • Ultralytics YOLOv8 — Object detection (ready for custom training)
  • Python 3.12

Frontend

  • HTML5 / CSS3 — Clean, responsive interface
  • Vanilla JavaScript — No frameworks needed
  • REST API — Communication with backend

🚀 Quick Start

Prerequisites

  • Python 3.12 or higher
  • pip (Python package manager)

Installation

  1. Clone the repository:
git clone https://github.com/yourusername/trematode-scanner.git
cd trematode-scanner
  1. Create and activate virtual environment:
cd backend
python -m venv venv

# On Windows:
venv\Scripts\activate
# On Mac/Linux:
source venv/bin/activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Run the backend server:
uvicorn app:app --reload --host 0.0.0.0 --port 8000
  1. Run the frontend (in a new terminal):
cd ../frontend
python -m http.server 5500
  1. Open your browser at http://localhost:5500

🧪 How It Works

  1. Upload: Biologist uploads a photo of a Petri dish
  2. Detection: Backend processes the image using:
    • Adaptive thresholding to find dark regions
    • Contour detection to identify circular objects
    • Circularity filtering (0.7 < circularity < 1.3)
    • Size filtering (50 < area < 2000 pixels)
  3. Visualization: Results are returned with green bounding boxes
  4. Reporting: Detection count is displayed instantly

📊 Example

Input Output
Input Output

🔮 Future Improvements

  • Train YOLOv8 on real trematode datasets
  • Add SQLite database for analysis history
  • Export results to CSV/Excel
  • Support for microscope image formats (.tiff, .czi)
  • Batch processing for multiple images
  • User authentication and result sharing

🤝 Contributing

This is a proof-of-concept project. Contributions are welcome!

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • Built for researchers working on trematode detection
  • Inspired by real-world needs in parasitology labs

Project Link: https://github.com/bat801/trematode-scanner

About

AI-powered tool for detecting trematode parasites in Petri dish images using OpenCV and YOLOv8. Built for biology researchers to reduce manual screening time.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages