Systems and methods for automated assessment of animal welfare indicators on swine carcasses
The system automates the assessment of pig welfare on swine carcasses using computer vision to capture and analyze dorsal and lateral views, addressing the inefficiencies and risks of manual methods, ensuring accurate and consistent welfare evaluation.
Patent Information
- Application Number
- PCT/CA2025/051133
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-08-30
- Filing Date
- 2025-08-29
- Publication Date
- 2026-03-05
AI Technical Summary
Current methods for assessing pig welfare on farms are time-consuming, costly, and pose biosecurity risks, lacking third-party verification and leading to gaps in data collection, while manual observations are labor-intensive and infrequent, making it difficult to ensure high animal welfare standards.
A system for automated assessment of animal welfare indicators on swine carcasses using computer vision, comprising a primary object detection model, multi-object tracker, secondary object detection model, and detection manager module to capture dorsal and lateral views of swine carcasses, along with classification models to identify and analyze skin lesions, hernias, and tail length.
Enables efficient, standardized, and non-biased assessment of animal welfare indicators, providing accurate and consistent data for improving farm productivity and meat quality, while reducing human intervention and biosecurity risks.
Smart Images

Figure CA2025051133_05032026_PF_FP_ABST
Abstract
Description
SYSTEMS AND METHODS FOR AUTOMATED ASSESSMENT OF ANIMAL WELFARE INDICATORS ON SWINE CARCASSESTECHNICAL FIELD
[0001] The disclosed exemplary embodiments relate to computer vision and, in particular, to automated image processing of animal carcasses.BACKGROUND
[0002] The assessment of pig welfare is an important aspect of ensuring high animal welfare standards in sustainable pork production.
[0003] However, current practices for assessing pig welfare on farms present several challenges that hinder effective monitoring and improvement.
[0004] One major concern is transparency in farm animal welfare. With increasing public awareness and scrutiny of animal welfare issues, there is growing pressure to ensure that farms are providing a safe and humane environment for their animals. In addition to societal demands for increased food security and transparency in livestock production, consumers also want to know that animals raised for meat consumption have had an acceptable quality of life. Meeting high animal welfare standards not only ensures social acceptability of pork production but can also benefit on-farm productivity and meat quality of the final product. Unfortunately, current on- farm assessments often lack third-party verification, leaving room for uncertainty and potential animal welfare violations.
[0005] Verification aside, existing methods for assessing pig welfare on farms can be time-consuming, costly, and pose biosecurity risks. On-farm assessments typically involve manual observations and data collection performed once per season or annually, which can be labor-intensive and require significant resources. This inevitably leads to gaps in data collection, as not every animal can be monitored and the frequency of monitoring per farm is limited. Additionally, increased audits incur a greater cost for the producer and increase the risk of disease entry into the barn from individuals who are travelling between farms.SUMMARY
[0006] The following summary is intended to introduce the reader to various aspects of the detailed description, but not to define or delimit any invention.
[0007] A first aspect provides a system for capturing dorsal and lateral views of swine carcasses for use in automated assessment of animal welfare indicators on the swine carcasses, the system comprising: a primary object detection model configured to, for each original image of a sequence of original images, detect swine carcasses in the original image, and for each detected swine carcass, identify, from the original image, an image of the swine carcass; a multi-object tracker module configured to track swine carcasses through the sequence of original images by assigning an identifier to each image of a swine carcass such that each image of a same swine carcass is assigned a same identifier; a secondary object detection model configured to, for each detected swine carcass, detect, from the image of the swine carcass, an orientation of the tail of the swine carcass; and a detection manager module configured to, for each different swine carcass detected select, based on the tail orientation detections, a first image, from the images of that swine carcass, that provides a dorsal view of the swine carcass and a second image, from the images of that swine carcass, that provides a lateral view of the swine carcass.
[0008] The secondary object detection model may be configured to detect whether the tail of the swine carcass is in one of a back orientation and a side orientation; and wherein the detection manager module is configured to determine that: the image of the swine carcass provides a lateral view of the swine carcass if the secondary objection detection model detects that the tail of the swine carcass is in the side orientation, and the image of the swine carcass provides a dorsal view of the swine carcass if the secondary objection detection model detects that the tail of the swine carcass is in the back orientation.
[0009] The secondary object detection model may be further configured to identify from the image of the swine carcass, an image of the head of the swine carcass; the system may further comprise a classification model configured to, for each identified swine carcass, detect, from the image of the head of the swine carcass, an orientation of the head of the swine carcass; and the detection manager module may be further configured to select the first and second images of the swine carcass from the head orientation detections.
[0010] The classification model may be configured to detect whether the head of the swine carcass is in one of a back orientation, a side orientation and an underside orientation.
[0011] The detection manager module may be configured to determine that: the image of the swine carcass provides a lateral view of the swine carcass if the classification model detects that the head of the swine carcass is in the side orientation, and the image of the swine carcass provides a dorsal view of the swine carcass if the classification model detects that the head of the swine carcass is in the back orientation.
[0012] The detection manager module may comprise a set of queues for each of a plurality of different swine carcasses, the set of queues for a swine carcass comprises one or more dorsal view queues and one or more lateral view queues, and the detection manager module may be configured to: when it is determined that the image of the swine carcass presents a dorsal view of the swine carcass, store the image of the swine carcass in at least one of the one or more dorsal view queues for the swine carcass; and when it is determined that the image of the swine carcass presents a lateral view of the swine carcass, store the image of the swine carcass in at least one of the one or more lateral view queues for the swine carcass.
[0013] The detection manager module may be configured to select the first image for the swine carcass from the images in the one or more dorsal view queues for that swine carcass and select the second image for the swine carcass from the images the one or more lateral view queues for that swine carcass.
[0014] The one or more dorsal view queues for the swine carcass may comprise a dorsal view tail queue and a dorsal view head queue, and the detection manager module may be configured to: when the secondary object detection model detects that the tail of the swine carcass is in the back orientation, store the image for the swine carcass in the dorsal view tail queue; and when the classification model detects that the head of the swine carcass is in the back orientation, store the image of the swine carcass in the dorsal view head queue.
[0015] The detection manager module may be configured to select the first image for the swine carcass by: determining if a number of images in the dorsal view tail queue is greater than a predetermined number of images; in response to determining that the number of images in the dorsal view tail queue is more than the predetermined number of images, selecting one of the images in the dorsal view tail queue as the first image; and in response to determining that the number of images inthe dorsal view tail queue is equal to or less than the predetermined number of images, selecting one of the images in the dorsal view head queue as the first image.
[0016] The selected image in the dorsal view tail queue or the dorsal view head queue may be an image at a certain percentage of images in the dorsal view tail queue or the dorsal view head queue.
[0017] The one or more lateral view queues for the swine carcass may comprise one or more lateral view tail queues and one or more lateral view head queues, and the detection manager module may be configured to: when the secondary object detection model detects that the tail of the swine carcass is in the side orientation, store the image of the swine carcass in at least one of the one or more lateral view tail queues; and when the classification model detects that the head of the swine carcass is in the side orientation, store the image of the swine carcass in at least one of the one or more lateral view head queues.
[0018] The one or more lateral view tail queues may comprise a lateral view tail up queue and a lateral view tail down queue, the secondary object detection model may be configured to identify, from the image of the swine carcass, an image of the tail of the swine carcass, and the detection manager module may be configured to: determine from the image of the swine carcass and the image of the tail of the swine carcass whether the tail of the swine carcass is in an upper half or a lower half of the image of the swine carcass; when the secondary object detection model detects that the tail of the swine carcass is in the side orientation and the detection manager module detects that the tail is in the upper half of the image of the swine carcass, store the image of the swine carcass in the lateral view tail up queue; and when the secondary object detection model detects that the tail of the detected swine carcass is in the side orientation and the detection manager module detects that the tail is in the lower half of the image of the swine carcass, store the image of the swine carcass in the lateral view tail down queue.
[0019] The one or more lateral view head queues may comprises a lateral view head up queue and a lateral view head down queue, and the detection manager module is configured to: determine from the image of the swine carcass and the image of the head of the swine carcass whether the head of the swine carcass is in the upper half or the lower half of the image of the swine carcass; when the classification modeldetects that the head of the swine carcass is in the side orientation and the detection manager module detects that the head of the swine carcass is in the upper half of the image of the swine carcass, store the image of the swine carcass in the lateral view head up queue; and when the classification model detects that the head of the swine carcass is in the side orientation and the detection manager module detects that the head of the swine carcass is in the lower half of the image of the swine carcass, store the image of the swine carcass in the lateral view head down queue.
[0020] The detection manager module may be configured to select the second image for the swine carcass by: determining if a number of images in the lateral view tail up queue is greater than a predetermined number of images; in response to determining that the number of images in the lateral view tail up queue is greater than the predetermined number of images, selecting one of the images in the lateral view tail up queue as the second image for the swine carcass; in response to determining that the number of images in the lateral view tail up queue is equal to or less than the predetermined number of images, determining whether a number of images in the lateral view tail down queue is greater than the predetermined number of images; in response to determining that the number of images in the lateral view tail down queue is greater than the predetermined number of images, selecting one of the images in the lateral view tail down queue as the second image for the swine carcass; in response to determining that the number of images in the lateral view tail down queue is equal to or less than the predetermined number of images, determining whether a number of images in the lateral view head up queue is greater than the predetermined number of images; in response to determining that the number of images in the lateral view head up queue is more than the predetermined number of images, selecting one of the images in the lateral view head up queue as the second image for the swine carcass; and in response to determining that the number of images in the lateral view head up queue is less than or equal to the predetermined number of images, selecting one of the images in the lateral view head down queue as the second image for the swine carcass.
[0021] The selected image in the lateral view tail up queue or the lateral view head up queue is an image at a first percentage of images in the lateral view tail up queue or the lateral view head up queue; and wherein the selected image in the lateral view tail down queue or the lateral view head down queue is an image at a second,different, percentage of images in the lateral view tail down queue or the lateral view head down queue.
[0022] The system may further comprise a single camera configured to generate the sequence of original images by capturing images of a plurality of swine carcasses on a line as the plurality of swine carcasses move along the line, the camera positioned at a turn in the line so that the camera captures different views of the plurality of swine carcasses as the plurality of swine carcasses move along the line.
[0023] The system may further comprise a welfare indicator detection module which is configured to, for each different swine carcass detected, automatically analyze the first and second images for that swine carcass to identify and assess indicators of animal welfare on the swine carcass.
[0024] The system may further comprise a carcass section detection module which is configured to, for each different swine carcass detected, analyze the first and second images for that swine carcass to identify sections of the swine carcass; and the welfare indicator detection module is configured to identify and assess indicators of animal welfare on the swine carcass within each identified section.
[0025] The welfare indicator detection module may comprise a skin lesion detection module configured to: for each of the first and second images for a swine carcass: process the image using a skin semantic segmentation model to generate a segmentation map in which each pixel in the image is classified as one of background, normal skin and lesion skin, generate one or more skin lesion ratios for the image based on the segmentation map, and determine a severity of skin lesions by comparing each of the one or more skin lesion ratios to one or more thresholds.
[0026] Each skin lesion ratio of the one or more skin lesion ratios for the image may be based on pixels in an area of the image.
[0027] Each skin lesion ratio of the one or more skin lesion ratios may be a ratio of lesion skin pixels in the corresponding area and a total of lesion skin pixels and normal skin pixels in the corresponding area.
[0028] The skin lesion detection module may be further configured to receive information identifying a dorsal area of the first image for the swine carcass that corresponds to a dorsal section of the swine carcass, and the one or more skin lesionratios for the first image for the swine carcass may comprise a skin lesion ratio based on pixels in the dorsal area.
[0029] The skin lesion detection module may be further configured to receive information identifying a back area of the second image for the swine carcass that corresponds to a back section of the swine carcass, and the one or more skin lesion ratios for the second image for the swine carcass may comprise a skin lesion ratio based on pixels in the back area.
[0030] The skin lesion detection module may be further configured to receive information identifying a middle area of the second image for the swine carcass that corresponds to a middle section of the swine carcass, and the one or more skin lesion ratios for the second image for the swine carcass may comprise a skin lesion ratio based on pixels in the middle area.
[0031] The skin lesion detection module may be further configured to receive information identifying a front area of the second image for the swine carcass that corresponds to a front section of the swine carcass, and the one or more skin lesion ratios for the second image for the swine carcass may comprise a skin lesion ratio based on pixels in the front area.
[0032] The skin lesion detection module may be configured to, for each skin lesion ratio of the one or more skin lesion ratios for the image: determine that skin lesions in the corresponding area are severe if the skin lesion ratio is greater than a first threshold; determine that the skin lesions in the corresponding area are moderate if the skin lesion ratio is equal to or less than the first threshold but greater than a second, lower, threshold; and determine that the skin lesions in the corresponding area are mild if the skin lesion ratio is equal to or less than the second threshold.
[0033] The skin semantic segmentation model may be a UNet model with a ResNet backbone.
[0034] The welfare indicator detection module may comprise a hernia detection module configured to: process the second image for a pig carcass using a hernia object detection model, wherein the hernia object detection model is configured to detect one or more types of hernia in the image, and, for each detected hernia, output information identifying the hernia in the image and the type of hernia.
[0035] The one or more types of hernia may comprise a severe hernia and a mild hernia.
[0036] A severe hernia may be a hernia greater than 10cm.
[0037] A mild hernia may be a hernia less than or equal to 10cm.
[0038] The hernia object detection model may be a YOLO model with a ResNet backbone.
[0039] The system may further comprise a carcass section detection module that is configured to generate from the first image for each swine carcass an image of a tail of the swine carcass, and the welfare indicator detection module may comprises a tail lesion detection module configured to: process the image of the tail using a tail lesion semantic segmentation model to generate a segmentation map in which each pixel in the image of the tail is classified as one of background, normal skin and lesion skin; classify each lesion skin pixel as either a necrotic lesion or a low-grade lesion based on colour; generate one or more skin lesion ratios for the image of the tail based on the segmentation map and the classification of each lesion skin pixel; and determine a severity of skin lesions on the tail by comparing the one or more skin lesion ratios to one or more thresholds.
[0040] The one or more skin lesion ratios for the image of the tail may comprise a necrotic skin lesion ratio and a low-grade lesion ratio.
[0041] The necrotic skin lesion ratio may be a ratio of necrotic lesion pixels to a total of normal skin pixels and lesion skin pixels.
[0042] The low-grade lesion ratio may be a ratio of low-grade lesion pixels to a total of normal skin pixels and lesion skin pixels.
[0043] The severity of skin lesions in the tail may be determined to be one of severe, mild and no lesions by comparing the necrotic skin lesion ratio and low-grade lesion ratio to the one or more thresholds.
[0044] If the necrotic lesion ratio is greater than a necrotic threshold, the skin lesions on the tail may be determined to be severe; if the necrotic lesion ratio is less than or equal to the necrotic threshold and the low-grade lesion ratio is greater than a low-grade threshold, the skin lesions on the tail may be determined to be mild; and if the necrotic lesion ratio is less than or equal to the necrotic threshold and the low-grade lesion ratio is less than or equal to the low-grade threshold, it may be determined that there are no skin lesions on the tail.
[0045] Each lesion skin pixel may be classified as either a necrotic lesion or a low-grade lesion based on a value channel of a HSV colour space.
[0046] Each lesion skin pixel may be classified as a necrotic lesion if the value channel forthat pixel is less than a value threshold and classified as a low-grade lesion if the value channel for that pixel is greater than or equal to the value threshold.
[0047] The tail lesion semantic segmentation model may be a UNet model with a ResNet backbone.
[0048] The system may further comprise a carcass section detection module that is configured to generate from the second image for each carcass an lateral image of a tail of the swine carcass, and the welfare indicator detection module may comprise a tail length detection module configured to: process the lateral image of the tail using a tail semantic segmentation model to generate a segmentation map in which each pixel in the image is classified as one of background and tail; apply a skeletonization algorithm to the pixels classified as tail in the segmentation map to generate a medial axis of the tail; and determine a length of the tail from the medial axis of the tail.
[0049] Determining the length of the tail from the medial axis of the tail may comprise processing the medial access using a filtering algorithm to identify and remove outliers from the media axis to generate a filtered medial axis.
[0050] The filtering algorithm may be principal component analysis.
[0051] Determining the length of the tail from the medial axis of the tail may further comprise determining if one or more key terminal points were removed as outliers, and if it is determined that one or more key terminal points were removed as outliers, adding the one or more key terminal points to the filtered medial axis to generate a corrected and filtered medial axis.
[0052] The one or more key terminal points may comprise a tale base and / or a tail tip.
[0053] The tail base may be identified as being a pixel in the medial axial in a first row of the lateral image of the tail in which a first predetermined percentage of the row is identified in the segmentation map as being tail.
[0054] The tail tip may be identified as being a pixel in the medial axis in a last row of the lateral image of the tail in which a second predetermined percentage of the row is identified in the segmentation map as being tail.
[0055] Determining the length of the tail from the medial axis of the tail may further comprise fitting the corrected and filtered medial axis to a polynomial curve.
[0056] The corrected and filtered medial axis may be fitted to a polynomial curve using polynomial regression.
[0057] Determining the length of the tail from the medial axis of the tail may further comprise determining the length of the tail to be a length of the polynomial curve.
[0058] Determining the length of the tail from the medial axis of the tail may further comprise determining the length of the tail to be a length of the corrected and filtered media axis.
[0059] Determining the length of the tail from the medial axis of the tail may further comprise determining the length of the tail to be a length of the filtered medial axis.
[0060] The tail length detection module may be configured to determine the length of the tail to be a length of the medial axis.
[0061] A second aspect provides a computer-implemented method of capturing dorsal and lateral views of swine carcasses for use in automated assessment of animal welfare indicators on the swine carcasses, the method comprising, at one or more processors: for each original image of a sequence of original images, detecting, using a primary object detection model, swine carcasses in the original image, and for each detected swine carcass, identifying, from the original image, an image of the swine carcass; tracking, using a multi-object tracker module, swine carcasses through the sequence of original images by assigning an identifier to each image of a swine carcass such that each image of a same swine carcass is assigned a same identifier; for each detected swine carcass, detecting, using a secondary object detection model, an orientation of a tail of the swine carcass from the image of the swine carcass; and for each different swine carcass detected, selecting, based on the tail orientation detections, a first image, from the images of that swine carcass, that provides a dorsalview of the swine carcass and a second image, from the images of that swine carcass, that provides a lateral view of the swine carcass.
[0062] A third aspect provides a system for identifying and assessing skin lesions on a swine carcass, the system comprising at least one processor configured to: receive one or more images of the swine carcass; and for each of the one or more images: process the image using a semantic segmentation model to generate a segmentation map in which each pixel in the image is classified as one of background, normal skin and lesion skin, generate one or more skin lesion ratios for the image based on the segmentation map, and determine a severity of skin lesions by comparing each of the one or more skin lesion ratios to one or more thresholds.
[0063] Each skin lesion ratio of the one or more skin lesion ratios for the image may be based on pixels in an area of the image.
[0064] Each skin lesion ratio of the one or more skin lesion ratios may be a ratio of lesion skin pixels in the corresponding area and a total of lesion skin pixels and normal skin pixels in the corresponding area.
[0065] The one or more images of the swine carcass may comprise an image that provides a dorsal view of the swine carcass.
[0066] The at least one processor may be further configured to receive information identifying a dorsal area of the image that provides the dorsal view of the swine carcass that corresponds to a dorsal section of the swine carcass, and the one or more skin lesion ratios for the image that provides a dorsal view of the swine carcass may comprise a skin lesion ratio based on pixels in the dorsal area.
[0067] The one or more images of the swine carcass may comprise an image that provides a lateral view of the swine carcass.
[0068] The at least one processor may be further configured to receive information identifying a back area of the image that provides a lateral view of the swine carcass that corresponds to a back section of the swine carcass, and the one or more skin lesion ratios for the image that provides a lateral view of the swine carcass may comprise a skin lesion ratio based on pixels in the back area.
[0069] The at least one processor may be further configured to receive information identifying a middle area of the image that provides a lateral view of theswine carcass that corresponds to a middle section of the swine carcass, and the one or more skin lesion ratios for the image that provides a lateral view of the swine carcass may comprise a skin lesion ratio based on pixels in the middle area.
[0070] The at least one processor may be further configured to receive information identifying a front area of the image that provides the lateral view of the swine carcass that corresponds to a front section of the swine carcass, and the one or more skin lesion ratios for the image that provides a lateral view of the swine carcass may comprise a skin lesion ratio based on pixels in the front area.
[0071] The at least one processor may be configured to, for each skin lesion ratio of the one or more skin lesion ratios for the image: determine that skin lesions in the corresponding area are severe if the skin lesion ratio is greater than a first threshold; determine that the skin lesions in the corresponding area are moderate if the skin lesion ratio is equal to or less than the first threshold but greater than a second, lower, threshold; and determine that the skin lesions in the corresponding area are mild if the skin lesion ratio is equal to or less than the second threshold.
[0072] The semantic segmentation model may be a UNet model with a ResNet backbone.
[0073] A fourth aspect provides a computer-implemented method for identifying and assessing skin lesions on a swine carcass, the method comprising, at least one processor: receiving one or more images of the swine carcass; and for each of the one or more images: processing the image using a semantic segmentation model to generate a segmentation map in which each pixel in the image is classified as one of background, normal skin and lesion skin, generating one or more skin lesion ratios for the image based on the segmentation map, and determining a severity of skin lesions by comparing each of the one or more skin lesion ratios to one or more thresholds.
[0074] A fifth aspect provides a system for identifying and assessing hernias on a swine carcass, the system comprising at least one processor configured to: receive an image presenting a lateral view of the swine carcass; and process the image using an object detection model, wherein the object detection model is configured to detect one or more types of hernia in the image, and, for each detected hernia, output information identifying the hernia in the image and the type of hernia.
[0075] The one or more types of hernia may comprise a severe hernia and a mild hernia.
[0076] A severe hernia may be a hernia greater than 10cm.
[0077] A mild hernia may be a hernia less than or equal to 10cm.
[0078] The object detection model may be a YOLO model with a ResNet backbone.
[0079] A sixth aspect provides a computer-implemented method for identifying and assessing hernias on a swine carcass, the method comprising, at one or more processors: receiving an image presenting a lateral view of the swine carcass; and processing the image using an object detection model, wherein the object detection model is configured to detect one or more types of hernia in the image, and, for each detected hernia, output information identifying the hernia in the image and the type of hernia.
[0080] A seventh aspect provides a system for identifying and assessing skin lesions on a tail of a swine carcass, the system comprising at least one processor configured to: receive an image of a tail of a swine carcass; process the image using a semantic segmentation model to generate a segmentation map in which each pixel in the image is classified as one of background, normal skin and lesion skin; classify each lesion skin pixel as either a necrotic lesion or a low-grade lesion based on colour; generate one or more skin lesion ratios for the image based on the segmentation map and the classification of each lesion skin pixel; and determine a severity of skin lesions by comparing the one or more skin lesion ratios to one or more thresholds.
[0081] The one or more skin lesion ratios for the image may comprise a necrotic skin lesion ratio and a low-grade lesion ratio.
[0082] The necrotic skin lesion ratio may be a ratio of necrotic lesion pixels to a total of normal skin pixels and lesion skin pixels.
[0083] The low-grade lesion ratio may be a ratio of low-grade lesion pixels to a total of normal skin pixels and lesion skin pixels.
[0084] The severity of skin lesions may be determined to be one of severe, mild and no lesions by comparing the necrotic skin lesion ratio and low-grade lesion ratio to the one or more thresholds.
[0085] If the necrotic lesion ratio is greater than a necrotic threshold, the skin lesions may be determined to be severe; if the necrotic lesion ratio is less than or equal to the necrotic threshold and the low-grade lesion ratio is greater than a low-grade threshold, the skin lesions may be determined to be mild; and if the necrotic lesion ratio is less than or equal to the necrotic threshold and the low-grade lesion ratio is less than or equal to the low-grade threshold, it may be determined there are no skin lesions.
[0086] Each lesion skin pixel may be classified as either a necrotic lesion or a low-grade lesion based on a value channel of a HSV colour space.
[0087] Each lesion skin pixel may be classified as a necrotic lesion if the value channel forthat pixel is less than a value threshold and classified as a low-grade lesion if the value channel for that pixel is greater than or equal to the value threshold.
[0088] The semantic segmentation model may be a UNet model with a ResNet backbone.
[0089] An eighth aspect provides a computer-implemented method for identifying and assessing skin lesions on a tail of a swine carcass, the method comprising, at one or more processor: receiving an image of a tail of a swine carcass; processing the image using a semantic segmentation model to generate a segmentation map in which each pixel in the image is classified as one of background, normal skin and lesion skin; classifying each lesion skin pixel as either a necrotic lesion or low-grade lesion based on colour; generating one or more skin lesion ratios for the image based on the segmentation map and the classification of each lesion skin pixel; and determining a severity of skin lesions by comparing the one or more skin lesion ratios to one or more thresholds.
[0090] A ninth aspect provides a system for identifying and assessing skin lesions on a tail of a swine carcass, the system comprising at least one processor configured to: receive an image of a tail of a swine carcass; process the image using a semantic segmentation model to generate a segmentation map in which each pixel in the image is classified as one of background and tail; apply a skeletonization algorithm to the pixels classified as tail in the segmentation map to generate a medial axis of the tail; and determine a length of the tail from the medial axis of the tail.
[0091] Determining the length of the tail from the medial axis of the tail may comprise processing the medial access using a filtering algorithm to identify and remove outliers from the media axis to generate a filtered medial axis.
[0092] The filtering algorithm may be principal component analysis.
[0093] Determining the length of the tail from the medial axis of the tail may further comprise determining if one or more key terminal points were removed as outliers, and if it is determined that one or more key terminal points were removed as outliers, adding the one or more key terminal points to the filtered medial axis to generate a corrected and filtered medial axis.
[0094] The one or more key terminal points may comprise a tale base and / or a tail tip.
[0095] The tail base may be identified as being a pixel in the medial axial in a first row of the image in which a first predetermined percentage of the row is identified in the segmentation map as being tail.
[0096] The tail tip may be identified as being a pixel in the medial axis in a last row of the image in which a second predetermined percentage of the row is identified in the segmentation map as being tail.
[0097] Determining the length of the tail from the medial axis of the tail may further comprise fitting the corrected and filtered medial axis to a polynomial curve.
[0098] The corrected and filtered medial axis may be fitted to a polynomial curve using polynomial regression.
[0099] Determining the length of the tail from the medial axis of the tail may further comprise determining the length of the tail to be a length of the polynomial curve.
[0100] Determining the length of the tail from the medial axis of the tail may further comprise determining the length of the tail to be a length of the corrected and filtered media axis.
[0101] Determining the length of the tail from the medial axis of the tail may further comprise determining the length of the tail to be a length of the filtered medial axis.
[0102] The at least one processor may be configured to determine the length of the tail to be a length of the medial axis.
[0103] A tenth aspect provides a computer-implemented method for identifying and assessing skin lesions on a tail of a swine carcass, the method comprising, at one or more processors: receiving an image of a tail of a swine carcass; processing the image using a semantic segmentation model to generate a segmentation map in which each pixel in the image is classified as one of background and tail; applying a skeletonization algorithm to the pixels classified as tail in the segmentation map to generate a medial axis of the tail; and determining a length of the tail from the medial axis of the tail.
[0104] According to some aspects, the present disclosure provides a non- transitory computer-readable medium storing computer-executable instructions. The computer-executable instructions, when executed, configure a processor to perform any of the methods described herein.BRIEF DESCRIPTION OF THE DRAWINGS
[0105] The drawings included herewith are for illustrating various examples of articles, methods, and systems of the present specification and are not intended to limit the scope of what is taught in any way. In the drawings:FIG. 1 is a block diagram of an example system for detecting pig carcasses on a slaughter line and capturing both dorsal and lateral view images thereof;FIG. 2 is a schematic diagram illustrating an example positioning of a camera to capture images of pig carcasses on a slaughter line;FIG. 3 is a schematic diagram illustrating the detection of two pig carcasses in an image;FIG. 4A is an image of an example dorsal view of a pig carcass;FIG. 4B is an image of an example lateral view of a pig carcass;FIG. 4C is an image of an example ventral view of a pig carcass;FIG. 4D is an image of an example dorsal view of a tail of a pig carcass;FIG. 4E is an image of an example lateral view of a tail of a pig carcass;FIG. 4F is an image of an example dorsal view of a head of a pig carcass;FIG. 4G is an image of an example lateral view of a head of a pig carcass;FIG. 4H is an image of an example ventral view of a head of a pig carcass;FIG. 5A is an image of an example lateral view of pig carcass with the head and tail in the up position;FIG. 5B is an image of an example dorsal view of a pig carcass;FIG. 5C is an image of an example lateral view of a pig carcass with the head and tail in the down position;FIG. 6 is a schematic diagram illustrating an example queue for storing images of pig carcasses;FIG. 7 is a block diagram of an example computer-vision based system for automated animal welfare assessment that comprises the system of FIG. 1 ;FIG. 8A is an image of a dorsal view of a pig carcass showing example sections thereof which may be detected;FIG. 8B is an image of a lateral view of a pig carcass showing example sections thereof which may be detected;FIG. 9A is an image of a portion of a first example pig carcass which may be used to train an object detection model to detect a pig’s tail;FIG. 9B is an image of a portion of a second example pig carcass which may be used to train an object detection model to detect a pig’s tail;FIG. 9C is an image of a portion of a first example pig carcass which may be used to train an object detection model to detect a pig’s ears;FIG. 9D is an image of a portion of a second example pig carcass which may be used to train an object detection model to detect a pig’s ears;FIG. 10 is a schematic diagram illustrating skin lesions scores on example pig carcasses;FIG. 11A is an image of a dorsal view of an example pig carcass with skin lesions present;FIG. 11 B is a segmentation map of the image of FIG. 11A generated by a UNet model;FIG. 110 is a segmentation map of the image of FIG. 11A generated by a Segformer model;FIG. 12A is an image of a lateral view of an example pig carcass with a mild hernia;FIG. 12B is an image of a lateral view of an example pig carcass with a severe hernia;FIG. 13A is a schematic diagram of an example method for detecting and determining the severity of lesions on a tail of a pig carcass;FIG. 13B is a flow chart of an example method for determining the severity of lesions on a tail of a pig carcass;FIG. 14 is a graph illustrating the mean Value (V) in HSV colour space for dorsal tail lesions;FIG. 15 is a flow chart of an example method for determining the length of a pig carcass’s tail;FIG. 16 is a schematic diagram illustrating an example method of converting a pig tail length in pixels to centimeters;FIG. 17 is a schematic diagram providing a visual comparison of predicted tail paths using different methods;FIG. 18 is a scatter plot of the predicted versus actual tail lengths for a plurality of different methods;FIG. 19A is an image of an example pig carcass with severe ear deform ities / lesions;FIG. 19B is an image of an example pig carcass with moderate ear deform ities / lesions;FIG. 19C is an image of an example pig carcass with mild ear deform ities / lesions;FIG. 20A is an image of a first example pig carcass with frostbite indicators;FIG. 20B is an image of a second example pig carcass with frostbite indicators;FIG. 21 A is an image of an example pig carcass with an old healing skin lesion;FIG. 21 B is an image of an example pig carcass with a human handler injury;FIG. 21 C is an image of an example pig carcass with loin bruising;FIG. 22 is a flow diagram of an example method for detecting pig carcasses on a slaughter line and capturing both dorsal and lateral view images thereof which may be implemented by the system of FIG. 1 ;FIG. 23 is a flow diagram of an example method for automatically assessing the welfare of pigs from their carcasses on a slaughter line which may be implemented by the system of FIG. 7; andFIG. 24 is a block diagram of an example computer which may be used to implement all, or a portion of the systems and methods described herein.DETAILED DESCRIPTION
[0106] Currently, in at least some regions, the verification of animal care standards for farmed swine is performed by on-farm assessments of live animals, typically once a year, by human auditors. On-farm welfare assessment methods are effective, but their implementation by human observers means they can be subject to bias, expensive, time consuming and can pose risks to biosecurity.
[0107] However, performing welfare assessments at the time of slaughter by assessing animal-based indicators of welfare on pig carcasses can improve welfare surveillance that can complement on-farm assessment, but it can also provide the abattoir with information on their pre-slaughter handling practices and be incorporated into abattoir feedback to pork producers, reporting on welfare measures of the animals sent to slaughter.
[0108] While resource and management-based indicators are useful in providing insights into aspects of farm design and management strategies, animalbased indicators provide a direct insight into animal welfare as an outcome of the animal’s interaction with its environment. In this sense, animal-based indicators are regarded as a more accurate metric of welfare, and a good candidate to use in on- carcass welfare assessments for swine.
[0109] Observable characteristics on the body of an animal have been scientifically validated to provide information on animal welfare. These characteristics can provide information on human handler interactions, animal behaviour andaggression, tail biting, environmental conditions, signs of heat / cold stress, injury, transport conditions, and animal health. Monitoring carcasses for these indicators can similarly provide a retrospective analysis.
[0110] Skin and tail lesions are an example of animal-based indicators and have previously been used as a retrospective “iceberg” indicator of welfare on farm. As an example, tail length is one indicator of animal welfare. A high percentage of docked tails may suggest that tail-biting is a widespread concern at the source farm, e.g., because the tails have been pre-emptively docked to curb biting. Other tail or skin lesions can similarly serve as indicators of animal welfare.
[0111] The assessment of animal-based indicators on carcasses can also be used to calculate the associated economic loss from carcass condemnations and cutouts, providing an economic incentive for the improvement of animal care practices which could be routinely monitored and reported on with the use of automation.
[0112] Accordingly, it is desirable to be able to automatically identify and analyze animal-based welfare indicators on a pig’s body at the time of slaughter. One method to automatically analyze animal-based welfare indicators visible on a pig’s body may involve the use of computer vision techniques. Not only can animal-based welfare indicators be identified and assessed effectively and efficiently using computer vision techniques but using computer vision techniques allows standardization of the assessment, which is important for consistency and accuracy, offering a non-biased assessment.
[0113] The first step in automatically identifying and analyzing animal-based indicators on a pig’s body using computer vision techniques is extracting key frames or images that capture the positioning of the pig carcass. Specially, it is desirable to capture both dorsal and lateral view images of each pig carcass. These perspectives offer optimal angles for collecting animal-based welfare indicators. However, obtaining images for both dorsal and lateral views is a complex task due to factors such as lighting variations, occlusions, and image noise. While position estimation techniques could potentially aid in this process, they typically require large datasets with very specific formats for effective training.
[0114] Described herein are real-time object-detection based systems and methods to detect pig carcasses on the slaughter line and capture both dorsal andlateral view images which can be used to identify and analyze animal-based welfare indicators visible on a pig’s body. Specifically, the systems described herein comprise a combination of different object detection models working in a cascade or pipeline fashion, where the output of each model serves as the input for the next. The pipeline of object detection models is configured to detect and track pig carcasses in a sequence of original images and then detect the orientation of one or more anatomical sections (e.g., tails and / or heads) of the detected pig carcasses to determine whether the detected pig carcasses are shown in a lateral view or a dorsal view. Then, for each pig carcass, the system selects one image that represents a dorsal view of the pig carcass and one image that represents a lateral view of the same pig carcass.
[0115] In some examples the system comprises a first object detection model that is configured to receive a sequence of original images, detect pig carcasses in the original images, and identify, from the original images, images of the detected pig carcasses; a tracking module which is configured to track pig carcasses over the sequence of original images using identifiers such that the same pig carcass in different original images is assigned the same identifier; a second object detection model which is configured to receive the images of the pig carcasses, and detect the tail of the pig carcass and the orientation of the tail; and a detection manager module which is configured to determine from the tail orientation detections which view of the pig carcass each image of a pig carcass presents, and, for each different detected pig carcass, select an image of that pig carcass that presents a dorsal view of the pig carcass and an image of that pig carcass that presents a lateral view of the pig carcass. In some cases, the second object detection model may also be configured to identify, from the image of a pig carcass, an image of the head of the pig carcass; and the system may further comprise a classification model which is configured to receive the images of the pig heads and detect the orientation of the head. As described in more detail below, the head orientation can be used as a back-up to identify the view of the pig carcass when the tail orientation detection fails or is not possible.
[0116] Also described herein are computer-vision based systems and methods for automated animal welfare assessment which comprise the real-time objection detection-based system or method described herein. Specifically, the described systems and methods use the lateral and dorsal images of the pig carcasses outputby the objection-detection based system or method to automatically identify and assess indicators (e.g., lesions) on the pig carcasses of animal welfare. In some examples, the systems may comprise a carcass section / part detection module which uses computer vision techniques such as object detection to automatically detect, from the dorsal and lateral view images of a pig carcass, anatomical sections (e.g., ears) of that pig carcass; and a welfare indicator detection module which uses computer vision techniques to automatically detect and assess welfare indicators on a pig carcass within the identified anatomical sections.
[0117] The described systems and methods can be used in commercial pig abattoirs to evaluate every carcass for lesions that represent particular animal welfare indications. In particular, the described systems and methods enable every pig slaughtered to be assessed. In some cases, the systems may also provide reports on the prevalence of indicators per farm, or even batches of pigs from each farm. In some cases, the system may provide for identifying slap marks (e.g., tattoos on the skin of pigs) or reading RFID tags on pigs. Data can be used to provide feedback to pork producers and be used by companies for evaluation and continuous improvement. It can also be used at a national level to benchmark and provide data on animal care targets. Indeed, some countries require animal-based indicators of welfare on the carcass to be assessed as part of post-slaughter monitoring, as an inspection tool for monitoring standards of pig welfare. Accordingly, the described systems and methods are globally applicable to commercial swine production and the pork processing industry.System for Automated Detection of Dorsal and Lateral Views of Pig Carcasses
[0118] Reference is now made to FIG. 1 which illustrates an example automated system 100 for detecting pig carcasses on a slaughter line and capturing both dorsal and lateral view images thereof. As noted above, and described in more detail below, the dorsal and lateral view images of each pig carcass output by the system 100 of FIG. 1 can be used to identify and analyze animal-based welfare indicators visible on the pig’s body. The system 100 of FIG. 1 may be implemented by one or more computers, such as, but not limited to, the computer described below with respect to FIG. 18.
[0119] The example system 100 of FIG. 1 comprises a pipeline 102 of computer-vision models 104, 106, 108 and 110, and a detection manager module 112. The pipeline 102 of computer-vision models 104, 106, 108 and 110 is configured to receive a sequence of original images 114 of pig carcasses on a slaughter line, detect and identify images of the pig carcasses 116 in the original images 114 and detect the orientation of one more anatomical regions of the pig carcasses to identify the orientation of the pig carcasses in the images 116. The detection manager module 112 is configured to, for each different detected pig carcass, select, based on the detected anatomical region orientations, an image 118 of that pig carcass that presents a dorsal view of that pig carcass (which may be referred to herein as the dorsal image) and an image 120 of that pig carcass that presents a lateral view of that pig carcass (which may be referred to herein as the lateral image).
[0120] The sequence of original images may be generated by one or more cameras installed at an abattoir, or slaughterhouse, to capture the movement of pig carcasses along the production line or slaughter line following scaling and initial dehairing. In some cases, as shown in FIG. 2, the sequence of original images may be generated by a single camera 202 (e.g., a DS-2CD4A85 IP Camera from Hikvision) placed on a turn in the production line 204, so the pig carcasses 206 exhibit rotational motion as they approach the camera 202. This enables different views of each pig carcass 206 to be to be captured by the single camera 202. In some cases, a light source 208 may also be provided to illuminate and remove shadows. In some cases, the sequence of original images may be frames extracted from a video recording captured by the one or more cameras. In some cases, the system 100 may comprise a decoder 122 or the like which performs pre-processing on the original images before being processing by the pipeline 102. In one example, the decoder 122 may transmit the original images using GStreamer and decode them through an H.264 parser.
[0121] In the example shown in FIG. 1 , the pipeline 102 of computer-vision models 104, 106, 108, 110 which analyze the sequence of original images comprises a primary object detection model 104 to detect pig carcasses in the original images, a tracking module 106 for tracking pig carcasses through the sequence of original images, and a secondary object detection model 108 for detecting one or more anatomical parts of the pig carcass and the orientation thereof. As described in moredetail below, in some cases, the pipeline 102 may also comprise a classification model 110.
[0122] Object detection is the process of identifying objects, and their locations, in an image. Object detection models are artificial intelligence models configured to receive an image and determine if the image contains a specific object and if so, where that object is in the image. An object detection model generally outputs for each identified object, a confidence level indicating how confident the model is that the object is the specific object and the co-ordinates of a bounding box surrounding the object. Object detection models are usually trained to identify one or more specific objects. For example, an object detection model may be trained to identify cats and / or dogs in an image.
[0123] The primary object detection model 104 of FIG. 1 is trained to detect a single class - “pig”. Thus, the primary object detection model 104 is configured to receive the sequence of original images 114, and for each received original image 114, detect pig carcasses in the original image and, for each identified pig carcass, identify, from within the original image 114, an image 116 of the pig carcass. The image 116 of the pig carcass may be the portion of the original image corresponding to the bounding box identified by the primary object detection model 104. For example, if the primary object detection model 104 receives as an input the example original image 302 shown in FIG. 3 the primary objection detection model 104 may identify two pig carcasses in the original image 302 - a first pig carcass 304, and 306; and then identify from the original image 302, an image 308 of the first pig carcass and an image 310 of the second pig carcass.
[0124] Returning to FIG. 1 , there are many known object detection models, such as, but not limited to, YOLO (you only look once) models, Detectron2 models, EfficientDet, SSD (single shot multi-box detector) models, and Faster R-CNN (convolutional neural network) models. The primary object detection model 104 may be implemented by any suitable object detection model. In some cases, the primary object detection model 104 may be implemented by a YOLO object detection model owing to its real-time efficiency, ability to accurately detect a wide variety of objects in a single pass of the image, and high scalability enabling adaption to various image sizes and resolutions. In some cases, the primary object detection model 104 may be implemented by a YOLO v4 model with CSPDarknet19 as its backbone. Thebackbone of a YOLO v4 model acts as the feature extraction network that computes feature maps from the input images.
[0125] As the sequence of original images represent images of a slaughter line over time the same pig carcass will be shown in multiple original images. Since the objective of the system 100 is to output one dorsal image and one lateral image of each pig carcass on the line, it is desirable to be able to determine which pig carcass images identified by the primary objection detection model 104 relate to the same pig carcass. Accordingly, the pipeline 102 comprises a multi-object tracking module 106. Object tracking in computer vision comprises tracking detected objects as they move through a sequence of images (e.g., frames in a video stream). The multi-object tracking module 106 of FIG. 1 is configured to track the pig carcasses detected by the primary object detection model 104 and assign an identifier to each image of a pig carcass 116 identified by the primary object detection model 104 so that images 116 that relate to the same pig carcass are assigned the same identifier. As described in more detail below, the identifiers associated with the images of the pig carcasses 116 can then be used by the detection manager module 112 to group images of pig carcasses 116 that relate to the same pig carcass.
[0126] There are many known algorithms and models for tracking objects in a sequence of images. Any suitable algorithm or model may be used to implement the multi-object tracking module 106. In one example, the multi-object tracking module 106 may be implemented through a DeepStream plug in; NvDCF. NvDCF is an online multi-object tracker that utilizes a discriminative correlation filter for visual object tracking, enabling independent tracking of objects even in the absence of detection results.
[0127] The images of a pig carcasses identified by the primary object detection model 104 will present different views of the pig carcass as it moves along the line. For example, some of the images may present a dorsal view of the pig carcass, some of the images may present a lateral view of the pig carcass and some of the images may present a ventral view of the pig carcass. FIGS. 4A, 4B and 4C illustrate example dorsal, lateral and ventral views of an example pig carcass respectively.
[0128] The secondary object detection model 108 is configured to receive the images of pig carcasses identified by the primary object detection model 104, and foreach received pig carcass image, detect one or more anatomical regions or parts of the pig carcass and the orientation of at least one of the detected anatomical parts to determine whether the image of the pig carcass presents a lateral view or a dorsal view. In one example, the secondary object detection model 108 may be configured to detect the tail of the pig carcass and the orientation thereof. For example, if the image of the pig carcass presents a dorsal view (FIG. 4A) then the tail will be in a back or dorsal position (FIG. 4D) in the image, and if the image of the pig carcass presents a lateral view (FIG. 4B) then the tail will be in a side or lateral position (FIG. 4E). In such cases, the secondary object detection model 108 may be configured to detect at least two classes - “tail side”, and “tail back”.
[0129] As described above, with respect to the primary object detection model 108, there are many known object detection models. The secondary object detection model 108 may be implemented by any suitable object detection model. The secondary objection detection model 108 may be implemented in the same manner (e.g., by the same model) as the primary object detection model 104 or in a different manner. In some cases, the secondary object detection model 108 may be implemented by a YOLO object detection model owing to its real-time efficiency, ability to accurately detect a wide variety of objects in a single pass of the image, and high scalability enabling adaption to various image sizes and resolutions. In some cases, the secondary object detection model 108 may be implemented by a YOLO v4 model with CSPDarknet19 as its backbone.
[0130] It has been identified that in certain situations, the secondary objection detection model 108 may struggle to identify the tail of the pig carcass (e.g., when the pig tail has been severely bitten or obstructed). Accordingly, in some cases, the system 100 may also be configured to identify the head of each detected pig carcass and detect the orientation thereof to determine whether the image of the pig carcass presents a lateral or dorsal view. For example, if the image of the pig carcass presents a dorsal view (FIG. 4B) then the head will be in a back position (FIG. 4F), and if the image of the pig carcass presents a lateral view (FIG. 4B), then the head will be in a side position (FIG. 4G). In such cases, the secondary object detection model 408 may also be configured to detect the head of the pig carcass, and identify, from the image of the pig carcass, an image of the head; and the system 100 may further comprise a classification model 110 which is configured to receive the image of the head detectedby the secondary object detection model 108 and determine which orientation the head is in.
[0131] A classification model is configured to assign a label to an image. Specifically, a classification model is trained to predict whether an image comprises each of one or more objects / classes. For example, a classification model can be trained to predict whether an image comprises a dog or whether an image comprises a cat. In the system 100 of FIG. 1 the classification model 110 may be trained to detect at least two classes - “head back” (for the dorsal view) and “head side” (for the lateral view). The head detection and classification serve as an auxiliary or backup mechanism to determine whether an image presents a dorsal or lateral view of the pig carcass for situations where the secondary object detection model 108 is unable to detect the tail of the pig carcass or the orientation thereof. Testing showed the integrating the head position data substantially reduced missed detections to 6.25% and erroneous detections to 1 .25%
[0132] It has been determined that in some situations training the classification model 110 on only two classes - “head back” (for the dorsal view) and “head side” (for the lateral view) - resulted in heads in a front position 416 being misclassified into one of these categories. Accordingly, in some cases, the classification model 110 may be trained to detect three classes - “head back” (for the dorsal view), “head side” (for the lateral view) and “head underside” (for the ventral view). It was found that adding this third - “head underside” class - reduced the number of incorrect classifications.
[0133] There are many known classification models such as, but not limited to, logistic regression models, support vector machine models, decision tree models, and artificial neural network (ANN) models, such as, but not limited to ResNet models and EfficientNet models. Any suitable known classification model may be used to implement the classification model 110. In some cases, the classification model 110 may be implemented by an EfficientNet model, such as EfficientNet B1. EfficientNet models are a family of convolution neural network (CNN) models.
[0134] In other cases, instead of the secondary object detection model 108 detecting the tail of the pig carcass and the orientation thereof, and detecting the head of the pig carcass and a separate classification model 110 classifying the orientation of the head, the secondary object detection model 108 may be configured to detectthe tail of the pig carcass and the orientation thereof, and detect the head of the pig carcass and the orientation thereof. In such cases, the secondary object detection model 108 may be configured to detect at least four classes - “tail side”, “tail back”, “head-back” and “head-side”. Using only an objection detection model instead of an object detection model and a classifier simplifies the implementation, complexity and computation load while maintaining a high mAP of 0.975. Table 1 illustrates the performance metrics of such a classifier for an example set of images.Table 1
[0135] The detection manager module 112 is configured to receive each image of a pig carcass identified by the primary object detection model, along with its associated identifier generated by the tracker module 106, and select, based on the anatomical part orientation detections, two images for each different pig carcass - an image of that pig carcass that presents a dorsal view of the pig carcass and an image of that pig carcass that presents a lateral view of the pig carcass.
[0136] In some cases, the detection manager module 112 may be configured to store all the images corresponding to the same pig carcass in a set of one or more queues associated with that pig carcass and select the dorsal view and lateral view images for that pig carcass from the set of queues associated with that pig carcass. Since the original images may comprise multiple pig carcasses the system may be processing images that relate to multiple pig carcasses at the same time. Accordingly, the detection manager module 112 may comprise a plurality of (e.g., 4) sets of queues which can be dynamically allocated to pig carcasses as they appear in the images.For example, when the detection manager module 112 receives an image of a pig carcass that is associated with a new identifier (indicating a new pig carcass) the detection manager module 112 may associate the pig carcass with an unallocated or unassociated set of queues. If there is not an unallocated or unassociated queue then the detection manager module 112 may be configured to select a dorsal view image and a lateral view image from one set of queues and then allocate that set of queues to the new pig carcass. Each set of queues may be sized so as to hold all the images of a pig carcass output by the primary object detection model 104 until it exits the camera view.
[0137] In some cases, the detection manager module 112 may only store an image of a pig carcass in the set of queues associated with that pig carcass if the predicted probability (as determined by the primary objection detection model 104) of the image being of a pig carcass exceeds a primary probability threshold. If the predicted probability for an image does not exceed the primary probability threshold, then the image of the pig carcass may simply be discarded regardless of the anatomical part detections. In some cases, the primary probability threshold may be a precision of 0.5.
[0138] In some cases, the set of queues associated with a pig carcass may comprise one or more dorsal view queues and one or more lateral view queries so that the lateral view images of a pig carcass can be separated from the dorsal view images. In these cases, if the detection manager module 112 determines from the anatomical part orientation detections performed by the secondary objection detection model 108 (and optionally the classification model 110) that an image of a pig carcass presents a dorsal view, then the image will be stored in at least one of the one or more dorsal view queues for that pig carcass. Similarly, if the detection manager module 112 determines from the anatomical part orientation detections performed by the secondary objection detection model 108 (and optionally the classification model 110) that an image of a pig carcass presents a lateral view then the image will be stored in at least one of the one or more lateral view queues for that pig carcass. In some cases, an image may only be stored in a lateral view queue or a dorsal view queue if the probability of the orientation detection indicating that the image presents a lateral view, or a dorsal view respectively exceeds a secondary prediction threshold. For example, if the secondary objection detection model 108 detects that the tail in animage of a pig carcass is in a back orientation (indicating a dorsal view) with a predicted probability less than the secondary prediction threshold then the image may not be stored in a dorsal view queue. In some cases, the secondary threshold may be a predicted probability of 0.9.
[0139] In some cases, if the pipeline 102 is configured to detect the orientation of the tail and the head then both the one or more dorsal view queues and the one or more lateral queues may comprise one or more tail queues and one or more head queues to distinguish whether the view for the image was determined by the tail or the head. Specifically, the set of one or more dorsal view queues may comprise one or more dorsal view tail queues and one or more dorsal view head queues. In these cases, the set of queues for a pig carcass comprises at least four queues. In such cases, if the detection manager module 112 determines from a tail orientation detection that an image of a pig carcass presents a dorsal view of the pig carcass, then the image may be stored in dorsal view tail queue for that pig carcass. Similarly, if the detection manager module 112 determines from a head orientation detection that an image of a pig carcass presents a lateral view of the pig carcass, then the image may be stored in a lateral tail queue for that pig carcass. In these cases, a view determination based on a tail detection may be given priority over a view determination based on a head queue. Specifically, to select a dorsal / lateral image for a pig carcass the detection manager module 112 may first look in the corresponding tail queue (i.e. , the dorsal view tail queue or the lateral view tail queue) and only if the tail queue is not sufficient for selecting a dorsal / lateral image will the detection manager module 112 select the dorsal / lateral image from the corresponding head queue (i.e. the dorsal view head queue or the lateral view head queue). In some cases, the detection manager module 112 may determine that a tail queue is not sufficient for selecting a dorsal / lateral image if the queue has less than a predetermined number of entries (or images). In some cases, the predetermined number may be 10. For example, to select a dorsal image for a pig carcass the detection manager module 112 may first determine if the dorsal view tail queue for that pig carcass has at least 10 entries (or images). If it is determined that the dorsal view tail queue comprises at least 10 entries / images, then the detection manager module 112 may select one of the images in the dorsal view tail queue as the dorsal view image. If, however, it is determined that the dorsal view tail queue comprises less than 10 entries / images then thedetection manager module 112 may select one of the images in the dorsal view head queue as the dorsal view image. A similar approach may be used for selecting a lateral image.
[0140] In some cases, images of pig carcasses detected to be lateral view images, either by the tail or the head orientation detection, may be further subdivided into different queues based on whether the pig carcass is in an up position or a down position. For example, FIG. 5A shows an image that presents a lateral view of a pig carcass wherein the pig is in an up position (i.e. , the head 502 and tail 504 are in an up position); FIG. 5C shows an image that presents a lateral view of a pig carcass wherein the pig is in a down position (i.e., the head 506 and tail 508 are in a down position); and FIG. 5C shows an image that presents a dorsal view of a pig carcass with the head 510 and tail 512 identified. In these cases, the detection manager module 112 may be configured to, after it has been determined that an image presents a lateral view, determine whether the pig carcass in the image is in the up or down position. The determination of whether the pig carcass is in the up or down position may be based on whether the anatomical part (tail or head) used to determine the image was a lateral view is in the upper part of the image of the pig carcass or the lower part of the image of the pig carcass. For example, the detection manager module 112 may be configured to determine whether the pig is in the up or down position by comparing the vertical midpoint of the anatomical part (tail or head) detection to the vertical midpoint of the pig carcass detection. If the midpoint of the anatomical part (tail or head) is lower, the pig carcass is in the up position. If, however, the midpoint of the anatomical part is higher, the pig carcass is in the down position.
[0141] Once the detection manager module 112 has determined whether, in the lateral view of the pig carcass, the pig carcass is in the up or down position the detection manager module 112 stores the image in a queue associated with the view, the body part used to make the detection, and whether the pig carcass is up or down. For example, if the detection manager module 112 has determined, using the tail orientation detection, that an image of a pig carcass presents a lateral view of the pig carcass, and that the pig carcass is in the up position then the detection manager module 112 stores the image in a lateral view tail up queue associated with the pig carcass; and if the detection manager module 112 has determined that, using the head orientation detection, that an image of a pig carcass presents a lateral view of the pigcarcass, and that the pig carcass is in the down position then the detection manager module 112 stores the image in the lateral view head down queue associated with that pig carcass. Accordingly, in these cases, there are at least six queues for each pig carcass: a lateral view tail up queue, a lateral view tail down queue, a lateral view head up queue, a lateral view head down queue, a dorsal tail queue and a dorsal head queue.
[0142] In these cases, to selecting a lateral view image for a pig carcass the detection manager module 112 may be configured to process the lateral queues in a predetermined order wherein the detection manager module 112 only goes to the next queue in the order if it is determined that the current queue is not sufficient for selecting a lateral view image. In some cases, the detection manager module 112 determines that a current queue is not sufficient for selecting a lateral view image if that queue has less than a predetermined number (e.g., 10) of images / detections. In one example, the detection manager module 112 is configured to process the lateral queues in the following order: lateral view tail up queue, lateral view tail down queue, lateral view head up queue and lateral view head down queue. Accordingly, the images stored in the head queues are only used when there are fewer than the predetermined number of detections for the tail.
[0143] In some cases, the specific image in a queue that is selected as the lateral view or the dorsal view may be the image at a specific percentage of that queue. The specific percentages for different queues may be determined empirically.
[0144] Table 2 sets out example percentages of each of the six queues described above from which the frame is extracted for each scenario. For instance, in the case of a tail down lateral view, the frame corresponding to 90% of the total queue is extracted. The choice of 90% instead of 100% is because the final frames start to exhibit rotations or incomplete parts in the detection. This criterion also applies to the first images.Table 2View body part orientation Percentage (%)Lateral tail up 10 down 90View body part orientation Percentage (%) head up 10 down 90Dorsal tail - 60 head - 60
[0145] FIG. 6 illustrates a visual representation of the detection selection process implemented by the queue system. In the case of the lateral view, when the tail or head is detected to be in the up position, the detection manager module 112 selects the image positioned at the 10% mark within the queue. Conversely, when the tail or head is detected to be in the down position, the detection from the 90% mark in the queue is chosen. As for the dorsal view, the system opts for the image positioned at the 60% mark within the queue. It is noted that while FIG. 6 illustrates a single queue from which lateral and dorsal images are selected, in reality there will be different queues for the lateral and dorsal images as described above. For example, as described above, in some cases there are six different queues - four lateral view queues, and two dorsal view queues.
[0146] The described system has been designed such that it can be implemented on edges devices. Specifically, the system 100 was successfully implemented on a NVIDIA Jetson AGX Irin Developer Kit, which is compact and doesn’t require much space. Being able to implement the system 100 on an edge device means that all the functionality can be integrated into the device itself, minimizing the need for additional infrastructure.
[0147] As described in more detail below, the described system can serve as pre-processing for a skin and tail lesion detection model. In particular, skin and tail lesion detection is simplified and improved by performing automated assessment based on the dorsal and lateral views of pigs acquired through the described systems and methods. Various approaches such as semantic segmentation and object detection can be utilized to aid in identifying different conditions, enabling the recognition of welfare indicators such as skin lesions from animal aggression or injury, tail lesions, frostbite, hernias, and human handler injuries.Example Implementation of the System of FIG. 1
[0148] To test an implementation of the system 100 of FIG. 1 (comprising a primary objection detection model 104, a tracker module 106, a secondary object detection model 108 and a classification model 110) a 12-minute video segment was obtained from slaughterhouse recordings, containing approximately 10,000 frames. Each frame was annotated to denote the position of each pig passing the camera. The annotated images were then cropped to isolate individual pigs. The initial one third (i.e. , 4 minutes) of the video segment was harnessed as the foundational dataset for the subsequent phase. This secondary dataset comprised of approximately 4,000 images, each of which featured detailed annotations for the tail and head positions.
[0149] A more limited dataset of approximately 10% (e.g., 1 ,300 images) was employed to train the classification model for head position classification. Within this dataset, three distinct classes were established to accurately classify a pig’s head orientation: head side, head back, and head underside.
[0150] The primary and secondary object detection models 104 and 108 were implemented by YOLO v4 model with a CSPDarknet19 backbone. The primary and secondary objection detection models 104 and 108 were trained using the Adam optimization algorithm with an epsilon value of 1e-7, betal set to 0.9, beta2 set to 0.999. The YOLO v4 loss comprises the aggregation of four components: localization loss, negative objectiveness loss, positive objectiveness loss, and classification loss. Equal significance was assigned to each of these loss factors.
[0151] The primary and secondary object detection models 104 and 108 were trained for, e.g., 80 epochs with a batch size of 8. The backbone was frozen during training and pretrained on the ImageNet dataset. Cosine annealing and learning rate decay strategies were employes. The Ir was gradually increased from a minimum value of 1e-7 to a maximum of 1e-4 during the initial training phase.
[0152] The “soft start” parameter was set to 0.3, indicating that the initial phase during which the Ir increases is the first 30% of the training process. This approach aimed to ensure a smooth and controlled adjustment of the Ir, aiding in convergence and stability during training.
[0153] L1 regularization was applied to the primary and primary and secondary object detection models with a strength of 3e-5. The L1 regularization mechanism operates by adding a penalty term proportional to the absolute values of the CNN’sweights to the loss function. This promotes sparsity within the model’s learned features, assisting in preventing overfitting and encouraging the network to emphasize essential patterns in the data.
[0154] After training, the primary and secondary object detection models 104, 108 were pruned. Specifically, pruning was performed using the intersection method with a threshold of 0.1. This operator prunes a neuron only if the norms of all corresponding neurons are below a threshold. Corresponding neurons are neurons from different input layers that interact with each other through element-wise operations such as element-wise addition in residual blocks.
[0155] After pruning, the feature extraction layers of the first and second primary object detection models were unfrozen, L1 regularization removed, and the models trained for another (e.g., 80) epochs. The other parameters were maintained.
[0156] For the classification model 110, a Stochastic Gradient Descent (SGD) was used to train the network. Ir was set to 0.01 and momentum to a value of 0.9. The Categorical Cross-Entropy loss was used as the loss function.
[0157] The classification model was pre-trained using ImageNet. Thereafter, the model was trained for 20 epochs using a batch size of 64, with the feature extractor frozen. Ir was set to 0.006, which decreases by a factor of 0.1 every 10 epochs. L2 regularization was applied with a weight decay of 0.00005 to Conv and Dense layers.
[0158] After training, the classification model 110 was pruned using the union method with a threshold of 0.6. The union operator prunes a neuron if the norm of at least one of the corresponding neurons is below the threshold.
[0159] Once the pruning was complete, fine tuning was performed for 16 epochs. The hyperparameter settings may be the same as those used for the first training session.
[0160] For each of the primary object detection model 104, the secondary object detection model 108, and the classification model 110, 80% of the data was used for model training, 10% for validation, and the remaining 10% for testing.
[0161] Data augmentation was also applied. For the primary and secondary object detection models 104, 108, augmentation involves various transformations to enhance the training data. Data augmentation involves adjusting hue, saturation, andexposure while allowing horizontal flips with a 50% probability. Additionally, it introduces jitter and mosaic augmentations for diversity. The output dimensions were set to 1248x384 with 3 channels. Mosaic was applied with a 50% probability, considering a minimum ratio of 0.2. Vertical flips and randomization intervals were excluded from this setup. For the classification model 110, random and center cropping was be used for data augmentation, along with mix-up augmentation, which involves blending pairs of training samples with a factor of 0.1 to create new augmented data samples.
[0162] While evaluating the individual models (primary object detection model 104, secondary object detection model 108, and classification model 110) the primary object detection model 104 (responsible for pig carcass detection) achieved a mAP of 0.985. The secondary object detection model (responsible for head and tail detection) achieved a mAP of 0.988. Each of the primary and secondary object detection models 104, 108 had 53.4 M parameters. The classification model 110 (responsible for classifying the orientation or pose of the head) achieved perfect accuracy. It is believed that this may have been due to the small testing dataset comprising 135 images and the clear differentiation among different head positions. The classification model 110 had 4.6 M parameters.
[0163] To evaluate the system as a whole (the combination of the trained objection detection and classification models 104, 108, 110), a two-minute video segment was utilized, sources from the same origin used to generate the training dataset. The video featured 40 pigs, all of which are captured in lateral view, and 19 in both dorsal and lateral view.
[0164] The video was input to the system and the outputs analyzed. The system achieved an accuracy of 0.937, precision of 1 , recall of 0.915 and F1 -score of 0.955.
[0165] Human evaluation was also conducted to assess the quality of the generated data. This involved verifying where the data produced by the system correctly included images of the dorsal and lateral views, instead of images where the carcass is rotated or cropped. The human evaluation revealed that 92.5% of the detections (74 out of 80 detections in a video with 40 carcasses) and image absences were accurate. Additionally, 6.25% comprised undetected positions, while 1.25%encompassed detections resulting in images in incorrect or cropped positions. Thus, there were minimal false positives and undetected positions.System for Automated Animal Welfare Assessment
[0166] Reference is now made to FIG. 7 which illustrates an example computervision based system 700 for automated animal welfare assessment. The system comprises the system 100 of FIG. 1 for detecting pig carcasses on a slaughter line and capturing both dorsal and lateral view images thereof. Specifically, as described above, the system 100 of FIG. 1 receives a sequence of original images 116 of pig carcasses on a slaughter line and automatically detects and outputs a dorsal image 118 and a lateral image 120 of each pig carcass. The system 700 of FIG. 7 uses the lateral and dorsal images of the pig carcasses to automatically identify and assess indicators (e.g., lesions) on the pig carcasses of animal welfare. Specifically, the system 700 comprise a carcass section detection module 702 which uses computer vision techniques, such as, but not limited to, object detection to automatically detect, from the dorsal and lateral view images 118, 120 of a pig carcass, anatomical sections (e.g., ears, tail, shoulder, mid-section, rump) of that pig carcass; and a welfare indicator detection module 704 which uses computer vision techniques, such as, but not limited to, classification and segmentation techniques, to automatically detect and analyze (e.g., score) animal welfare indicators within the identified sections.
[0167] As noted above, the carcass section detection module 702 is configured to receive dorsal and lateral view images 118, 120 of a pig carcass and automatically detect and divide up the pig carcass into different body parts. Example body parts which the carcass section detection module 702 may be configured to detect include, but is not limited to, the tail, rump, mid-section of body, shoulder, ears, and back (or dorsal section). In some cases, the carcass section detection module 702 may be configured to, as shown in FIG. 8A, detect the back (or dorsal section) 802, the tail 804, and the right and left ears 806, 808 from the dorsal view of the pig carcass, and, as shown in FIG. 8B, detect the tail 810, back section 812, middle section 814, and front section 816 from the lateral view of the pig carcass.
[0168] In some cases, the carcass section detection module 702 may comprise one or more objection detection models 706 which are trained to detect the desired sections or parts of the pig carcass. In some cases, they may be a single objectdetection model 706n that is configured to detect all of the desired sections or parts (in both lateral and dorsal images) FIG. 9 shows example portions 902, 904, 906, 908 of images showing dorsal views of a pig carcass which were used to train an object detection model to detect a pig carcass’s ears, and example portions 910, 912 of images showing a lateral view of a pig carcass which were used to train an object detection model to detect a pig carcass’s tail.
[0169] As described above, there a number of different objection detection models. Any suitable object detection model may be used to implement the objection detection model(s) 706 of the carcass section detection module 702. In one example, one or more of the object detection models is implemented using a YOLOv4 model with a ResNet18 backbone. Testing has shown that a single objection detection model can be trained to achieve over 99% accuracy in detecting the body parts listed above. Table 3 shows performance metrics of a YOLOV4 model with a ResNet 18 backbone in detecting the back, dorsal, front, left-ear, middle, right-ear and tail where AP is the average precision per class and mAP is the mean average precision across all classes.Table 3
[0170] Detecting the individual body parts allows welfare indicators (e.g., lesions etc.) to be more easily detected. Specifically, certain welfare indicators will appear on certain parts of the body. Furthermore, being able to identify where the welfare indicators are occurring on the pig carcass provides greater diagnostic capabilities for the system 700 to provide a useful tool for animal management.
[0171] The welfare indicator detection module 704 is configured to use computer vision techniques, such as, but not limited to, classification and / or segmentation techniques, to automatically detect and assess one or more animal welfare indicators. For each welfare indicator, the welfare indicator detection module 704 may comprise a detection module 708, 710, 712, 714 that is configured to use computer vision techniques to identify and assess the welfare indicator based on one or more of the identified sections. In some cases, the welfare indicator detection module 704 may be configured to detect and assess one or more of the following welfare indicators: skin lesions, hernias, tail lesions, and tail length. In such cases, the welfare indicator detection module 704 may comprise a skin lesion detection module 708, a hernia detection module 710, a tail lesion detection module 712 and / or a tail length detection module 714. Example methods and systems for detecting and assessing each of these welfare indicators are described below.
[0172] In some cases, the system 700 may also comprise a diagnostics module 716 which may be configured to generate welfare data or statistics on, for example, a per pig carcass basis or on a per farm basis based on the detected indicators and the assessment thereof.
[0173] This data can be used to establish how the pork industry is performing to address common welfare challenges, such as tail biting, and in their management of the animals, as indicated from aggression lesions, tail length, etc. This information can be used at regional or national levels to collect industry wide data, from which to set targets for continual improvements and to be used to inform public policy and verify standards for animal care. Collected on a batch level, this information can provide feedback to individual farms to review management, and to also benchmark farms to support targets for improvement. Veterinarians can work with their farm clients to support improvement, and this data can be used by head vets in the abattoir and abattoir personnel to evaluate animal handling and mixing practices in pre-slaughter handling.Skin Lesions
[0174] As described above, in some cases, the welfare indicator detection module 704 may comprise a skin lesion detection module 708 that is configured to detect skin lesions on a pig carcass and assess the severity of the detected skin lesions. Skin lesions are widely recognized as a key animal-based indicator of welfare, particularly in pigs, as they are often linked to aggression, overcrowding, or rough handling during transport.
[0175] In some cases, the skin lesion detection module 708 may be configured to identify skin lesions on sections of the pig carcass and determine the severity of the skin lesions based on the number of detected lesions and / or a size or depth of each lesion. For example, the skin lesion detection module 708 may be configured to assign a lesion severity score of 0 if the skin lesion detection module 708 detects no more than 1 lesion, a lesion severity score of 1 if the skin lesion module detects between 2 and 5 lesions, a lesion severity score of 2 when the module detects between 6 and 10 lesions, and a score of 3 if the module detects 11 or more lesions. FIG. 10 shows an image 1002 of an example pig carcass that was assigned a lesion severity score of 0, an image 1004 of an example pig carcass that was assigned a lesion severity score of 1 , an image 1006 of an example pig carcass that was assigned a lesion severity score of 2, an image 1008 of an example pig carcass that was assigned a lesion severity score of 3. However, testing has shown that in some cases, determining the skin lesion severity in this manner may be prone to inaccuracies due to occlusions, overlapping lesions, and variability in lesion size and shape. Moreover, lesion count alone may not reliably capture the overall extent of skin damage, which may provide a more meaningful metric in terms of animal welfare.
[0176] In other cases, to overcome one or more deficiencies with determining the lesion severity based on the number of skin lesions detected, the skin lesion detection module 708 may be configured to identify skin lesions on one or more sections of the pig carcass (or on the whole body) and assign a skin lesion rating or score to the section / body based on a skin lesion ratio for the section / body - i.e. , the ratio of skin lesion area to total visible skin in the section / body.
[0177] In one example implementation the skin lesion detection module 708 may be configured to use semantic segmentation to separate normal pig skin fromskin with lesions to be able to generate the skin lesion ratio for a section or body. Specifically, in some cases, the skin lesion detection module 708 may be configured to receive a lateral image of a pig carcass and a dorsal image of the pig carcass; segment each received image into normal skin, lesion skin, and background pixels using a semantic segmentation model; and compute at least one skin lesion ratio based on the segmentation of the images.
[0178] Any known semantic segmentation model may be used to implement the semantic segment model of the skin lesion detection module 708. In some cases, the semantic segmentation model of the skin lesion detection module 708 may be a U- Net model with a ResNet-18 backbone, that is pre-trained on ImageNet. U-Net is a convolutional neural network that was developed for image segmentation. Testing has shown that a U-Net model produces consistent and accurate results, effectively segmenting a pig carcass and its lesions.
[0179] Specifically, images of pig carcasses were segmented into normal skin, lesion skin, and background using (1) a U-Net model with a ResNet-18 backbone; and (2) a Segformer model, a transformer-based model. While Segformer achieved strong global metrics, it often failed to isolate the target carcass in multi-carcass images, leading to inaccurate lesion masks and reduced reliability. This may have been because transformer-based models, such as, but not limited to Segformer rely on patch embeddings, which can struggle to capture fine-grained spatial detailed, particularly in small datasets. In contrast, UNet showed more consistent and accurate results (i.e. , accurately segmenting the target carcass and its lesions).
[0180] Specifically, UNet consistently outperformed Segformer in Intersection over Union (loU) across all classes, with scores of 98.23% for background, 95.58% for normal skin and 38.26% for lesions compared to Segformer’ s 92.04%, 89.05% and 33.74%, respectively. UNet also produced more accurate segmentations, avoiding background confusion and false positives commonly seen in Segformer. For example, FIG. 11A shows an original dorsal image of a swine carcass, FIG. 11 B shows the segmentation output when UNet was used to segment the image into background 1102, normal skin 1104 and lesions 1106, and FIG. 11 C shows the segmentation output when Segformer was used to segment the image into background 1108, normal skin 1110 and lesions 1112. It can be seen from FIGS. 11A-11C that Segformerincorrectly includes parts of the background pig carcass, while UNet maintains focus on the correct swine carcass.
[0181] In some cases, the skin lesion detection module 708 is configured to generate, from the output of the semantic segmentation model, a skin lesion ratio for one or more sections of the pig carcass identified by the carcass section detection module 704 as the ratio of pixels of that section corresponding to lesion skin and the number of pixels of that image corresponding to pig skin (i.e. , lesion skin + normal skin). In some cases, the skin lesion detection module 708 may be configured to generate a lesion skin ratio for one or more of the front section (from the lateral image), the middle section (from the lateral image), the back section (from the lateral image), and the dorsal section (from the dorsal image). In some cases, the skin lesion detection module 708 may not generate skin lesion ratios for the tail or for either of the ears. As described in more detail below, lesions on the tail may be detected and scored / assessed in a different manner and testing has shown that due to frequent biting or notching and their small, unreliable surface area it is difficult to accurately assess lesions on the ears.
[0182] In some cases, the skin lesion detection module 708 may be configured to determine the severity of the skin lesions for a section / body by comparing the skin lesion ratio for the section / body to one or more thresholds. For example, a section / body may be deemed to have severe skin lesions if the skin lesion ratio for that section / body exceeds a first threshold, moderate skin lesions if the skin lesion ratio is less than or equal to the first threshold and greater than a second, lower, threshold, and mild skin lesions if the skin lesion ratio is less than or equal to the second threshold. In some cases, pig carcasses with no detected skin lesions may also be classified as having mild skin lesions. In other cases, pig carcasses with no detected skin lesions may be classified differently than pig carcasses with mild skin lesions.
[0183] In some cases, where different skin lesion ratios are generated for different sections of a pig carcass, different threshold(s) may be used for different sections. In some cases, the threshold(s) may be determined statistically. For example, the threshold(s) may be determined by analyzing the mean and standard deviation of skin lesion ratios across training and validation sets. In particular, for example sets of training and validation sets in the dorsal section, mild cases had amean ratio of 0.8% (standard deviation = 0.37), while severe cases averaged 4.66% (standard deviation = 2.01). To ensure sensitivity in detecting severe cases, a conservative threshold - e.g., > 2.5% for dorsal severity - set slightly below the severe means may be used. A similar approach may be applied to lateral sections, where severe cases showed higher skin lesion ratios (e.g., 11.89% mean, 8.35 standard deviation). Example thresholds selected in this manner from example training and validation sets are shown in Table 4.Table 4
[0184] To evaluate lesion severity, two videos were generated from footage from a slaughterhouse for over a year capturing pig carcasses as they passed on a hanging rail: a three-minute lateral view and a seven-minute dorsal view. Each video was designed to show pig carcasses with different skin lesion severities. Each video was divided into sections as similar as possible for each severity type. The lateral dataset was imbalanced due to fewer severe cases, while the dorsal dataset was more balanced. For both views, the detection of any lesions and classification (on a per pig carcass basis vs a per section basis) across three severity levels: mild, moderate and severe were assessed. Tables 5-8 summarize the classification results, including accuracy, precision, recall, F1 -score and support (i.e., the number of true samples per class used for evaluation), where “W. Mean” indicates the weighted average, accounting for class imbalance.Table 5Table 6Table 7Table 8Hernia
[0185] As described above, in some cases, the welfare indicator detection module 704 may comprise a hernia detection module 710 that is configured to detect, from the dorsal and / or lateral images of pig carcass, hernias in the pig carcass and assess the severity of any detected hernias. Hernia are important welfare indicators in swine production, as they may be associated with pain, impaired mobility, and increased susceptibility to infections. At the abattoir level, visual inspection of the groin and umbilical regions can reveal the presence of hernias, providing retrospective insight into the animal’s welfare during the growing phase.
[0186] In some cases, the hernia detection module 710 may be configured to detect, from the lateral image of a pig carcass or from the middle section of a pig carcass (as detected from the lateral image of a pig carcass), a deviation or bump that indicates that the pig had a hernia and assign a hernia severity based on the size of the deviation or bump relative to the diameter of an orange. For example, the hernia detection module 710 may assign a hernia severity of mild if it detects a small hernia bump (e.g., < 10cm) and a hernia severity of severe if it detects a very large hernia bump (e.g., > 10 cm). FIG. 12A shows an image of an example pig carcass with a small hernia 1202 (which may be assigned a hernia severity of mild) and FIG. 11 B shows an image of an example pig carcass with a large hernia 1204 (which may be assigned a hernia severity of severe).
[0187] In some cases, the hernia detection module 710 may be configured to detect and assess the severity of a hernia in a pig carcass using an objection detection model that is trained to detect two classes - “hernia mild” and “hernia severe” in lateralimages of pig carcasses. As described above, object detection models are artificial intelligence models configured to receive an image and determine if the image contains a specific object and if so, where that object is in the image. Using an objection detection model to detect hernias and assess the severity thereof provides fast and objective evaluation at processing facilities.
[0188] There are many known object detection models, such as, but not limited to, YOLO (you only look once) models, Detectron2 models, EfficientDet, SSD (single shot multi-box detector) models, and Faster R-CNN (convolutional neural network) models. The object detection model of the hernia detection module 710 may be implemented by any suitable object detection model. In some cases, the object detection model of the hernia detection module 710 may be implemented by a YOLO object detection model owing to its real-time efficiency, ability to accurately detect a wide variety of objects in a single pass of the image, and high scalability enabling adaption to various image sizes and resolutions. In some cases, the object detection model of the hernia detection module 710 may be implemented by a YOLO v4 model with ResNet-18 as its backbone. The backbone of a YOLO v4 model acts as the feature extraction network that computes feature maps from the input images.
[0189] A hernia detection module 710 with an objection detection module (YOLO with a ResNet-18 backbone) trained to detect two classes “hernia mild”, “hernia severe” in lateral images of pig carcasses was evaluated by creating a 1 -minute video featuring 16 pig carcasses; 9 with mild hernias and 7 with severe hernias. For each pig carcass, multiple detections were gathered while the carcass was in the lateral or dorsal positions, and the frame with the highest hernia confidence score was selected. The predicted class and the corresponding image were then retained for evaluation. Tables 9 and 10 summarize the confusion matrix and classification metrics respectively for mild and severe hernia cases, wherein “W. Mean” indicates the weighted average, accounting for class imbalance and n indicates the number of true samples per class in the confusion matrix. It can be seen that the hernia detection module 710 achieved perfect precision and correctly identified all severe cases, with two mild cases missed, resulting in a weighted F1 -score of 0.93.Table 9Table 10Tail Lesions
[0190] As described above, in some cases, the welfare indicator detection module 704 may comprise a tail lesion detection module 712 that is configured to detect, from the dorsal and / or lateral images of pig carcass, lesions in the tail of the pig carcass and assess the severity of any detected lesions. Tail lesions are important indicators of welfare issues such as tail biting, which leads to inflammation and necrosis.
[0191] In some cases, the tail lesion detection module 712 may be configured to detect, and evaluate the severity of, lesions on the tail in a similar manner as detecting, and evaluating the severity of, skin lesions by processing the image of the tail (as identified by the carcass section detection module 702) using a semantic segmentation model to segment the image into background, normal skin and lesions; determining the tail skin lesion ratio as the ratio of the number of lesion pixels in the tail divided by the total number of tail pixels (normal skin + lesion); and comparing the tale skin lesion ratio to one or more thresholds to determine the severity of the tail lesions. However, testing has shown that in some cases this method of assessing the severity of tail lesions may be insufficient to reliably classify the severity of tail lesions.
[0192] Accordingly, in other cases, to improve discrimination, the tail lesion detection module 712 may be configured to, as shown in FIG. 13A, after the tail image 1302 is processed by a sematic segmentation model to generate a segmentation map 1304 that segments the tail image into background 1306, normal skin 1308 and lesions 1310, the pixels identified as lesions 1310 in the segmentation map 1304 are classified as either necrotic lesions 1312 or low-grade lesions 1314 based on colour; the necrotic lesion ratio (i.e. , the ratio of necrotic pixels to total tail pixels (normal skin + lesions)) and the low-grade lesion ratio (i.e., the ratio of low-grade lesion pixels to total tail pixels (normal skin + lesions)) are then computed; and the tail is classified as having one of severe, mild and no lesions based on the necrotic and low-grade lesion ratios.
[0193] In some cases, the pixels identified as lesions in the segmentation map 1204 may be classified as either necrotic lesions or low-grade lesions based on the value (V) channel of the HSV colour space. For example, a pixel identified as a lesion may be classified as necrotic if the V channel is below a V threshold and classified as a low-grade lesion otherwise. The HSV color space, also known as Hue, Saturation, Value, is a way to represent colors that is often more intuitive for humans than RGB (Red, Green, Blue). It separates color into three components: hue, which is the type of color (like red, green, blue), saturation, which is the intensity or purity of the color, and value, which is the brightness or darkness of the color (a value of 0 is black, and as the value increases, the color becomes lighter). This representation separates colour from brightness, making lesion features more discernible. Among HSV channels, the V channel was found to provide the clearest distinction between severity levels. Specifically, severe (necrotic) lesions had consistently lower V values, while mild (low-grade) lesions had higher ones. By classifying lesions based on the V value, lesions are classified by intensity into reddish (low-grade) and blackish (necrotic) areas.
[0194] In some cases, the V threshold may be determined empirically - e.g., by analyzing the distribution of V values in dorsal images of pig carcasses. For a set of test dorsal images, by sweeping thresholds from 0 to 255, it was determined that 114 was an optimal V threshold, minimizing classification error against the ground truth (reference labels provided by human experts). FIG. 14 illustrates this distribution with a dashed line 1402 marking the threshold between severe cases 1404 and mild cases 1406, wherein 1408 is the intersection of the distributions.
[0195] Testing has shown that high necrosis generally indicates severe lesions and if necrosis was low, redness above a threshold indicates mild lesions. Accordingly, in some cases, severity of any tail lesions may be determined through a two-step thresholding process. For example, as shown in FIG. 13B, tails with a necrotic lesion ratio above a necrotic threshold may be classified as having severe lesions. Tails with a necrotic lesion ratio below the necrotic threshold, but a low-grade lesion ratio above a low-grade threshold may be classified as having mild lesions, and all other cases the tail may be classified as having no lesions deeming any identified lesions a simply being superficial marks or noise.
[0196] In some cases, one or more of the thresholds may be determined empirically. For example, to determine the necrotic threshold, the necrotic ratio in a number of dorsal tail images may be computed and the average for tails with severe lesions and the average for tails with mild lesions may be determined and the necrotic threshold may be selected as a value between the two averages. For an example set of dorsal tail images mild and severe lesion cases show average ratios of 0.025 and 0.173 respectively. In some cases, a necrotic threshold of 0.099 may be selected to separate them. In other cases, the necrotic threshold may be conservatively lowered by 50% to prioritize sensitivity.
[0197] T esting showed that a tail lesion detection module which implements the tail lesion detection and severity method shown in FIGS. 13A and 13B achieved strong overall accuracy (87%), reflecting consistent classification performance across normal, mild and severe tail lesion categories. Tables 11 and 12 summarize the confusion matrix and classification metrics respectively for normal, mild and severe tail lesion cases, wherein “W. Mean” indicates the weighted average, accounting for class imbalance.Table 11Table 12Tail Length
[0198] As described above, in some cases, the welfare indicator detection module 704 may comprise a tail length detection module 712 that is configured to detect, from the lateral image of a pig carcass, the length of the pig carcass’s tail. Tail length is a valuable indicator in swine welfare studies, as shortened tails may be the result of tail docking or severe tail biting, both with implications for animal well-being. Tail biting is a common damaging behavior among pigs, often associated with environmental stressors, lack of enrichment, or high stocking density and lead to pain, inflammation, infection and is associated with increased incidence of disease and abscesses in carcasses. To mitigate these outcomes, tail docking is widely used in the swine industry as a preventative measure. However, this practice remains controversial due to animal welfare concerns and regulatory restrictions in certain regions. Additionally, how short the tail is docked is of importance to pig welfare, impacting acute and potentially chronic pain in the tail. In particular, 99% of pigs farmed are tail docked, but knowing how short they are docked can also indicate if docking practices are too severe, and likely also indicates a larger problem of severe tail biting if tails are docked so short.
[0199] In some cases, the tail length detection module 712 may be configured to determine the tail length of a pig carcass from an image of the tail obtained from the lateral view image of the pig carcass via a multi-step process that comprises segmentation, skeletonization, outlier removal, and / or curve fitting. For example, as shown in FIG. 15, the tail length detection module 712 may be configured to receive an image of the tail 1502 of a pig carcass identified by the carcass section detection module from the lateral image 120 of the pig carcass and process the image of the tail 1502 using a semantic segmentation model to generate a segmentation map 1504 that segments the image into background 1503 and tail 1505. Once the tail has been segmented, a skeletonization algorithm is applied to the area of pixels identified as forming the tail to extract the medial axis 1506 of the tail, preserving the central structure. A skeletonization algorithm is a computer vision technique that reduces a shape or object in an image to a thin, one-pixel-wide representation (its “skeleton”) while preserving its overall structure and connectivity. In this case, it retains only the central part of the tail, effectively capturing its “backbone.”
[0200] In some cases, as shown in FIG. 15, a filtering method may be applied to the identified medial axis 1506 to remove one or more outliers 1508 therefrom. In some cases, Linear Regression is used to identify and remove outliers 1508 from the medial axis 1506. In other cases, Random Sample Consensus (RANSAC) may be used to identify and remove outliers 1508. In yet other cases, Principal Component Analysis (PCA) is used to identify and remove outliers 1508 from the medial axis 1506. In some cases, PCA may be preferred due to its robust performance, computational efficiency, and ease of implementation.
[0201] In some cases, as shown in FIG. 15, after outliers have been removed, if key terminal points 1510, such as but not limited to, the tail base or tip, are lost in the filtering process they may be re-introduced to ensure continuity. In some cases, the tail base and / or tip may be identified using horizontal mask covers. For example, the row comprising the tale base may be identified as the first row with at least 40% coverage (i.e. , at least 40% of the row is identified in the segmentation map 1504 as being part of the tail) and the row comprising the tail tip may be identified as the last row with at least 10% coverage (i.e., at least 20% of the row is identified in the segmentation map 1504 as be part of the tail). Then if a point on the identified medialaxis 1506 in the tail row or tip row is removed as an outlier 1508 then that point is added back.
[0202] The tail length is then estimated from the medial axis 1506 or modified medial axis (after filtering to remove outliers 1508 and / or the re-introduction of key terminal points 1510). In some cases, the tail length may be estimated from the length of the medial axis 1506 or the modified medial axis. In other cases, as shown in FIG. 15, the tail length may be estimated by fitting the medial axis 1506 or the modified medial axis to a polynomial curve 1512 and estimating the tail length from the length of the curve 1512. Example curve fitting methods include, but are not limited to, polynomial regression and cubic spline fitting. Polynomial regression uses a single polynomial equation to fit the data. Cubic splines, on the other hand, use multiple polynomial segments joined together at “knots” allowing for more complexity in capturing complex curves. Testing has shown that although splines provided smoother curves, in some cases the polynomial model was faster and yielded slightly more accurate length estimates. The tail length may be measured in pixels.
[0203] In some cases, the tail length detection module 712 may be configured to automatically convert pixel measurements into real world measurement (e.g., centimeters) to enable consistent tail length estimation regardless of the distance between the pig carcass and the camera, ensuring practical applicability in abattoir conditions. In some cases, as shown in FIG. 16, a pixel to cm conversion ratio may be estimated as the ratio of the length of an average carcass (in cm), Wcm, and the number of pixels Wpxof the carcass bounding box; and the real world length of a tail may be equal to the pixel length multiplied by the conversion ratio.
[0204] T able 13 summarizes the mean squared error (MSE) and mean absolute error (MAE) for different tail length estimation methods - bounding box main diagonal (i.e. , the length of the diagonal of the bounding box surrounding the tail), tail skeleton length (i.e., the length of the medial axis 1406), polynomial curve of medial axis 1406, spline interpolation of media axis 1406, and PCA-filtered medial axis + polynomial regression. All the evaluations were performed in pixels to ensure internal consistency.Table 13
[0205] It can be seen that the combination of PCA filtered skeleton points with polynomial regression significantly outperformed simpler approaches such as bounding box diagonal and raw skeleton length. FIGS. 17 and 18 show the tail length estimation results. Specifically, FIG. 17 provides a visual comparison of predicted tail paths using the different methods, and FIG. 18 is a scatter plot of the predicted versus actual lengths. It can be seen from FIG. 18 that the PCT-filtered skeleton with polynomial regression provides the closest match to ground truth.Other Welfare Indicators
[0206] In some cases, the welfare indicator detection module 704 may be configured to detect one or more other types of welfare indicators.
[0207] For example, in some cases, the welfare indicator detection module 704 may be configured to detect lesions and other deformities with a pig’s ears and determine the severity of any detected lesions or deformities. FIGS. 19A, 19B and 19C show images of example pig ears with severe deformities, severe lesions and mild lesions respectively.
[0208] In some cases, the welfare indicator detection module 704 may be configured to detect lesions or markings that indicate that the pig suffered from frostbite and assess the severity of any frostbite. For example, the welfare indicator detection module 704 may categorize the frostbite as mild if the module detects frostbite lesions or markings on 20% of the lateral side of the pig carcass and may categorize the frostbite as severe if the module detects frostbite lesions or markingson more than 20% lateral side of the pig carcass. FIG. 20A shows an image of an example pig carcass wherein frostbite markings 2002 cover 20% of the lateral side thereof (which may be categorized as mild), and FIG. 20B shows an image of an example pig carcass wherein frostbite markings 2004 cover more than 20% of the lateral side thereof (which may be categorized as severe).
[0209] In some cases, the welfare indicator detection module 704 may be configured to identify and tabulate different types of skin lesions. For example, in addition to identifying fresh skin lesions, the welfare indicator detection module 704 may also be configured to detect and tabulate one or more of: old skin lesions, human handling lesions, and loin bruises. FIG. 21A shows an image of an example pig carcass with an old skin lesion 2102, FIG. 21 B shows an image of an example pig carcass with a human handling lesion 2104, and FIG. 21 C shows an image of an example pig carcass with a loin bruise 2106.Training and Testing of the System of FIG. 7
[0210] In one example, all models (classification, object detection, segmentation) in the system of FIG. 7 were trained using the NVIDIA TAO toolkit, YOLOv4 with a ResNet-18 backbone was used to implement objection detection models due to its compatibility with TensorRT and DeepStream. Semantic segmentation models were implemented a U-Net model with a ResNet-18 backbone. The dataset splits between training, validation and test were: skin lesion and tail segmentation (70 / 15 / 15) and hernia detection (80 / 10 / 10).
[0211] YOLOv4 models were trained for 80 epochs (batch size 8) using Adam (s = le - 7). L1 regularization (3e-5), and cosine annealing (Ir: 10'7to 10'4). Loss terms were equally weighted; augmentations included mosaic, jitter, and horizontal flip. Models were pruned with intersection-based equalization (0.1 threshold) and retrained without regularization.
[0212] U-Net models were trained on 320x320 images for 50 epochs (batch size 3) using Adam (s = le - 8), L2 regularization (2e-5), and cross-entropy loss. Augmentations included flip, crop-resize, and brightness changes. Pruning used union-based equalization (0.6 threshold) followed by retraining.
[0213] The system’s computational efficiency and model complexity were assessed to verify its real-time suitability in industrial settings. The evaluation focusedon model size, resource usage, and inference speed (frames per second (FPS)) during continuous video processing.
[0214] Table 14 summarizes the number of parameters in millions (M) for each pruned model component. The system of FIG. 7 comprises six deep learning models - primarily YOLOv4 and U-Net architectures with CSPDarknet19 or ResNet18 backbones - optimize for efficient inference. This modular design balances accuracy and computational cost, enabling real-time processing in industrial settings. The pruning process significantly reduced model size without sacrificing performance.Table 14
[0215] Runtime memory usage averaged approximately 6.5 GB dominated by loaded models. This footprint allows efficient operation on modern GPUs with at least 8 GB of RAM, supporting practical deployment in real-world industrial environments.
[0216] To assess the runtime efficiency of FIG. 7, a series of six independent tests were conducted using a two-and-a-half minute evaluation video encoded in H.264 format. The video was processed via a DeepStream-based pipeline to emulate a real-time video stream, representative of an industrial deployment scenario.
[0217] For each run, the average frames per second (FPS) were recorded and the mean and standard deviation of the FPS were computed. Subsequently, the results were averaged across all tests to obtain consolidated performance indicators.
[0218] The system achieved an average processing speed of 30.31 FPS, with a corresponding variability (standard deviation) of 7.01 FPS. This remains well within real-time operational thresholds, confirming its suitability for continuous video monitoring in slaughterhouse environments.Example Methods
[0219] Reference is now made to FIG. 22 which illustrates a flow diagram of an example method 1600 for detecting pig carcasses on a slaughter line and capturing both dorsal and lateral view images thereof which may be implemented, for example, by the system 100 of FIG. 1 . The method 2200 begins at block 2202 where, for each original image of a sequence of original images of the slaughter line, swine carcasses are detected in that original image using a primary object detection model (e.g., the primary object detection model 104 of FIG. 1 ) and for each detected swine carcass an image of the swine carcass is identified from the original image. As described above, the primary object detection model may be trained to detect a single class - “pig”. The image of the pig carcass that is identified from the original image may be the portion of the original image corresponding to the bounding box identified by the primary object detection model 104.
[0220] At block 2204, pig carcasses are tracked through the sequence of original images using a multi-object tracking module (e.g., tracking module 106 of FIG. 1 ) and each image of a pig carcass identified in block 2202 is assigned an identifier such that pig carcass images that relate to the same pig carcass are assigned the same identifier. As described above, the identifiers associated with the images of the pig carcasses can be used to group or identify images of pig carcasses that relate to the same pig carcass.
[0221] At block 2206, for each detected pig carcass, the orientation of an anatomical region or part is detected from the image of that pig carcass using a secondary object detection model to determine whether the image of the pig carcass presents a lateral view or a dorsal view of the pig carcass. In one example, the orientation of the tail of the pig carcass may be detected - e.g., whether the tail is in a side or lateral orientation or in a back or dorsal orientation. In such cases, the secondary object detection model 108 may be configured to detect at least two classes - “tail side”, and “tail back”.
[0222] At block 2208, for each different swine carcass detected, first and second images forthat swine carcass are selected from the images of that pig carcass (e.g., identified by the same identifier) based on the anatomical part orientation detections in block 2206, wherein the first image provides a dorsal view of the pig carcass, and the second image provides a lateral view of the swine carcass. Specifically, the anatomical part orientation detections can be used to identify which images of that swine carcass present a lateral view of the pig carcass and which images of that swine carcass present a dorsal view of the pig carcass. Then, one of the images that presents a dorsal view of that swine carcass can be selected and one of the images that presents a lateral view of that swine carcass can be selected. The selected first and second images may then be output.
[0223] As described above, in some cases, selecting the first and second images for a pig carcass may comprise storing all the images corresponding to that same pig carcass in a set of one or more queues associated with that pig carcass and selecting the dorsal view and lateral view images for that pig carcass from the set of queues associated with that pig carcass. As described above, some queues may be used to store lateral view images and other queues may be used to store dorsal view images. Any of the queue techniques described above with respect to FIG. 1 may be used to implement block 2208.
[0224] As described above, it has been identified that in certain situations, the secondary objection detection model may struggle to identify the tail of the pig carcass in some cases (e.g., when the pig tail has been severely bitten or obstructed). Accordingly, in some cases, in block 2206 the secondary object detection model may also be used to identify the head of each detected pig carcass and identify the image of the head, and the method 2200 may comprise an additional block, block 2210, where the orientation of the head (whether the head is in a side or lateral orientation or in a back or dorsal orientation) is detected from the image of the head, using a classification model (e.g., classification model 110 of FIG. 1 ). In such cases, the secondary object detection model may be trained to detect at least three class - “head”, “tail side” and “tail back”, and the classifier model may be trained to detect at least two classes - “head side” and “head back”.
[0225] As described above, it has been determined that in some situations training the classification model on only two classes - “head back” (for the dorsal view)and “head side” (for the lateral view) - resulted in heads in a front position being misclassified into one of these categories. Accordingly, in some cases, the classification model may be trained to detect three classes - “head back” (for the dorsal view), “head side” (for the lateral view) and “head underside” (for the ventral view). It was found that adding this third - “head underside” class - reduced the number of incorrect classifications.
[0226] In other cases, in block 2206 the secondary object detection model may also be used to detect the orientation of the tail of the pig carcass and the orientation of the head of the pig cases. In such cases, the secondary object detection model may be trained to detect at least four class - “tail side” “tail back”, “head side” and “head back”.
[0227] In both cases the head detection and classification serve as an auxiliary or backup mechanism to determine whether an image presents a dorsal or lateral view of the pig carcass for situations where the secondary object detection model 108 is unable to detect the tail of the pig carcass or the orientation thereof.
[0228] Reference is now made to FIG. 23 which illustrates an example method 2300 for automatically assessing the welfare of pigs from their carcasses on a slaughter line, which may, for example, be implemented by the system 700 of FIG. 7. The method 2300 begins at block 2302 where the method 2200 of FIG. 22 is used to identify lateral and dorsal images of the pig carcasses on the slaughter line.
[0229] At block 2304, for each pig carcass for which lateral and dorsal images were identified in block 2302, one or more anatomical parts or sections (e.g., ears, head, dorsal section, rump etc.) of that pig carcass are identified from the lateral and dorsal images of that pig carcass using one or more computer vision techniques. For example, as described above, one or more classification models may be trained and then used to detect the one or more anatomical parts.
[0230] At block 2306, welfare indicators (e.g., lesions etc.) in the identified anatomical parts or sections are automatically detected and analyzed (e.g., scored) using computer vision techniques. Example techniques for identifying and scoring / assessing welfare indicators on a pig carcass using computer vision techniques were described above.
[0231] Reference is now made to FIG. 24 which illustrates a simplified block diagram of an example computer 2400. Computer 2400 is an example implementation of a computer which may be used to implement all or a part of the systems 100, 700 of FIGS. 1 and 7 and methods 2200, 2300 of FIGS. 22 and 23. Computer 2400 has at least one processor 2402 operatively coupled to at least one memory 2404, at least one communications interface 2406 (also referred to herein as a network interface), and at least one input / output (I / O) device 2408.
[0232] The at least one memory 2404 includes a volatile memory that stores instructions executed or executable by the processor 2402, and input and output data used or generated during execution of the instructions. The memory 2404 may also include non-volatile memory used to store input and / or output data - e.g., within a database - along with program code containing executable instructions.
[0233] The processor 2402 may transmit or receive data via the communications interface 2406 and may also transmit or receive data via any additional input / output device 2408 as appropriate.
[0234] In some cases, the processor 2402 includes a system of central processing units (CPUs) 2410. In other cases, the processor 2402 includes a system of one or more CPUs 1810 and one or more Graphical Processing Units (GPUs) 2412 that are coupled together. For example, the primary objection detection model 104, the secondary object detection model 108 and / or the classification model 110 may execute neural network computations on CPU and GPU hardware, such as the system of CPUs 2410 and GPUs 2412 of FIG. 24.
[0235] Various systems or processes have been described to provide examples of embodiments of the claimed subject matter. No such example embodiment described limits any claim and any claim may cover processes or systems that differ from those described. The claims are not limited to systems or processes having all the features of any one system or process described above or to features common to multiple or all the systems or processes described above. It is possible that a system or process described above is not an embodiment of any exclusive right granted by issuance of this patent application. Any subject matter described above and for which an exclusive right is not granted by issuance of this patent application may be the subject matter of another protective instrument, for example, a continuing patentapplication, and the applicants, inventors or owners do not intend to abandon, disclaim or dedicate to the public any such subject matter by its disclosure in this document.
[0236] For simplicity and clarity of illustration, reference numerals may be repeated among the figures to indicate corresponding or analogous elements. In addition, numerous specific details are set forth to provide a thorough understanding of the subject matter described herein. However, it will be understood by those of ordinary skill in the art that the subject matter described herein may be practiced without these specific details. In other instances, well-known methods, procedures, and components have not been described in detail so as not to obscure the subject matter described herein.
[0237] The terms “coupled” or “coupling” as used herein can have several different meanings depending in the context in which these terms are used. For example, the terms coupled or coupling can have a mechanical, electrical or communicative connotation. For example, as used herein, the terms coupled or coupling can indicate that two elements or devices are directly connected to one another or connected to one another through one or more intermediate elements or devices via an electrical element, electrical signal, or a mechanical element depending on the particular context. Furthermore, the term “operatively coupled” may be used to indicate that an element or device can electrically, optically, or wirelessly send data to another element or device as well as receive data from another element or device.
[0238] As used herein, the wording “and / or” is intended to represent an inclusive-or. That is, “X and / or Y” is intended to mean X or Y or both, for example. As a further example, “X, Y, and / or Z” is intended to mean X or Y or Z or any combination thereof.
[0239] T erms of degree such as "substantially", "about", and "approximately" as used herein mean a reasonable amount of deviation of the modified term such that the result is not significantly changed. These terms of degree may also be construed as including a deviation of the modified term if this deviation would not negate the meaning of the term it modifies.
[0240] Any recitation of numerical ranges by endpoints herein includes all numbers and fractions subsumed within that range (e.g., 1 to 5 includes 1 , 1 .5, 2, 2.75, 3, 3.90, 4, and 5). It is also to be understood that all numbers and fractions thereof arepresumed to be modified by the term "about" which means a variation of up to a certain amount of the number to which reference is being made if the result is not significantly changed.
[0241] Some elements herein may be identified by a part number, which is composed of a base number followed by an alphabetical or subscript-numerical suffix (e.g., 112a, or 112i). All elements with a common base number may be referred to collectively or generically using the base number without a suffix (e.g. , 112).
[0242] The systems and methods described herein may be implemented as a combination of hardware or software. In some cases, the systems and methods described herein may be implemented, at least in part, by using one or more computer programs, executing on one or more programmable devices including at least one processing element, and a data storage element (including volatile and non-volatile memory and / or storage elements). These systems may also have at least one input device (e.g., a pushbutton keyboard, mouse, a touchscreen, and the like), and at least one output device (e.g., a display screen, a printer, a wireless radio, and the like) depending on the nature of the device. Further, in some examples, one or more of the systems and methods described herein may be implemented in or as part of a distributed or cloud-based computing system having multiple computing components distributed across a computing network. For example, the distributed or cloud-based computing system may correspond to a private distributed or cloud-based computing cluster that is associated with an organization. Additionally, or alternatively, the distributed or cloud-based computing system be a publicly accessible, distributed or cloud-based computing cluster, such as a computing cluster maintained by Microsoft Azure™, Amazon Web Services™, Google Cloud™, or another third-party provider.
[0243] Some elements that are used to implement at least part of the systems, methods, and devices described herein may be implemented via software that is written in a high-level procedural language such as object-oriented programming language. Accordingly, the program code may be written in any suitable programming language such as Python or Java, for example. Alternatively, or in addition thereto, some of these elements implemented via software may be written in assembly language, machine language or firmware as needed. In either case, the language may be a compiled or interpreted language.
[0244] At least some of these software programs may be stored on a storage media (e.g., a computer readable medium such as, but not limited to, read-only memory, magnetic disk, optical disc) or a device that is readable by a general or special purpose programmable device. The software program code, when read by the programmable device, configures the programmable device to operate in a new, specific, and predefined manner to perform at least one of the methods described herein.
[0245] Furthermore, at least some of the programs associated with the systems and methods described herein may be capable of being distributed in a computer program product including a computer readable medium that bears computer usable instructions for one or more processors. The medium may be provided in various forms, including non-transitory forms such as, but not limited to, one or more diskettes, compact disks, tapes, chips, and magnetic and electronic storage. Alternatively, the medium may be transitory in nature such as, but not limited to, wire-line transmissions, satellite transmissions, internet transmissions (e.g., downloads), media, digital and analog signals, and the like. The computer usable instructions may also be in various formats, including compiled and non-compiled code.
[0246] While the above description provides examples of one or more processes or systems, it will be appreciated that other processes or systems may be within the scope of the accompanying claims.
[0247] To the extent any amendments, characterizations, or other assertions previously made (in this or in any related patent applications or patents, including any parent, sibling, or child) with respect to any art, prior or otherwise, could be construed as a disclaimer of any subject matter supported by the present disclosure of this application, Applicant hereby rescinds and retracts such disclaimer. Applicant also respectfully submits that any prior art previously considered in any related patent applications or patents, including any parent, sibling, or child, may need to be revisited.
Claims
We claim:1 . A system for capturing dorsal and lateral views of swine carcasses for use in automated assessment of animal welfare indicators on the swine carcasses, the system comprising: a primary object detection model configured to, for each original image of a sequence of original images, detect swine carcasses in the original image, and for each detected swine carcass, identify, from the original image, an image of the swine carcass; a multi-object tracker module configured to track swine carcasses through the sequence of original images by assigning an identifier to each image of a swine carcass such that each image of a same swine carcass is assigned a same identifier; a secondary object detection model configured to, for each detected swine carcass, detect, from the image of the swine carcass, an orientation of a tail of the swine carcass; and a detection manager module configured to, for each different swine carcass detected select, based on the tail orientation detections, a first image, from the images of that swine carcass, that provides a dorsal view of the swine carcass and a second image, from the images of that swine carcass, that provides a lateral view of the swine carcass.
2. The system of claim 1 , wherein the secondary object detection model is configured to detect whether the tail of the swine carcass is in one of a back orientation and a side orientation; and wherein the detection manager module is configured to determine that:the image of the swine carcass provides a lateral view of the swine carcass if the secondary objection detection model detects that the tail of the swine carcass is in the side orientation, and the image of the swine carcass provides a dorsal view of the swine carcass if the secondary objection detection model detects that the tail of the swine carcass is in the back orientation.
3. The system of claim 2, wherein: the secondary object detection model is further configured to identify, from the image of the swine carcass, an image of ta head of the swine carcass; the system further comprises a classification model configured to, for each identified swine carcass, detect, from the image of the head of the swine carcass, an orientation of the head of the swine carcass; and the detection manager module is further configured to select the first and second images of the swine carcass from the head orientation detections.
4. The system of claim 3, wherein the classification model is configured to detect whether the head of the swine carcass is in one of a back orientation, a side orientation and an underside orientation.
5. The system of claim 4, wherein the detection manager module is configured to determine that: the image of the swine carcass provides a lateral view of the swine carcass if the classification model detects that the head of the swine carcass is in the side orientation, and the image of the swine carcass provides a dorsal view of the swine carcass if the classification model detects that the head of the swine carcass is in the back orientation.
6. The system of claim 5, wherein the detection manager module comprises a set of queues for each of a plurality of different swine carcasses and the set of queues for a swine carcass comprises one or more dorsal view queues and one or more lateral view queues, and the detection manager module is configured to: when it is determined that the image of the swine carcass presents a dorsal view of the swine carcass, store the image of the swine carcass in at least one of the one or more dorsal view queues for the swine carcass; and when it is determined that the image of the swine carcass presents a lateral view of the swine carcass, store the image of the swine carcass in at least one of the one or more lateral view queues for the swine carcass.
7. The system of claim 6, wherein the detection manager module is configured to select the first image for the swine carcass from the images in the one or more dorsal view queues for that swine carcass and select the second image for the swine carcass from the images in the one or more lateral view queues for that swine carcass.
8. The system of claim 6, wherein the one or more dorsal view queues for the swine carcass comprises a dorsal view tail queue and a dorsal view head queue, and the detection manager module is configured to: when the secondary object detection model detects that the tail of the swine carcass is in the back orientation, store the image for the swine carcass in the dorsal view tail queue; and when the classification model detects that the head of the swine carcass is in the back orientation, store the image of the swine carcass in the dorsal view head queue.
9. The system of claim 8, wherein the detection manager module is configured to select the first image for the swine carcass by: determining if a number of images in the dorsal view tail queue is greater than a predetermined number of images; in response to determining that the number of images in the dorsal view tail queue is more than the predetermined number of images, selecting one of the images in the dorsal view tail queue as the first image; and in response to determining that the number of images in the dorsal view tail queue is equal to or less than the predetermined number of images, selecting one of the images in the dorsal view head queue as the first image.
10. The system of claim 9, wherein the selected image in the dorsal view tail queue or the dorsal view head queue is an image at a certain percentage of images in the dorsal view tail queue or the dorsal view head queue.11 . The system of claim 6, wherein the one or more lateral view queues for the swine carcass comprises one or more lateral view tail queues and one or more lateral view head queues, and the detection manager module is configured to: when the secondary object detection model detects that the tail of the swine carcass is in the side orientation, store the image of the swine carcass in at least one of the one or more lateral view tail queues; and when the classification model detects that the head of the swine carcass is in the side orientation, store the image of the swine carcass in at least one of the one or more lateral view head queues.
12. The system of claim 11 , wherein the one or more lateral view tail queues comprises a lateral view tail up queue and a lateral view tail down queue, the secondary object detection model is configured to identify, from the image ofthe swine carcass, an image of the tail of the swine carcass, and the detection manager module is configured to: determine from the image of the swine carcass and the image of the tail of the swine carcass whether the tail of the swine carcass is in an upper half or a lower half of the image of the swine carcass; when the secondary object detection model detects that the tail of the swine carcass is in the side orientation and the detection manager module detects that the tail is in the upper half of the image of the swine carcass, store the image of the swine carcass in the lateral view tail up queue; and when the secondary object detection model detects that the tail of the detected swine carcass is in the side orientation and the detection manager module detects that the tail is in the lower half of the image of the swine carcass, store the image of the swine carcass in the lateral view tail down queue.
13. The system of claim 12, wherein the one or more lateral view head queues comprises a lateral view head up queue and a lateral view head down queue, and the detection manager module is configured to: determine from the image of the swine carcass and the image of the head of the swine carcass whether the head of the swine carcass is in the upper half or the lower half of the image of the swine carcass; when the classification model detects that the head of the swine carcass is in the side orientation and the detection manager module detects that the head of the swine carcass is in the upper half of the image of the swine carcass, store the image of the swine carcass in the lateral view head up queue; and when the classification model detects that the head of the swine carcass is in the side orientation and the detection manager module detects that the headof the swine carcass is in the lower half of the image of the swine carcass, store the image of the swine carcass in the lateral view head down queue.
14. The system of claim 13, wherein the detection manager module is configured to select the second image for the swine carcass by: determining if a number of images in the lateral view tail up queue is greater than a predetermined number of images; in response to determining that the number of images in the lateral view tail up queue is greater than the predetermined number of images, selecting one of the images in the lateral view tail up queue as the second image for the swine carcass; in response to determining that the number of images in the lateral view tail up queue is equal to or less than the predetermined number of images, determining whether a number of images in the lateral view tail down queue is greater than the predetermined number; in response to determining that the number of images in the lateral view tail down queue is greater than the predetermined number of images, selecting one of the images in the lateral view tail down queue as the second image for the swine carcass; in response to determining that the number of images in the lateral view tail down queue is equal to or less than the predetermined number of images, determining whether a number of images in the lateral view head up queue is greater than the predetermined number of images; in response to determining that the number of images in the lateral view head up queue is more than the predetermined number of images, selecting one of the images in the lateral view head up queue as the second image for the swine carcass; andin response to determining that the number of images in the lateral view head up queue is less than or equal to the predetermined number of images, selecting one of the images in the lateral view head down queue as the second image for the swine carcass.
15. The system of claim 14, wherein the selected image in the lateral view tail up queue or the lateral view head up queue is an image at a first percentage of images in the lateral view tail up queue or the lateral view head up queue; and wherein the selected image in the lateral view tail down queue or the lateral view head down queue is an image at a second, different, percentage of images in the lateral view tail down queue or the lateral view head down queue.
16. The system of any one of claims 1 to 15, further comprising a single camera configured to generate the sequence of original images by capturing images of a plurality of swine carcasses on a line as the plurality of swine carcasses move along the line, the camera positioned at a turn in the line so that the camera captures different views of the plurality of swine carcasses as the plurality of swine carcasses move along the line.
17. The system of any one of claims 1 to 16, further comprising a welfare indicator detection module which is configured to, for each different swine carcass detected, automatically analyze the first and second images for that swine carcass to identify and assess indicators of animal welfare on the swine carcass.
18. The system of claim 17, further comprising a carcass section detection module which is configured to, for each different swine carcass detected, analyze the first and second images for that swine carcass to identify sections of the swine carcass; and the welfare indicator detection module is configured to identify and assess indicators of animal welfare on the swine carcass within each identified section.
19. The system of claim 17 or claim 18, wherein the welfare indicator detection module comprises a skin lesion detection module configured to: for each of the first and second images for a swine carcass: process the image using a skin semantic segmentation model to generate a segmentation map in which each pixel in the image is classified as one of background, normal skin and lesion skin, generate one or more skin lesion ratios for the image based on the segmentation map, and determine a severity of skin lesions by comparing each of the one or more skin lesion ratios to one or more thresholds.
20. The system of claim 19, wherein each skin lesion ratio of the one or more skin lesion ratios for the image is based on pixels in an area of the image.21 . The system of claim 20, wherein each skin lesion ratio of the one or more skin lesion ratios is a ratio of lesion skin pixels in the corresponding area and a total of lesion skin pixels and normal skin pixels in the corresponding area.
22. The system of any of claims 19 to 21 , wherein the skin lesion detection module is further configured to receive information identifying a dorsal area of the first image for the swine carcass that corresponds to a dorsal section of the swine carcass, and the one or more skin lesion ratios for the first image for the swine carcass comprises a skin lesion ratio based on pixels in the dorsal area.
23. The system of any of claims 19 to 22, wherein the skin lesion detection module is further configured to receive information identifying a back area of the second image for the swine carcass that corresponds to a back section of the swine carcass, and the one or more skin lesion ratios for the secondimage for the swine carcass comprises a skin lesion ratio based on pixels in the back area.
24. The system of any of claims 19 to 22, wherein the skin lesion detection module is further configured to receive information identifying a middle area of the second image for the swine carcass that corresponds to a middle section of the swine carcass, and the one or more skin lesion ratios for the second image for the swine carcass comprises a skin lesion ratio based on pixels in the middle area.
25. The system of any of claims 19 to 24, wherein the skin lesion detection module is further configured to receive information identifying a front area of the second image for the swine carcass that corresponds to a front section of the swine carcass, and the one or more skin lesion ratios for the second image for the swine carcass comprises a skin lesion ratio based on pixels in the front area.
26. The system of any of claims 20 to 25, wherein the skin lesion detection module is configured to, for each skin lesion ratio of the one or more skin lesion ratios for the image: determine that skin lesions in the corresponding area are severe if the skin lesion ratio is greater than a first threshold; determine that the skin lesions in the corresponding area are moderate if the skin lesion ratio is equal to or less than the first threshold but greater than a second, lower, threshold; and determine that the skin lesions in the corresponding area are mild if the skin lesion ratio is equal to or less than the second threshold.
27. The system of any of claims 19 to 26, wherein the skin semantic segmentation model is a UNet model with a ResNet backbone.
28. The system of any of claims 17 to 27, wherein the welfare indicator detection module comprises a hernia detection module configured to: process the second image for a pig carcass using a hernia object detection model, wherein the hernia object detection model is configured to detect one or more types of hernia in the image, and, for each detected hernia, output information identifying the hernia in the image and the type of hernia.
29. The system of claim 28, wherein the one or more types of hernia comprises a severe hernia and a mild hernia.
30. The system of claim 29, wherein a severe hernia is a hernia greater than 10cm.31 . The system of claim 28 or 29, wherein a mild hernia is a hernia less than or equal to 10cm.
32. The system of any of claims 28 to 31 , wherein the hernia object detection model is a YOLO model with a ResNet backbone.
33. The system of any of claims 17 to 27, further comprising a carcass section detection module that is configured to generate from the first image for each swine carcass an image of a tail of the swine carcass, and wherein the welfare indicator detection module comprises a tail lesion detection module configured to: process the image of the tail using a tail lesion semantic segmentation model to generate a segmentation map in which each pixel in the image of the tail is classified as one of background, normal skin and lesion skin; classify each lesion skin pixel as either a necrotic lesion or a low-grade lesion based on colour;generate one or more skin lesion ratios for the image of the tail based on the segmentation map and the classification of each lesion skin pixel; and determine a severity of skin lesions on the tail by comparing the one or more skin lesion ratios to one or more thresholds.
34. The system of claim 33, wherein the one or more skin lesion ratios for the image of the tail comprises a necrotic skin lesion ratio and a low-grade lesion ratio.
35. The system of claim 34, wherein the necrotic skin lesion ratio is a ratio of necrotic lesion pixels to a total of normal skin pixels and lesion skin pixels.
36. The system of claim 34 or 35, wherein the low-grade lesion ratio is a ratio of low-grade lesion pixels to a total of normal skin pixels and lesion skin pixels.
37. The system of any of claims 34 to 36, wherein the severity of skin lesions in the tail is determined to be one of severe, mild and no lesions by comparing the necrotic skin lesion ratio and low-grade lesion ratio to the one or more thresholds.
38. The system of claim 38, wherein: if the necrotic lesion ratio is greater than a necrotic threshold, the skin lesions on the tail are determined to be severe; if the necrotic lesion ratio is less than or equal to the necrotic threshold and the low-grade lesion ratio is greater than a low-grade threshold, the skin lesions on the tail are determined to be mild; and if the necrotic lesion ratio is less than or equal to the necrotic threshold and the low-grade lesion ratio is less than or equal to the low-grade threshold, it is determined that there are no skin lesions on the tail.
39. The system of any of claims 33 to 38, wherein each lesion skin pixel is classified as either a necrotic lesion or a low-grade lesion based on a value channel of a HSV colour space.
40. The system of claim 39, wherein each lesion skin pixel is classified as a necrotic lesion if the value channel for that pixel is less than a value threshold and classified as a low-grade lesion if the value channel for that pixel is greater than or equal to the value threshold.41 . The system of any of claims 39 to 46, wherein the tail lesion semantic segmentation model is a UNet model with a ResNet backbone.
42. The system of any of claims 17 to 41 , further comprising a carcass section detection module that is configured to generate from the second image for each carcass an lateral image of a tail of the swine carcass, and wherein the welfare indicator detection module comprises a tail length detection module configured to: process the lateral image of the tail using a tail semantic segmentation model to generate a segmentation map in which each pixel in the image is classified as one of background and tail; apply a skeletonization algorithm to the pixels classified as tail in the segmentation map to generate a medial axis of the tail; and determine a length of the tail from the medial axis of the tail.
43. The system of claim 42, wherein determining the length of the tail from the medial axis of the tail comprises processing the medial access using a filtering algorithm to identify and remove outliers from the media axis to generate a filtered medial axis.
44. The system of claim 43, wherein the filtering algorithm is principal component analysis.
45. The system of claim 43 or 44, wherein determining the length of the tail from the medial axis of the tail further comprises determining if one or more key terminal points were removed as outliers, and if it is determined that one or more key terminal points were removed as outliers, adding the one or more key terminal points to the filtered medial axis to generate a corrected and filtered medial axis.
46. The system of claim 45, wherein the one or more key terminal points comprises a tale base and / or a tail tip.
47. The system of claim 46, wherein the tail base is identified as being a pixel in the medial axial in a first row of the lateral image of the tail in which a first predetermined percentage of the row is identified in the segmentation map as being tail.
48. The system of claim 46 or 47, wherein the tail tip is identified as being a pixel in the medial axis in a last row of the lateral image of the tail in which a second predetermined percentage of the row is identified in the segmentation map as being tail.
49. The system of any of claims 45 to 48, wherein determining the length of the tail from the medial axis of the tail further comprises fitting the corrected and filtered medial axis to a polynomial curve.
50. The system of claim 49, wherein the corrected and filtered medial axis is fitted to a polynomial curve using polynomial regression.51 . The system of claim 49 or claim 50, wherein determining the length of the tail from the medial axis of the tail further comprises determining the length of the tail to be a length of the polynomial curve.
52. The system of any of claims 45 to 48, wherein determining the length of the tail from the medial axis of the tail further comprises determining the length of the tail to be a length of the corrected and filtered media axis.
53. The system of claim 43 or claim 44, wherein determining the length of the tail from the medial axis of the tail further comprises determining the length of the tail to be a length of the filtered medial axis.
54. The system of claim 42, wherein the tail length detection module is configured to determine the length of the tail to be a length of the medial axis.
55. A computer-implemented method of capturing dorsal and lateral views of swine carcasses for use in automated assessment of animal welfare indicators on the swine carcasses, the method comprising, at one or more processors: for each original image of a sequence of original images, detecting, using a primary object detection model, swine carcasses in the original image, and for each detected swine carcass, identifying, from the original image, an image of the swine carcass; tracking, using a multi-object tracker module, swine carcasses through the sequence of original images by assigning an identifier to each image of a swine carcass such that each image of a same swine carcass is assigned a same identifier; for each detected swine carcass, detecting, using a secondary object detection model, an orientation of a tail of the swine carcass from the image of the swine carcass; and for each different swine carcass detected, selecting, based on the tail orientation detections, a first image, from the images of that swine carcass, that provides a dorsal view of the swine carcass and a second image, fromthe images of that swine carcass, that provides a lateral view of the swine carcass.
56. A non-transitory computer readable medium storing computer executable instructions which, when executed by a computer processor, cause the computer processor to carry out a method of capturing dorsal and lateral views of swine carcasses for use in automated assessment of animal welfare indicators on the swine carcasses, the method comprising: for each original image of a sequence of original images, detecting, using a primary object detection model, swine carcasses in the original image, and for each detected swine carcass, identifying, from the original image, an image of the swine carcass; tracking, using a multi-object tracker module, swine carcasses through the sequence of original images by assigning an identifier to each image of a swine carcass such that each image of a same swine carcass is assigned a same identifier; for each detected swine carcass, detecting, using a secondary object detection model, an orientation of a tail of the swine carcass from the image of the swine carcass; and for each different swine carcass detected, selecting, based on the tail orientation detections, a first image, from the images of that swine carcass, that provides a dorsal view of the swine carcass and a second image, from the images of that swine carcass, that provides a lateral view of the swine carcass.
57. A system for identifying and assessing skin lesions on a swine carcass, the system comprising at least one processor configured to: receive one or more images of the swine carcass; andfor each of the one or more images: process the image using a semantic segmentation model to generate a segmentation map in which each pixel in the image is classified as one of background, normal skin and lesion skin, generate one or more skin lesion ratios for the image based on the segmentation map, and determine a severity of skin lesions by comparing each of the one or more skin lesion ratios to one or more thresholds.
58. The system of claim 57, wherein each skin lesion ratio of the one or more skin lesion ratios for the image is based on pixels in an area of the image.
59. The system of claim 58, wherein each skin lesion ratio of the one or more skin lesion ratios is a ratio of lesion skin pixels in the corresponding area and a total of lesion skin pixels and normal skin pixels in the corresponding area.
60. The system of any of claims 57 to 59, wherein the one or more images of the swine carcass comprises an image that provides a dorsal view of the swine carcass.61 .The system of claim 60, wherein the at least one processor is further configured to receive information identifying a dorsal area of the image that provides the dorsal view of the swine carcass that corresponds to a dorsal section of the swine carcass, and the one or more skin lesion ratios for the image that provides a dorsal view of the swine carcass comprises a skin lesion ratio based on pixels in the dorsal area.
62. The system of any of claims 57 to 61 , wherein the one or more images of the swine carcass comprises an image that provides a lateral view of the swine carcass.
63. The system of claim 62, wherein the at least one processor is further configured to receive information identifying a back area of the image that provides a lateral view of the swine carcass that corresponds to a back section of the swine carcass, and the one or more skin lesion ratios for the image that provides a lateral view of the swine carcass comprises a skin lesion ratio based on pixels in the back area.
64. The system of claim 62 or claim 63, wherein the at least one processor is further configured to receive information identifying a middle area of the image that provides a lateral view of the swine carcass that corresponds to a middle section of the swine carcass, and the one or more skin lesion ratios for the image that provides a lateral view of the swine carcass comprises a skin lesion ratio based on pixels in the middle area.
65. The system of any of claims 62 to 64, wherein the at least one processor is further configured to receive information identifying a front area of the image that provides the lateral view of the swine carcass that corresponds to a front section of the swine carcass, and the one or more skin lesion ratios for the image that provides a lateral view of the swine carcass comprises a skin lesion ratio based on pixels in the front area.
66. The system of any of claims 58 to 65, wherein the at least one processor is configured to, for each skin lesion ratio of the one or more skin lesion ratios for the image: determine that skin lesions in the corresponding area are severe if the skin lesion ratio is greater than a first threshold; determine that the skin lesions in the corresponding area are moderate if the skin lesion ratio is equal to or less than the first threshold but greater than a second, lower, threshold; and determine that the skin lesions in the corresponding area are mild if the skin lesion ratio is equal to or less than the second threshold.
67. The system of any of claims 57 to 66, wherein the semantic segmentation model is a UNet model with a ResNet backbone.
68. A computer-implemented method for identifying and assessing skin lesions on a swine carcass, the method comprising, at least one processor: receiving one or more images of the swine carcass; and for each of the one or more images: processing the image using a semantic segmentation model to generate a segmentation map in which each pixel in the image is classified as one of background, normal skin and lesion skin, generating one or more skin lesion ratios for the image based on the segmentation map, and determining a severity of skin lesions by comparing each of the one or more skin lesion ratios to one or more thresholds.
69. A system for identifying and assessing hernias on a swine carcass, the system comprising at least one processor configured to: receive an image presenting a lateral view of the swine carcass; and process the image using an object detection model, wherein the object detection model is configured to detect one or more types of hernia in the image, and, for each detected hernia, output information identifying the hernia in the image and the type of hernia.
70. The system of claim 69, wherein the one or more types of hernia comprises a severe hernia and a mild hernia.
71. The system of claim 70, wherein a severe hernia is a hernia greater than 10cm.
72. The system of claim 69 or 70, wherein a mild hernia is a hernia less than or equal to 10cm.
73. The system of any of claims 69 to 72, wherein the object detection model is a YOLO model with a ResNet backbone.
74. A computer-implemented method for identifying and assessing hernias on a swine carcass, the method comprising, at one or more processors: receiving an image presenting a lateral view of the swine carcass; and processing the image using an object detection model, wherein the object detection model is configured to detect one or more types of hernia in the image, and, for each detected hernia, output information identifying the hernia in the image and the type of hernia.
75. A system for identifying and assessing skin lesions on a tail of a swine carcass, the system comprising at least one processor configured to: receive an image of a tail of a swine carcass; process the image using a semantic segmentation model to generate a segmentation map in which each pixel in the image is classified as one of background, normal skin and lesion skin; classify each lesion skin pixel as either a necrotic lesion or a low-grade lesion based on colour; generate one or more skin lesion ratios for the image based on the segmentation map and the classification of each lesion skin pixel; anddetermine a severity of skin lesions by comparing the one or more skin lesion ratios to one or more thresholds.
76. The system of claim 75, wherein the one or more skin lesion ratios for the image comprises a necrotic skin lesion ratio and a low-grade lesion ratio.
77. The system of claim 76, wherein the necrotic skin lesion ratio is a ratio of necrotic lesion pixels to a total of normal skin pixels and lesion skin pixels.
78. The system of claim 75 or 76, wherein the low-grade lesion ratio is a ratio of low-grade lesion pixels to a total of normal skin pixels and lesion skin pixels.
79. The system of any of claims 76 to 78, wherein the severity of skin lesions is determined to be one of severe, mild and no lesions by comparing the necrotic skin lesion ratio and low-grade lesion ratio to the one or more thresholds.
80. The system of claim 79, wherein: if the necrotic lesion ratio is greater than a necrotic threshold, the skin lesions are determined to be severe; if the necrotic lesion ratio is less than or equal to the necrotic threshold and the low-grade lesion ratio is greater than a low-grade threshold, the skin lesions are determined to be mild; and if the necrotic lesion ratio is less than or equal to the necrotic threshold and the low-grade lesion ratio is less than or equal to the low-grade threshold, it is determined there are no skin lesions.81 . The system of any of claims 75 to 80, wherein each lesion skin pixel is classified as either a necrotic lesion or a low-grade lesion based on a value channel of a HSV colour space.
82. The system of claim 81 , wherein each lesion skin pixel is classified as a necrotic lesion if the value channel for that pixel is less than a value threshold and classified as a low-grade lesion if the value channel for that pixel is greater than or equal to the value threshold.
83. The system of any of claims 75 to 82, wherein the semantic segmentation model is a UNet model with a ResNet backbone.
84. A computer-implemented method for identifying and assessing skin lesions on a tail of a swine carcass, the method comprising, at one or more processor: receiving an image of a tail of a swine carcass; processing the image using a semantic segmentation model to generate a segmentation map in which each pixel in the image is classified as one of background, normal skin and lesion skin; classifying each lesion skin pixel as either a necrotic lesion or low-grade lesion based on colour; generating one or more skin lesion ratios for the image based on the segmentation map and the classification of each lesion skin pixel; and determining a severity of skin lesions by comparing the one or more skin lesion ratios to one or more thresholds.
85. A system for identifying and assessing skin lesions on a tail of a swine carcass, the system comprising at least one processor configured to: receive an image of a tail of a swine carcass; process the image using a semantic segmentation model to generate a segmentation map in which each pixel in the image is classified as one of background and tail;apply a skeletonization algorithm to the pixels classified as tail in the segmentation map to generate a medial axis of the tail; and determine a length of the tail from the medial axis of the tail.
86. The system of claim 85, wherein determining the length of the tail from the medial axis of the tail comprises processing the medial access using a filtering algorithm to identify and remove outliers from the media axis to generate a filtered medial axis.
87. The system of claim 86, wherein the filtering algorithm is principal component analysis.
88. The system of claim 86 or 87, wherein determining the length of the tail from the medial axis of the tail further comprises determining if one or more key terminal points were removed as outliers, and if it is determined that one or more key terminal points were removed as outliers, adding the one or more key terminal points to the filtered medial axis to generate a corrected and filtered medial axis.
89. The system of claim 88, wherein the one or more key terminal points comprises a tale base and / or a tail tip.
90. The system of claim 89, wherein the tail base is identified as being a pixel in the medial axial in a first row of the image in which a first predetermined percentage of the row is identified in the segmentation map as being tail.91 . The system of claim 89 or 90, wherein the tail tip is identified as being a pixel in the medial axis in a last row of the image in which a second predetermined percentage of the row is identified in the segmentation map as being tail.
92. The system of any of claims 88 to 91 , wherein determining the length of the tail from the medial axis of the tail further comprises fitting the corrected and filtered medial axis to a polynomial curve.
93. The system of claim 92, wherein the corrected and filtered medial axis is fitted to a polynomial curve using polynomial regression.
94. The system of claim 92 or claim 93, wherein determining the length of the tail from the medial axis of the tail further comprises determining the length of the tail to be a length of the polynomial curve.
95. The system of claim 88 or claim 91 , wherein determining the length of the tail from the medial axis of the tail further comprises determining the length of the tail to be a length of the corrected and filtered media axis.
96. The system of claim 86 or claim 87, wherein determining the length of the tail from the medial axis of the tail further comprises determining the length of the tail to be a length of the filtered medial axis.
97. The system of claim 85, wherein the at least one processor is configured to determine the length of the tail to be a length of the medial axis.
98. A computer-implemented method for identifying and assessing skin lesions on a tail of a swine carcass, the method comprising, at one or more processors: receiving an image of a tail of a swine carcass; processing the image using a semantic segmentation model to generate a segmentation map in which each pixel in the image is classified as one of background and tail; applying a skeletonization algorithm to the pixels classified as tail in the segmentation map to generate a medial axis of the tail; anddetermining a length of the tail from the medial axis of the tail.5