๐ŸŽ S24 Farms Apple Detection Model

YOLOv8n ู„ู€ ูƒุดู ุงู„ุชูุงุญ ูˆุชู‚ุฏูŠุฑ ุงู„ู…ุญุตูˆู„ โ€” Apple detection and yield estimation

Usage

from ultralytics import YOLO

# Load model directly from Hugging Face Hub
model = YOLO("s24-farms/apple-detector/best.pt")

# Detect apples in image
results = model("orchard.jpg", conf=0.25, iou=0.45)
for r in results:
    print(f"Detected {{len(r.boxes)}} apples")

Model Details

Property Value
Architecture YOLOv8n (nano)
Input size 640ร—640
Confidence threshold 0.25
NMS IoU 0.45
Training images 200 synthetic + 3000 augmented
Classes 1 (apple)

Detection Pipeline

  1. YOLOv8n โ€” Primary detector (fast, ~0.2s per image on CPU)
  2. OpenCV Color Blob โ€” Fallback for red/yellow apples
  3. Watershed Segmentation โ€” Separates touching apples
  4. Hough Circles โ€” Detects round shapes with apple-like color

Features per Apple

  • Bounding box with confidence score
  • Estimated diameter (mm) with range (ยฑ5mm)
  • Estimated weight (g) with range (ยฑ15%)
  • Variety classification (Red/Golden/Granny/Mixed)
  • Disease detection (Scab, Bitter Rot, Sooty Blotch, Sunburn, Powdery Mildew)
  • Size classification (Small/Medium/Large)

Video Tracking (ByteTrack)

from tracker import process_video_file

result = process_video_file("orchard_row.mp4", max_frames=300)
print(f"Unique apples: {{result['summary']['total_unique_apples']}}")

Web API (FastAPI)

pip install -r requirements.txt
python api_fastapi.py 8080
# โ†’ http://localhost:8080/docs

Dataset

The model was trained on 200 synthetic apple images (generated in Unreal Engine) and augmented to 3200 images using Albumentations:

  • Random brightness/contrast (ยฑ30%)
  • HSV shifts (Hยฑ20, Sยฑ30, Vยฑ20)
  • Gaussian/Motion blur
  • CLAHE, GaussNoise, RandomShadow
  • Horizontal flip

Citation

@software{s24_farms_apple_detector,
  author = {{S24 Farms}},
  title = {{S24 Farms Apple Detection}},
  year = {2026},
  url = {https://huggingface.co/s24-farms/apple-detector}
}
Downloads last month
42
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support