ML & Computer VisionCompleted2025

Sweet Pepper Segmentation & Classification

Multi-algorithm ML pipeline for pepper detection comparing LogReg, KNN, SVM, GMM, and Gradient Boosting approaches.

Sweet Pepper Segmentation & Classification

Gallery

Problem

Automated detection and classification of sweet peppers in images requires robust segmentation that handles varying lighting, occlusion, and color variations (red vs yellow peppers).

Approach

Implemented and compared multiple ML approaches: custom logistic regression with gradient descent, KNN (k=3), SVM with RBF kernel and grid search, Gaussian Mixture Models, and Histogram Gradient Boosting with PCA. Evaluated different color spaces (RGB, LAB, HSV) and feature extractors (LBP texture features).

Data

Sweet pepper images with pixel-level ground truth masks for training and validation.

Validation

Precision-recall curves, F1 scores, and visual segmentation quality assessment. LAB color space consistently outperformed RGB for segmentation tasks.

Results

Best segmentation: KNN with LAB features (fast training, high precision). Best classification: SVM with HSV+LBP features. Modular codebase with reusable utility libraries.

My Role

Sole developer. Implemented all algorithms, ran hyperparameter optimization, wrote evaluation framework.

Next Steps

Deep learning comparison (U-Net); real-time inference optimization; extend to other crop species.

Key Outcomes

  • 6 ML algorithm implementations
  • Systematic color space comparison
  • Reusable ML utility libraries

Tech Stack

Pythonscikit-learnscikit-imageNumPyMatplotlib

Tags

segmentationclassificationphenotypingpython

Interactive Pipeline Comparison

Original Image

Original pepper plant image

Segmentation Mask (Logistic Regression)

Logistic Regression segmentation mask

Performance Metrics

LAB

Accuracy

99.08%

F1-Score

94.90%

Precision

95.50%

Recall

94.30%

Precision-Recall Curve

Logistic Regression Precision-Recall curve

Key Insight

Fast baseline achieving 95% F1-Score with simple linear decision boundaries in perceptually-uniform LAB space.