Quentin Milot

Mickaël Dardaillon

Justine Bonnot
email: jbonnot@wedolow.com

Daniel Menard

Wordlength Optimization for Custom Floating-point Systems

Keywords: Custom floating-point, Wordlength, Optimization

Algorithm complexity and problem size explosion during the last few years brought new challenges for hardware implementation of data-oriented applications. In particular, they have caused a large increase in memory, execution time, and power needed. One solution to address those challenges is to reduce data sizes. Custom floating-point is a good candidate that brings a large dynamic range in a compact representation. Thanks to improvement in floating-point units, it is more and more explored as an alternative to fixed-point. This paper proposes an automatic optimization flow to optimize floatingpoint wordlength for a given quality metric. This flow is generic and can be used for any C or C++ algorithm. Different strategies are proposed to optimize the exponent and mantissa wordlengths. These strategies take advantages of analyzing the data dynamic range to reduce the optimization time. The obtained results show that better implementation cost can be obtained compared to 16-bit floating-point for a same quality.

Introduction

During the last years, with the technological progress in the semiconductor industry, digital platforms have integrated more and more transistors and have become faster and more energy efficient. With this evolution, numerous smarter systems are designed based on data-oriented applications. This technological progress leads to a significant improvement of the logical elements through the reduction of latency and dynamic energy. The energy to transport the data can now be higher than the energy to process the data by up to two to four orders of magnitude [4]. Memory access and data transportation became the new bottleneck for computation optimization. One way to face this issue is to optimize the data wordlength [START_REF] Jouppi | Ten Lessons From Three Generations Shaped Google's TPUv4i : Industrial Product[END_REF].

Two finite precision arithmetics are mainly used inside digital platforms to implement data-oriented applications: fixed-point and floating-point. The fixedpoint arithmetic was favored in energy-efficient systems thanks to its lower cost.

Even if shift operations must be inserted between operations for scaling or aligning data, the processing part of fixed-point is less complex in terms of logical elements compared to floating-point. For fixed-point arithmetic, the quantization step (distance between two consecutive values) is constant due to the fixed implicit scaling factor. For floating-point arithmetic, the quantization step is adapted to the value to represent thanks to the explicit scaling factor embedded in the floating-point data. Thus, floating-point arithmetic can better compress data than fixed-point i.e. for a similar quantization error, fewer bits are required for encoding a floating-point data than for a fixed-point data.

However, with the reduction of floating-point's computing energy, especially compared to memory access energy [START_REF] Jouppi | Ten Lessons From Three Generations Shaped Google's TPUv4i : Industrial Product[END_REF], custom floating-point data types becomes a new contender for energy-efficient systems integrating data-oriented applications. In contrast to 64, 32 and 16-bit standard floating-point data types, customizing floating-point data requires an in-depth knowledge of the data dynamic range and application accuracy to adapt the wordlength to the need of each data. To obtain an optimized cost, the wordlength of the mantissa and the exponent must be adapted for each data inside an application. To face the complexity of modern applications, and to limit the development time, automatic frameworks to convert an application using standard floating-point data types to custom floating-point data types are mandatory.

Different methodologies and frameworks [START_REF] Caffarena | Wordlength optimization of fixed-point algorithms[END_REF] have been proposed for fixedpoint conversion. This conversion is composed of two main steps. First, the number of bits for the integer part is determined from the dynamic range analysis. Secondly, the number of bits for the fractional part is determined. The total number of bits is optimized such as the implementation cost is minimized subject to a quality criterion on the application output. In floating-point arithmetic, the problem is more complex because the accuracy depends on the mantissa wordlength but also of the exponent wordlength. Wordlength optimization for custom floating-point arithmetic has been proposed for specific applications like deep learning [START_REF] Shah | KD-Lib: A PyTorch library for Knowledge Distillation, Pruning and Quantization[END_REF][START_REF] Liu | Improving Neural Network Efficiency via Post-training Quantization with Adaptive Floating-Point[END_REF][START_REF] Kwak | Quantization Aware Training with Order Strategy for CNN[END_REF]. Generic approaches have been proposed for custom floatingpoint system design [START_REF] Gaffar | Unifying bit-width optimisation for fixed-point and floating-point designs[END_REF][START_REF] Osborne | Automatic Accuracy-Guaranteed Bit-Width Optimization for Fixed and Floating-Point Systems[END_REF]. However, the strategy to optimize the wordlength of both the exponent and mantissa is not considered in these approaches.

In this paper, a new method for custom floating-point refinement is proposed. Different strategies are proposed to optimize the exponent and mantissa wordlengths. These strategies take advantage of analyzing the data dynamic range to reduce the optimization time. The obtained results show that better implementation costs can be obtained compared to standard 16-bit floating-point for a same quality.

The rest of the paper is organized as follows. Section 2 presents previous works on finite precision conversion. The proposed finite precision conversion flow is then described in Section 3. The determination of the exponent wordlength from dynamic range analysis is presented in Section 4. The optimization strategies specified for custom floating-point are detailed in Section 5. Section 6 presents the experiment results on different use cases.

Background and State of the art

Finite precision arithmetic

Two finite precision arithmetics are mainly used to implement data-oriented applications: fixed-point and floating-point. Fixed-point arithmetic allows representing real values with the help of integer arithmetic. A fixed-point value x FxPt is composed of two parts corresponding to the integer and the fractional part.

x FxPt is obtained by multiplying an integer x int by a constant scaling factor 2 -n , where n corresponds to the fractional part wordlength.

Contrary to fixed-point arithmetic, for which the scaling factor is implicit and not embedded in the data, in floating-point arithmetic, the scaling factor is explicit and defined through the exponent field e. A normalized floating-point value x FlPt is composed of three parts corresponding to the sign s, the exponent e and the mantissa m. This exponent e is embedded in the encoded data and allows selecting the range by representing the log 2 of the number x to represent. Thus, with floating-point data types, very small and very high values can be represented with a good relative accuracy. The mantissa part m refines the value inside the considered range.

To avoid multiple representations of a given value and to allow interoperability between digital platforms, standards, like the IEEE 754 norm have been proposed for defining floating-point data type for 64, 32 and 16 bits. A normalized floating-point data type is under discussion for 8-bit data [START_REF] Micikevicius | FP8 Formats for Deep Learning[END_REF][START_REF] Kuzmin | Fp8 quantization: The power of the exponent[END_REF]. This standard defines the exponent and mantissa wordlengths, w E and w M respectively [START_REF]IEEE Computer Society: IEEE Standard for Floating-Point Arithmetic[END_REF].

The exponent e c embedded in the floating-point data is an unsigned integer value. To consider negative exponents to represent small values, a bias ∆ equal to half of the exponent range is defined with the following expression:

e = e c -∆ with ∆ = 2 w E -1 -1
where w E corresponds to the number of bits to represent the exponent. The minimal and maximal exponent values are used to represent specific values (0, denormalized values, ±∞, NaN). In hardware design, like for fixed-point arithmetic, optimizing the data wordlength and using its own wordlength for each data will reduce the implementation cost (area, energy, latency). For custom floating-point data, reducing the exponent wordlength will impact the range of the data that can be represented. Reducing the mantissa wordlength will impact the accuracy [START_REF] Liu | Improving Neural Network Efficiency via Post-training Quantization with Adaptive Floating-Point[END_REF]. The challenge is to provide automated design tools to convert a C source code into a C++ code using custom floating-point data types. The data wordlength search space must be explored efficiently in order to reduce the implementation cost for a maximal application quality degradation.

State of the art

