Behavior Comparison During Chronic Heat Stress in Large White and Creole Pigs Using Image-Analysis

Behavior is a good indicator of animal welfare, especially in challenging environments. However, few studies have investigated how pig behavior changes during heat stress. The current study is a proof-of-concept using Convolutional Neural Network (CNN) models to monitor pig behavior in order to investigate the differences in behavioral response to heat stress of two contrasted breeds: Large White (LW), selected for high performance, and Creole (CR), adapted to tropical conditions. A total of 6 slaughter pigs (3 CR and 3 LW; 22 weeks of age) were monitored from 8:30 to 17:30 during 54 days. Two CNN architectures were used to detect the animal (Yolo v2) and to estimate animal's posture (GoogleNet). Pig postures estimated by the neural network showed that pigs spent more time lying on their side when temperature increased. When comparing the two breeds, as temperature increases, CR pigs spent more time lying on their side than LW pigs, suggesting that they use this posture to increase thermoregulation and dissipate heat more efficiently. This study demonstrates that neural network models are an efficient tool to monitor animal behavior in an automated way, which could be particularly relevant to characterize breed adaptation to challenging environments.


INTRODUCTION
With the global increase of ambient temperature worldwide, Heat Stress (HS) is becoming a major concern for production (Renaudeau et al., 2012) and welfare (Johnson, 2018) in the pig industry. HS impacts on the economic viability, costing for instance $2 billion annually in the USA swine industry (St-Pierre, 2003). Due to their low number of sweat glands, pig thermoregulation relies mostly on heat dissipation through sensible heat loss and respiratory evaporation (Renaudeau et al., 2007). The defense mechanisms of pigs against HS vary according to the intensity and duration of the stress (Mayorga et al., 2019). Nevertheless, the first response of the animal to stress is to change behavior. The behavioral response is less costly in terms of energy when compared to the physiological and metabolic responses (Moberg and Mench, 2000). At high temperatures, pigs spend more time lying on the side and less on the belly, and less close to other pigs, probably to increase body contact with the floor and thus maximize conductive heat loss (Aarnink et al., 2006). Therefore, the assessment of the behavioral response could allow the early detection of animal suffering from HS without recourse to biological samples that are mostly collected in an invasive manner.
The response of the animal to HS also varies according to the genotype. The effect of high temperature on pig growth performance is more pronounced in recent studies, suggesting that more modern, highly selected pigs would be more sensitive to HS than older genotypes with reduced growth potential (Renaudeau et al., 2011). Moreover, there is a crucial need of data on local breeds and on their adaptation to specific environmental conditions, as they represent genetic resources that are essential to maintain livestock system efficiency in the context of climate change (Gicquel et al., 2020). The Creole breed (CR) is the most important local breed in the Caribbean, both in population size and economic importance (Burgos-Paz, 2013). The CR breed has been submitted to little genetic selection (mainly on backfat thickness, Agüero et al., 2006) and is characterized by early maturity, high fat deposition and a good adaptation to tropical conditions (Rinaldo et al., 2003;Renaudeau et al., 2006). Therefore, the effect of breed in the behavioral response to HS can be studied by comparing the CR breed to the Large White (LW) breed that is selected for high growth performance in optimal housing conditions. Until recently, recording animal behavior in farm conditions over long periods of time remained a complicated procedure and relied on human visual observation in many cases. However, computer vision is a promising approach that is successfully used for animal tracking (Dell et al., 2014;Crall et al., 2015;Gan et al., 2021). For livestock, the use of accelerometers and GPS have been initially preferred to cover indoor and outdoor housing conditions, but computer vision starts offering a reliable solution to track animals and automatically record fine behavioral features, such as postural changes (Zheng et al., 2018;Leonard et al., 2019;Nasirahmadi et al., 2019;Yang et al., 2020) or aggression among group mates (Viazzi et al., 2014;Chen et al., 2020).
In the current proof-of-concept study, we used computer vision to track and estimate posture of CR and LW slaughter pigs during more than 7 weeks while they were kept in individual pens. We based our detection framework on two freely available CNN architectures, Yolo v2 (Redmon and Farhadi, 2017) to detect the animal and GoogleNet to estimate posture. Using transfer learning, the networks were fine tuned to analyze the animal posture from video images. We then used the tracking and postures data to estimate behavioral differences between breeds in that specific context and highlight how they respond to HS.

