Q3 Technologies developed an open source solution for the tracking of livestock and identifying any anomalous behavior based on historic trends for them to take near real-time attention by providing medical treatment to the cattle in the form of medicines and equipments.

Client Background

One of the world’s largest and fastest-growing dairy company was interested in an open source solution for tracking of their livestock and identifying and anomalous behavior based on historic trend for them to take near real-time attention by providing treatment to cattle in the form of medicines, equipments and care. The other motive was to identify the cattle in Heat period for optimizing their milk production.

Industry Landscape

The dairy farming industry is growing with the increase in food demands. As a consequence, attention has been shifted from cattle yield to an automation solution that can assist farmers to detect whether cattle are in heat (to exploit fertility) and other information such as cattle mobility, eating and standing/laying patterns for livestock welfare.


In the absence of any RFID / pedometer and working only with live camera feeds to merge the different feeds of multiple cameras in the farm to create a single video and hence create one view for the whole farm. This involved remove of Fisher Eye effect from feed, merging the multiple feeds and applying perspective transformation to enhance the input.


The enhanced frames were passed to the detection / classification algorithm applying Deep Convolutional Neural Network with TensorFlow implementation with GPU support. The Tracking algorithm was applied on the classified label for each cattle in the Region of Interest (ROI).

The animals were tracked using the Multi-track tracking algorithm using Python libraries and coordinates of the animal were stored in a predefined JSON format in near real time. The CNN model refines the detection output by passing it through multiple layers and reducing the loss function each time, thus providing very good accuracy for uniquely identifying a cattle from another object in the background.

One of the output of the CNN is as shown in the figure below.

The key features of the solution were:

  • Collect and update activity and behavior data all the time
  • Indicate decrease in activity (lame or sick cows)
  • Record history of heat patterns throughout cow’s entire life

Business Impact

Cattle movement is easily tracked
Cattle feeds visible from multiple cameras
Cattle surveillance becomes easy
Cattle traversed distance can be estimated
Health status of cattle is improved
Cattle heat patterns are recorded