The challenge of creating design tools for custom floating-point data type has been explored through multiple point of view in the literature. Domain-specific quantization Domain-specific quantization takes advantage of domain particularities to improve quantization. Neural network quantization is a good example, with current interest in machine learning driving a lot of works in both quantization-aware training and post-training quantization. In quantization-aware training, data wordlengths are added as parameters to optimize during training [START_REF] Kwak | Quantization Aware Training with Order Strategy for CNN[END_REF]. It improves quantization robustness by taking into account quantization noise during training, but the method is specific to machinelearning. Post-training quantization is more generic as it can be applied outside of the domain of machine learning. It relies on the algorithm designer to set an objective. These approaches usually optimize a wordlength per layer, and use standard floating-point data types based on the targeted architecture [START_REF] Shah | KD-Lib: A PyTorch library for Knowledge Distillation, Pruning and Quantization[END_REF]. In [START_REF] Liu | Improving Neural Network Efficiency via Post-training Quantization with Adaptive Floating-Point[END_REF], custom floating-point data types are used. The exponent and mantissa wordlength are optimized.

Bitsize [START_REF] Gaffar | Unifying bit-width optimisation for fixed-point and floating-point designs[END_REF] The Bitsize framework aims at optimizing the wordlength for fixedpoint and floating-point data types. This framework uses an analytical approach for quantization error evaluation. The error model is efficient in terms of error evaluation time but limited to smooth operations. An operation is considered as smooth if the output is a continuous and differentiable function of the inputs.

Minibit+ [START_REF] Osborne | Automatic Accuracy-Guaranteed Bit-Width Optimization for Fixed and Floating-Point Systems[END_REF] Minibit+ is an increment of Minibit approach [START_REF] Lee | MiniBit: bit-width optimization via affine arithmetic[END_REF] dedicated to fixed-point optimization. The transformation focuses on non-uniform optimization and floating-point optimization. The flow is based on a C++ program input. It starts with a range analysis using affine arithmetic. It then performs a coarse-grained accuracy analysis followed by a fine-grained accuracy analysis to determine the data wordlength. The main limitation is its lack of support for control structures such as conditions and loops.

In the Bitsize and Minibit+, the strategy to optimize the wordlength of both the exponent and mantissa is not detailed.

Finite Precision Conversion Flow

The proposed framework aims at converting automatically a C or C++ code with standard floating-point data types (float or double) to a C++ source code with custom floating-point data types for which the data wordlength has been optimized according to an application quality criterion. This output source code can then be used with high-level synthesis tools such as Vitis or Catapult for hardware implementation.

To optimize applications described with C/C++ floating-point code, the proposed framework in Figure 1 starts with a source-to-source compiler [15]. This step analyzes the application source code to determine which variables in the application source code may have their precision optimized i.e., all the variables involved in the application output computation. This first step also determines if some data types are set up by other ones, so as to reduce the design space to explore. Let V be a set grouping the N v variables v i to be optimized. At the output of this compiling step, the application source code is generated with generic data types that will be modified during the optimization process. This version of the application is then automatically instrumented by the framework to derive information on the variables belonging to the set V.

The next step is a dynamic range analysis of each variable belonging to the set V. Ranges are extracted based on a simulation running the testbench provided by the developer. The generic data types introduced in the first step are instrumented to collect all the values taken by a variable v during the source code execution and to build the histogram of log 2 (v). To illustrate, an example of a histogram is given in Figure 2.

Exponent wordlength determination

The dynamic range associated with standard floating-point data types is predefined and depends on the exponent wordlength. Since this range is not custom for standard floating-point data types, several bits in the exponent field can be left unused, leading to supplementary implementation cost.

To obtain a suitable exponent wordlength, the data range needs to match with the representation for any mantissa wordlength w M . A floating-point data having w E bits for the exponent fields with standard bias ∆ allows representing values in the range indicated in Equation 1 in the extreme case of mantissa wordlength w M = 0.

[-2

2 w E -1 -1 ; -2 -(2 w E -1 -2) ] ∪ [2 -(2 w E -1 -2) ; 2 2 w E -1 -1 ] (1)
Let v and v be respectively the minimal and maximal values taken by the variable |v| without considering the value 0. The exponent range I Ev represents the values that the exponent needs to reach to handle all the values of v. Since the exponent part needs to be symmetrical with standard bias ∆ and reach both values of I Ev , the maximal range distance R Ev determines the maximal wordlength w max E . The maximal wordlength w max E needs to represent the value R Ev and -R Ev and can be determined with the following expression:

I Ev = [log 2 (v), log 2 (v)], R Ev = max (|I Ev |) , w max E = ⌈log 2 (R Ev )⌉ + 1 (2)
Let w max E = w max E0 , . . . w max Ei . . . w max E Nv -1 be a N v -length vector storing for each variable v i of V, the maximal number of bits w max Ei for the exponent.

5 Wordlength optimization for custom floating-point

Wordlength optimization problem definition

Worldlength optimization aims at obtaining a minimal cost C satisfying a userdefined quality constraint λ min .

With w being the concatenation of the vectors w E and w M representing the exponent and mantissa wordlengths respectively for each variable of the set V.

Cost evaluation Different metrics like architecture area, energy consumption or memory space can be considered for the implementation cost C. For this study, an energy consumption and a memory space models are considered.

The dynamic energy of an operation depends on its type (addition, multiplication, memory transfer, ...) and the input and output wordlengths. For a given technology node for ASIC or for a given chip for FPGA, a library is obtained from a characterization process in which the operation costs are evaluated for different combinations of exponent and mantissa wordlengths. The energy consumption of the complete system is the sum of all the operation costs used in the system. For this study, a library for 28nm FDSOI technology is used [START_REF] Barrois | Customizing fixed-point and floating-point arithmetic -A case study in K-means clustering[END_REF]. This library provides the implementation cost for arithmetic operations but not for memory transfer, limiting the cost model to processing, excluding on-chip and off-chip memory. The memory cost aims at estimating the memory space to store the application variables. To do so, the number of allocations of a variable is determined and multiplied to the total wordlength of the variable.

Quality evaluation Simulation-based and analytical approaches can be considered to evaluate the quality metric λ at the output of an application according to the data wordlength w. Analytical approaches aim at providing a mathematical expression of the quality metric. With this mathematical expression, the quality evaluation time is low but the supported applications are limited to those having only smooth operations.

Simulation-based techniques are more generic and support any application. The quality metric is statistically evaluated from data collected with a Monte-Carlo simulation carried out on the testbench input data. The source code is modified to integrate the custom floating-point data types. In this work, ac type [START_REF]Algorithmic C Datatypes reference manual[END_REF] are used. The confidence in the statistical estimation of the quality metric depends on the number of input samples used for the Monte-Carlo simulation. Thus, a huge number of samples can be required, leading to high quality evaluation time.

Optimization algorithm

The space to explore being a subspace of natural numbers, the optimization needs to be heuristic. Numerous heuristic methods have been proposed to optimize wordlengths and especially in the context of fixed-point systems [START_REF] Caffarena | Wordlength optimization of fixed-point algorithms[END_REF].

In this paper, the min+1 algorithm [START_REF] Caffarena | Wordlength optimization of fixed-point algorithms[END_REF] has been adapted for wordlength optimization problem in the context of custom floating-point. This algorithm is composed of two steps. First, an initial solution is found to start the greedy algorithm deployed in the second step. All the variables of vector w are set to their maximal value and one variable w i is decreased until the quality constraint is no more fulfilled. The minimal value fulfilling the constraint is recorded in the vector w min . This process is repeated for each variable of vector w. In the second step, a mildest-ascent greedy algorithm is applied to increment by one bit one of the variables of vector w at each iteration. This second step starts with the initial solution w min , for which the quality constraint is not fulfilled. At each iteration a gradient is computed for each variable to find the best direction i.e. the variable for which a one-bit wordlength increment lead to the best quality improvement. The optimization algorithm stops when the quality constraint is fulfilled.

