Vincent Miele
email: vincent.miele@univ-lyon1.fr

Gaspard Dussert

Bruno Spataro

Simon Chamaillé-Jammes

Dominique Allainé

Christophe Bonenfant

Revisiting giraffe photo-identification using deep learning and network analysis

Keywords: animal identification, SIFT, deep metric learning, image similarity networks, opensource 1

An increasing number of research programs rely on photographic capture-recapture (vs. direct marking) of individuals to study distribution and demography within animal populations. Photoidentification of individuals living in the wild is sometimes feasible using idiosyncratic coat or skin patterns, like for giraffes. When performed manually, the task is tedious and becomes almost impossible as populations grow in size. Computer vision techniques are an appealing and unavoidable help to tackle this apparently simple task in the big-data era. In this context, we propose to revisit giraffe re-identification using convolutional neural networks (CNNs).We first developed an end-to-end pipeline to retrieve a comprehensive set of re-identified giraffes from about 4, 000 raw photographs. To do so, we combined CNN-based object detection, SIFT pattern matching, and image similarity networks. We then quantified the performance of deep metric learning to retrieve the identity of known and unknown individuals. The re-identification performance of CNNs reached a top 5 accuracy of about 90%. Fully based on open-source software packages, our work paves the way for further attempts to build CNN-based pipelines for re-identification of individual animals, in giraffes but also in other species.

Introduction

In many respects, population and behavioural ecology have immensely benefited from individualbased, long term monitoring of animals in wild populations [START_REF] Clutton | Individuals and populations: the role of long-term, individual-based studies of animals in ecology and evolutionary biology[END_REF][START_REF] Loren | Long-term field studies of mammals: what the short-term study cannot tell us[END_REF]. At the heart of such monitoring is the ability to recognize individuals. This is often achieved by actively marking individuals, such as deploying ear-tags or leg rings, cutting fingers or feathers, or scratching scales in reptiles. In some species, however, individuals display natural marks that make them uniquely identifiable. Many large African mammals such as leopard (Panthera pardus), zebra (Equus sp.), kudu (Tragelaphus strepsiceros) or wildebeest (Connochaetes taurinus) all present idiosyncratic fur and coat patterns particularly useful for non-invasive and reliable recognition of individuals. This is the case for the iconic but endangered giraffe (Giraffa camelopardalis), for which mark-resight (MS) surveys would allow understanding the demographic processes underlying the dynamics of its populations, possibly helping to set conservation policies. Individual identification of giraffes has long been known to be feasible from comparisons of the distinctive coat patterns of individuals [START_REF] Despard | The behavior guide to african mammals: including hoofed mammals, carnivores[END_REF]. As the number of giraffes to identify increases, people-based visual comparisons of pictures can rapidly become overwhelming. With the move to digital technologies (namely digital cameras and camera traps), the problem becomes even more acute as the number of pictures to process can easily reach the thousands or ten of thousands.

Over the last decade, the use of computer vision rapidly spread into biological sciences to become almost unavoidable in animal ecology for many repetitive tasks [START_REF] Ben G Weinstein | A computer vision for animal ecology[END_REF]. In a seminal publication, Bolger and colleagues [START_REF] Douglas T Bolger | A computerassisted system for photographic mark-recapture analysis[END_REF] first presented computer-aided giraffe photo-identification, soon followed by other similar studies on giraffe as well [START_REF] Kelly M Halloran | Applying computer-aided photoidentification to messy datasets: a case study of t hornicroft's giraffe (g iraffa camelopardalis thornicrofti)[END_REF][START_REF] Buehler | An automated program to find animals and crop photographs for individual recognition[END_REF]. The underlying computer technique is a feature matching algorithm, the Scale Invariant Feature Transform operator (SIFT; [START_REF] David G Lowe | Distinctive image features from scale-invariant keypoints[END_REF]), where each image is associated to the k-nearest best matches. The current use of SIFT for ecologists requires human intervention to validate the proposed candidate images within a graphical interface [START_REF] Dt Bolger | Wild id user guide: pattern extraction and matching software for computer-assisted photographic mark[END_REF]. As SIFT features cover whole images, two images can be considered as similar not only because of similar giraffe coat patterns but also because of similarities in the backgrounds (similar trees for instance), which could lead to false positive matches. For the best results with computer vision, all images have to be cropped before, so that only the giraffe flank appears on the images, hence excluding most of the neck, head, legs and background. Until now, this cropping operation was most often done manually [START_REF] Kelly M Halloran | Applying computer-aided photoidentification to messy datasets: a case study of t hornicroft's giraffe (g iraffa camelopardalis thornicrofti)[END_REF], despite being a highly time-consuming task when processing thousands of images. Recently, Buehler and colleagues [START_REF] Buehler | An automated program to find animals and crop photographs for individual recognition[END_REF] have however developed a procedure based on Histogram of Oriented Gradients (HOG) to automatise photograph cropping.

In the meantime, the Deep Learning (DL) revolution was underway in computer vision, showing breakthrough performance improvements [START_REF] Sylvain Christin | Applications for deep learning in ecology[END_REF]. In particular, convolutional neural networks (CNNs) are now the front-line technique to deal with the large range of image processing questions in ecology and environmental sciences [START_REF] Lamba | Deep learning for environmental conservation[END_REF]. In particular, many recent studies tackle the problem of re-identification using CNNs, which has been mostly developed and extensively used for humans [START_REF] Wu | Deep learning-based methods for person re-identification: A comprehensive review[END_REF]. Technically, re-identification consists in using a CNN to classify images of different individuals, some of them being not necessarily seen before, i.e. unknown individuals. However, despite the availability of proven and efficient techniques [START_REF] Zheng | Person re-identification: Past, present and future[END_REF] and several successful attempts to apply the method to non-human species [START_REF] Körschens | Towards automatic identification of elephants in the wild[END_REF][START_REF] Mark F Hansen | Towards on-farm pig face recognition using convolutional neural networks[END_REF][START_REF] Andre C Ferreira | Deep learning-based methods for individual recognition in small birds[END_REF][START_REF] Moskvyak | Robust re-identification of manta rays from natural markings by learning pose invariant embeddings[END_REF][START_REF] Bouma | Individual common dolphin identification via metric embedding learning[END_REF][START_REF] Schofield | Chimpanzee face recognition from videos in the wild using deep learning[END_REF][START_REF] He | Distinguishing individual red pandas from their faces[END_REF][START_REF] Bogucki | Applying deep learning to right whale photo identification[END_REF][START_REF] Schneider | Similarity learning networks for animal individual re-identification-beyond the capabilities of a human observer[END_REF][START_REF] Chen | A study on giant panda recognition based on images of a large proportion of captive pandas[END_REF], re-identification remains a challenging task when applied to animals in wild population where re-observations are limited sensu largo [START_REF] Schneider | Past, present and future approaches using computer vision for animal re-identification from camera trap data[END_REF].

In practice, current CNN-based approaches have to be tailored to the needs of field ecologists interested in using them for individual recognition. For instance, batches of new images are regularly added to the reference database following yearly fieldwork sessions. Also, in many situations, new individuals may have been born, and the study population may be open, i.e. immigration can occur.

2 Therefore, we expect the re-sighting of known individuals, as well as the observation of individuals never seen before. In other words, this sampling design implies to solve the re-identification in a mixture of known and unknown individuals. Chen and colleagues [START_REF] Chen | A study on giant panda recognition based on images of a large proportion of captive pandas[END_REF] referred to this problem as the "open set" identification problem, and they proposed to identify images from unknown individuals and to assign them a single "unknown" label. Here, we moved one step further and evaluated the possibility to build a model capable of identifying all individuals, be they known or unknown.

