
==== Front
Data Brief
Data Brief
Data in Brief
2352-3409
Elsevier

S2352-3409(24)00799-6
10.1016/j.dib.2024.110835
110835
Data Article
Image dataset for cattle biometric detection and analysis
Bai Lili
Zhang Zhe
Song Jie songjie@mail.neu.edu.cn
⁎
Software College, Northeastern University, Shenyang 110819, China
⁎ Corresponding author. songjie@mail.neu.edu.cn
13 8 2024
10 2024
13 8 2024
56 11083513 4 2024
12 7 2024
7 8 2024
© 2024 The Author(s)
2024
https://creativecommons.org/licenses/by-nc/4.0/ This is an open access article under the CC BY-NC license (http://creativecommons.org/licenses/by-nc/4.0/).
The dataset of cattle biometric features is a pivotal asset for improving livestock management and promoting smart agriculture innovation. We obtained a dataset of images capturing the side and back views of Horqin yellow cattle from a farm in eastern Inner Mongolia, China. These data consist of images of 72 free-range Horqin yellow cattle taken with a mobile camera on the grasslands. Each cattle is accompanied by detailed annotations, including oblique body length, withers height, heart girth, hip length, as well as body weight among other crucial data points. This information is considered as high-quality biological feature data. In the field of computer vision, utilizing this dataset can facilitate the construction of deep learning models to develop an automated livestock monitoring system. The aim is to enhance management efficiency and operational effectiveness within the livestock industry. By integrating biological feature information, specific model tools can be employed for body condition assessment and health monitoring research. This approach enables the effective identification and prevention of disease conditions, ultimately providing a deeper level of care and support for livestock welfare and health. The cattle dataset offers support for smart agriculture by enabling the development of intelligent farm management systems. These systems facilitate real-time alerts for livestock health and environmental monitoring. This advancement will drive the modernization and digitization of animal husbandry, fostering agricultural intelligence and sustainable development.

Keywords

Livestock husbandry
Body measurements
Intelligent animal husbandry
Automatic measurement
==== Body
pmcSpecifications TableSubject	Livestock Husbandry, Animal Science, Livestock management, Animal Biometrics, Artificial Intelligence, Computer Science Applications	
Specific subject area	Image based Biometrics, Identity Recognition, Digital Identity, Biometrics Research, Animal Welfare, Animal Tracking	
Type of data	Images: PNG (All data without pre-processing)
Table: Excel (Information annotation for each cattle)	
Data collection	On the day of data collection, all selected Horqin yellow cattle were concentrated in separate rearing pens. We utilized a mobile phone for capturing images, specifically the iPhone 13 (12-megapixel camera), with dataset images having dimensions of 4032×3024 pixels. We did not use the zoom function when taking the photo. The data collection process took approximately 3 days, from April 28 to 30, 2023, with activities conducted each day from 8:30 to 14:00. The shooting environment was sunny each day with abundant sunlight. We collected image data from 72 cattle, the dataset file contains 72 back views and 72 side views. In addition to capturing photos, manual body measurements were also performed. We recorded the oblique body length, withers height, heart girth, hip length and weight of cattle, which were filled in an excel table. To facilitate the subsequent use of the dataset, image labels were assigned to the photos using image editing software through a manual annotation process. Scholars can effectively apply this dataset in various models. The dataset size is 2.29GB.	
Data source location	Institution: Software College, Northeastern University
Country: China
Data Collection City: Tongliao, Inner Mongolia
Latitude and Longitude for collected samples: 42°55′50″N 122°05′39″E. Elevation: 263 m/ 862.86 feet.	
Data accessibility	Repository name: Cattle side view and back view dataset
Data identification number: 10.17632/h2s22wr5py.2
Direct URL to data: https://data.mendeley.com/datasets/h2s22wr5py/2	

1 Value of the Data

• The dataset of side and back images of cattle presents the morphological characteristics of cattle in terms of contour, size and proportion, which provides an important basis for studying the morphological differences of cattle. In addition, the patterns and marks embodied in the images can be used for identity verification research. The back view reveals the structure of the hip muscles, providing clues to assess muscle development and physical health.

• In the field of computer vision, using this dataset to train deep learning models can realize the automatic identification of cattle and promote the intelligent process of agricultural production. Multi-angle data also supports the development of accurate posture and weight estimation algorithms, which effectively improves the production efficiency of animal husbandry.

• From the perspective of biological research, comparing the side and back view images can help to understand the similarities and differences of cattle body structure, promote the cognition of cattle characteristics, and provide a new perspective for biological research.

