Deep Learning · Computer Vision

Vision Systems for
Agricultural AI

Two YOLO-based computer vision projects — detecting nutrient deficiencies in coffee leaves and monitoring livestock behavior from camera feeds.

Framework
YOLOv5
Tools
Roboflow · OpenCV · Colab
Projects
2 (1 published · 1 ongoing)
🏆

UIUC AI Foundry Hackathon 2025

Agriculture Track · University of Illinois Urbana-Champaign · Certified

Project Overview
Coffee Leaf Nutrient Detection

This project trained a YOLOv5 object detection model to identify nutrient deficiencies in coffee crop leaves from field photographs. Given that visual symptoms of nitrogen, phosphorus, and potassium deficiency overlap significantly, the model needed to distinguish subtle spectral and morphological differences between classes.

The project was built during the UIUC AI Foundry Agriculture Track, combining agronomic domain knowledge with computer vision techniques to create a field-deployable detection tool.

✓ Completed
Detection Classes
What the Model Detects
🟡
Nitrogen (N)
Yellowing of older leaves (chlorosis), reduced leaf size, pale green color progressing upward
🟣
Phosphorus (P)
Purple/reddish discoloration on leaf undersides, dark green with anthocyanin buildup
🟤
Potassium (K)
Brown scorching at leaf margins and tips, necrosis progressing inward from edges
Methodology
Training Pipeline
01
Dataset Collection
Sourced field images of deficient coffee leaves
Image dataset
02
Annotation — Roboflow
Bounding box annotation per deficiency class
3 classes · YOLO format
03
Data Augmentation
Flip, rotate, brightness/contrast variation, mosaic
Roboflow pipeline
04
YOLOv5 Training
Transfer learning from pre-trained COCO weights
Google Colab · GPU
05
Evaluation & Export
mAP, precision, recall evaluation. Model export
ONNX / PyTorch
Code
Training Snippet
Python
# Train YOLOv5 on coffee leaf deficiency dataset
# After cloning ultralytics/yolov5 and setting up Roboflow export

import subprocess

subprocess.run([
    'python', 'train.py',
    '--img', '640',
    '--batch', '16',
    '--epochs', '50',
    '--data', 'coffee-deficiency/data.yaml',
    '--weights', 'yolov5s.pt',  # pretrained COCO weights
    '--name', 'coffee_npk_v1',
    '--cache'
])

# Classes: ['N_deficiency', 'P_deficiency', 'K_deficiency']
# Annotated using Roboflow with bounding boxes
Sample Outputs
Detection Visuals

Sample images showing the model's bounding box detections on coffee leaves — each box labeled with deficiency class and confidence score.

📷 Detection Output — Nitrogen [ Add screenshot from Colab results ]
📷 Detection Output — Potassium [ Add screenshot from Colab results ]
YOLOv5 Roboflow OpenCV Google Colab PyTorch Python
Project Overview
Livestock Monitoring System

An ongoing computer vision research project applying YOLO-based object detection and pose estimation to monitor cattle in farm environments. The system detects individual cows, tracks their movement, and classifies feeding behavior — enabling automated livestock health and productivity monitoring.

The system uses a multi-module approach: cow face detection for individual identification, body keypoint estimation for posture analysis, and a feeder classification module currently in development.

⟳ Ongoing Research
System Modules
Detection Components
🐄
Cow Detection
YOLOv5 bounding box detection for cattle presence and counting in frame
👁️
Face ID Module
Cow face detection for individual animal identification across camera frames
🦴
Pose Estimation
Body keypoint detection for posture and behavior classification (standing, lying, feeding)
Architecture
System Pipeline
01
Video Input
Farm camera feed or recorded video
OpenCV capture
02
Cattle Detection
YOLOv5 bounding boxes around individual animals
Per-frame inference
03
Face Detection
Crop ROI → run face detection sub-model
Individual ID
04
Pose Keypoints
Skeleton estimation for behavior classification
YOLO-Pose
05
Feeder Classification
Detect feeding events at trough — in development
⟳ In development
Sample Outputs
Detection Frames
📷 Cattle Detection Output [ Add detection screenshot here ]
📷 Pose Estimation Output [ Add keypoint visualization here ]
Applications
Why This Matters

Manual livestock monitoring is labor-intensive and misses early signs of illness or distress. An automated vision system can flag abnormal behaviors — prolonged lying, reduced feeding activity, unusual postures — that often precede health decline, enabling early veterinary intervention at scale.

In Nepal's hill farming context, where herds are often managed by small families, even a simple camera + Raspberry Pi deployment could meaningfully reduce livestock losses. This project explores the feasibility of that kind of low-cost precision livestock farming.

YOLOv5 YOLO-Pose OpenCV Python Google Colab PyTorch
← Pratik Ghimire
Crop Yield Prediction → Rice Transplanter →