Computer vision project for automated sperm cell detection and counting using YOLOv8.
This project uses YOLOv8 to detect and count sperm cells in microscopic images. It can process individual images, batches of images, and videos.
- Trained YOLOv8 models (nano and medium) on sperm cell dataset
- Image detection with counting and density calculation
- Video processing for frame-by-frame analysis
- Batch processing for multiple images
- Training images: 240
- Validation images: 24
- Test images: 11
- Source: Roboflow Sperm Morphology Dataset
- mAP@50: 71.7%
- Precision: 67.3%
- Recall: 68.0%
- Better accuracy with more parameters
- Training visualizations available in
Sperm_counting/yolov8m_improved/
sperm-classification/
├── Full-Sperm-Cell-Detection-6/ # Dataset
│ ├── train/
│ ├── valid/
│ ├── test/
│ └── data.yaml
├── Sperm_counting/ # Training results
│ ├── yolov8n_training/
│ ├── yolov8m_improved/
│ └── yolov8m_improved2/
├── sprem_classification.ipynb # Main notebook
└── output_video.mp4 # Sample output
pip install ultralytics opencv-python numpy pandas matplotlib roboflow jupyterfrom ultralytics import YOLO
model = YOLO('yolov8m.pt')
model.train(
data='./Full-Sperm-Cell-Detection-6/data.yaml',
epochs=50,
imgsz=640,
batch=16
)model = YOLO('./Sperm_counting/yolov8m_improved/weights/best.pt')
results = model.predict('test_image.jpg', save=True)
print(f"Detected: {len(results[0].boxes)} sperm cells")results = model.predict('video.mp4', save=True)- ✅ Sperm cell detection
- ✅ Automatic counting
- ✅ Density calculation
- ✅ Batch processing
- ✅ Video analysis
- ✅ Training visualizations
- YOLOv8 (Ultralytics)
- PyTorch
- OpenCV
- NumPy, Pandas
- Matplotlib
- Jupyter Notebook
- Morphology classification
- Motility tracking
- Web interface
- Mobile app
MIT License
Elsaraf
- GitHub: @Elsaraf1