• At the overall livestock industry level, employing this dataset for image data analysis can enhance the efficiency of cattle health monitoring, enabling early disease detection. Simultaneously, it facilitates breed improvement and genetic reproduction efforts. This comprehensive application significantly contributes to the advancement and productivity.

2 Background

With the continuous advancement of computer technology, the field of smart agriculture has been rapidly developing, particularly in livestock management. Intelligent livestock management systems, as important tools for improving agricultural production efficiency and optimizing animal health, are increasingly gaining attention [[1], [2], [3]]. This paper presents a dataset constructed from the side and back views of Horqin yellow cattle from Inner Mongolia, with an in-depth discussion on the datasetʼs construction process and its applications. The dataset encompasses key information such as the body of cattle structure and appearance characteristics, providing valuable resources for subsequent research. Deep learning models trained with this dataset have a wide range of applications, including cattle breed identification, posture estimation, and health status monitoring, which can promote the in-depth application of smart agricultural technology in the livestock industry. This not only enhances the efficiency of agricultural production but also enables more refined animal management, providing strong technical support for the sustainable development of the livestock industry.

3 Data Description

The data collection environment is shown in Fig. 1. When collecting data, all qualified Horqin yellow cattle were concentrated in the breeding enclosure with a shooting environment.Fig. 1 Data acquisition environment.

Fig 1

We utilized an iPhone 13 for the image acquisition of the side and back views of cattle. The device is equipped with a 12-megapixel wide-angle lens (F1.6 aperture) and an ultra-wide-angle lens (F2.4 aperture), supporting 2× optical zoom. To facilitate precise body size measurements in subsequent automated systems, we applied colored paint to mark several key points on each cattle, which are clearly visible in the images.

As shown in Fig. 2, when taking the image, the side view was taken at a distance of 1 m, while the back view was taken at a distance of 0.5 m. We did not use the zoom function when taking the photo to ensure that the body features of the cow were fully captured. The resolution for all images collected was set to 4032×3024 pixels, ensuring the clarity of detailed features such as the coat of cattle texture and body markings, providing high-quality visual data for the training and application of deep learning models. The dataset comprises side and back view images in “.png” format, complemented by a spreadsheet detailing the body measurements obtained manually (in “.xlsx” format).Fig. 2 A sample of the collected data, the left is the side view image and the right is the back view image.

Fig 2

Lighting conditions have a significant impact on image quality. We chose to photograph under natural light, avoiding direct sunlight to reduce the effects of shadows and highlights. To address uneven lighting conditions such as overcast or cloudy days, we also employed supplementary lighting equipment to ensure uniformity of illumination. Additionally, during the image pre-processing stage, we applied noise reduction and sharpening techniques, as well as histogram equalization for illumination correction, to tackle challenges posed by image noise, blurriness, and varying lighting conditions.

Regarding background selection, we prioritized open pasture environments with grasslands and fences as the primary background, striving to maintain consistency. Although natural environments inevitably present variations such as swaying grass leaves and moving shadows, we believe these variations are beneficial for assessing the performance of the model under different background conditions. Therefore, the dataset also includes image samples taken under different background conditions. Through this meticulous image acquisition process, we have ensured the quality and reliability of the dataset, providing a solid foundation for subsequent image analysis and model training.

We conducted detailed biometric annotations on the side and back view images of cattle, including four key measurement points: oblique body length, heart girth, withers height, and hip length. The following describes the measurement methods we employed:(1) Oblique Body Length (OBL): We measured the straight-line distance from the rear edge of the scapula to the ischial tuberosity to obtain data on the oblique body length.

(2) Heart Girth (HG): At the widest part of the cattle's chest, which is the midpoint between the rear edge of the scapula and the anterior edge of the sternum, we measured horizontally around the body to determine the girth dimension.

(3) Withers Height (WH): The vertical distance from the ground to the highest point of the scapula was recorded as the withers height.

(4) Hip Length (HL): The straight-line distance from the ischial tuberosity to the rear edge of the cow's stifle was measured to obtain data on hip length.

All measurements were manually conducted by experienced livestock experts while the cattle were standing still to ensure the accuracy of the data. To minimize human error, each measurement was repeated three times, and the average value was taken as the final data point. After the measurements were completed, we associated this biometric data with the image dataset, providing detailed annotations for each image.

4 Experimental Design, Materials and Methods

