Managing mastitis with thermal imaging

Swedish researchers have developed a thermal imaging system that enables farmers to detect Mastitis in dairy cattle.

1606vsdprofile Figure 1

Swedish researchers have developed a thermal imaging system that enables farmers to detect Mastitis in dairy cattle.

Ellinor Eineren, CEO, Agricam

One critical problem facing today's dairy farmers is a disease called Mastitis, a potentially fatal mammary gland infection that causes inflammation in the udders of dairy cattle. If diagnosed in an early stage, the infected cow can usually be milked more often to ensure that there is little to no milk left in the udder for the bacteria that cause the infection to replicate. This allows the animal's natural defense system to eliminate the bacteria before the Mastitis becomes clinical.

With traditional milking methods, diagnosing Mastitis was relatively easy. The disease could be identified by the farmer by manually detecting a rise in temperature in the udder caused by increased blood flow - a common sign of inflammation. However, over the past several decades, automatic milking systems have been deployed in many dairy farms to make them more efficient and profitable. Although the machines have enabled dairy farmers to eliminate the manual labor required in the milking process, farmers are now no longer able to detect the increased temperature of the udders that would warn of any symptoms.

This is an issue for the milking industry. Mastitis causes pain and general discomfort for the animal and it has to be treated with antibiotics. Due to strict European rules, all of the milk from infected dairy cattle has to be discarded until all of the antibiotic drug residues have left the animal's system. On Eco-farms, the treatment time takes twice as long, which means that double the milk has to be disposed of compared to conventional dairy farms.

Thermal imaging