This optimization method needs to test numerous configurations. Let n C be the number of tested configurations to obtain the final solution. Let n S be the number of input samples required to obtain a quality evaluation with a given confidence interval. The time t Opt required for this global optimization process can be determined with Equation 4. In this equation, t S and t comp represent the execution time for one sample and the compilation time of the modified source code to evaluate the quality.

t Opt = n C * (t comp + n S * t S ) (4)

Global wordlength optimization strategies

In this section, the proposed strategies to optimize the wordlength of both the exponent and mantissa are detailed. As shown in Equation 4, the optimization time is proportional to the number of tested configurations. This latter depends on the optimization search space. The search space is linked to three parameters, N v the number of variables to optimize, E r . = {x ∈ N Nv : 1 ≤ x i ≤ w max Ei } the search space for exponent wordlength and M . = {x ∈ N Nv : 1 ≤ x i ≤ W m } the search space for the mantissa wordlength W m represent the mantissa wordlength of the reference type (24 for single precision, 53 for double precision) and w max Ei the maximal number of bits required for the i th variable according to the range analysis.

Exponent and mantissa wordlength simultaneous optimization This approach optimizes the wordlengths of the exponent and mantissa simultaneously. The maximal exponent wordlength is defined in vector w max E computed with Equation 2 with the help of the range analysis step. The variable for the optimization process is a 2.N v -length vector w composed of the exponent wordlength w Ei and the mantissa wordlength w Mi for each variable v i of the set V. The domain to explore is then E r * M. The number of elements n p of the search space can be expressed with the following expression:

n p = M Nv * Nv i=0 w max Ei (5)
By considering the exponent wordlength as a variable to optimize, compared to the approaches described in following sections , this approach provides more degrees of freedom to find an optimized solution. Indeed, values with a small exponent can potentially be approximated without degrading too much the application quality λ. Furthermore, for these values, the unnormalized representation can help to represent a part of the smallest values. To optimize this unnormalized representation, both the mantissa and exponent need to be taken into account.

The use of the reduced space E r , instead of a space composed of the maximal exponent wordlength ,allows reducing the optimization time. Indeed, the values higher than w max Ei will lead to the same quality results for a superior cost and are irrelevant. Nevertheless, this approach leads to the largest number of possibilities and thus tends to the highest optimization time of the three proposed methods.

Mantissa wordlength only optimization

This approach aims at optimizing only the mantissa wordlength. The exponent wordlength is set to the value obtained with Equation 2(w e = w max e ). The variable for the optimization process is a N v -length vector w composed only of the mantissa wordlength w Mi for each variable v i of the set V. This a priori information allows limiting the search space to the set M. Compared to the first approach, the number of variables in the optimization process has been divided by two. Thus, the number of tested configurations during the optimization process and the optimization time are reduced. The number of elements n p of the search space can be expressed with the following expression:

n p = M Nv (6)
Nevertheless, this approach can lead to a solution less optimized compared to the one obtained with the first approach. This approach does not explore the potential benefit of reducing slightly the exponent wordlentgh in relation to the value obtained with Equation 2.

Exponent and mantissa wordlength sequential optimization This approach is a middle ground between the other two. The optimization problem is divided into two optimization processes carried-out one after the other. First the exponent wordlengths are optimized and then the mantissa. The variable for the first optimization process is a N v -length vector w composed of the exponent wordlength w Ei for each variable v i of the set V. The variable for the second optimization process is a N v -length vector w composed of the mantissa wordlength w Mi for each variable v i of the set V. The optimization is performed on a subset of the search space E r * M. The number of elements n p of the search space can be expressed with the following expression:

n p = M Nv + Nv i=0 w max Ei (7)
Since this approach is a middle ground between the two other methods in terms of exploration space, the number of configurations required tends to be a middle ground. However, optimizing with a sequential optimization algorithm such as min+1 can lead for high λ min to the exploration of more configurations.

This solution brings a new hyperparameter to the optimization process. The quality degradation due to finite precision must be budgeted between the two independent optimization processes. In this work, the goal λ Emin for the first optimization process was set to equal the quality of the original system.

Experiments and results

The results are presented for two applications corresponding to a Linear Time-Invariant (LTI) system and a Convolutional Neural Network (CNN). The LTI system is an Infinite Impulse Response filter composed of four cascaded biquad cells. The optimization process is defined with N v = 7. The quality evaluation metric is based on the Signal to Quantization Noise Ratio (SQNR), considering as a reference the single-precision floating-point data types (FP32). The second application is the Squeezenet CNN used for image classification. The network is composed of 14 layers. The optimization process is defined with N v = 15. The CNN structure is complex due to pooling layers that add unsmooth operations. The quality evaluation metric is based on the top 1 accuracy, considering as a reference the FP32 implementation. Firstly, the efficiency of our approach for finding an efficient solution in terms of tradeoff between cost and quality is evaluated for different quality metric constraints. For the Squeezenet, the tradeoff between the implementation cost and the quality metric is depicted in Figure 3a and Figure 3b respectively for the energy consumption and for the memory size. The x-axis represents the implementation cost normalized with the cost obtained for the reference solution with FP32. The y-axis represents the quality metric. The results are presented with the three proposed strategies and for three values of λ min . The Pareto front is shown with the dotted line. These solutions can be compared with the one obtained for the IEEE 754 half-precision floating-point data type (FP16). These results show that the solutions located in the Pareto front and obtained with our approach are better than the FP16 solution. For a similar quality metric value, a difference of 7% and 3% for the relative energy consumption are measured. Indeed, FP16 is a generic data type that can not take advantage of the specificities and the limited variable dynamic range of the considered application. Moreover, customizing mantissa and exponent wordlength allows obtaining more flexibility in terms of cost and quality compared to standard data types. When comparing the three proposed strategies, the second strategy is always less efficient than the two others. This shows that reducing the exponent wordlength compared to w max Ei provides gain. Decreasing the exponent wordlength of one or two bits can be acceptable in terms of quality degradation. This is illustrated in Figure 2, where the small values located in the left distribution tail will be approximated with unnormalized numbers. Even, a reduction of one bit is not negligible when the exponent wordlength is small.

The results obtained for the IIR filter are summarized in Table 1. The solution with FP16 and our solutions obtained for λ min = 50 dB are close. The dynamic range of the variables inside the filter is very high and the five bits of the exponent are required to represent these values. As for Squeezenet, the second strategy always leads to a more conservative solution. By considering the two applications, both the first and third strategies can provide the best solution.

The number of configurations n C tested during the optimization process are depicted in Figure 3c for the Squeezenet and summarized in Table 1 for the IIR filter. By optimizing only the mantissa wordlength the second strategy always requires testing fewer configurations compared to the two others. Then, by using a sequential process, the third solution always requires half as much configurations compared to the first solution.

Conclusion

This paper proposes a new method for custom floating-point refinement. Three strategies were established to optimize the exponent and mantissa wordlengths according to a user-defined quality constraint. These strategies are based on data dynamic range analysis to adapt the exponent wordlength. The results show an improvement in terms of power and memory consumption compared to a generic solution with FP16 data types. Our approaches allow obtaining different tradeoffs between cost and quality.

Fig. 1 :

 1 Fig. 1: Proposed framework for custom floating refinement.