Starting date of the monitoring period Duration in days
June 24 th 2020 8 July 8 th 2020 7 July 22 nd 2020 9 August 5 th 2020 10 August 19 th 2020 7 September 2 nd 2020 7 September 22 nd 2020 6 using feed experiments on pigs (https://anr.fr/Project-ANR-17-CE27-0002). This experiment lasted 15 weeks to observe a possible effect of diets on pig mandibles and imposed several constraints (age of the animal, duration of the experiment, housing of the animals in individual crates to quantify individual feed intake and refusal). These constraints were an opportunity to study the behavior and assess the welfare of slaughter pigs individually over a long period of time. In this experiment, 6 pigs (3 LW and 3 CR) of similar age (22 weeks) were maintained inside a semi-open experimental building during a total of 15 weeks (including one week adaptation period to experimental conditions), but were only monitored with video during 54 days, i.e., nearly 8 weeks. Video recording were run during 7 periods of 6 to 10 consecutive days, between June 24 th 2020 and September 27 th 2020. The dates and durations of the monitoring periods are available in Table 1. The pigs were individually kept in cages of 1.6m width and 1.9m length (3.04 m 2 ground area). The cage walls were made of metal rod barriers, which allowed a pig to see its neighbors and communicate with them by olfactory, visual and auditory signals. The experimental layout is available in Supplementary Figure 1. Pigs were fed a conventional diet supplemented with sugar cane. Sugar cane stalks were provided ad libitum, and grounded in 20 cm medium-sized cut pieces just before the distribution. The diet was supplemented with industrial pellets containing 16.4 % crude protein and 13.53 MJ DE/kg. Feed was given twice daily: between 06:00 and 08:00 (half of the pellets and the totality of the sugar cane stalks); and between 11:00 and 13:00 (the other half of the pellets). All pigs had free access to water provided by a low-pressure nipple drinker. Every morning feed refusal and spillage were manually collected before each distribution, and weighed between 06:00 and 07:00. The daily feed intake was calculated as the difference between the amount of feed provided on day n and the amount of feed left over the morning of day n+1. Information on pig weights and feed intake are summarized in Table 2.

Ambient Temperature
Room temperature and relative humidity were monitored every 10 min, all along the experiment using a stand-alone USB data logger (EL-USB-2+; DATAQ Instruments, Inc., Akron, OH).The temperature sensor and the crates were located in the same room. Average temperature and humidity are available in Figure 1. Temperature was generally below 30 • C before 10:00 and after 16:00. Temperatures were highest between 12:00 and 14:00. It FIGURE 1 | Daily climatic fluctuation of average ambient temperature (green) and average relative humidity (orange) in the pig building facility. Errors bars give the 25% and 75% quantiles found on the data over the 54 monitoring days.
increased until 13:00 and then started decreasing for the rest of the day. Humidity follows the opposite pattern: it was highest in the morning, decreased until 13:00 and then increased for the rest of the day. The minimal and maximal temperatures recorded were 24.5 • C and 37 • C. The minimal and maximal humidity recorded were 45% and 95.5%.

Automatic Monitoring Framework
The 6 pigs were monitored using time-lapse cameras (TLC2000 pro, year 2018, brand Brinno) taking pictures of the cage every 30 seconds, from 8:30 to 17:30. The location of the pig in the cage and its posture were automatically estimated using two distinct CNN. To locate the animal on the image, we used a first CNN based on the You Only Look Once v2 architecture [YOLO, (Redmon and Farhadi, 2017)]. We used the layer activation 40 relu of the CNN resnet50 to extract the features for YOLO, with three anchor boxes. The network was then trained using 2,164 images chosen randomly, for which the pig was located manually. After training, visual evaluation of thousands of images confirmed that the pig was correctly detected on the images on 100% of the cases. This is not surprising as the images are top views of a single cage, with only one pig per cage. Except some variation due to the sunlight or the presence of the sugar cane, the background of the image was nearly constant, which made the pig detection easy. The pig's center of gravity was estimated as the center of gravity of the YOLO detection. It is initially in pixels, and we used an image registration technique to convert the location in spatial coordinates (Bonneau et al., 2020). We then computed the pig's movement over the day, by computing the distance between the pig center of gravity on two consecutive frames. In order to reduce the impact of detection noise, we down to zeros all the movement that were initially lower than 4 cm. Indeed, even if the animal is not moving between two frames, the bounding box around the pig estimated by Yolo, and thus the center of gravity is not necessarily exactly the same. Movement is a useful measure to visualize the activity pattern of the animal. Examples of CNNs detection and estimation, pig's activity pattern and postures distribution are available in Figures 2A-C. The posture of the pig was estimated from a second CNN, based on the GoogleNet architecture, where the sub-image containing the pig, detected by YOLO, was the input image. To fit the model to our data, we estimated the parameters of the last 94 layers of the GoogleNet CNN, using a stochastic gradient descent with 25 epochs. The parameters of the first 50 layers of the GoogleNet CNN remained fixed. In total 14,928 images were classified manually and 70% of the images were used to train the network, while 30% were used for validation. Four postures were considered: standing, sitting, lying sternally and lying laterally, as described in Zheng et al. (2020)   : (i) Standing, when the body is in upright position, with extended legs and when only hooves are in contact with the floor. (ii) Sitting, when the animal is partly rested on stretched front legs with caudal end of body contacting the floor. (iii) Lying sternally, when the animal is lying on abdomen/sternum with the front legs folded under the body. The hind legs folded invisible or stretched out visible. Abdomen is totally/partially obscured. (iv) Lying laterally, when the animal is lying on either side with all four legs visible and abdomen is totally visible.
For both CNN, the training and testing images were selected randomly from the entire set of images originated from the five first monitoring periods. For practical reasons, the last two monitoring periods were not included.

Statistical Analysis
All the statistical analyzes were performed with Matlab 2020a.
To compare the posture distribution of the two breeds, we used the Wilcoxon rank sum test between two independent samples, with 5% significance level. For a given posture, a sample was the daily proportion of time spent in this posture over the monitoring period. The daily proportion of time spent in a posture was compiled for all animals of the same breed. As the animals were video-recorded during 54 days, for a given posture, a sample had 3 × 54 = 162 elements.The null hypothesis of the statistical test was that the two samples had the same mean. Or in other words, that the two breeds spent an equal time in a given posture. The null hypothesis was rejected when the p-value is under 0.05. One Wilcoxon rank sum test was performed for each posture, i.e. 4 different tests in total.
A Wilcoxon rank sum test with 5% significance level was also used to compare the daily distance traveled between the two breeds.
We fitted a linear model of the individual proportion of time spent lying laterally (y) as a function of temperature class (x), i.e. y = a * x + b, where a and b are the model parameters, fitted using ordinary least squares. x is an integer variable, defined as the lower bound of the temperature interval. To compute y, we simply divided the number of pictures where the animal was estimated in the lying laterally posture, by the total number of pictures that were available in the temperature interval for this animal. One Celsius degree temperature interval were considered, with the lower bound of the first interval equal to 25 • C, and to 35 • C for the last interval. Note that the number of pictures per temperature interval is not necessarily the same for all intervals. Only temperature intervals with more than 4,000 records were considered. As a consequence, temperature lower than 25 • C and higher than 36 • C were not accounted for.
Finally, we compared the proportion of time spent standing on various time interval. We considered one hour length time interval. The lower bound of the first interval was 8:30 and the lower bound of the last interval was 16:30. For each interval, the proportion of time spent standing was the number of pictures where animals were estimated in the standing posture, divided by the total number of pictures available for that time interval. Note that all time intervals have the same? Number of pictures. The same procedure was applied for the proportion of time spent lying. The data was aggregated for all animals, with no distinction of breed.

Estimating Posture Through Image Analysis
The precision and sensitivity of the posture prediction method is available in Table 3. Most errors happened for the sitting posture which was mixed up with standing and sternal. This is due to the top view position of the camera, i.e., with no perspective. There is also some confusion between lying laterally and the sternal posture. In addition, the standing posture was sometimes confused with the sternal posture.

Pig Behavior According to Breed
The proportion of daily time the animals spent in the 4 positions according to breed is shown in Figure 2C. The individual posture distribution between breed is summarized in Table 4. We found that the 3 CR pigs spent more time lying on their side than the 3 LW pigs. On the contrary, the 3 LW pigs spent more time lying on the sternum and slightly more time standing than the 3 CR pigs. Although the difference between the proportion of time spent standing for each breed was not significant (p-value = 0.08), the LW pigs moved more than the CR pigs during the day (p-value < 0.001, see Table 4). Indeed, the LW pigs covered an average daily distance 80% higher than the CR pigs (p-value < 0.001).

Pig Behavior According to Temperature
The proportion of daily time spent in the different postures as a function of ambient temperature is shown in Figure 3. In both breeds, when temperature increased, pigs spent more time lying on their side and less time standing. When comparing LW and CR, when ambient temperature increased, CR pigs spent more time lying on their side than LW. The increase in proportion of time spent lying laterally is illustrated in Figure 4. For the purpose of illustration, we also fitted a linear model of the proportion of time spent lying laterally as a function of temperature class. An increase of 1 • C resulted in an increase of the proportion of time spent lying laterally of 4% in LW and 5.9% in CR.

Pig Behavior According to Time of day
We also visualized the distribution of the postures over the day (Figure 5). We observed that for the two breeds, animal spent more time standing during the morning, whereas they spent more time lying in the afternoon. On Figure 6, we observed that the proportion of time spent standing decreased until 12:30 and then stayed relatively constant. It is the opposite for the proportion of time spent lying, it increases until 12:30 and then stayed relatively constant as well.

DISCUSSION
Advances in automatic image analysis allow the monitoring of animal behavior over extended periods of time ranging from hours to days and weeks. The analysis of animal behavior allows addressing animal welfare issues which are of concern for society. The discomfort induced in animals by climate change is one of them. The most remarkable effect of HS on behavior  is that pigs spend more time lying and less time eating as temperature increases (Brown-Brandl et al., 2001). However, little information on the activity during the growing and finishing phase, in interaction with feeding behavior, ambient temperature and growth is available in the literature. Image analysis is a promising approach, especially for pigs, that are usually raised in environmental conditions suitable for the use of cameras. They are generally raised indoor, with relatively constant light exposure and access to electricity and network. In addition, they are raised in relatively small areas, reducing the number of cameras to be used. Compared to embedded technology, such as accelerometers, image analysis allows to monitor pigs behavior without human intervention on pigs, which can be difficult. In this article, we showed that stateof-the-art CNNs can be used almost directly to track and estimate the postures of an animal. This is particularly convenient because the CNNs that we used (i.e. resNet50 as a feature extractor for Yolo and GoogleNet to predict posture) were pre-trained on a large amount of images (several millions using ImageNet) and only a small amount of parameters needed to be tuned to obtain a good accuracy on a specific dataset. As a consequence, only thousands of images have to be manually labeled to re-train the CNNs. However, the trained CNNs are most likely not suitable for other environments, such as group-housed pigs. Indeed, the experimental setup was particular, with a centered top view of the scene and with only one animal in the camera field of view. More variability in the training dataset would be needed to train a generic CNNs that could work for most studies on pig behavior.
In our study, we used computer-based analysis of images to investigate the behavioral response to HS of two contrasted breeds. The European LW breed has been selected for lean growth for several decades in optimal growing conditions, i.e. in buildings controlled for temperature and under temperate climate. The Caribbean CR breed has been submitted to little genetic selection and is characterized by high fat deposition and good adaptation to harsh environmental conditions (Rinaldo et al., 2003;Renaudeau, 2005). Little data is available on the behavior of the CR breed compared to commercial pig breeds (Gourdine et al., 2018;Poullet et al., 2019). Characterizing the behavior of different breeds, especially local breeds, could provide valuable knowledge on their response to chronic stress, and acute stress due to an environmental change. Behavioral results may be interpreted in terms of welfare.
Over the experimental period lasting almost 8 weeks, LW pigs covered a higher distance during the day than CR pigs despite being larger in size than CR. This finding is consistent with previous results on this breed obtained in outdoor conditions from human 24h visual observations (Gourdine et al., 2018). On the contrary, in an experiment on restricted vs. normally fed growing pigs, Poullet et al. (2019) found CR pigs more active than LW ones in both feeding conditions. This discrepancy could be explained by the difference in stages and body weight of the animals: in Poullet et al. (2019), growing pigs were used compared to finishing pigs in the present study. Moreover, the method used to assess behavior was also different: in Poullet et al. (2019), behavior was manually assessed during 24h compared to a 54-day automatic image processing in the present study. The fact that LW are more active and spend more time standing could be an intrinsic difference in breed behavior. For instance, a striking difference in the way the pigs extract sugar from the sugar cane was observed between LW and CR pigs. According to the technical team observations (data not shown), CR pigs tended to lie down with a front leg blocking the sugar cane and peel the cane, while LW pigs tended to pick up the cane, one by one, and chew it completely while standing, which would increase the movement measured. This contrasting behavior could also be an adaptation of the CR pigs to temperature and to the local feed. This type of observations cannot be measured by the image analysis as we configured it, and it illustrates the complementarity between human observation and automatic image processing techniques. Moreover, LW had a higher sugar cane intake than CR, which could also explain the increased activity.
In our study, pigs were housed in semi open building and were therefore submitted to the high ambient temperatures of the tropical climate. During the daily recording period (from 8:30 to 16:30), temperature in the semi-open facilities varied from 25 to 36 • C. Consistent with previous studies on heat-stressed pigs (Brown-Brandl et al., 2001;Kerr et al., 2003;Aarnink et al., 2006), we found that, irrespective of breed, when ambient temperature increases, pigs spend more time lying on their side and less time standing, probably as a mean to dissipate heat and reduce heat production. Previous studies showed that heat-stressed pigs tend to lie preferentially on their side to reduce body heat (Aarnink et al., 2006). Similar results were found in gestating sows using  CNN-based computer analysis of behavior developer (Kasani et al., 2021). The upper limit of thermoneutrality, in which no extra energy is used for thermoregulation, is considered to be around 25 • C for growing-finishing pigs (Le Dividich et al., 1998;Renaudeau et al., 2008). However, this threshold may vary between breeds. Renaudeau et al. (2007) defined an evaporative critical temperature, above which respiratory rhythm increases to prevent a rise in body temperature. In LW pigs, the evaporative critical temperature was measured at 25.5 • C, whereas in CR pigs it was significantly higher (+2.8 • C at the same age and +1.3 • C at similar BW). In our study, LW and CR pigs were of similar age, therefore we can assume that the critical temperature for CR was 2.8 • C higher than in LW pigs (28.3 • C for CR and 25.5 • C in LW). When comparing the behavior of the two breeds in response to HS, i.e. changes in time spent in each posture in response to the rise of ambient temperature, we found that CR pigs adopted the lateral lying posture preferentially (as compared to the other positions) from a temperature of 29 • C, compared to 35 • C for LW. Therefore, despite a lower critical temperature, LW adopt the lateral lying posture at much higher temperature than CR and still at a lower frequency. It is interesting to note that at lower temperature, < 27 • C, the difference in time spend lying on the side between CR and LW is also significant, suggesting that this might be an intrinsic breed difference and that CR may naturally adopt this position rather than sternal lying to dissipate heat more efficiently than LW. LW and CR pigs were of similar age and due to the lower growth rate of CR compared to LW, CR pigs had lower body weight than LW. However, difference in body weight between the two breeds could not explain the difference in behavior observed in our study because with lower BW, CR need to dissipate less heat than LW. Indeed as mentioned above, animals with lower BW have lower critical threshold temperature because they can dissipate heat easier than heavier ones. Studies on CR growing pigs (Renaudeau, 2005) and lactating sows (Gourdine et al., 2006a,b) demonstrated a better heat tolerance of CR animals compared to LW. This better thermal tolerance in CR could come from a better ability to dissipate heat, notably by increasing non evaporative heat loss and heat conductivity. The fact that CR pigs adopt the lateral lying at lower temperatures and at a larger frequency than LW is consistent with the latter hypothesis, because lateral lying increases heat loss by conductivity. These results show that this kind of behavioral analysis could help to characterize how different breeds respond to HS and eventually identify heat-tolerant breeds that are essential resources in research studies to alleviate the negative effects of HS on pig production (Renaudeau et al., 2012).
The distribution of the postures during the day, irrespective of breed, indicated a peak of time spent standing between 8:30 and 9:30, right after the distribution of the feed (all the sugar cane and half of the pellets). This peak of activity, despite the already high temperature at this time of the day (on average 28 • C between 8:30 and 9:30) could be explained both by the animal motivation to eat after the night fast and by the enrichment potential of the sugar cane. A systematic study evaluating the interactions of pigs with 74 different objects to develop environmental enrichment found that the emergent characteristics of the favored objects, which maintain responsiveness and interactions, were "ingestible", "chewable", "deformable" and "destructible" (Van de Weerd et al., 2003). Sugar cane stalks exhibit these four characteristics and could therefore be considered as a good enrichment material for pigs. Indeed, the stalks allow the pigs to express feeding (extraction of sugar by chewing), exploring (looking for and peaking stalks) and playing with the stalks or the spillage like a toy. Furthermore, the spillage on the flooring provides the pigs with a more comfortable floor than the metalslatted pens.
Our study provides a proof-of-concept showing that behavior analysis through CNN is an efficient method to monitor animal behavior during stress and over long periods of time. However, our analysis was carried out only on 6 animals and studies with larger number of animals would be needed to confirm our results. Nevertheless, the automatic behavior analysis method chosen here uses thousands of images over several weeks of recording, which is considerably more than the classical manual annotation method used to track animal behavior. Another limitation of our study is that we monitored individually-housed animals, which is not the norm in farms where animals are mostly grown in groups. As mentioned earlier, the CNNs used here would need a wider training set of images to work on group-housed animals. However, CNNs have been used to monitor individual behavior of group-housed animals (van der Zande et al., 2021), showing that it would be possible to do so in the context of HS.

CONCLUSION
In conclusion, despite the small number of animals used in this proof-of-concept study, our results demonstrate that behavior analysis through CNN is a promising approach to track animal behavior automatically over long periods of time. This long-term analysis allowed to measure breed differences in activity level and to gain insight into their adaptation to a hot environment. The better heat tolerance of the CR breed has been demonstrated in terms of performance and physiological response and the behavioral response that we observe is consistent with these studies. More research with larger number of animals is needed to characterize heat tolerant genotypes that could help to alleviate the problem of HS in the pig industry. Image analysis is an efficient method to monitor the HS response in different pig breeds and thus should be part of the toolbox to help reach this goal.

DATA AVAILABILITY STATEMENT
The original contributions presented in the study are included in the article/Supplementary Materials, further inquiries can be directed to the corresponding author/s.

ETHICS STATEMENT
The animal study was reviewed and approved by Animal Care and Use Committee of French West Indies and Guyane, the French Ministry of Agriculture authorized the experiment referenced at APAFIS#24019 -2020020316349534 v2.

AUTHOR CONTRIBUTIONS
J-LG designed the experiment. MB designed the procedure to track, estimate the posture of the pigs, and performed the calculations. DB and LD mainly performed the experiments at the animal experimental unit. MB and NP equally wrote the manuscript and carried out the analysis. LC and J-LG reviewed and edited the paper. All authors provided critical feedback and approved the final version of the manuscript.

FUNDING
The cameras were funded by the project suiRAvi, supported by the animal genetics division of INRAE. The study was supported by Région Guadeloupe and the European Union Fund (FEDER) in the framework of the AgroEcoDiv project.