As an important part of agriculture, animal husbandry plays a key role in modern society. Accurate measurement of livestock body size is essential for improving feeding efficiency, disease surveillance, and genetic improvement [[4], [5], [6]]. In the past, the traditional measurement methods often relied on manual operation, and there were some problems such as measurement inconsistency, tedious and error, which limited the measurement accuracy and efficiency. In recent years, with the rapid development of computer vision and deep learning technology, cattle body size measurement technology based on image processing has gradually emerged [[7], [8], [9]]. By using the captured cattle images, combined with modern computer algorithms, efficient automatic measurement can be achieved, so as to improve the accuracy and stability of data acquisition. In addition, this method can also provide more accurate data support for livestock managers and promote the digital transformation of the breeding industry [[11], [12], [13], [14]].

4.1 Dataset collection

At present, the number of image datasets that can be used to analyze cattle is very limited [10]. In the public datasets, most of them contain multiple cows in each image, which is mainly for recognition tasks, and it is impossible to determine the detailed feature points of each cow to measure the body size. This data set allows us to perform more complex estimation tasks such as automated measurements and weight prediction. We provide high-definition side view and back view of 72 cows, especially the back view, which has not been found in the public data set. However, the back view of cattle is very important in key objectives such as disease surveillance and feeding efficiency in cattle. Therefore, we believe that this dataset is a very valuable biometric dataset for live cattle.

4.2 Data pre-processing

After collecting the cattle photos, we made thorough preparations for the cattle measurement body size model. During the data augmentation phase, we utilized a variety of image processing techniques to expand the dataset, resulting in 550 side views and 450 back views. We specifically applied different sets of transformations for the side and back views to better simulate the appearance of cattle from different perspectives. For the side views, we primarily used rotations (from −30° to 30°), horizontal flips, and slight scaling (±10 %) to enhance the model's ability to recognize cattle from various angles and sizes. The back views, on the other hand, were subjected to scaling (±20 %), shearing (±0.1), and translation (±10 pixels) to simulate different shooting distances and angles. After pixel-level adjustments, all images were distributed into the training set, test set, and validation set according to a 7:2:1 ratio. This pre-processing not only ensured the robustness of the model but also improved its adaptability to unseen data, effectively avoiding overfitting. We have experimentally verified the effectiveness of our data augmentation strategy, and the results indicate that the augmented dataset can significantly enhance the model's generalization ability.

4.3 Body measurements

We annotate the processed images to ensure the accuracy of the model. To measure the oblique body length, withers height, heart girth and hip length of cattle, we used Labelme software to make detailed annotations for the side view and back view, as shown in Fig. 3.Fig. 3 The key points in the side view and back view are marked, the AB point is oblique body length, the CD point is withers height, the EF point is the chest width, the AG point is hip length, and the HI point is the hip width.

Fig 3

OBL, WH, HL measurements. As shown in Fig. 4, after keypoint detection, the distance between keypoints can be directly measured from the side view by connecting the coordinates of each point in the 2D image, and the AB connection is obtained as OBL, the AG connection is obtained as HL, and the CD connection is obtained as WH.Fig. 4 OBL, WH, HL measurements.

Fig 4

HG measurements. As shown in Fig. 5, chest width in the side view and hip width in the back view are used to calculate chest circumference. The connection distance between two points of EF is chest width, and the connection distance between two points of HI is hip width. As shown in Fig. 6, the chest circumference is calculated by Ramanujan formula (1).(1) L(a+b)≈π(a+b)[1+310∑n=1∞(2n−1)!!4(2n)!!(a−b2na+b)]

where L(a+b) is the circumference of the ellipse or the chest circumference. a and b are the axis lengths as shown in Figs. 6, 2a is the EF connection length and 2b is the HI connection length.Fig. 5 chest width and hip width measurements.

Fig 5

Fig. 6 HG measurements.

Fig 6

4.4 Deep learning models selection and training

In the context of automated livestock monitoring systems, selecting an appropriate deep learning model is crucial for the efficient monitoring of cattle. Considering the characteristics of the side and back view image datasets of cattle, we have assessed the applicability of various deep learning architectures.

Convolutional Neural Networks (CNNs): Due to their outstanding performance in image recognition tasks, CNNs are one of the preferred models. We have considered using pre-trained CNN models, such as ResNet or Openpose, to extract features and perform transfer learning, thereby enhancing the model's performance on limited datasets. Recurrent Neural Networks (RNNs): Although RNNs excel in processing sequential data, in this study, we focus more on the analysis of single-frame images, thus limiting the application of RNNs. Generative Adversarial Networks (GANs): The capability of GANs to generate realistic images makes them potentially valuable in data augmentation, especially when the dataset is imbalanced or there is a need to generate specific view images.