Fig. 2 :

 2 Fig. 2: Example of an histogram obtained from dynamic range analysis. Ranges for different floating-point data types are illustrated based on methods presented in Section 5.2.

  w)) subject to λ(w) ≥ λ min

  Pareto chart of relative energy consumption (processing part) and final accuracy obtained according to the strategy and the minimal quality λmin. Pareto chart of relative memory space and final accuracy obtained according to the strategy and the minimal quality λmin . Number of configurations tested for each optimization process according to the strategy and λmin.

Fig. 3 :

 3 Fig. 3: Results for the squeezenet application.

Table 1 :

 1 Optimization results of an IIR filter for different strategies and λ min .

		Strategy	Relative power estimation	Relative memory estimation	SQNR obtained (db)	Number of configuration tested
	λmin FP16	0.40	0.50	51.26	.
		1	0.39	0.32	50.35	233
	50	2	0.42	0.45	51.18	154
		3	0.39	0.33	50.28	185
		1	0.51	0.42	70.72	197
	70	2	0.54	0.55	70.10	125
		3	0.50	0.44	70.09	156
		1	0.86	0.74	90.14	749
	90	2	0.87	0.81	90.956	112
		3	0.64	0.56	90.13	161


Andrea Quintero

Patrice Gergaud

Jean-Michel Hartmann

Vincent Delaye

Vincent Reboud

Eric Cassan

Philippe Rodriguez

Impact and behavior of Sn during the Ni/GeSn solid-state reaction

des établissements d'enseignement et de recherche français ou étrangers, des laboratoires publics ou privés.


Zhengrui Tu

Jianhao Zhang

John Rönn

Carlos Alonso-Ramos

Xavier Leroux

Laurent Vivien

Zhipei Sun

Éric Cassan

Potential for sub-mm long erbium-doped composite silicon waveguide DFB lasers


Julien Paulet

Axel Molina

Benjamin Beltzung

Takafumi Suzumura

Shinya Yamamoto

Cédric Sueur

Deep Learning for Automatic Facial Detection and Recognition in Japanese Macaques: Illuminating Social Networks

Keywords: macaques, primates, primatology, deep learning, automatic

Individual identification plays a pivotal role in ecology and ethology, notably as a tool for complex social structures understanding. However, traditional identification methods often involve invasive physical tags and can prove both disruptive for animals and time-intensive for researchers. In recent years, the integration of deep learning in research offered new methodological perspectives through automatisation of complex tasks. Harnessing object detection and recognition technologies is increasingly used by researchers to achieve identification on video footage. This study represents a preliminary exploration into the development of a non-invasive tool for face detection and individual identification of Japanese macaques (Macaca fuscata) through deep learning. The ultimate goal of this research is, using identification done on the dataset, to automatically generate a social network representation of the studied population. The current main results are promising: (i) the creation of a Japanese macaques' face detector (Faster-RCNN model), reaching a 82.2% accuracy and (ii) the creation of an individual recogniser for Kōjima island macaques population (YOLOv8n model), reaching an 83% accuracy. We also created a Kōjima population social network by traditional methods, based on co-occurrences on videos. Thus, we provide a benchmark against which the automatically generated network will be assessed for reliability. These preliminary results are a testament to the potential of this innovative approach to provide the scientific community with a tool for tracking individuals and social network studies in Japanese macaques.

Introduction

