Using AI technology to detect and evaluate lesions

A smart tool from Hipra can detect, monitor and evaluate pulmonary lesions relating to Enzootic Pneumonia. The smart system can keep score of lesions individually and objectively based on lung and nasal images.

The assessment of pulmonary lesions compatible with Enzootic Pneumonia at the slaughterhouse is one of the techniques of reference for assessing the incidence of this disease in porcine farms and it is the first technique for assessing the effectiveness of vaccines against Mycoplasma hyopneumonia (Mhyo).

Until now, monitoring the degree of pulmonary involvement caused by Mhyo required highly skilled technicians to take care of the pulmonary score at the slaughterhouses. These technicians had to be present at the slaughter line, with the accompanying restrictions, to be able to manually and individually check every single lung and keep the score on paper or on a tablet. The process is undoubtedly slow and time-consuming and, even if carried out by skilled personnel, the disparity of the pulmonary assessments carried out by different technicians reveals this is a subjective process, based on the human factor.

What is AI?

Artificial intelligence (AI) is defined as the ability of a machine to present the same capacities as human beings.

AI allows technological systems to perceive their environment, relate to it, solve problems and work with a specific purpose. The machine receives data (already prepared or collected using its own sensors, for instance, a camera), processes and responds to it.

Monitoring lungs or nasal turbinates is part of the vet’s routine health control of their pig farms. This monitoring work is tedious, complicated and completely subjective, which is why it is a clear candidate for automation using AI technology.

Artificial Intelligence Diagnos (AI Diagnos) is a smart system capable of keeping the score of lesions individually and objectively based on images of lungs and nasal turbinates.

The following article describes the main features of this new service provided by HIPRA.

AI technology is a tool that can help process and identify diseases quickly and efficiently. Photo: Hipra
AI technology is a tool that can help process and identify diseases quickly and efficiently. Photo: Hipra

Operation: Detection and classification

This section explains how the algorithms detect the various parts of an image and how they are classified, considering the two cases developed: Rhinitis and Mycoplasma.

The general detection and classification process is as follows:

  1. Firstly, a “filter” (detector of focus) is applied to the image with the purpose of detecting the pig snout (for Rhinitis) or the lung (for Mycoplasma). Once this is achieved, the resulting image is saved.
  2. The processed image goes through a detector of areas of interest which identifies each of the target sections for each disease (for instance, septum and turbinates for Rhinitis or the various pulmonary lobes for Enzootic Pneumonia).
  3. After these detections, a new “filter” is applied which checks their position within the image in order to rectify potential detection errors.
  4. When the sections have been detected, each of them is cut out and saved separately keeping their relationship with the initial image (the image resulting from point 1).
  5. Each section goes through a new “filter” (classifier) which is trained for scoring the particular lesion grade.
  6. Finally, the total involvement grade is calculated, and this information is sent back together with the prediction of all the sections.
Processing of the Rhinitis model. Photo: Hipra
Processing of the Rhinitis model. Photo: Hipra

Click to enlarge image

Processing of the Mycoplasma model. Photo: Hipra
Processing of the Mycoplasma model. Photo: Hipra

Click to enlarge image


The detection of objects is a smart image recognition technique which allows to identify and locate objects within an image. AI Diagnos has 2 detectors per model: the detector of focus, which identifies the lung or the nasal septum, and the detector of areas of interest, which identifies the various areas of the lung or the nasal septum.


We have the following sections for each case:

  • Rhinitis: right-hand dorsal turbinate, left-hand dorsal turbinate, right-hand ventral turbinate, left-hand ventral turbinate and septum.
  • Mycoplasma : right-hand apical lobe, left-hand apical lobe, right-hand cardiac lobe, left-hand cardiac lobe, right-hand diaphragmatic lobe and left-hand diaphragmatic lobe.

In order to create the models, the system had to be capable of classifying the lesion grade of the various areas of interest, according to the set of images previously analysed by the same system during training. The model takes each and every image for analysis and shows the lesion grade for each section.

The system has been ‘trained’ using over 11,000 images which have been evaluated by the system and corrected for learning by a number of experts in Mhyo from all over the world, so the system is thus validated. The result of this validation was that the system currently has more than 85% direct accuracy by system-evaluator, which means that the system and the evaluator have both given the same score, and more than 96% with an error per lobe rate of ±1.

Advantages of the AI Diagnos system

Artificial Intelligence Diagnos is a great breakthrough for the swine industry, because it is a new system to evaluate lesions caused by Enzootic Pneumonia and Atrophic Rhinitis which has very clear advantages:

  • Automated: it only requires taking photos and uploading them in the system, there is no need to send specialised technicians to the slaughters, time is also saved in the individual assessments.
  • Reliable: it is a fully objective process, where the subjectivity of the evaluators is eliminated, and the images are always evaluated according to the same set of criteria. In addition to this, the system has been ‘trained’ with more than 11,000 images validated by the main specialists in Mhyo from all over the world.
  • Simple: it is a very user-friendly system, where only the farm data must be completed and the images of the lungs or nasal turbinates’ need be added for the system to perform the evaluation automatically. In addition, the system generates a report automatically to make interpretation easier for the user.

References are available on request