On large dairy farms with 1000+ head, the veterinarian cannot inspect every cow daily. Losing one day with mastitis means a 10-15% drop in milk yield, while missed insemination results in empty days and significant losses. We develop turnkey AI systems: we fuse data from ear sensors, rumen boluses, milk meters, and video, issuing alerts 24-48 hours before clinical signs. Our experience — 10+ projects in Russia and CIS, average mortality reduction of 15-20%. Automatic heat detection is 2 times more efficient than visual observation: accuracy reaches 95% vs 60%. We use machine learning for behavioral analysis of cattle and IoT devices for data collection.
What problems does AI monitoring solve?
Three key tasks the system addresses:
-
Missed heat — each heat lasts 12-18 hours, visually detected only 60% of the time. The system analyzes activity and rumination at 2-minute intervals and issues an alert 4-6 hours before the insemination window closes.
-
Subclinical mastitis — milk conductivity increases 24-48 hours before clots appear. Sensitivity 85% at specificity 90%.
-
SARA (subacute ruminal acidosis) — rumen pH drops below 5.8 for 3+ hours, reducing productivity by 15%. Time series analysis from rumen bolus detects risk 1-2 days in advance.
How to detect heat with 95% accuracy?
Algorithm based on activity and rumination:
import pandas as pd
import numpy as np
from scipy.signal import find_peaks
def detect_estrus(animal_id: str, sensor_data: pd.DataFrame,
baseline_days: int = 21) -> dict:
"""
Heat in cattle: sharp increase in activity + decrease in rumination
Cycle ~21 days — periodic pattern
"""
recent = sensor_data[sensor_data['animal_id'] == animal_id].tail(baseline_days * 24)
activity_baseline = recent['activity_count'].quantile(0.5)
rumination_baseline = recent['rumination_time'].quantile(0.5)
current_24h = sensor_data[
sensor_data['animal_id'] == animal_id
].tail(12)
activity_ratio = current_24h['activity_count'].mean() / (activity_baseline + 1e-9)
rumination_ratio = current_24h['rumination_time'].mean() / (rumination_baseline + 1e-9)
estrus_score = activity_ratio * (2 - rumination_ratio)
prev_cycle_score = check_previous_cycle(animal_id, sensor_data, days_back=21)
return {
'animal_id': animal_id,
'estrus_score': float(estrus_score),
'estrus_detected': estrus_score > 2.5,
'confidence': 'high' if prev_cycle_score > 2.0 else 'medium',
'recommended_action': 'insemination_window_12-18h' if estrus_score > 2.5 else None
}
Why is rumination a key health indicator?
Early mastitis detection:
def mastitis_risk_score(milking_data: pd.DataFrame, animal_id: str) -> float:
"""
Mastitis → inflammation → increase in Na+, Cl- ions → increase in conductivity
"""
today_milking = milking_data[
(milking_data['animal_id'] == animal_id) &
(milking_data['date'] == milking_data['date'].max())
]
if today_milking.empty:
return 0.0
quarters = ['LF', 'RF', 'LR', 'RR']
conductivities = {q: today_milking[f'conductivity_{q}'].mean()
for q in quarters if f'conductivity_{q}' in today_milking.columns}
if len(conductivities) < 2:
return 0.0
mean_cond = np.mean(list(conductivities.values()))
max_deviation = max(abs(v - mean_cond) for v in conductivities.values())
relative_deviation = max_deviation / (mean_cond + 1e-9)
yield_deviation = check_yield_drop(animal_id, milking_data, today_milking)
risk_score = 0.6 * (relative_deviation / 0.1) + 0.4 * yield_deviation
return min(1.0, risk_score)
Additional mastitis signs: increased milk temperature in the quarter (+0.5°C), flocculation, reduced yield, behavioral changes.
How to set up mastitis detection step by step?
- Collect baseline data: at least 500 milkings without pathology for each cow.
- Compute baseline conductivity for each quarter considering lactation stage.
- Set thresholds: sensitivity 85% at specificity 90%.
- Validate on historical data: at least 50 confirmed mastitis cases.
- A/B test on 10% of herd before full deployment.
What does SARA monitoring provide?
Subacute ruminal acidosis (SARA) — pH < 5.8 for more than 3 hours:
def detect_sara_risk(rumen_bolus_data: pd.DataFrame, animal_id: str) -> dict:
"""
Data from rumen bolus SmaXtec updates every 10 minutes
"""
today_data = rumen_bolus_data[
(rumen_bolus_data['animal_id'] == animal_id) &
(rumen_bolus_data['date'] == pd.Timestamp.today().date())
]
low_ph_minutes = len(today_data[today_data['rumen_pH'] < 5.8]) * 10
avg_ph = today_data['rumen_pH'].mean() if not today_data.empty else 6.5
rumination_today = today_data['rumen_motility'].mean() if not today_data.empty else 1.0
sara_risk = 'high' if low_ph_minutes > 180 else (
'medium' if low_ph_minutes > 60 else 'low'
)
return {
'animal_id': animal_id,
'low_ph_hours': round(low_ph_minutes / 60, 1),
'avg_ph': round(avg_ph, 2),
'sara_risk': sara_risk,
'action': 'adjust_roughage_ratio' if sara_risk == 'high' else None
}
SARA monitoring enables precision feeding: when risk is detected, the system recommends adjusting the roughage ratio. Implementation reduces veterinary costs and increases herd productivity.
How to integrate the system with existing software?
We support REST API for sending events to DairyComp 305, Lely T4C, DeLaval ALPRO, and herd monitoring software. Integration takes 1-2 days. Real-time data transmission: heat events, disease risks, weight indicators.
How we implement the system: a case study
On a farm with 2000 heads of cattle, we installed SCR ear accelerometers and SmaXtec rumen boluses. In the first week, we collected ~1.5 million activity records and 200,000 pH measurements. After 3 weeks, models reached 92% sensitivity for heat and 90% for SARA. Compare: visual method gives 60% heat detection, manual pH analysis — single measurements. Automation reduced veterinary service costs by 1.5 times.
How we solved the sensor drift problem?
During calibration, we encountered sensor drift: after 3 months of operation, some accelerometers started overestimating activity. Solution — automatic recalibration every 2 weeks based on group averages. This improved mastitis detection stability from 82% to 90%.| Method | Heat detection accuracy | Time spent |
|---|---|---|
| Visual observation | 60-70% | 2-3 hours/day |
| Accelerometer + AI | 95% | 5 minutes/day |
| Sensor combination | 98% | 2-3 minutes/day |
Project stages and timelines
| Stage | Duration | What is included |
|---|---|---|
| Analysis and design | 5–7 days | Farm audit, sensor selection, ML pipeline architecture |
| Sensor integration | 1–2 weeks | Gateway setup, baseline data collection, calibration |
| Model development | 2–4 weeks | Heat, mastitis, SARA detection — baseline + fine-tuning |
| Dashboard and alerts | 1–2 weeks | Web interface, Telegram bot, export to DairyComp |
| Testing and deployment | 1 week | A/B test on 10% of herd, latency optimization |
What is included in the work
- Architecture documentation and API description
- Personnel training (2 days on-site or online)
- 30 days of post-release technical support
- Model warranty — 6 months (free updates when herd changes)
- Adaptation to existing infrastructure (DairyComp 305, Lely T4C, DeLaval ALPRO)
Leave a request — we will assess your farm in 2 days and propose an architecture. Contact us to discuss the project. Get a consultation on your herd and learn how AI monitoring can reduce mortality and increase milk yields.