In our study, we have chosen the CNN-based OpenPose as our training model for the following reasons:(1) Real-time Performance: OpenPose is a model specifically designed for real-time applications, capable of quickly and accurately detecting and locating key points in images.

(2) Accuracy in Pose Estimation: Although initially developed for human pose estimation, OpenPose has shown potential in the detection of keypoints on livestock. The body structure of cattle is somewhat similar to that of humans, which enables OpenPose to adapt and be used for cattle pose estimation.

(3) Cross-platform Compatibility: OpenPose supports a variety of hardware platforms, including both CPUs and GPUs, allowing for flexible deployment across different computing environments, including potentially resource-constrained farm settings.

(4) Open Source and Customizability: As an open-source project, OpenPose allows researchers to customize and optimize it according to specific application needs. This provides us with the freedom to adjust the model to better suit the cattle image dataset.

Additionally, we have considered the challenges and difficulties faced when using the OpenPose model. OpenPose was initially designed for human pose estimation and may not be sufficiently accurate for estimating the poses of animals such as cattle. Appropriate adjustments and retraining of the model are necessary to adapt to the body structure and pose variations of cattle. Smart livestock farming is often deployed in outdoor environments, where variations in lighting, weather conditions, and background interference can all impact the performance of the model. Therefore, the model needs to have good robustness to adapt to different environmental conditions. The surveillance equipment on farms and ranches may have limited computing resources, so the complexity of the model and its demand for computing resources must be within an acceptable range.

To overcome these challenges, we have considered the following measures: enhancing the adaptability of model to environmental changes through image enhancement and data augmentation techniques. We also aim to reduce the computational burden of the model by employing model pruning and quantization techniques, making it more suitable for edge computing devices. The parameters of the model are shown in Table 1.Table 1 Body measurement model parameter setting.

Table 1Hyperparameter	Value	
Model	OpenPose	
Train Set	700 (385 side view, 315 back view)	
Test Set	200 (110 side view, 90 back view)	
Validation Set	100 (55 side view, 45 back view)	
Learning Rate	0.001	
Epochs	8	
Optimizer	Adam	

During the training process, to address the issue of converting image sizes to actual sizes, we adopted a method based on average size data to estimate the body measurements of cattle in the images. Specifically, we first determined the average values of key body measurement indicators for the Horqin cattle breed. Then, using the OpenPose model, we identified key points in the images. Based on the proportional relationship between the distances between these key points in the images and the average body measurement data, we converted the pixel distances to actual biological measurement values. This method not only improved the accuracy of the measurement estimation but also verified its practicality and reliability in intelligent agricultural monitoring systems.

4.5 Body measurements results

We mainly measured the oblique body length, body height, heart girth and hip length of cattle, and used MAPE and RMSE as evaluation indexes. The results obtained are shown in Table 2.Table 2 The MAPE and RMSE of cattle body measurements.

Table 2Measurements	OBL	WH	HG	HL	
MAPE(%)	14.101	6.904	10.882	7.120	
RMSE(cm)	10.07	9.8	13.90	14.12	

4.6 Prospects

This study has laid the foundation for the development of intelligent livestock monitoring systems by constructing a dataset of cattle biometric features. To further enhance the depth and breadth of our research, we propose several potential future research directions:• Precision livestock farming and the advancement of automation technology(1) Automated Monitoring: Employing image recognition techniques, the behavior and health status of cattle can be continuously monitored in real-time, enabling automated disease alerts and behavioral analysis.

(2) Precision Feeding: By analyzing variations in the body size and weight of cattle, personalized feeding programs can be devised for each animal, optimizing feed ratios and enhancing the efficiency of husbandry.

(3) Reproductive Management: Image datasets can facilitate the assessment of cattle's reproductive conditions, predicting reproductive performance through physical attributes and guiding breeding plans.

• Enhancement of animal health and welfare(1) Early Disease Diagnosis: Utilizing machine learning models to analyze cattle images can identify early signs of disease, such as skin lesions and abnormal behaviors, allowing for timely treatment.

(2) Stress Management: By examining patterns of cattle behavior, stress levels can be assessed, and appropriate measures can be taken to reduce stress and improve animal welfare.

(3) Genetic Improvement: The dataset can be employed in genetic studies to screen for markers associated with superior productive traits and higher health standards, informing breeding efforts.

• Interdisciplinary research and applications(1) Ethological Research: The dataset can be utilized to study the social behaviors, communication methods, and environmental adaptability of cattle, deepening our understanding of bovine ethology.

(2) Ecological Research: Analyzing the interaction between cattle and their environment can shed light on their role and impact within ecosystems, providing a scientific basis for ecological conservation.