A classical CNN classifier can re-identify already known individuals (usually with a softmax last layer) but will fail to identify new individuals. Indeed, the number of predicted classes must match the number of known individuals. Therefore, we crucially need a CNN-based approach that can retain the power of the features learnt in a CNN while, at the same time, allow for the identification of individuals unknown at the time of the analysis. We propose to rely on deep metric learning [DML 25] as an ideal candidate to solve the "open set" identification problem: DML consists in training a CNN model to embed the input data (input images) into a multidimensional Euclidean space such that data from a common class (for instance, images of a given individual) are much closer, in terms of Euclidean distance, than with the rest of the data. Retrieving the individuals (known as well as unknown) consists in relying on the Euclidean distance computed for any pair of images. Finally, a suitable machine learning algorithm will retrieve the individuals.

Here we addressed the problem of giraffe photo-identification with an updated, open-source, and end-to-end automatic pipeline. In a first step, we applied state-of-the art techniques for object detection with CNNs [START_REF] Lin | Focal loss for dense object detection[END_REF] to automatically crop giraffe flanks of about 4,000 raw photographs shot in the field. Indeed, the most recent CNN approaches clearly outperformed the HOG approach [START_REF] Girshick | Rich feature hierarchies for accurate object detection and semantic segmentation[END_REF]. Second, following Bolger and colleagues [START_REF] Douglas T Bolger | A computerassisted system for photographic mark-recapture analysis[END_REF], we used the SIFT operator to calculate a numeric distance between any pair of giraffe flanks. From the n × n calculated distances, we built an image similarity network [START_REF] Wang | Network enhancement as a general method to denoise weighted biological networks[END_REF] and applied network clustering to retrieve different clusters of images coming from different individual giraffes, hence removing any human intervention in the process. However, we manually validated a subset of our results to build a ground-truth data set of different individuals (n = 178) to train our CNN. Finally, we evaluated the predictive accuracy of our CNN-based metric learning approach with a 5-fold cross-validation procedure.

Material and Methods

Photograph database

We carried out this study in the northeast of Hwange National Park (HNP), Zimbabwe. HNP park covers a 14,650 km 2 area [START_REF] Chamaillé-Jammes | Seasonal density estimates of common large herbivores in hwange national park, zimbabwe[END_REF]. The giraffe sub-species currently present in HNP could be either G. c. angolensis or G. c. giraffa according to the IUCN [START_REF] Muller | Giraffa camelopardalis (amended version of 2016 assessment)[END_REF]. Here we used data from a regular monitoring conducted between 2014 and 2018. Each year, daily for at least three consecutive weeks, we drove the road network available within ¡60km of the HNP Main Camp station, and took photographs of every giraffe encountered. Pictures were taken with 200mm to 300mm lenses mounted on Nikon DSRL cameras (sensor resolution ranged between 16 and 40 Mpx). Importantly, we filtered sequences of very similar photographs occurring with the camera burst mode in the same second, and retained one single photograph per sequence. Overall, we shot n = 3,940 photographs.

Image cropping with CNN and transfer learning

We relied on convolutional neural networks (CNNs) to detect one or several giraffes in each photograph. For an efficient detection and classification, a CNN has to be trained on a huge amount of images (usually > millions of images) to capture the most discriminant features associated with 3 each class. Because of our limited amount of photographs, we relied on transfer learning [START_REF] Shin | Deep convolutional neural networks for computer-aided detection: Cnn architectures, dataset characteristics and transfer learning[END_REF], a specific method aiming at training a CNN on a small number of images. In transfer learning, we do not start the CNN training "from scratch" with some random model parameters, but use the parameters of another model pre-trained for a task presenting some similarities with the task of interest. For giraffe detection, we used a pre-trained model for object detection that can deal with a few mammalian species, even if those species differed from the one of interest. This approach works because the pre-trained model has already learnt a wide range of relevant and generic features, that we can reuse as a starting point for our learning problem of finding giraffe flanks in photographs. Thanks to this prior information, transfer learning can deal with a small dimension data set (down to a few hundreds of images per class).

A range of cutting edges tools are now available to take advantage of CNN in the context of object detection for animal detection [START_REF] Parham | An animal detection pipeline for identification[END_REF][START_REF] Schneider | Deep learning object detection methods for ecological camera trap data[END_REF]34]. In particular, RetinaNet [START_REF] Lin | Focal loss for dense object detection[END_REF] is a CNN-based object detector able to detect a series of predefined object classes (e.g. different animal species) and that returns the coordinates of a bounding box around these objects as well as a confidence score. These two steps are performed at the same time with a single CNN, which makes RetinaNet a onestage detector as opposed to two-stage detectors for which a first CNN search for regions containing a potential object and a second CNN classify these regions. Two-stage detectors are known to achieve better performance in practice but are slower than one-stage detectors [START_REF] Redmon | You only look once: Unified, real-time object detection[END_REF]. However, RetinaNet proposes a new technique that better manage non informative objects' background with similar performance compared to two-stage detectors while being much faster [START_REF] Lin | Focal loss for dense object detection[END_REF]. Finally, it is known that the more heterogeneous the training data set is (various positions, backgrounds, scale or lighting), the most efficient a CNN is [START_REF] Beery | Recognition in terra incognita[END_REF], so we used data augmentation (flipping, rotation and color changes) to enhance our model performance.