Now, a patented thermal imaging system called CaDDi (Cattle Disease Diagnostics) Mastitis has been developed by engineers at Agricam (Linköping, Sweden; that can measure and analyze the temperature of the udder of the cattle, detecting the symptoms of Mastitis two or three days before any clinical symptoms appear. This enables farmers to treat the inflammation naturally - without using expensive and regulated antibiotics.

To test the feasibility of such a system, Agricam initially cooperated with the Linköping-based FLIR products distributor Termisk Systemteknik (Linköping, Sweden; to determine whether thermal imaging cameras could detect the disease. To do so, the Agricam team manually recorded thermal images of cow udders with a P660 thermal imaging camera from FLIR (Wilsonville, OR, USA; and analyzed the resulting thermal images in cooperation with veterinarians from the Swedish National Veterinary Institute (Uppsala, Sweden;

Having proved that the thermal cameras could detect a temperature rise indicative of the disease, the next step was to build a system that could capture images and process them automatically. But this was complicated due to the fact that not every warm area in the thermal image of the udder indicates an inflammation. Animals' body temperatures fluctuate naturally, and there are also many subtle differences between the thermal patterns of individual animals.

To address that issue, Agricam engineers set about developing advanced analysis software that could analyze sets of images of the udders of the cattle that were captured over a period of time to confirm whether they had contracted the disease.

In use, the system first identifies each one of the dairy cattle using an RFID reader such as those from Allflex (DFW Airport, TX, USA; which capture a unique identification number for the animal from an ear tag as the animal enters a milking parlor down a walkway. Two FLIR 320 x 240 A300 thermal imaging cameras and an NETD of 50mK - positioned on either side of the walkway - then capture an image of both sides of the udder of the animals (Figure 1) at a frame rate of three images per second.

1606vsdprofile Figure 1
Figure 1: Agricam has developed a system called CaDDi Mastitis that deploys two thermal imaging cameras to capture images of the udders of dairy cattle. Those images are then transferred to a PC where custom built analysis software determines if the temperature of the udder is abnormal - a sign that the cattle may be infected with mastitis.

To protect the FLIR A300 cameras against the adverse conditions in a dairy farm, the cameras are mounted in a waterproof housing with automatic window cleaning system. The housing cleaning mechanism is also patented and can be used in other exposed environments.

Although the thermal imaging cameras continuously acquire images, only a specific set of images captured a few seconds before and after the animal's RFID tag has been read are analyzed by the system, ensuring that the udder of the animal will be present in one or more of them. The thermal images of the udder captured during the process - together with the unique identification number of the animal - are relayed to a PC over an Ethernet interface. The PC software then analyzes the temperature of the udder.

To do so, the system first locates the position of the udder in both images using a Decision Forest classification algorithm, which is deployed for its accuracy and its ability to deal with small sample sizes. By capturing images seconds before and after the RFID tag of the animal is read, the software assumes that the approximate location of the udder of the animal will be found in the images. The Decision Forest classification algorithm, which has been trained from previously acquired images of the udders of the cattle, is then be applied to the images to determine the specific location of the udder within those regions.

Once the udders have been located, the software then finds a region of interest in the image around and above the teat of the animal where the inflammation due to Mastitis would occur. The temperatures across that region of the udder are then calculated by analyzing the thermal imaging data acquired by the cameras. To produce accurate results, temperature differences are measured to 0.1° C accuracy.

Temperature differences

Simply comparing the temperature of the udder of one animal with previous temperature measurements from the same animal, however, would not provide an accurate indication of whether an animal was infected with Mastitis. This is because the variation in the temperature of the udder may be caused by other factors, not simply by infection. Seasonal variations in temperature, for example, mean that the udders of all the cattle will be warmer in the summer months than in winter. Furthermore, the temperature of the cattle will also vary due to changes that occur in the animals as they progress through different stages of lactation.

To accommodate these differences, the individual temperature of the udder of one animal is compared to temperatures from the same animal at specific milking periods during the day and to groups in the entire herd that are in similar phases of lactation. In doing so, the software reduces the risk of generating false alarms.

Once deployed on a dairy farm, a database of thermal images is created for each of the cattle. Using that database, the CaDDi software can then determine the normal thermal patterns associated with the udders of each individual animal. By comparing each new reading to the previously recorded data, the system software can then accurately detect the type of thermal anomalies that indicate Mastitis.

The results of the thermal analysis for each of the cattle are presented to the user on a graphical user interface (Figure 2). The interface displays the results of the thermal analysis for each of the dairy cattle on the farm on a daily basis, highlighting which cattle are free from infection and which may have abnormally high udder temperatures.

1606vsdprofile Figure2b
Figure 2 a and b: The results of the thermal analysis for each of the cattle are presented to the user on a graphical user interface. The interface displays the results of the thermal analysis for each of the dairy cattle in the farm on a daily basis, highlighting which cattle are free from infection and which may have abnormally high udder temperatures due to mastitis.

If the temperature of the udder of the animal is too high, the system displays the date when the temperature exceeded its expected value in red. If the temperature reaches a critical point where treatment is required, the date is displayed in blue. The system also sends an alarm to an indicator at the milking station to enable the farmer to take the appropriate action to treat the infected animal.

The CaDDi Mastitis software enables the farmer to view the temperature of the entire herd with respect to the temperature of an individual animal by displaying how the temperature of the herd and the individual have deviated from an expected value during specific days. This allows the user to immediately visualize any critical differences between the two that would indicate that an animal may be sick. If the animal is sick, she is then automatically placed on a list with others that also require treatment.

The user interface also enables the farmer to flag those cattle that are undergoing treatment for Mastitis with antibiotics, enabling the progress of the cattle undergoing that treatment to be monitored. By logging the data, the farmer can review which cattle are most susceptible to the disease over several years.

Increased yields

To date, the system - which can be used in all types of milking parlors and is universally suited to any sort of robot, carousel or herringbone parlors (Figure 3) - has been installed on ten farms in Sweden where it has been proven to reduce production losses.

1606vsdprofile Figure3a
1606vsdprofile Figure3b
1606vsdprofile Figure3c
Figure 3a, b and c: The CaDDi Mastitis system can be deployed in different configurations of robot, carousel or herringbone milking parlors.

To document its success, Agricam collects data on the number of clinical Mastitis cases that have occurred on the farms each month, and compares the number with previous years to determine if incidents of Mastitis have decreased. The results from the analysis have been highly encouraging. The deployment of the system has reduced cases of the disease by between 40-60%, the highest percentage increase recorded by any alternative health management system.

The system has also reduced the amount of antibiotics used to treat cattle infected with Mastitis by up to 85%, decreased the somatic cell count in the milk from the cattle - a main indicator of quality that determines how much farmers are financially rewarded for their milk - and increased milk production by 6-10%. A video of the system can be viewed at:

Ellinor Eineren, CEO, Agricam (Linköping, Sweden;

Companies mentioned

Linköping, Sweden

Allflex USA
DFW Airport, TX, USA

Wilsonville, OR, USA

Swedish National Veterinary Institute
Uppsala, Sweden

Termisk Systemteknik
Linköping, Sweden

More in Boards & Software