Through these future research directions, we hope to promote the development of smart agriculture, improve the efficiency and effectiveness of livestock monitoring, and contribute to the sustainable development of agriculture.

Limitations

None.

Ethics Statement

All animal data used in this study were collected as part of standard farming and selling practices. As such, no part of this research was subject to approval of an ethics committee.

CRediT authorship contribution statement

Lili Bai: Conceptualization, Methodology, Software, Writing – original draft, Investigation. Zhe Zhang: Validation, Writing – review & editing. Jie Song: Supervision, Validation, Writing – review & editing.

Data Availability

Cattle side view and back view dataset (Original data) (Mendeley Data).

Acknowledgments

This paper is supported by the 10.13039/501100001809 National Natural Science Foundation of China (Grant No. 62302086 ) and the 10.13039/501100012226 Fundamental Research Funds for the Central Universities (Grant No. N2317005 ).

Declaration of Competing Interest

The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.
==== Refs
References

1 Liu D. Parmiggiani A. Psota E. Fitzgerald R. Norton T. Where's your head at? Detecting the orientation and position of pigs with rotated bounding boxes Comput. Electron. Agric. 212 2023 108099 10.1016/j.compag.2023.108099
2 Witte J.-H. Gerberding J. Melching C. Marx Gómez J. Evaluation of deep learning instance segmentation models for pig precision livestock farming Bus. Inf. Systems. 2021 209 220 10.52825/bis.v1i.59
3 Petrovska-Delacretaz D. Edwards A. Chiasson J. Chollet G. Pilliod D.S. A reference system for animal biometrics: application to the northern leopard frog Proceedings of the 2014 1st International Conference on Advanced Technologies for Signal and Image Processing (ATSIP) Sousse, Tunisia 2014 17 19
4 Xu B. Wang W. Guo L. Chen G. Wang Y. Zhang W. Li Y. Evalu.ation of deep learning for automatic multi-view face detection in cattle Agriculture 11 2021 1062 10.3390/agriculture11111062
5 Baranov A.S. Graml R. Pirchner F. Schmid D.O. Breed differences and intra-breed genetic variability of dermato- glyphic pattern of cattle J. Anim. Breed. Genet. 110 1993 385 392 10.1111/j.1439-0388.1993.tb00751.x 21395737
6 Zhao K. Jin X. Ji J. Wang J. Ma H. Zhu Z. Individual identification of Holstein dairy cows based on detecting and matching feature points in body images Biosyst. Eng. 181 2019 128 139 10.1016/j.biosystemseng.2019.03.004
7 Yang Y. Qin W. Sun L. Shi W. Magnenat-Thalmann N. Advances in Computer Graphics CGI 2022, Lecture Notes in Computer Science 13443 2022 Springer Cham 28 40 10.1007/978-3-031-23473-6_3
8 Lu Y. Weng Z. Zheng Z. Zhang Y. Gong C. Algorithm for cattle identification based on locating key area Expert. Syst. Appl. 228 2023 120365 10.1016/j.eswa.2023.120365
9 Wang J. Zhang X. Gao G. Lv Y. OP mask R-CNN: an advanced mask R-CNN network for cattle individual recognition on large farms 2023 International Conference on Networking and Network Applications (NaNA) Qingdao, China 2023 601 606 10.1109/NaNA60121.2023.00104
10 Du A. Guo H. Lu J. Su Y. Ma Q. Ruchay A. Marinello F. Pezzuolo A. Automatic livestock body measurement based on keypoint detection with multiple depth cameras Comput. Electron. Agricult. 198 2022 107059 10.1016/j.compag.2022.107059
11 Bhoj S. Tarafdar A. Chauhan A. Singh M. Gaur G.K. Image processing strategies for pig liveweight measurement: updates and challenges Comput. Electron. Agricult. 193 2022 106693 10.1016/j.compag.2022.106693
12 Noe S.M. Zin T.T. Tin P. Kobayashi I. Comparing state-of-the-art deep learning algorithms for the automated detection and tracking of black cattle Sensors 23 1 2023 532 10.3390/s23010532 36617130
13 Li X. Xiang Y. Li S. Combining convolutional and vision transformer structures for sheep face recognition Comput. Electron. Agricult. 205 2023 107651 10.1016/j.compag.2023.107651
14 Win K.D. Kawasue K. Yoshida K. Lee G. Automatic pig selection system based on body size using a camera: rotating mechanics for pig selection Artif. Life Robot. 26 2 2021 155 161 10.1007/s10015-020-00654-y