We manually prepared our training data set by cropping bounding boxes around giraffe flanks, excluding most of the neck, head, legs and background, with the labelImg open source program for image annotation (https://github.com/tzutalin/labelImg). We obtained 469 bounding boxes associated to 400 photographs. We performed transfer learning with RetinaNet to detect a single object class, the giraffe flank, from a pre-trained model shipped with RetinaNet, that is a ResNet50 backbone trained on the COCO dataset (80 different classes of common objects including giraffes among a few other animal species [START_REF] Lin | Microsoft coco: Common objects in context[END_REF]). We trained the model with 30 epochs of 100 batches of size 2. Training took approximately 30 minutes on a Titan X card. Our pipeline was based on the Keras implementation of RetinaNet available at https://github.com/fizyr/keras-retinanet.

Distance estimation between giraffe flank images

Our re-identification pipeline is based on the computation of distance between pairs of images displaying giraffe flanks. To build a reference data set and to gain some insights on the potential added-value of deep-learning approaches, we used either distances based on the SIFT algorithm, currently the most commonly used traditional computer vision approach in our context, or distances based on a CNN approach. These distances were then used to build a network of photographs and identify clusters of photographs of the same individual giraffe.

Using the Scale Invariant Feature Transform operator

We built on Bolger and colleagues [START_REF] Douglas T Bolger | A computerassisted system for photographic mark-recapture analysis[END_REF] to achieve pattern matching between giraffe flanks with the Scale Invariant Feature Transform operator (SIFT; [START_REF] David G Lowe | Distinctive image features from scale-invariant keypoints[END_REF]). The SIFT algorithm extracts characteristic features in photographs called key points that are invariant with respect to scale and orientation. Comparing two photographs, pairs of matching key points (i.e. having similar characteristics) are 4 retrieved and ranked by distance (Euclidean distance between their feature vectors). Here, we selected the 25 closest pairs of key points. However, for better results, we had to assess the extent to which matching key points were coherent in the two giraffe flanks, i.e. if their location matched on the giraffe body. To find out relevant cases where matching key points were actual matches of coat patterns, we superimposed key points extracted from a pair of giraffe photographs with a geometrical transformation called homography. An homography is a perspective transformation between the two planes, with here one plane per image.The homography consists in finding the optimal transformation such that the key points from the first image are as close as possible as those of the second image, conserving the relative positioning of these key points but changing the perspective. Then key points from both images were superimposed on a plane and we computed the Euclidean distance between all pairs of key points in a pair of photographs, hence obtaining our SIFT-based distance. We used the implementation of SIFT and homography in the open source openCV library [START_REF] Bradski | The OpenCV Library[END_REF] version 3.4.

Using deep metric learning and triplet loss with CNN

We trained a CNN model using the triplet loss [START_REF] Hermans | In defense of the triplet loss for person re-identification[END_REF], in line with recent studies on other species [START_REF] Moskvyak | Robust re-identification of manta rays from natural markings by learning pose invariant embeddings[END_REF][START_REF] Bouma | Individual common dolphin identification via metric embedding learning[END_REF]. The triplet loss principle (details in [START_REF] Bouma | Individual common dolphin identification via metric embedding learning[END_REF]) relies on triplets of images, each triplet composed by a first image called anchor and another positive image of the same class (same giraffe here) with a third negative image of another class (any different giraffe). The training step consists in optimising the CNN model such that the Euclidean distance (computed using the last CNN layer) between any anchor and its positive image is minimal, while maximizing the distance between this anchor image with its negative image. We used an improved algorithm called semi-hard triplet loss [START_REF] Schroff | Facenet: A unified embedding for face recognition and clustering[END_REF] consisting in dealing with triplets where the positive and negative images are close enough to be informative still during the training procedure, using the TripletSemiHardLoss function in TensorFlow Addons.

After training completion, we computed the Euclidean distances between any pair of giraffe flank photographs, again using the vector composing the last layer of our CNN model.

The CNN requires a training data set that we derived from the photograph clusters identified by the SIFT algorithm. We retained only those clusters fulfilling the following conditions: (i) the cluster was made of at least five images; (ii) the cluster demonstrated a perfect and verified consistency. This second condition is of upmost importance because errors in the training data set would lead to sub-optimal performances of the machine learning approach. We therefore carefully checked, manually, that the SIFT-based clusters we retained were perfectly unambiguous. We achieved this high level of data quality by discarding all cases where two or more giraffes overlapped on the same frame, or when giraffes were indifferently oriented from the back to the front (orientation ambiguities). We performed transfer learning using the pre-trained model MobileNetV2 readily available in Keras (input images resized to 224 x 224 pixels). We ran the model training stage with 200 epochs with batches of size 96. Again, we augmented our data (rotation, width and height shift, brightness, zoom and shear mapping) using the stochastic gradient descent optimizer with a rate of 0.2. Training took about 2 hours to complete on a Titan X card. Our pipeline was implemented with Keras 2.3.0.

Image similarity network, community detection and clusters of flank images

Following the computation of distances between all pairs of giraffe flanks obtained either with the SIFT or the CNN approach, we searched for clusters of flank images that should come from one single individual giraffe. We first defined a network made of nodes and representing giraffe flank images, and of edges: we considered that two nodes were connected by an edge, i.e. two flanks 5 were similar and came from the same giraffe individual, if the Euclidean distance between paired images felt below a given threshold (see below for more details). Therefore, the so-called connected components of this network are supposed to gather images from different individuals.

We estimated the distance threshold value by taking advantage of a property of complex networks called the explosive percolation [START_REF] Achlioptas | Explosive percolation in random networks[END_REF]. The explosive percolation predicts a phase transition of the network just above a threshold point. At this turning point, adding a small number of edges in the network, for example by slightly increasing the distance threshold [START_REF] Hayasaka | Explosive percolation in thresholded networks[END_REF], leads to the sudden appearance of a giant component encompassing the majority of nodes. In other words, a small increase of the distance threshold leads to considering that almost most of the images come from the same giraffe individual. The threshold value was found graphically and was estimated to 340 when dealing with our SIFT-based distance (see Figure A.1a) and between 0.6 and 0.8 in our repeated experiments using our CNN-based distance (see Figure A.1b).

An additional issue need to be resolved: a connected component might be composed of different sub-components that are erroneously connected. This is the case when the distance computation fail in avoiding false positive edges (example in Figure A.2), i.e. when two flanks are erroneously considered similar. Moreover, in some cases the body of two or more giraffes can overlap in one photograph. In this situation, two or more nodes might be linked by edges, when we actually have different giraffes. Therefore, we applied a network clustering algorithm called community detection, developed in network science [START_REF] Fortunato | Community detection in graphs[END_REF]. It is designed to split -only when relevant -any connected component into different groups of nodes that are significantly much more connected between themselves than with the others. Indeed, the presence of many edges inside a group of images suggested it was consistent (i.e. from the same individual), whereas the absence of many edges between two groups clearly informed about their inconsistency and heterogeneity (i.e. from two different individuals). We applied the community detection with the InfoMap algorithm [START_REF] Rosvall | Maps of random walks on complex networks reveal community structure[END_REF] that is based on a random walker exploring the network. The final product of the community detection algorithm is a series of clusters of images corresponding either to a connected component or to a community retrieved by InfoMap. Any cluster is considered as a group of images coming from a single individual, and should also be the only cluster dealing with this particular individual.

Training and evaluation of CNN-based re-identification

We evaluated the overall predictive performance of our CNN deep metric learning with a classical 5-fold cross-validation procedure. We first randomly extracted 20% of our individuals from our original data set. Every image of these individuals (hereafter named unknown individuals) was moved to the test set. We then partitioned the images of the remaining 80% of our individuals as follows. Since we wanted to check the model ability to identify unknown as well as already known individuals, we moved two images of the these individuals (hereafter named known individuals) to the test set. Therefore, the test set contained all the images of the unknown individuals, and two images of the known individuals. We built the training set with the remaining data.

Our CNN model was not designed to classify images directly (i.e. assigning images to individual giraffes). Indeed, deep metric learning led to the computation of the distance between any pair of images. To mimic re-identification per se, we considered that we had a "reference book" with three representative images per known individuals (images from the training set). A representative image was intended to work as a "hook" to catch images from the same individual inside the test set. Indeed, we expected a small distance between an image in the test and a representative one when they corresponded to the same known individual. Finally, we calculated the distance between any pairs of images (as described before) in the three categories: i) the unknown individuals and ii) the known individuals from the test set, and iii) the representative images per known individual 6 coming from the training set.

We quantified the predictive performance of the trained CNN model with three different indices measuring different facets of the performance. (i) The top 5 accuracy consists in checking for each query image if another image from the same individual is among the five images with smallest distance. We also computed the widely used (ii) sensitivity and (iii) specificity for the evaluation of binary classification tests. Indeed, we built a network where the nodes are the giraffe flank images from the three categories (representative, known and unknown) and the edges are defined using a threshold (see previous section). Therefore, we were able to test the concordance between our "true" clusters (i.e. the validated SIFT-based clusters) and the "predicted" clusters obtained by applying the network-based approach on the CNN-based distance. Hereafter, we established the correspondence between true and predicted clusters by checking the predicted cluster with highest number of images from this true cluster. Sensitivity is the fraction of images of a true cluster correctly assigned, averaged over all the true clusters of interest. Specificity is the fraction of images in a predicted cluster that are in the corresponding true cluster, that we averaged over the true clusters.

Results

From thousands of images to hundreds of identified giraffe individuals

We trained the object detection method RetinaNet [START_REF] Lin | Focal loss for dense object detection[END_REF] on a set of 400 photographs for which the cropping of the giraffe flank has been previously done manually. When applying the automatic cropping procedure on our 3,940 photographs (see Figure 1a), we retrieved 5,019 images with associated bounding boxes, supposed to contain a single giraffe flank (see Figure 2a). The cropping failed for 186 photographs (failure rate: 4.7%), mostly due to foreground vegetation and unusual and difficult orientation of giraffes in the photograph (see examples on Figure 1b). In a few cases, a bounding box could contain the bodies of two overlapping giraffes, one being partially in front of the other (see Figure 2a). Similarly, we observed rare instances where a group of giraffes very close to each other is present on a photograph, RetinaNet could fail in retrieving the exact boundaries of each giraffe flank (see the worst case that we experienced, from a partially blurry photograph in Figure 2b). Running the SIFT algorithm [START_REF] David G Lowe | Distinctive image features from scale-invariant keypoints[END_REF] to compare all pairs of flanks took about 800 CPU hours of heterogeneous computing resources. Our customised SIFT-based distance led to an image similarity network composed of 5,019 nodes and 11,249 edges, composed by 1,417 connected components (see Methods) among which 781 singletons. We identified several false positive edges leading to two images being erroneously classified as similar. False positive matches occurred either because of image background similarity (e.g. the same tree appeared on two images; see nodes 3 and 4 in Figure 3) or because of a perfect matching between giraffe orientation (see Figure A.2). These false positive matches connected images from different individuals inside a connected component. For instance, when the body of two giraffes overlapped on the same image (see node 2 in Figure 3), then this image linked two sets of images corresponding to the two individuals.