In the fields of ethology and ecology, individual identification plays a crucial role, enabling a wide range of research domains. Long-term observations spanning days, months, or even years, rely on the ability to track and differentiate individuals thus enabling to follow up some variables while ensuring the stability of others [START_REF] Clutton-Brock | Individuals and populations : The role of long-term, individual-based studies of animals in ecology and evolutionary biology[END_REF]. Individual identification is pivotal in various fields and scales, including the study of social group dynamics, heredity of traits through lineage, phenotypic changes in one in response to life history, or behavioural transmission in a population [START_REF] Wich | Life history of wild Sumatran orangutans (Pongo abelii)[END_REF]. Moreover, beyond its role in fundamental ethological and ecological research, individual identification holds significant importance in applied science and conservation efforts. This allows minimising losses during problematic species regulation by targeting specific individuals. It for examples of deep learning applications regarding complex morphological data analysis, social network analysis or individual identification). Particularly in the realm of image analysis and object recognition, AI has become a highly used tool in various human activities (see for instance [START_REF] Beltzung | Deep learning for studying drawing behaviour : A review[END_REF]. In the field of biology, image analysis and object detection are among the first applications of deep learning, for species identification based on phenotypic biometrics. Over the past decade, there has been a surge in projects focused on automated individual recognition in animals as in right whales, Eubalaena glacialis [START_REF] Bogucki | Applying deep learning to right whale photo identification[END_REF], in farm pigs, Sus domesticus [START_REF] Hansen | Towards on-farm pig face recognition using convolutional neural networks[END_REF], in giant pandas, Ailuropoda melanoleuca: [START_REF] Hou | Identification of animal individuals using deep learning : A case study of giant panda[END_REF], in Amur tigers, Panthera tigris altaica [START_REF] Shi | Amur tiger stripes : Individual identification based on deep convolutional neural network[END_REF], in the small birds Philetairus socius, Parus major and Taeniopygia guttata [START_REF] Ferreira | Deep learning-based methods for individual recognition in small birds[END_REF], in giraffes, Giraffa camelopardalis: [START_REF] Miele | Revisiting animal photo-identification using deep metric learning and network analysis[END_REF] in Asian elephants, Elephas maximus [START_REF] De Silva | Feasibility of using convolutional neural networks for individual-identification of wild Asian elephants[END_REF] having an impact on species conservation and biodiversity monitoring. Going deeper in identification precision researchers explored the possibility of individual identification by face analysis in some selected species, just as applications of face detection have proliferated and diversified for humans in recent years. Focusing on the face offers a significant advantage due to the distinctive inter-individual variations exhibited by facial traits, particularly in primates, where these traits are generally stable and recognisable across various life events and time, akin to humans (D. P. [START_REF] Schofield | Automated face recognition using deep neural networks produces robust primate social networks and sociality measures[END_REF]. Several projects have already been conducted with different primate clades (in lemurs: [START_REF] Crouse | LemurFaceID: A face recognition system to facilitate individual identification of lemurs[END_REF]in mandrills, Mandrillus sphinx: Charpentier et al., 2020; in western lowland gorillas, Gorilla gorilla gorilla: [START_REF] Brookes | Evaluating cognitive enrichment for zoo-housed gorillas using facial recognition[END_REF]in 41 different species: Guo et al., 2020). Notably, [START_REF] Schofield | Automated face recognition using deep neural networks produces robust primate social networks and sociality measures[END_REF] developed a fully automated pipeline for face detection, tracking, and recognition of 23 chimpanzees in the long-term field site of Bossou in Guinea. This project uses face recognition directly from video data. Unlike traditional AI approaches that rely on single frames, this recognition method tracks faces across multiple frames to make predictions, enhancing the reliability and certainty of individual identification. Additionally, their AI pipeline has been employed to generate cooccurrence matrices of individuals based on hours of video footage, providing insights into the social network of group members and its changes over time. Claire L. Witham also employed automatic face recognition to generate a social network in rhesus macaques in 2018, although her model relied on manual training rather than deep learning techniques. In the present study, drawing from Schofield et al. work, we aim to investigate whether similar deep learning-based techniques for face detection, recognition, and subsequent automatic construction of a social network can be applied on Japanese macaques (Macaca fuscata). Japanese macaques are an endemic monkey species inhabiting various ecosystems across Japan. They typically form troops consisting of approximately 30 individuals, with around two-thirds being females and one-third males [START_REF] Sugiyama | Life history of male Japanese monkeys[END_REF]. Troops of macaques exhibit a well defined and strict social hierarchy. Females generally inherit their rank, while males engage in competition to establish a hierarchy [START_REF] Koyama | On dominance rank and kinship of a wild Japanese monkey troop in Arashiyama[END_REF][START_REF] Koyama | Matrilineal cohesion and social networks in Macaca fuscata[END_REF]. These troops follow a matrilineal society, where females remain in their natal group throughout their lives [START_REF] Fedigan | The monkeys of Arashiyama : Thirty-five years of research in Japan and the West[END_REF], while males disperse at sexual maturity, typically around four years old [START_REF] Nakamichi | Sex differences in social development during the first 4 years in a free-ranging group of Japanese monkeys, Macaca fuscata[END_REF], and may undergo emigration from their troop during mating seasons several times in their life. They practise polygamous mating, males and females typically having multiple partners during the mating season [START_REF] Soltis | Measuring male-female relationships during the mating season in wild Japanese macaques (Macaca fuscata yakui)[END_REF]. Social cohesion within troops is primarily maintained through grooming behaviour, which is most prevalent among females and juveniles [START_REF] Baxter | Grooming and consort partner selection in a troop of Japanese monkeys (Macaca fuscata)[END_REF][START_REF] Nakamichi | Distribution of grooming among adult females in a large, freeranging group of Japanese macaques[END_REF]. Japanese macaques hold a significant ethological interest as they exhibit a rich and subtle sociocognitive life. They were one of the first species to provide insights on the concept of animal culture, demonstrating the emergence and transmission of behaviours such as sweet potato washing (Kawai, 1965). They are still often studied for their social behaviours, communication skills, community management through the hierarchy, cultural behaviours development and transmission [START_REF] Huffman | Cultured Japanese macaques : A multidisciplinary approach to stone handling behaviour and its implications for the evolution of behavioural tradition in nonhuman primates[END_REF][START_REF] Rebout | Tolerant and intolerant macaques show different levels of structural complexity in their vocal communication[END_REF][START_REF] Shimada | Social play among juvenile wild Japanese macaques (Macaca fuscata) strengthens their social bonds[END_REF]. Since this species is often studied directly in freeranging populations, with a strong interest in the follow-up of social interactions, reliable individual identification is generally mandatory, but also complex. Therefore, investing in the development of automatic identification tools can provide substantial support for future Japanese macaque research. Recent studies by [START_REF] Otani | Potency of Individual Identification of Japanese Macaques (Macaca fuscata) Using a Face Recognition System and a Limited Number of Learning Images[END_REF]) on 11 Yakushima Island macaques and [START_REF] Ueno | Automatic individual recognition of Japanese macaques (Macaca fuscata) from sequential images[END_REF] on 51 Katsuyama macaques have already explored some potential of individual identification in Japanese macaques using different learning methods for their models. Here we try to go further by building a freely available automatic system with social network visualisation for the Kōjima macaque population, which is one of the most studied in Japan. Building upon those previous works, our goal is ultimately to create an automatic pipeline capable of detecting Japanese macaques' faces, tracking them across video frames, recognising individuals from a known set of macaques, and finally constructing the social structure of the population. The work we present here is a methodological exploration of the following three main objectives: (i) the development of a face detector able to automatically localise Japanese macaque faces on video frames; (ii) the development of an individual recogniser for Kōjima macaques, able to identify the detected faces; (iii) an analysis of the Kōjima macaques social network, which will serve to evaluate our future pipeline's performance to automatically generate social network based on recognised macaques' identities. Furthermore, this research project presents an opportunity to contribute to the first face labelled dataset of videos featuring the main population of Japanese macaques on Kōjima Island. Ultimately, our project aims to provide a reliable tool for tracking individuals, enabling a deeper understanding of how macaques form social networks and gaining insights into processes such as the social transmission of cultural behaviours.

Material and methods

A graphical representation of our methodological approach is presented in Figure 1, summarising the realised work and the perspectives still to explore.

Study Group and Localisation

The study took place on Kōjima, a small island spanning approximately 30 hectares situated in the Sea of Hyūga, about 300 metres off the Nichinan Coast, near the city of Kushima in Miyazaki Prefecture. The island is mainly boarded by rocky coasts and has one sandy beach called Odomari [START_REF] Iwamoto | A bioeconomic study on a provisioned troop of Japanese monkeys (Macaca fuscata fuscata) at koshima islet, Miyazaki[END_REF] sinking for 100 metres into the island (Figure 2.A). Kōjima Island serves as a field study site affiliated with the Wildlife Research Center at Kyoto University and is hosting a community of approximately 100 Japanese macaques. These macaques are divided into three distinct populations: the 'main group', the 'maki group', and the 'hitorizaru' which are free-ranging males. Each individual on the island is named and documented in a maternal pedigree spanning over 60 years. To build our dataset, we chose to focus specifically on the 'main group,' which is regularly the subject of extensive research. While the macaques on the island live and behave freely, the members of the 'main group' come daily around the beach, essentially in the morning (Figure 2.B). Researchers provide them with soya beans as supplemental feeding, which occurs one to three days per week, depending on weather conditions impacting accessibility to the island. The macaques are periodically weighed by baiting them onto scales with food (Figure 2.C). A few tourists visit the beach regularly to observe the monkeys. Consequently, the Kōjima macaques have become habituated to human presence and appear to exhibit minimal reactions. During the two-month observation period from February to March 2023, the 'main group' comprised 42 individuals, including 26 females, 11 males, and 5 yet-to-be-sexed infants (Supplementary Material). Occasionally, three free-ranging males would join the group. It is important to note that the observation period coincided with the mating season. Throughout most of the observation sessions, the current alpha male of the 'main group,' Shika, was absent, likely engaging in mating with females from the other group. Muku, the oldest female in the group, passed away during the middle of the observation period.

Data Collection

During the two-month period from February to March 2023, the Kōjima 'main group' of macaques was subjected to daily filming sessions, contingent upon favourable weather conditions that allowed for boat transportation to the island. The camcorder used was a Sony Handycam 4K AX43A. Upon our arrival, the macaques were promptly provided with food, assuring most of the population to be attracted to the beach. Following the feeding session, the macaques would generally settle near their relatives and partners on the beach, engaging in regular bouts of grooming. To facilitate data collection and maximise reliability, most recording was achieved during resting periods. Each group member was systematically identified and individually filmed for an approximately two and a half minutes focal sampling, following a pre-established randomised list that varied for each session. The primary objective during the video recording was to capture an extended duration of the focused individual's front face and to diversify the facial viewpoints as much as possible. In instances where the focused individual was in 'social proximity' with other group members (within a one-meter radius from the focused individual), the camera zoom was adjusted to encompass the surrounding individuals, ensuring their visibility on the recorded footage. The zoom level and filming method were calibrated to include only those individuals in proximity, while ensuring that the faces of all individuals were the most clearly discernible in the footage. Throughout the two-month observation period, detailed records were maintained to monitor the duration and quality of footage obtained for each individual. During last weeks, special attention was given to scaling the quantity and quality of recordings for each group member, ensuring a balanced dataset. Subsequently, the recorded footage was carefully reviewed with Takafumi Suzumura, working on the site since tens of years, to ensure accurate identification of individuals featured in the recordings. The total amount of data is composed of 370 videos for around 15 hours recorded.

Dataset Annotation for Face Detector

To develop the macaques' face detector, a dataset of annotated frames was created for training a deep learning model. A total of 5985 frames were extracted from 48 videos, with a sampling rate of one frame per second, using the open-source software ffmpeg [START_REF] Tomar | Converting video formats with FFmpeg[END_REF]. The selection of videos aimed to ensure a balanced representation of each individual and a diverse range of backgrounds, camera angles, and behaviours. The annotations were performed using the web-based tool VGG Image Annotator. The annotation process involved tracing bounding boxes labelled as 'macaque' around the faces of each macaque. These annotations met specific criteria for face detection training, such as faces oriented between frontal and profile views, with a maximum obstruction of 30% and without blurriness or small faces at far distance in the background. Out of the 5985 frames in the dataset, 3011 frames contained at least one good quality macaque face, while 2974 frames had no annotations. The annotated frames comprised a total of 3555 face bounding boxes. To this dataset were added 642 frames extracted at a rate of 1 frame per second from the 'Japanese Macaques Look Almost Human' YouTube video by Animalogic, generating a 6622 frame dataset. These frames were annotated following the same methodology as the initial dataset frames. This augmentation of the dataset introduces multiple distinct faces not found on Kōjima Island, enhancing the dataset's diversity and maximising the potential for robust generalisations in Japanese macaques face detection. Generalisation refers to a model's ability to perform well on new, unseen data that was not part of the training set. The information about bounding boxes' position on frames are organized at COCO format and exported via a JavaScript Object Notation (json) file to be readable for the detector training.

Data Augmentation

Subsequently, the dataset underwent a data augmentation process. Data augmentation is the generation of several new frames by applying modifications on frames already in the dataset. Data augmentation involves generating numerous new frames through the application of modifications to existing frames within the dataset. A wide spectrum of modifications is possible (e.g. image flipping, colorimetric adjustments, grayscale conversion), frequently resulting in an expansion of the initial dataset size by more than twofold. The primary rationale behind the application of data augmentation in this context is to introduce variations and amplify dataset diversity, thereby fostering enhanced generalisations during model training and mitigating the risk of overfitting (e.i. when a model becomes excessively specialised to the training data and fails to generalise effectively to novel examples). By incorporating data augmentation techniques, we introduce variations that help the model learn the underlying patterns present in the data, rather than memorising specific instances. The execution of data augmentation was carried out using the computer vision software Roboflow [START_REF] Alexandrova | RoboFlow : A flow-based visual programming language for mobile manipulation tasks[END_REF][START_REF] Lin | RoboFlow : A data-centric workflow management system for developing AI-enhanced Robots[END_REF]. The following modifications have been selected: 90° rotation clockwise and counter-clockwise, 180° rotation, rotation between -45° and +45°, shear ±45° horizontal and ±45° vertical, apply grayscale to 25%, saturation between -60% and +60%, brightness between -25% and +25%, exposure between -10% and +10%, blur up to 1px. Three new images were generated per frame in the training set using randomly selected modifications from this list.

Face Detection

For the task of face detection, a Convolutional Neural Network (CNN) model [START_REF] Chauhan | Convolutional neural network (CNN) for image detection and recognition[END_REF] was trained using deep learning. The foundation of this model stems from the Faster R-CNN architecture, featuring a ResNet-50 backbone, and it is constructed atop a Feature Pyramid Network (FPN) architecture. Prior to training on our specific task, the model underwent pre-training through three iterations on the COCO dataset, primarily designed for object detection tasks. Following these pre-training phases, the model underwent fine-tuning using our specialised macaque face detection dataset. Our dataset, comprising 17772 frames, was partitioned into two distinct subsets. The training set of 16266 frames, constituting around 92% of the dataset, was dedicated to training the model, while 1506 frames, equivalent to 8% of the dataset, were allocated to form the validation set. This validation subset served as a benchmark to evaluate the model's performance all along the training. The implementation of the model was realised through the utilisation of Detectron 2, an open-source object detection framework developed atop PyTorch [START_REF] Imambi | PyTorch. Programming with TensorFlow: Solution for Edge Computing Applications[END_REF][START_REF] Stevens | Deep learning with PyTorch[END_REF]. This framework facilitated the seamless orchestration of the complex training process. The coding environment employed for this undertaking was Google Colab [START_REF] Baptista | Using Python and Google Colab to Teach Physical Chemistry During Pandemic[END_REF][START_REF] Nelson | Notes on Using Google Colaboratory in AI Education[END_REF], a Jupyter notebooks service, which provided a robust and flexible platform for the model development. Training the model necessitated substantial computational resources. The process was conducted on Google Colab's Backend Google Compute Engine Python 3 virtual machine service, benefiting from the computational prowess of the A100 GPU. The hyperparameters were tuned to achieve optimal results within our computational capacities. Those are diverse settings that influence the deep learning algorithm during training. The training process has been made with a batch size of 8 frames per batch, denoting the number of files processed concurrently before the model weights are updated. The learning rate was set at 0.001, influencing the gradient descent algorithm's pace during weight updates. The training persisted for 6000 batches.

Dataset Creation for Individual Classifier

For the individual classifier training, we used the initial 5985 frame dataset randomly reduced by half and supplemented with 1210 new frames manually extracted from a wide variety of videos from all the videos repertory. As specific individual classification requires a greater diversity of examples for each individual, this reduction/supplementation was made to decrease similar frames and increase new ones in the dataset to ensure a better performance. The selection of new frames was done by selecting specific frames in videos to enrich the initial dataset with a new point of view, facial expression and backgrounds for each individual. Those new macaques' faces were then annotated following the same method as for face detector datasets, directly on Roboflow to ease its integration in the initial dataset. All the bounding boxes have been manually labelled with the corresponding macaque's name as a class. All the frames from the initial dataset with no bounding box were deleted, as they only were necessary for face detection training. The dataset for individual classifiers, before data augmentation, contains 2485 frames with 42 classes, corresponding to the 42 individuals' names. A program was made using the image processing library 'OpenCV-Python' to extract normalised 240x240 pixels images from the faces bounding boxes. This collection of portraits was then data augmented using roboflow. The following modifications have been selected: 90° rotation clockwise and counter-clockwise, 180° rotation, rotation between -15° and +15°, shear ±15° horizontal and ±15° vertical, apply grayscale to 5%, saturation between -25% and +25%, brightness between -6% and +6%, exposure between -6% and +6%, blur up to 1px. Three new images were generated per frame in the training set using randomly selected modifications from this list. The resulting dataset contained 5956 images.

Individuals Classifier

For the task of individual recognition, a Convolutional Neural Network (CNN) model was trained using deep learning. This model follows a 'You Only Look Once' (YOLO) architecture with the v8 Nano extension (i.e. the fastest model version for YOLO architecture) especially pretrained for classification with ImageNet [START_REF] Jocher | V3. 0[END_REF]. Our dataset, comprising 5956 frames, was partitioned into three distinct subsets. The training set contained 5205 frames, constituting around 87% of the dataset, the validation set contained 494 frames, equivalent to 8% of the dataset, and the test set contained 248 frames, constituting around 4% of the dataset. This test subset served as a benchmark to evaluate the model's performance after training. The implementation of the model was realised through the utilisation of Ultralytics [START_REF] Jocher | V3. 0[END_REF], an open-source object detection and classification framework. The coding environment and computational resources used were the same as for the face detector. The training process was made with a batch size of 16 frames per batch and a 0.01 learning rate. The training persisted for 100 epochs, corresponding to the number of times the complete dataset was processed, effectively amounting to a total of 37 225 batches.

Social Network Analysis

In the perspective of evaluating our future pipeline capacity to output a reliable production of social network analysis based on automatically generated co-occurrence matrix, we performed a first social network analysis based on manually computed co-occurrences of individuals in collected field videos. We considered dyadic association indices as the probability of observing the focal individual with another individual in the same video, as a proxy of physical proximity between them. These indices were computed as 'simple ratio' [START_REF] Hoppitt | Association indices for quantifying social relationships : How to deal with missing observations of individuals or groups[END_REF] of the number of co-occurrences of individuals A and B, divided by the total number of occurrences of appearance of both A and B on the dataset (supplementary material). In order to describe the overall social network profile, we computed the following social network measures, using the Animal Network Toolkit Softare package (ANTs, [START_REF] Sosa | A multilevel statistical toolkit to study animal social networks : The Animal Network Toolkit Software (ANTs) R package[END_REF] on Rstudio: (i) the network density, representing the ratio between existing links and all potential links in the network [START_REF] Pasquaretta | Social networks in primates : Smart and tolerant species have more efficient networks[END_REF][START_REF] Sosa | Network measures in animal social network analysis : Their strengths, limits, interpretations and uses[END_REF]; and (ii) the global efficiency, reflecting how fast information can spread through the network with the minimum number of connections [START_REF] Pasquaretta | Social networks in primates : Smart and tolerant species have more efficient networks[END_REF]. Furthermore, for each individual we computed sociality values such as the degree (i.e. the total number of individuals with which the subject co-occurred), the strength (i.e. the sum of all association indices of the individual) and the eigenvector centrality, reflecting how much an individual is integrated in the network [START_REF] Pasquaretta | Social networks in primates : Smart and tolerant species have more efficient networks[END_REF]. The package Igraph [START_REF] Csardi | The igraph software package for complex network research[END_REF] was then used to represent graphically the group social network, spatialised following a GEM layout algorithm.

Data, supplementary material and codes are available at Zenodo (https://doi.org/10.48550/arXiv.2310.06489) and Github (https://github.com/AxelCodaeMolina/AI-Saru).

Results

Face Detector

After training, our Japanese macaques face detection CNN model displayed an average precision of 82.2% for an intersection over Union (IoU) of 0.5. It means that 82.2% of predicted detection boxes by the AI are superposing at least 50% on manually annotated boxes. As bounding boxes can't match precisely with the shape of the macaques' face and considering variability of face angles and point of view, the fact that two bounding boxes do not superpose a lot more than 50% while still showing the same information is expected. This AP50 (e.i. Average Precision at IoU 0.50) value for the face detector reflects a clear capacity to place bounding boxes on Japanese macaques' faces (Figure 3). The training phenomenon can be observed with the false negative rate evolution through batches on Figure 4, starting from a 100% false negative rate at first batch to 13,65% rate reached at the 5699 th batch.

Individual Classifier

Our classifier model for individual recognition displayed a performance of 83% for its top1 accuracy and 92.92% for its top5 accuracy (Figure 5). When the AI predicts the identity, it proposes a probability score for every class (i.e. the 42 names). The top5 accuracy means that 92.92% of the time, our model predicts the good individual in its five most probable estimations. The 83% of top1 accuracy means the main prediction given by the AI is the right answer 83% of the time. This accuracy has been reached after 66 epochs. The normalised confusion matrix, expressing the proportion of predicted identity for every individual in the test set, underline a remarkably high rate of correct individual classification (Figure 6).

Social Network Analysis

A total of 276 dyadic co-occurrences of individuals on the videos have been observed. The resulting network of associations had a score of density of 0.173 and a global efficiency of 0.508. Network individual measures, i.e. the density, strength and eigenvector centrality of each subject are reported in Supplementary Information. The individuals with the highest degree (D) and strength (S) were mostly juveniles such as Hirugi (D = 15, S = 1.180), Hinoki (D = 11, S = 1.011), Chimaki (D = 11, S = 1.200), Tsukasa (D = 11, S = 1.114) (Figure 7). Among the individuals with the highest eigenvector centrality indices (E), we can notice a remarkably high representation of mothers, such as Tsuwa (E = 0.895), Hiba (E = 0.885), Kizu (E = 0.884) and Yone (E = 0.822). Substantial association values were observed mainly between mothers and their offspring (e.g. 0.370 for Tabu and Baby_Tabu, 0.343 for Tsuwa and Kuro), even in adult dyads (e.g. 0.258 for Kanna and Yuna).

Discussion

Here we provide a first exploration to assess feasibility of the creation of a fully automatic pipeline for Japanese macaques' face detection and recognition from videos with deep learning followed by social network data generation. The primary focus of our work was the creation of a face detector for Japanese macaques and an identity classifier for Kōjima 'main group' population, both unified in a fluid code pipeline, from video frames extraction to identity prediction (Figure 8). Both the face detector (with an IoU threshold of 0.5) and the individual classifier achieved accuracy levels exceeding 80%, indicating a successful learning process for both models. This work represents the first operational deep learning-based AI pipeline designed for the study of Kōjima Island macaques. Consequently, we are currently working on an intuitive ergonomic Google Colab interface to make our code accessible to anyone. Utilising this platform, researchers would be able to effortlessly incorporate their own data and execute program steps, subsequently visualising outputs (i.e. face detection boxes on frames and identification on portraits). Thus, beyond serving as a proof of concept for future models, this first tool could significantly benefit non-AI-expert researchers working with Kōjima Island macaques, facilitating various studies requiring individual recognition. However, while this first step is a significant stride forward, there remains room for improvement. Indeed, our results are similar to some prior studies using deep learning and individual recognition (D. [START_REF] Schofield | Chimpanzee face recognition from videos in the wild using deep learning[END_REF], others displayed stronger accuracy values with different approaches [START_REF] Otani | Potency of Individual Identification of Japanese Macaques (Macaca fuscata) Using a Face Recognition System and a Limited Number of Learning Images[END_REF][START_REF] Ueno | Automatic individual recognition of Japanese macaques (Macaca fuscata) from sequential images[END_REF]. Several limitations surface within our method, each of which presents an opportunity for future research. Firstly, we must acknowledge that the composition of our datasets may have contributed to suboptimal results. Notably, we chose to annotate faces as long as they remained visible from a front view to a profile view. Faces are complex 3D objects and the coexistence of front and profile perspectives within the same category may have introduced ambiguity during the training process. It is plausible that excluding profile viewpoints from the dataset could lead to improved detection and recognition capabilities for front-facing images. However, this modification may also imply a decrease in the diversity of the point of view the models can handle. Conducting further tests with different datasets could help us strike the optimal balance between accuracy and diversity in this context. Technical limitations also bear consideration. Some hyperparameters were constrained due to resource limitations, e.g. a batch size capped at 10 frames per batch for the face detector training. As batch size can greatly impact training, this strongly limits the potential of exploration for best hyperparameters. Consequently, considerable room remains for exploration and improvement of this dataset to yield optimal results. Thus, we invite any interested researchers with programming and deep learning skills to customise our code as needed and explore ways of improvement with the base we provide. Considering we expect our code to produce automatic social network description based on our data, we manually made this social network description to prepare a performance assessment by comparison. We can observe that this network offers some reliable description of the social life of Japanese macaques as we know it. For example, we can see a remarkable inter-individual variability among adult females in their number of relationships, represented by the nods size. This is consistent with what we know of the species as there is a significant increase in social behaviours in females' Japanese macaques correlated with hierarchical position in the group [START_REF] Koyama | Matrilineal cohesion and social networks in Macaca fuscata[END_REF]. Thus we could infer for example that Yone, who has the greatest nod among female adults, may occupy a high place in the hierarchy. Another good reliability point is the fact that the juveniles, apart from the youngest babies who always stay with their mother, are generally the most connected individuals in the troop. The only exception is Kuro, who is a young male about to turn 4 years old. Those dynamics are quite supported by [START_REF] Nakamichi | Sex differences in social development during the first 4 years in a free-ranging group of Japanese monkeys, Macaca fuscata[END_REF] which depict juvenile females as very interactive with various individuals, while subadult males have a stronger tendency to go to the periphery of the troop. Anyway, those are only preliminary observations for a more in-depth study of social networks with the future automatically generated network. Nevertheless, we can identify flaws in our data collection method which can limit the relevance of our results. Overall, adverse weather conditions regularly hindered our ability to collect a substantial amount of data on the island. A number of 276 co-occurrences for 42 individuals is a good start to infer some social tendencies, but a larger number of data would be needed to establish a more relevant and reliable co-occurrence dataset. Moreover, the two-month duration of data collection on Kōjima Island, spanning February and March, might not suffice to comprehensively elucidate the intricacies of the population's social network, knowing that Japanese macaques can exhibit variation in social behaviours depending on the period of the year. This fact can be exemplified by the absence of Shika, the troop alpha male, during most of the fieldwork period. As the fieldwork period overlapped with the mating season, it's plausible that Shika sought out females from the other troop. We could reasonably think that Shika would have occupied a central position in our social network, interacting with several females, and exerting a significant impact on the social dynamics of the troop. Enhancing the representativity of our co-occurrence network could involve deploying data collection across different periods, thereby capturing the full complexity of social interactions exhibited along the year. While organising fieldwork can be complex, one viable option to increase data quantity and period diversity could be to employ automatic data collection through the use of camera traps. However, transitioning to camera traps would involve changing the current co-occurrence measure method. Indeed, considering a co-occurrence on a frame as social interaction is simple but non-resilient to non-normed tapes. Wider angle views of camera traps, compared to our zoomed shots, would not allow us to use co-occurrence as a proxy for physical proximity. This is why we should explore other more complex interaction measurement methods. We could use an algorithm that considers the distance between detected bounding boxes and their size to express depth distance. These values could then be compared to a threshold to determine whether an interaction has occurred and should be recorded. At its current stage, our AI pipeline is specialised for analysing individual pictures one at a time. We are also working to make our pipeline capable of processing entire datasets of frames in a single run, thereby making it able to analyse large datasets. Thus, we could implement the automatic cooccurrence matrix generation at the end of the pipeline. For this upgrade, we plan to use a custom version of the Kanade-Lucas-Tomasi [START_REF] Lee | Improved Kanade-Lucas-Tomasi tracker for images with scale changes[END_REF] face tracking code created by [START_REF] Schofield | Chimpanzee face recognition from videos in the wild using deep learning[END_REF] for their work on chimpanzees. With this add-on, our extracted frames will no longer be processed one by one through the face detector code. Instead, they would be analysed simultaneously by a face tracker, using our face detector model's values. Consequently, the forthcoming integration of the tracker into our code will serve as the last part of our pipeline and will thus enable fully automated identity recognition from input videos. Furthermore, by establishing face tracks spanning multiple frames within a video, our identity classifier will be able to make predictions based on several frames, substantially enhancing the reliability of our identification predictions. We expect our work to set the stage for long-term longitudinal studies with Kōjima Island macaques. Through the pipeline we are providing with this project, it becomes easily conceivable to conduct follow-up research on the social network of this population over the years. Additionally, on the userfriendly Google Colab page we will share, we are planning to include an option to easily fine-tune the model with new datasets. This means our current model could be updated and retrained by anyone using newly annotated data from the Kōjima population. Such fine-tuning would not only enhance the precision of the individual classifier but also allow for recognition of newcomers in the troop, such as babies and free-ranging males, by learning new identities. What makes this even more interesting is that fine-tuning could also be extended to other Japanese macaque populations. Researchers would have to annotate identities on the bounding box generated by our face detector. This way, the new training dataset for the classifier would lead the produced model to encompass new populations to its repertory of known individuals. Thus, in the future we could expect the development of a unified standardised accessible tool tailored for monitoring the individuals from the most extensively studied Japanese macaque populations (e.g., Awajishima, Arashiyama, Jigokudani, Yokushima). Such a tool would open up exciting opportunities for comparative studies between different populations. The examination of how social dynamics manifest differently within the same species across various populations would be particularly exciting. Japanese macaques have frequently demonstrated a remarkable propensity for cultural diversity, as seen in behaviours like potato washing, bathing in hot springs or playing with rocks. As a result, the study of social networks holds pivotal importance, given its role in shaping the transmission of cultural knowledge throughout the group. Moreover, it's plausible to speculate that social structures could be influenced by environmental factors and population-specific cultural traits. Thus, undertaking comparative studies on social structure could yield valuable insights. Unveiling the diverse facets of social networks and identifying the potential drivers behind such diversity offers a particularly appealing perspective.

In conclusion, we have successfully developed the main components of our AI pipeline project, including a robust face detector and an identity classifier tailored for Kōjima 'main group' macaques. The remaining steps involve handling large datasets with a face tracker and implementing automatic co-occurrence matrix generation using classifier outputs, which we are currently working on. Subsequently, we will evaluate its capacity to efficiently generate reliable automatic social network descriptions. Our goal is ultimately to make our code available to the scientific community. Importantly, technologies like the one used in this study offer not only powerful research tools but also avenues for conservation, science popularisation, and raising public awareness. By packaging our recogniser into a user-friendly software, we can enable real-time applications using smartphone cameras, similar to what Witham did in 2017 with webcams. Given that several studied Japanese macaque populations are popular tourist attractions, providing accessible facial recognition tools could serve both entertainment and educational purposes. This approach has the potential to enhance the general understanding of artificial intelligence while highlighting the concept of individuality in wild animals. Raising awareness about individuality in wild animals is not just an opportunity to share ethological knowledge; it's also a means to foster empathy and improve our understanding of animal welfare issues. In the broader context, our tool opens up exciting prospects for accessible individual recognition and has the potential for diverse expansions through deep learning. This would stimulate fundamental research with Japanese macaques and offer opportunities to explore their social behaviours and interactions in new and meaningful ways.

Figure 1 .

 1 Figure 1. Methodological graphic summary regarding the project three main objectives. Bold text within coloured boxes relates to software, frameworks and packages we used.

Figure 2 .

 2 Figure 2. Contextual pictures of Kōjima and its 'main group' population. (A) Satellite shot of Kōjima (Source: Googlemap), (B) 'Main group' macaques feeding on the beach, (C) Baited macaques on scales.

Figure 3 .

 3 Figure 3. Examples of two frames before and after face detection by our AI model. We can see on the frame (B) an example of false negative detection on a partially obstructed face.

Figure 4 .

 4 Figure 4. Curve of false negative rate of the face detection model depending on the number batches on which it was trained. A pink dot is placed at the lowest false negative rate reached (0.1365 at 5699 th batch)

Figure 6 .

 6 Figure 6. Normalised confusion matrix of predicted individual identity vs true individual identity. A blue scale represents the percentage of predicted identities for each individual in the test set.

Figure 7 .

 7 Figure 7. Network representation, following a GEM layout algorithm, of the co-occurrences of focal individuals with congeners on videos. Nod size represents the degree value for each individual and line thickness between two nods represent the dyadic association index for the two individuals.

Figure 8 .

 8 Figure 8. Chronological representation of the different codes of the pipeline applied on a frame and the different outputs generated.


Estelle Hotellier

Franck Sicard

Julien Francq

Stéphane Mocanu

Behavioral Intrusion Detection Methodology for Hybrid Industrial Control Systems

des établissements d'enseignement et de recherche français ou étrangers, des laboratoires publics ou privés.