Our network-based approach, relying on community detection, dealt with these difficult cases to retrieve consistent clusters of flank images (different colors in Figure 3). The cluster size distribution is by definition more concentrated after network clustering (see Figure 4) with a maximal size of 35 instead of 373. Indeed, this very large connected component was clearly an artifact due to a chain of giraffe overlaps, and has been successfully split by our procedure (see Figure 5). We detected 316 clusters with more than 5 images, and 105 with more than 10 images. However, in rare cases, some images from the same individuals were found in different clusters (see Figure 5). Because these clusters arose from a single connected component, we could a posteriori check for consistencies by comparing clusters of the same component manually (such as performed for Figure 5).

From identified giraffe individuals to a deep learning approach for re-identification

We saved 178 human-validated unambiguous SIFT-based clusters to generate a reference data set of unique individual giraffes. Those 178 clusters were made of 1,393 images of giraffe flanks from which we evaluated our re-identification pipeline based on deep metric learning. Top 5 accuracy was about 90% on average (see Table 1) but note that the top 5 accuracy is of similar magnitude between both categories of known and unknown individuals. Top 5 accuracy increased, however, to 95.4% when considering only images of nknown individuals. Regarding the mapping between original and predicted clusters of images, both sensitivity and specificity were high, reaching values > 90% when dealing with known individuals (see Figure 6a). However, sensitivity dropped down to 53.9% when dealing with unknown individuals. This was partly due to the number of singletons image that are not associated to any other image in our network-based approach. Interestingly, specificity was moderate with all images included (about 71%) but increased to 90% dealing with only the images of unknown individuals (see Figure 6b). 8 q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q 4 6 5

Discussion

In this study, we were able to propose a complete and fully automated pipeline to build a data set of re-identified giraffe individuals. We took advantage of the most recent techniques to perform object detection and crop the giraffe flanks to allow coat pattern analysis. This step was particularly efficient when giraffe individuals were not overlapping in a photograph. However, cascade of problems arose when overlap existed, including erroneous cropping and difficulties to assign a bounding box to a single individual (since it contained two individuals). We then followed previ-9 q q q q q q q q q q q q q q q q 2 3 4 Actual number of individuals (truncated scale) Number of clusters (truncated-scale)

Figure 5: Agreement between the number of clusters (when at least two clusters were found out of a connected component) as returned by our machine-learning approach, and the human-based and manually-checked number of individuals. Circle size is proportional to the number of observations. Top 5 (%) Sens. (%) Spec. (%) Singleton (%) Known indiv.

89.4 ± 0.5 90. ous attempts to use the SIFT-operator to perform pattern matching between flanks. However, we proposed a new problem statement using a network-based approach that efficiently handled false positive problems (e.g. matching between two images due to a similar element in the background) and false negative problems (e.g. differences in lighting and orientation). We were then able to go one step further other approaches from the literature since the end product of our automatic method is a comprehensive list of clusters of images, one cluster per re-identified individual.

We then evaluated the possibility to train a convolutional network to allow for giraffe identification when known and unknown individuals are present in a data set to be analysed. We observed that the CNN model seemed to contain relevant features that can be generalised to unknown individuals. One advantage of this approach is that our CNN-based distances were computed in a few minutes instead of hours to compute the SIFT-operator (once the training has been performed; see Table A .1). We achieved about 90% top 5 accuracy, which can definitely help field researchers in identifying giraffes, but is not fully satisfying if we are interested in a fully end-to-end automated pipeline that would require no checking by people. For this reason, we considered the same network-based approach using the prediction performed by the CNN. Whereas we obtained good results dealing with known individuals (i.e. good match between true and predicted cluster), we were not able to handle correctly the prediction of clusters of unknown giraffe images. We obtained 10 q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q Figure 6: Image similarity networks defined by CNN-based metric learning. Node color represents different individual giraffes. Left: between flanks from known individuals only (including representative flanks; see Methods). Right: between flanks from unknown individuals only. limited specificity due to many erroneous false positive links between images of known and unknown individuals. Even worse, we faced a sensitivity issue with a lot of images that were not connected to any other images. We understood that our CNN is vulnerable to orientation variation, much more than the more robust SIFT operator.

Further methodological developments should be investigated, to improve the current results. Firstly, our study suggests that a two step procedure could be developed: the first step consisting in detecting (and putting aside) images of known individuals; the second step consisting in treating the unknown individuals, as our study has shown that a CNN model can be trained to contain features that can be generalised to unknown giraffe individuals. Secondly, we believe that different data augmentation strategies should be able to improve our results, in particular in reducing the sensitivity of the CNN-based approach to image orientation changes. Such methodological developments will be able to benefit from this study and the large ground-truth data set that we make available upon request. In any case, we believe that our study, fully and freely reproducible, paves the way for future CNN-based works on animal individual re-identification.

Finally, this inter-disciplinary work provides guidelines about best practices to collect identification images in the field, if to be used later with an automated pipeline such as the one presented here. Better results can be achieved with simple framing rules of animals with cameras. First the field operator should try to avoid as much as possible overlaying bodies of two or more individuals as this was the most acute issue in our giraffe experience. Note that several but well separated individuals in the same photograph is not a problem at all thanks to the CNN cropping performed as a preliminary stage. Another point to pay attention to is the background which, if too similar on the same images (e.g. photographs shot from the very same spot) with obvious structures (tree, pond, rocks. . . ) will likely mislead the computer vision algorithm, even on cropped images because cropping is rectangular and do not delineate the animal body. This situation often arises while photographing animals moving in line, as giraffes and many others often do. A last point is the heterogeneity of situations under which animals were observed. We did our best to improve the training data set with data augmentation. However, photographing giraffes in as many different conditions as possible would most likely improve the results. This includes light conditions (dawn, dusk, noon), orientation of individual or background (open vs. more densely vegetated areas). More specific to CNN re-identification is the need to have a greater number of pictures (> 50) of photographs per individuals that what is currently available, so a particular attention should be given, in the field under optimal shooting conditions, to the opportunity to take more photographs of each observed individual.

Figure 1 :Figure 2 :

 12 Figure 1: Performance of RetinaNet flank detection. a) Number of identified flanks per image. b) Manual classification of cropping problems encountered in 186 images where Retinanet failed to identify a giraffe flank.

Figure 3 :

 3 Figure 3: Example of a connected component split into four clusters using the InfoMap algorithm (see Methods). Each cluster is delineated by an ellipse of different color. Node 2 is an image with two giraffes that we also have in images 1 and 3 respectively. Images 3 and 4 are considered similar because of the presence of the same tree in the background (same for images 5 and 6).

Figure 4 :

 4 Figure 4: Re-identification from 5,019 giraffe flank images. Number of flank images retrieved by clusters, with the original clusters/connected component (red) or with the clusters retrieved using the InfoMap algorithm to split the connected components (blue; see Methods).

Table 1 :

 1 Metric learning performance computed on the test set with images of known individuals and unknown individuals, or solely on a restricted test set with only the unknown individuals (excluding images from the known individuals). Top 5 accuracy, average sensitivity and specificity. Mean ± standard error over 10 trials.

		2 ± 0.4 90.8 ± 0.3	15.2 ± 1.1
	Unknown indiv.	89.8 ± 0.7 53.9 ± 1 71.3 ± 1.8	23.3 ± 1.8
	Unknown indiv. only 95.4 ± 0.4 53.8 ± 1 90.6 ± 1.1	23.3 ± 1.8

Acknowledgments

We would like to thank Jeanne Duhayer for her considerable help in analysing our preliminary findings, and our statistician colleagues Laurent Jacob and Franck Picard for their insights on deep learning. This work was performed using the computing facilities of the CC LBBE/PRABI. Funding was provided by the French National Center for Scientific Research (CNRS) and the Statistical Ecology Research Group (EcoStat) of the CNRS. We are also grateful to Derek Lee for his kind advice in processing photographs, and for sharing with us his experience in the monitoring of giraffes. Finally, we acknowledge the support from the CNRS Zone Atelier / LTSER program for fieldwork.

a)

q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q 100 200 300 400 500 600 1000 3000 Distance threshold Giant component size b) qqqqqqqqqqqq qq q q q q q q q q qqqqqqqq 0.0 0. q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q Figure A.3: Image similarity networks defined by CNN-based metric learning. Nodes'color correspond to giraffe individuals. Between flanks from unknown individuals and known individuals (black square). Edges between known individuals were discarded.


Simon Chamaillé-Jammes

A reformulation of the selection ratio shed light on resource selection functions and leads to a unified framework for habitat selection studies

Keywords: distribution model, niche, method, movement, space use

1. The selection ratio (SR), i.e. the ratio of proportional use of a habitat over proportional availability of this habitat, has for long been the standard metric of habitat selection analyses. It is easy to compute and directly estimates disproportionate use. Its apparent restriction to habitat selection analyses using categorical predictors led to the development of the resource selection functions (RSF) approach, which has now become the norm.

2. The RSF approach has however led to debates and confusion. For instance, what functional form can be used remains debated, and the concept of relative probability of selection is often misunderstood.

3. I propose a reformulation of the SR demonstrating that it can be estimated in a regression context, and thus even with continuous predictors. This reformulation suggests that RSF can be seen as an intermediate step in the calculation of SR. This reformulation also clarifies some longstanding debates about RSF and data-selection/fitting practices.

4. I further suggest that SR estimates the strength of habitat selection, but that the contribution of selection in determining use, which should be more directly linked to fitness than selection per se, .

Introduction

Understanding why organisms use their environment the way they do is a key aim for ecologists [START_REF] Morris | Toward an ecological synthesis: a case for habitat selection[END_REF]. Decades of habitat selection studies have aimed at testing, quantifying, and explaining the disproportionate use of some habitats by individuals. 'Disproportionate' is usually formally defined in comparison with the expected use of habitats by individuals that would use the available habitats at random [START_REF] Manly | Resource Selection by Animals Statistical Design and Analysis for Field[END_REF]. The standard approach to estimate whether habitat use is disproportionate has for long relied on selection indices. Many selection indices have been proposed [START_REF] Lechowicz | The sampling characteristics of electivity indices[END_REF][START_REF] Manly | Resource Selection by Animals Statistical Design and Analysis for Field[END_REF], but the most simple and commonly used is the forage ratio first proposed by [START_REF] Savage | The relation between the feeding of the herring off the east coast of England and the plankton of the surrounding waters[END_REF], cited in Manly et al., 2002), often (and hereafter) simply referred to as selection ratio (SR). The SR for a habitat i is defined as follow:

SR i = P i U P i A equation 1
with P i U the proportion of habitat i in the set of used locations, and P i A the proportion of habitat i in the set of available locations when availability is estimated using random locations. A SR i value of 1 indicates that use of habitat i is proportional to its availability in the accessible landscape, and therefore a lack of selection for this habitat. A SR i > 1 indicates selection, whereas a SR i < 1 indicates avoidance. The common and persisting use of SR (e.g [START_REF] Aho | Confidence intervals for ratios of proportions: implications for selection ratios[END_REF][START_REF] Basille | Plastic response of fearful prey to the spatiotemporal dynamics of predator distribution[END_REF] shows that the SR is an index widely accepted by ecologists, probably thanks to its ease of interpretation and the clear match between its calculation and the definition of selection as a disproportionate use compared to random use.

The SR approach however appeared limited to situations in which the habitat could be defined by a limited number of categorical predictors, as one needs to be able to compute proportions over habitat categories (e.g., open vs. closed habitats). [START_REF] Mcdonald | Analyzing foraging and habitat use through selection functions[END_REF] proposed a new statistical approach -resource selection functions (RSF) -to analyze the selection of habitats (or resources) defined by several variables, categorical or continuous, and their interactions [START_REF] Mcdonald | Analyzing foraging and habitat use through selection functions[END_REF]. This flexibility, associated with the increasing ability to integrate many habitat-defining variables thanks to advances in remote sensing, has made RSF the model of choice to estimate the strength of habitat selection.

A RSF is a function, often termed w, that transforms the density distribution of habitat i in the set of available locations into the density distribution of the same habitat in the set of used locations [START_REF] Mcdonald | Analyzing foraging and habitat use through selection functions[END_REF][START_REF] Johnson | Resource Selection Functions Based on Use -Availability Data : Theoretical Motivation and Evaluation Methods[END_REF][START_REF] Lele | Weighted distributions and estimation of resource selection probability functions[END_REF][START_REF] Mcdonald | The point process use-availability or presence-only likelihood and comments on analysis[END_REF], such that:

w (x)= f U (x) f A (x ) equation 2
with w (x) the RSF, f U ( x) and f A ( x) the density distributions of used and available locations respectively. For a set of predictors x 1 to x n ,

w=f (β 0 +β 1 * x 1 + ...β n * x n )
Interpreted differently, the RSF describes how the relative probability of selection of habitats varies with their characteristics defined by a set of predictors [START_REF] Manly | Resource Selection by Animals Statistical Design and Analysis for Field[END_REF]. As the link between eq.

1 and 2 makes clear, and as stated by [START_REF] Lele | A new method for estimation of resource selection probability function[END_REF], the RSF "is simply an extension of the idea of selection index to the case of continuous covariates".

Despite its apparent simplicity, the RSF methodology has led to debates and confusion, which I now summarize:

(1) RSF are commonly assumed to have an exponential form, such that

w=exp(β 0 +β 1 * x 1 +... β n * x n )
There is however little theoretical justification for the use of this specific form. The exponential RSF is the unique model when both the used and available distribution follow a normal distribution [START_REF] Lele | Selection, use, choice and occupancy: clarifying concepts in resource selection studies[END_REF][START_REF] Mcdonald | The point process use-availability or presence-only likelihood and comments on analysis[END_REF], but these conditions are rarely, if ever, met. The use of exponential RSF is actually based on practicality: if one assumes an exponential RSF, the likelihood of the RSF is proportional to the likelihood of a logistic regression, with used locations being coded as 1 and available locations as 0 [START_REF] Johnson | Resource Selection Functions Based on Use -Availability Data : Theoretical Motivation and Evaluation Methods[END_REF][START_REF] Mcdonald | The point process use-availability or presence-only likelihood and comments on analysis[END_REF] [START_REF] Lele | Weighted distributions and estimation of resource selection probability functions[END_REF][START_REF] Lele | Selection, use, choice and occupancy: clarifying concepts in resource selection studies[END_REF] argued however that other models, such as probit or complementary log-log functions, could actually be used, and should sometimes be favoured, to fit RSF. Thus, although most studies assume an exponential form for the RSF, it is still unclear whether other functions could be used, and how they would perform compared to exponential RSF.

(2) RSF do not estimate absolute probability of selection (i.e. the probability of selecting an habitat when encountered [START_REF] Lele | Selection, use, choice and occupancy: clarifying concepts in resource selection studies[END_REF]. In RSF models, the intercept, which would allow normalizing the RSF scores to obtain probabilities of selection [START_REF] Avgar | Relative Selection Strength: quantifying effect size and biological significance in habitat-and step-selection inference[END_REF], is considered uninterpretable because it depends heavily on how the 'used' and 'available' locations are sampled [START_REF] Manly | Resource Selection by Animals Statistical Design and Analysis for Field[END_REF][START_REF] Lele | Weighted distributions and estimation of resource selection probability functions[END_REF][START_REF] Mcdonald | The point process use-availability or presence-only likelihood and comments on analysis[END_REF]. RSF are therefore only valid to "estimate relative probability of selecting one habitat unit with a particular set of characteristics relative to another unit with different characteristics" [START_REF] Mcdonald | The point process use-availability or presence-only likelihood and comments on analysis[END_REF]. In the current RSF framework, assuming that i is the reference habitat, one can conclude that habitat j has (for instance) a higher probability of being selected than reference habitat i, but one cannot conclude about the extent to which habitats i and j are selected or avoided, compared to expectations under random use of the available habitats.

Nevertheless, results from RSF analyses are often wrongly interpreted as 'habitat j is selected', overlooking that estimates of the strength of habitat selection are only relative. If the study of the relative probability of selection between habitats can in itself be sometimes of interest, often one would want to estimate whether habitats are selected, used proportionally to their availability, or avoided, irrespectively of others, in accordance with the usual definition of habitat selection being used more than expected under random use. This is most clearly seen if considering a RSF analysis with a continuous explanatory variable only, for instance distance to nearest road. The RSF will inform on whether selection increases or decreases as distance increases, but will not allow concluding about the distance at which selection shifts from attraction to random use or avoidance.

It suggests that RSF cannot fulfill the original goal of most habitat selection studies. Moreover, and as emphasized by [START_REF] Lele | Selection, use, choice and occupancy: clarifying concepts in resource selection studies[END_REF], the interpretation of relative probability of selection is difficult: a doubling in the relative probability of selection does not have the same biological implication if the absolute probability of selection of the reference habitat is 0.004 or is 0.4. It has been claimed

that absolute probability of selection can be estimated using resource selection probability functions (RSPF) [START_REF] Lele | A new method for estimation of resource selection probability function[END_REF], but not all authors agree [START_REF] Mcdonald | The point process use-availability or presence-only likelihood and comments on analysis[END_REF], and they are limited to specific situations (e.g., for instance models should contain at least one continuous predictor [START_REF] Lele | Weighted distributions and estimation of resource selection probability functions[END_REF][START_REF] Lele | A new method for estimation of resource selection probability function[END_REF]. Generally, very few studies have fitted RSPF models, suggesting that practitioners do not feel at ease with RSPF models.

(3) RS(P)F have led to misinterpretations. As emphasized by [START_REF] Lele | Selection, use, choice and occupancy: clarifying concepts in resource selection studies[END_REF] who clarified it, the concept of probability of selection which underlies the RS(P)F framework is commonly misunderstood, often confounded with probability of use or probability of choice [START_REF] Lele | Selection, use, choice and occupancy: clarifying concepts in resource selection studies[END_REF].

The use of the logistic regression machinery, classically used in statistics to model probabilities, but in RSF analyses used to estimate the parameters of the exponential RSF and the relative probability of selection, has also created some confusion [START_REF] Lele | Selection, use, choice and occupancy: clarifying concepts in resource selection studies[END_REF]. It is not uncommon to see authors reporting RSF scores as if they were log-ratio of the probabilities of selection, although they are not [START_REF] Lele | Selection, use, choice and occupancy: clarifying concepts in resource selection studies[END_REF][START_REF] Avgar | Relative Selection Strength: quantifying effect size and biological significance in habitat-and step-selection inference[END_REF]. Additionally, the common practice of reporting or plotting the raw coefficients of logistic regression to visualize the effect sizes is misleading because the exponentiation required to calculate the RSF scores affects the scaling.

Overall, RS(P)F are powerful tools to study complex habitat selection models, but they also have drawbacks and can be misunderstood. I re-emphasize here that the RS(P)F framework emerged from the need to integrate continuous variables in habitat selection analyses previously conducted using SR. With this in mind, I propose a new formulation of SR, mathematically equivalent to eq. 1, showing that SR are directly estimable in a classical regression framework integrating both categorical and continuous variables. I therefore argue that SR can be the standard metrics for the study of the strength of habitat selection. I complement this approach with an additional step allowing to differentiate between the strength of habitat selection and its effect on habitat use, which is mediated by habitat availability and should be more directly related to individual fitness than the strength of habitat selection [START_REF] Gaillard | Habitat-performance relationships: finding the right metric at a given spatial scale[END_REF].

A reformulation of the selection ratio

The SR of any habitat i (SR i ), when estimated using samples of use and available locations, can be reformulated as follow:

SR i = P i U P i A = N i U N U N i A N A = N i U N U * N A N i A = N i U N i A * N A N U equation 3
Thus, SR i equals the ratio, calculated using locations falling in habitat i only, of the number of used locations N i U over the number of available locations N i A , multiplied by the ratio, calculated using all locations, of the number of available locations N A over the number of used locations

N U .
The ratio

N i A N i U
is the ratio of the numbers of locations that could be of two mutually exclusive types: be a 'used' location or be an 'available' location. Therefore, it is simply the odd of the probability that a data location falling in habitat i belongs to the set of 'used' locations. This is demonstrated here:

N i U N i A = N i U N i N i A N i = N i U N i (N i -N i U ) N i = P i setU 1-P i setU =odd(P i setU ) equation 4
We obtain the reformulation of SR by combining eq. 3 and eq. 4:

SR i =odd (P i setU ) * N A N U equation 5
For a given analysis, N U is the total number of used locations to be analyzed, N A is selected by the analyst, and thus

N A N U
is a known scalar. Therefore, one only needs to model how odd i varies with the predictors to model how those affect habitat selection, measured using SR.

Eq. 5 provides a new justification for the use of exponential RSF estimated by logistic regression in habitat selection studies, as logistic regression is the most common statistical approach to model probabilities and odds. Logistic regression uses a logit link function to linearize probabilities [START_REF] Fox | Applied regression analysis and generalized linear models[END_REF], and fits:

logit (P i setU )=log ( P i setU 1-P i setU )=log (odd (P i setU ))=β 0 +β 1 * x 1 +...+β n * x n equation 6
It is clear that the score w i exp of an exponential RSF, such that

w i exp =exp(β 0 +β 1 * x 1 +...+β n * x n ) , estimates odd ( P i setU )
, and eq. 5 shows that SR i can be recovered simply:

SR i =w i exp * N A N U equation 7
Alternatively, one could fit an exponential RSF using logistic regression incorporating log (

N A N U )
as an offset, in which case the RSF score would directly equal the SR. Using a number of random locations equals to the number of used locations, so that N A N U =1 , could appear an easy way to directly obtain SR without any calculations beyond RSF fitting. In most cases however, this would lead to use a relatively low number of available locations and a poor estimation of the availability of habitats [START_REF] Northrup | Practical guidance on characterizing availability in resource selection functions under a use-availability design[END_REF], and is therefore not advised. Note that, when

N A N U =1
and thus w i equals SR i , the practice of normalizing RSF scores over all available habitats leads one to obtain values that are equivalent to Chesson's α selection index [START_REF] Chesson | Measuring Preference in Selective Predation[END_REF][START_REF] Lechowicz | The sampling characteristics of electivity indices[END_REF][START_REF] Manly | Resource Selection by Animals Statistical Design and Analysis for Field[END_REF].

Overall, I suggest that RSF can be viewed as an intermediate step towards the calculation of SR, which could remain the central metrics to estimate the strength of habitat selection, even when one considers continuous predictors.

Implications of the reformulation of the SR, and benefits of its use

The use of SR to estimate the strength of habitat selection naturally solves some of the aforementioned issues and debates associated with RSF modelling, and additionally shed light on another issue that had until now been overlooked when fitting RSF as hierarchical (i.e., mixed) models.

First and foremost, SR are easily interpreted and directly match the accepted definition of selection, i.e., the disproportionate use of some habitats relative to a null model of random use of the available landscape. The concept of SR may thus be viewed as conceptually more appealing than the concept of (relative) probability of selection, which is not always understood [START_REF] Lele | Selection, use, choice and occupancy: clarifying concepts in resource selection studies[END_REF]. The use of SR, which allow calculating selection strength for each habitat, should also prevents misinterpretation arising from the use of RSF models, which estimate differences in the strength of selection between habitats, with the strength of selection for the reference habitat remaining unknown. Note that the use of SR does not prevent the comparison of selection strength between habitats when these are of interest. All of this suggests that SR could be a unifying metric of the strength of habitat selection.

Second, the reformulation of SR highlights that the use of logistic regression to estimate the parameters of RSF can be viewed not as a 'statistical trick' based on the equivalence between the likelihoods of the logistic regression and of the use-availability or point-process models (e.g. [START_REF] Johnson | Resource Selection Functions Based on Use -Availability Data : Theoretical Motivation and Evaluation Methods[END_REF][START_REF] Aarts | Comparative interpretation of count, presenceabsence and point methods for species distribution models[END_REF][START_REF] Mcdonald | The point process use-availability or presence-only likelihood and comments on analysis[END_REF], but as being justified on the basis of the required estimation of an odd. Logistic regression is the most common and straightforward method to estimate odds, but other probability models such as probit or complementary-log-log (clog-log) models could also be used, re-expressing results as odds [START_REF] Fox | Applied regression analysis and generalized linear models[END_REF]. This would make no sense if all predictors are categorical variables, because in that case results are perfectly identical between logit, probit or clog-log models. When continuous predictors are involved, having the choice of models could offer more flexibility. In practice, it could however be more straightforward to use the logit link with either transformed predictors, polynomials or splines to obtain the desired level of flexibility. Regression coefficients are also more easily interpreted when using a logit link, as they represent odd-ratios, and results from regression with logit or probit links are usually very similar. Note that estimating SR in a regression context as proposed here, even when only one categorical predictor is present, naturally solves the difficulty of estimating confidence intervals for SR [START_REF] Aho | Confidence intervals for ratios of proportions: implications for selection ratios[END_REF].

Overall, the reformulation of SR supports the common use of exponential RSF, but importantly highlights that other link functions could also be appropriate (see also [START_REF] Lele | Weighted distributions and estimation of resource selection probability functions[END_REF] for a similar claim, on a different basis). It is worth emphasizing once more that the estimated odd is not the odd of the probability of selection, and that results from logistic regression in the context of habitat selection analyses should not be interpreted as a log-odd-ratio of the probability of selection [START_REF] Lele | Selection, use, choice and occupancy: clarifying concepts in resource selection studies[END_REF][START_REF] Mcdonald | The point process use-availability or presence-only likelihood and comments on analysis[END_REF]. This issue would disappear if the estimation process is pursued up to the estimation of SR.

Third, the reformulation of SR demonstrates that, contrary to current practice, the intercept of RSF models, which allows calculating the associated RSF score w r for the reference habitat r, should not be overlooked. First, w r allows the SR of the reference habitat to be estimated (eq. 7), which can be of interest in itself. Second, it is crucial to recognize that the estimation of the intercept affects the estimation of other parameters of the RSF. In particular, it is clear from equations above that the intercept aggregates a biological and a sampling process (see also [START_REF] Fieberg | Correlation and studies of habitat selection: problem, red herring or opportunity?[END_REF][START_REF] Mcdonald | The point process use-availability or presence-only likelihood and comments on analysis[END_REF]. Eq. 7 shows that w r =SR r * N U N A , so that the value of the intercept will vary with the individual's strength of selection for the reference habitat r, but also with the ratio of used/available locations in the dataset. This dependence of the intercept on a biological and a sampling process warrants some caution when fitting hierarchical (i.e., mixed) RSF models.

For instance, it questions the recommendation made to use random intercepts to account for unbalanced sample size between individuals when fitting hierarchical RSF models [START_REF] Gillies | Application of random effects to the study of resource selection by animals[END_REF]. Eq. 7 shows that what matters is actually not differences in the number of 'used' locations

N U between individuals, but the ratio N U N A .
When this ratio is constant among individuals there is no need to account for differences in the number of 'used' locations. When this ratio varies between individuals, because for instance the same number of 'available' locations is chosen for all individuals whereas their number of 'used' locations vary, then random intercepts will account for both the variation in N U N A ratios and the difference in the strength of selection for the reference habitat (SR r ). The fixed effect intercept will therefore be a meaningless average of these effects across individuals, and the parameter estimates for other habitats, which are estimated as difference from this reference habitat, will therefore also be biased. Similarly, when N U N A ratios vary between individuals, the random intercepts and their variance will not accurately quantify interindividual differences in the strength of habitat selection between individuals. In this case they should therefore not be used to assess 'personalities' for instance. This is especially true as, for categorical habitat variables, the variation in the strength of selection between individuals is spread between random intercepts (for the reference habitat) and random slopes (for other habitats). Fitting random intercepts and slopes is therefore required when fitting hierarchical RSF models (see also Muff et al., 2018 for a similar suggestion, based on a different ground). From personal experience, fitting such models could prove challenging (e.g., large computation time, frequent convergence issues) when categorical habitat variables are defined by many classes, or involved in a number of interactions with other variables. Two-stage approaches where one model is fit per individual and individual results later aggregated accounting for uncertainty in estimates may sometimes be easier to implement [START_REF] Murtaugh | Simplicity and Complexity in Ecological Data Analysis[END_REF][START_REF] Fieberg | Correlation and studies of habitat selection: problem, red herring or opportunity?[END_REF].

Finally, the relevance of the intercept of RSF analyses also leads to questioning the current use of step-selection-function (SSF) analyses. SSF analyses are now routinely used when location data are collected at temporal resolution such that subsequent locations cannot be considered independent [START_REF] Thurfjell | Applications of step-selection functions in ecology and conservation[END_REF]. In SSF analyses, each used step is matched to a number of available steps, and SSF models are then fitted using conditional logistic regression with strata identifying the association between used and matched available steps [START_REF] Fortin | Wolves Influence Elk Movements: Behavior Shapes a Trophic Cascade in Yellowstone National Park[END_REF][START_REF] Thurfjell | Applications of step-selection functions in ecology and conservation[END_REF]. Because of the conditioning, conditional logistic regression models do not estimate an intercept [START_REF] Duchesne | Mixed conditional logistic regression for habitat selection studies[END_REF]. This possibly explains why SSF models do not allow simulating utilization distribution when habitat selection is strong [START_REF] Signer | Estimating utilization distributions from fitted stepselection functions[END_REF]. Further work trying to bridge the gap between RSF and SSF models, or on other approaches for autocorrelated location data [START_REF] Michelot | Inference in MCMC step selection models[END_REF], is urgently needed.

Beyond the strength of selection, estimating the contribution of selection to habitat use

The SR is a natural and intuitive measure of the strength of habitat selection. It is well known however that the strength of habitat selection does not in itself reflects to what extent the amount of use of a habitat is modified by habitat selection [START_REF] Lele | Selection, use, choice and occupancy: clarifying concepts in resource selection studies[END_REF]. For instance, a highly selected habitat, as assessed by its SR, is used only moderately more than under random use if it is little available. This can be shown formally by considering that the selection effect (SE) on the use of habitat i can be estimated by:

SE i =P i U -P i A
From eq. 1,

P i U =SR i * P i A
and therefore:

SE i =P i A * ( SR i -1) equation 8
Eq. 8 makes clear that the selection effect of the amount of use of one habitat depends on both the strength of selection for this habitat and its availability. Once SR i have been estimated as suggested above, it is thus straightforward to estimate SE i , as P i A can be directly estimated using density estimation (this might require binning the continuous variables). Although SE i could also be expressed as a function of P i U and SR i , its estimation would likely be less accurate as the estimation of P i U by density estimation is likely to be less precise that the one of P i A , due to sample size. Note that, whereas SR is a unitless metric, SE is on the scale of use and availability measures. For instance, if one assumes that the number of locations in habitat i estimates the time spent in habitat i, then SE i estimates how much time spent in habitat i has been added or lost by selection compared to expectations under random use of habitats.

It is interesting to note that the SE index had already been proposed by [START_REF] Strauss | Reliability Estimates for Ivlevˈs Electivity Index, the Forage Ratio, and a Proposed Linear Index of Food Selection[END_REF] as an index of selection [START_REF] Lechowicz | The sampling characteristics of electivity indices[END_REF], and that an index equaled to the square of SE, termed marginality, is the basis of some statistical approaches of habitat selection (Ecological-Niche Factor Analysis: [START_REF] Gaillard | Habitat-performance relationships: finding the right metric at a given spatial scale[END_REF].

Overall, the study of SR and SE will provide a comprehensive understanding of the strength of habitat selection and of its consequences for habitat use.

An example: plains zebra habitat selection

To demonstrate the value of the approach described above, I conducted an analysis of dry-season habitat selection analyses of plains zebras (Equus quagga), using data from 19 individuals collected in Hwange National Park (Zimbabwe). I estimated the strength of habitat selection and the contribution of habitat selection on habitat use, using SR and SE respectively, in one of the management block of the Park. Habitats were defined using information on vegetation types (i.e., grassland, bushland or woodland) and distance to water. See Supplementary Appendix S1 for more information on the study area and the data.

I fitted an exponential RSF, which uses a logit link function, as this is the approach most commonly used. Coefficients from the RSF (Supplementary Appendix S1) showed that the strength of habitat selection increased with proximity to water, and was higher in grasslands that in the two other vegetation types. However, from such a RSF model, one could not know when, along the distance to water gradient, the strength of selection shifted from selection to avoidance. This information could however be critical in a management context, for example when deciding how to spread artificial waterholes in a landscape. Computing SR from the RSF model, following eq. 7, solved this issue and revealed that the shift from selection to avoidance occurred at ~ 2 km from water in bushland and woodland vegetation types, but at ~ 5 km from water in grasslands (Fig. 1A).

Estimating the contribution of selection to habitat use provided further insights: the strong selection for habitats near water increased zebras' use of grasslands (Fig. 1B), but had only a minor effect on the use of bushlands and woodlands because these were rare near water (Fig. 1B). The zebras' habitat selection process affected the use of bushlands and woodlands only at intermediate (~ 3 to 7 km) distance to water, where these types of vegetation were less used than expected by chance. The general avoidance of areas located far from water also did not influence habitat use, compared to a random use, because these areas were rare in the landscape (Fig. 1B).

Conclusion

The reformulation of the SR presented here reveals that SR can be estimated in a regression context, even with continuous predictors, whereas it was initially the need to incorporate these predictors that led to the formulation of RSF [START_REF] Mcdonald | Analyzing foraging and habitat use through selection functions[END_REF][START_REF] Lele | A new method for estimation of resource selection probability function[END_REF]. It also clarifies some long-

Figure 1 .

 1 Figure 1. (A) Strength of zebra habitat selection, estimated using the selection ratio (SR), as a function of vegetation types and distance to water. Dotted lines show the 95% confidence intervals. (B) Contribution of habitat selection to habitat use, estimated using the selection effect (SE) metric (see text for details). Dotted lines show the 95% confidence intervals. The inset shows the distribution of habitats in the available landscape, estimated from data binned over 1 km bins.

  standing debates about RSF and data-selection/fitting practices. Finally, it shows that, with a trivially simple extra-step (i.e., multiplication of RSF scores by N can be greatly clarified. Finally, it highlights the inter-relation between various metrics used to study habitat selection (i.e., SR, other selection indices, RSF scores, marginality). I thereby propose that SR and SE can be the unifying metrics of habitat selection, as together they offer a comprehensive view on the strength of habitat selection and its effect on habitat use.

  Complementary log-log or Probit functions are inappropriate because they don't map values in the [0, +Inf[ range. On the contrary, Lele et al.

. Therefore, the parameters of the exponential RSF are equivalent to those returned by a logistic regression, a procedure available in virtually all statistical software.

[START_REF] Mcdonald | The point process use-availability or presence-only likelihood and comments on analysis[END_REF]

however suggested that a RSF could be any unbounded, monotonically increasing and positive function, as the only constraint he identified was that the RSF, being a ratio, should return values between [0, +Inf[. He also emphasized that Logistic,

  [START_REF] Hirzel | Ecological-niche factor analysis: how to compute habitat-suitability maps without absence data[END_REF]; K-select analysis:[START_REF] Calenge | K-select analysis: a new method to analyse habitat selection in radio-tracking studies[END_REF]; General nicheenvironment system factor analysis:[START_REF] Calenge | A general framework for the statistical exploration of the ecological niche[END_REF]. More recently, myself and colleagues have emphasized that SE can be understood as the contribution of selection in determining use, and it provides a different, but complementary way, to measure habitat selection, compared to SR[START_REF] Padié | Roe deer at risk: teasing apart habitat selection and landscape constraints in risk exposure at multiple scales[END_REF]. SR estimates the effort made by the animal to select and use specific habitats, whereas SE estimates to what extent this effort actually modifies its habitat use, relatively to a random use of the available landscape. Thus, SR and SE do not estimate the same aspects of the habitat selection process and caution should be applied when comparing studies based on SR or RSF approaches with studies based on SE or marginality. Also, SE should be preferred when studying to what extent habitat selection affect demographic performances, as fitness is influenced by use, rather than selection itself

Supplementary Appendix

S1. Presentation of the data used to analyze plains zebras habitat selection

The study was conducted using GPS data from zebra collared in Hwange National Park, Zimbabwe.

The park vegetation is typical of dystrophic savannas: the vegetation is mostly made of bushland, interspersed by patches of woodlands and grasslands that are particularly common near waterholes [START_REF] Chamaillé-Jammes | Piosphere contribution to landscape heterogeneity: a case study of remote-sensed woody cover in a high elephant density landscape[END_REF]. For this study I used the 30-m resolution vegetation map produced by [START_REF] Arraut | The 2013-2014 vegetation structure map of Hwange National Park, Zimbabwe, produced using free satellite images and software[END_REF]. I reduced the number of vegetation classes to three by pooling grasslands and bushed grasslands into a 'grassland' class, bushlands on Kalahari sands and scrublands on basalts into a 'bushland' class and deciduous woodland on Kalahari sands, deciduous woodland on basalts and evergreen woodlands into a 'woodland' class. The location of all permanent waterholes that retain water during the dry season is known [START_REF] Chamaillé-Jammes | Climate driven fluctuations in surface water availability and the buffering role of artificial pumping in an African savanna: Potential implication for herbivore dynamics[END_REF]. I used GPS tracking data collected during the dry season (August to October) on 19 adult females living in different harems. Locations were originally acquired every 30 min or every hour but I reduced autocorrelation in the data by retaining only one location per day, the one closest to noon. See for instance [START_REF] Courbin | Reactive responses of zebras to lion encounters shape their predatorprey space game at large scale[END_REF][START_REF] Courbin | Zebra diel migrations reduce encounter risk with lions at night[END_REF] for further information about the zebra tracking study.

S2. Statistical models and results

I studied zebra habitat selection by fitting resource selection function (RSF) models to estimate selection ratios (SR) and selection effect on use (SE). The RSF models were fitted in the use/available framework: I used the actual GPS locations as 'used' zebra locations, and drew 'available' locations randomly within the study area defined as the Main Camp management block of Hwange National Park (see Chamaillé-Jammes, Valeix, & Fritz 2007 for map). The ratio of available/used locations was 1000 for all individuals.

For the example provided here I fitted an exponential RSF model, which uses a logit link function, as it is the most commonly used RSF functional form. I used vegetation type (categorical variable with 3 categories, and 'bushland' as reference category), distance to water (continuous, logtransformed as we previously showed before that it greatly improved the fit of RSF models on these data [START_REF] Courbin | Reactive responses of zebras to lion encounters shape their predatorprey space game at large scale[END_REF]) and the interaction between these two variables as predictors in the RSF model. I included zebra identity as random effects on the intercept and slopes for all predictors. All analyses were conducted with the R software v. 3.5.2 (R Core Team 2018) and the lme4 package v.

1.1.17 [START_REF] Bates | Fitting Linear Mixed-Effects Models Using lme4[END_REF].

The exponential RSF model showed that the strength of habitat selection increased with proximity to water, and was higher in grasslands that in the two other vegetation types (Table S1).

Arraut, E. M., Loveridge, A. J., Chamaillé-Jammes, S., [START_REF] Arraut | The 2013-2014 vegetation structure map of Hwange National Park, Zimbabwe, produced using free satellite images and software[END_REF].

The 2013-2014 vegetation structure map of Hwange National Park, Zimbabwe, produced using free