Samuel Felton
email: samuel.felton@irisa.fr.

Pascal Brault
email: pascal.brault@irisa.fr.

Elisa Fromont
email: elisa.fromont@irisa.fr.

Eric Marchand
email: eric.marchand@irisa.fr.

Tamin Asfour

Visual Servoing in Autoencoder Latent Space

Keywords:

Visual servoing (VS) is a common way in robotics to control a robot motion using information acquired by a camera. This approach requires to extract visual information from the image to design the control law. The resulting servo loop is built in order to minimize an error expressed in the image space. We consider a direct visual servoing (DVS) from whole images. We propose a new framework to perform VS in the latent space learned by a convolutional autoencoder. We show that this latent space avoids explicit feature extraction and tracking issues and provides a good representation, smoothing the cost function of the VS process. Besides, our experiments show that this unsupervised learning approach allows us to obtain, without labelling cost, an accurate end-positioning, often on par with the best DVS methods in terms of accuracy but with a larger convergence area.

I. INTRODUCTION

V ISUAL servoing (VS) uses the information provided by a vision sensor to control the movements of a dynamic system [START_REF] Chaumette | Visual servo control, Part I: Basic approaches[END_REF]. VS can be used for tasks such as end-effector positioning, object picking or target tracking. It is especially useful in the cases where the current and target poses (positions and orientations) of the robot are not directly obtainable. This is the case when the scene may change in time and is not perfectly known. VS has applications in industrial settings for assembly operations, where the considered objects may not always be perfectly placed, making visual sensing a requirement for accurate operations. VS is framed as an optimisation process, where one seeks to minimise the difference between two sets of features that correspond to what is seen by the camera at the current pose and what is seen at the goal pose. The features that are used are often handcrafted. They can be 2D features (points, lines, ...) or 3D features (camera pose, 3D points). These features must be tracked over time and a matching process between features in the current and desired images is required. When the scene is not well structured (no tags, no well defined features), features tracking and matching is a difficult problem, which is often the cause of the failure of VS applications.

Photometric VS [START_REF] Collewet | Visual servoing set free from image processing[END_REF] or DVS (Direct Visual Servoing) has been formulated to work directly on the photometric information. By considering the whole image, these approaches do not require any tracking or matching process. They display very high positioning accuracy, but suffer from a small convergence area due to the fact that the optimisation problem is highly non-linear. To alleviate this issue, more compact image representations such as photometric moments [START_REF] Bakthavatchalam | A Direct Dense Visual Servoing Approach using Photometric Moments[END_REF], projections on an orthogonal basis (PCA [START_REF] Marchand | Subspace-based visual servoing[END_REF] or DCT [START_REF]Direct visual servoing in the frequency domain[END_REF]) or Gaussian mixtures [START_REF] Crombez | Visual Servoing with Photometric Gaussian Mixtures as Dense Feature[END_REF]) can be considered.

In the last decade, the effectiveness of learning-based methods on unstructured data has soared, in big part thanks to Deep Learning (DL). Neural networks, and especially Convolutional Neural Networks (CNNs) have achieved state of the art results in a variety of problems, encompassing classification [START_REF] Krizhevsky | Imagenet classification with deep convolutional neural networks[END_REF], [START_REF] He | Deep residual learning for image recognition[END_REF], optical flow regression [START_REF] Dosovitskiy | Flownet: Learning optical flow with convolutional networks[END_REF] or pose estimation [START_REF] Kendall | Posenet: A convolutional network for real-time 6-dof camera relocalization[END_REF] among other tasks. This success comes in big part from the fact that deep networks learn a hierarchical representation of the input, each layer extracting the features relevant to the downstream layers and the final task to be solved. These models alleviate the need for hand-crafted features, as they are learned directly from the data. DL is often used in a supervised setting, where the labels are provided during training and the learned representation is optimised directly for the task. In the unsupervised setting, one can for example train a network to learn to reconstruct the original input with some constraints. This network is called an autoencoder (AE). AEs aim to learn a "good" representation of the data. This representation is often low dimensional, following the manifold hypothesis stating that the input data is generated from a much lower number of variables than its own dimensionality. AEs have been shown to be able to compress the information into a very small code, with better reconstruction than their linear counterparts, e.g. PCA [START_REF] Hinton | Reducing the dimensionality of data with neural networks[END_REF].

Deep learning has previously been applied to VS. In some of these approaches [START_REF] Bateux | Training Deep Neural Networks for Visual Servoing[END_REF], [START_REF] Saxena | Exploring convolutional networks for end-to-end visual servoing[END_REF], [START_REF] Yu | Siamese convolutional neural network for sub-millimeter-accurate camera pose estimation and visual servoing[END_REF], a deep neural network is used to estimate either the camera pose or the pose difference between two cameras, from which the control law can be derived. In [START_REF] Felton | Siame-se(3): regression in se(3) for end-to-end visual servoing[END_REF], the camera velocity is directly regressed. This requires data labelling in the form of an image-pose correspondence and simulation is often used to train before transferring to the real world. These methods show a good convergence area, but the end positioning is not always accurate. A classical DVS method can be applied at the end of the process, to correct the remaining positioning error.

In this paper, we propose a novel visual servoing control law, based on photometric information in combination with a deep network. The network, an autoencoder, is trained in an unsupervised fashion, learning to compress the given input. Based on a convolutional architecture, it can extract richer features than other previous dimensionality reduction approaches. We establish the link between the learned representation and the camera motion, allowing for the control of robot in the latent space. We show through experiments, both in simulation and on a real robot, that servoing in the latent space is effective, with a very accurate positioning and a better convergence domain than other dimensionality reduction-based methods. This approach contrasts with other works combining DL and VS in that it does not require supervision. Moreover, it is less sensitive to the gap between simulation and real world, which is problematic in other DL works [START_REF] Felton | Siame-se(3): regression in se(3) for end-to-end visual servoing[END_REF]. It also differs from reinforcement learning litterature [START_REF] Levine | End-to-end training of deep visuomotor policies[END_REF], [START_REF] Van Hoof | Stable reinforcement learning with autoencoders for tactile and visual data[END_REF], [START_REF] Vecerik | A practical approach to insertion with variable socket position using deep reinforcement learning[END_REF], [START_REF] Mattner | Learn to swing up and balance a real pole based on raw visual input data[END_REF], where the control law (policy) is learned from the data and from a reward signal. This contrasts with our approach, in which we derive an analytical control law on a new, learned feature space. Moreover, it is complementary to visual planning approaches such as [START_REF] Nair | Hierarchical foresight: Self-supervised learning of long-horizon tasks via visual subgoal generation[END_REF], [START_REF] Crombez | Visual Servoing with Photometric Gaussian Mixtures as Dense Feature[END_REF] that use latent representations to generate subgoals in the form of images. In this case, the control/planning is still done w.r.t. images, while our method has no generation step, as we remain in the latent space.

The paper is structured as follows: we first give an overview of VS and how features extracted from images can be used to move in the cartesian space. We then detail how servoing can be done in the low dimension latent space of an autoencoder with our method, going from training a network to deriving the control law associated to a neural network. Finally, we validate the servoing scheme in experiments, both in simulation and deployed on a real robot.

II. VISUAL SERVOING

The goal of visual servoing is to control the motion of a robot with information extracted from images acquired by a camera, either looking at or mounted on the robot end-effector [START_REF] Chaumette | Visual servo control, Part I: Basic approaches[END_REF]. It is designed as a minimisation problem between the image features s(r), extracted at the current pose r, and s * , the desired features at the desired pose r * . The error e to be minimized is then:

e = s(r) -s * . (1)
If the feature are correctly chosen, when the error is minimized in the image space, the robot has reached the desired position r * in the 3D space.

To design the control law, the relationship between the motion of the features s in the image and the camera velocity v must be known. This is done thanks to the interaction matrix L s (also known as image jacobian), which contains the partial derivatives of the features w.r.t. to the pose ∂s ∂r .

The link between the time variation (motion) ṡ of s and the camera velocity v is given by:

ṡ = L s v. (2)
When the camera is mounted on the end-effector of the robot, the control law is directly deduced from (Eq. 1) and (Eq. 2). The camera velocity v which allows the error e to be minimised is obtained with:

v = -λL + s e (3)
where λ is a gain parameter, which ensures an exponential decrease of the error, and L + s is the pseudo inverse of L s . VS is realised in a closed loop scheme, with v being computed for each new image acquired by the camera.

One interaction matrix of interest to us is that of a 2D point x = (x, y). It is given as

L x =    -1 Z 0 x Z xy -(1 + x 2 ) y 0 -1 Z y Z 1 + y 2 -xy -x    (4)
where Z is the depth of the point. Many types of features can be considered for VS, as long as their interaction matrix is available [START_REF] Chaumette | Visual servo control, Part I: Basic approaches[END_REF].

Recently, some approaches have tried to move away from handcrafted features by considering the pixel intensities [START_REF] Collewet | Visual servoing set free from image processing[END_REF]. It is known as Direct (or photometric) VS. In this setting, the feature is the image itself s(r) = vec(I(r)). The interaction matrix of the intensity I x of a given pixel at the point x is [START_REF] Marchand | Control camera and light source positions using image gradient information[END_REF]:

L Ix = -∇I x L x ( 5
)
where ∇I x is the spatial gradient at x. To consider an image I of dimensions N × N as the servoing features, the interaction matrix at every point of the image is computed and then are stacked to form the N 2 × 6 Jacobian L I . This leads to a very precise positioning, but suffers from a very small convergence domain and an unpredictable trajectory. To overcome the former problem, multiple approaches have been developed that aim at reducing the nonlinearity of the cost function by reducing the dimensionality of the input image while keeping the majority of the information. A possible solution is to project the image on an orthogonal basis to obtain a feature set of lower dimension. This basis can be learnt (eg, using Principal Component Analysis (PCA) [START_REF] Marchand | Subspace-based visual servoing[END_REF]) or predetermined (eg, using a DCT [START_REF]Direct visual servoing in the frequency domain[END_REF]). For example, as far as a PCA is considered, a set of images is used to compute the basis (training). At run-time, the images are projected onto this pre-computed basis. The projection is a linear transformation, expressed as a matrix U of size N 2 × D, with D a chosen low dimension. With U, one can project an image onto the eigenspace as w = U T (I -I). Then, to perform servoing, the associated interaction matrix can be defined as:

L w = U L I . (6)
In a similar way, the Discrete Cosine Transform (DCT) [START_REF]Direct visual servoing in the frequency domain[END_REF] can be considered to define the basis. The DCT allows for the image to be represented in the frequency domain by a sum of cosines of different frequencies and amplitudes. In both cases, PCA or DCT, reducing the dimensionality of the features allows to focus on the low frequencies of the images and discard the high frequencies which are shown to be unhelpful for the task.

[4] is our main source of inspiration. We also use learning as a way to compress the image, but we do so with a nonlinear function, unlike PCA which is linear and projects on an orthogonal basis. Here, we use a more powerful learning algorithm: an autoencoder, capable of learning a non-linear representation of the data, leading to a better compression of the information.

III. AEVS: SERVOING ON LEARNED FEATURES

In this section we detail the inner workings of AEVS, an Auto-Encoder Visual Servoing method, and describe how to perform visual servoing on the features extracted by a neural network. We start by giving some background on autoencoders (AE). AE typically achieve better compression and reconstruction than other linear learning-based methods. They also have the ability to better approximate the nonlinear manifold from which the data was generated. For these reasons, we argue that they are an ideal fit for reducing the dimensionality of Photometric VS, improving the convergence rate while retaining an accurate end positioning. AEVS, detailed afterwards, is based on the analytical computation of the interaction matrix of a neural network.

A. Background on autoencoders

Autoencoders (AE) [START_REF] Bengio | Representation learning: A review and new perspectives[END_REF] are neural networks composed of two distinct parts: an encoder h, which aims at projecting the learning data into a latent space (or bottleneck) with interesting properties and a decoding part d which decodes samples from the latent space into the original data space. Similarly to other neural networks, AE are trained by gradient descent and the parameters are updated in order to minimise a loss function, which is specific to the task at hand. Since gradient descent requires computing the gradients w.r.t. to the parameters and inputs of each layers, all the operations are differentiable. As for other neural networks, the most common layers of the AE apply a linear processing (convolutional or not), followed by a non-linear activation function. These non-linearities give its discriminatory and learning capabilities to neural networks, allowing them to form a non-linear mapping between the input and the output.

However, AE are particularly appealing since they do not require labelled data to be trained. This comes from the fact that they seek to learn the identity function f (x) = d(h(x)) = x. While this might be trivial to learn, constraints are added in order for the AE to learn a meaningful representation (latent space). The simplest one is to impose an undercomplete representation that has a low dimensionality [START_REF] Hinton | Reducing the dimensionality of data with neural networks[END_REF] and cannot conserve the full information of the data. AE compare favourably to their linear counterparts, e.g. PCA, in that they can achieve a lower error on the reconstruction task and encode into fewer variables the main factors of variations of the data, making their representation ideal for clustering and other downstream tasks. The reconstructed input is then x = d(h(x)). The latent, compressed information stemming from applying h is denoted as z = h(x). To minimise the reconstruction error, a loss function must be introduced. Two common choices are the mean squared error

L(x, x) = x -x 2 (7)
in the case of real unbounded values or the binary crossentropy (BCE)

L(x, x) = - 1 N N i x i log(x i ) + (1 -x i ) log(1 -xi ) (8)
when the inputs are binary or in the range [0, 1]. Both losses seek to maximise p(x|z), the probability of x being recovered from z.

AEs can also learn a representation that is robust to noise and small perturbations. This can be done by an explicit regularisation term as done in [START_REF] Rifai | Contractive auto-encoders: Explicit invariance during feature extraction[END_REF], or by corrupting the input [START_REF] Vincent | Extracting and composing robust features with denoising autoencoders[END_REF] while encouraging the reconstruction to be close to the uncorrupted input. These approaches enforce a small degree of invariance to small changes in the data, making the representation more robust.

AE have also previously been used for control. In reinforcement learning, they are useful to reduce the dimensionality of the input data, making easier to learn a policy afterwards [START_REF] Van Hoof | Stable reinforcement learning with autoencoders for tactile and visual data[END_REF], [START_REF] Mattner | Learn to swing up and balance a real pole based on raw visual input data[END_REF]. Given an appropriate architecture, they can extract spatial features such as points that can be used for control [START_REF] Finn | Deep spatial autoencoders for visuomotor learning[END_REF], [START_REF] Puang | Kovis: Keypoint-based visual servoing with zero-shot sim-to-real transfer for robotics manipulation[END_REF].

In the following, we will consider an AE that is trained to reconstruct an input image I. This AE, based on a convolutional architecture, must learn the parameters during training, so that the error between the reconstructed image Ĩ and I is minimised. Using a convolutional encoder allows us to learn a powerful and high level representation, which can be used for control purposes. Inspired by [START_REF]Direct visual servoing in the frequency domain[END_REF], we propose to guide our AE to learn a representation that is robust to changes in high frequencies and small photometric variations.

B. Learning a representation for visual servoing

In previous works approaching DVS through the prism of dimensionality reduction [START_REF] Marchand | Subspace-based visual servoing[END_REF], [START_REF]Direct visual servoing in the frequency domain[END_REF], it has been shown that considering the main factors of variation in the data or their low frequency components improves the servoing convergence. In these approaches, this knowledge is explicit, as the explained variance/frequency of each of the extracted features is known. However, in the case of an AE, the latent space must be guided towards the goal of prioritising lower frequencies. Indeed, the traditional losses presented in Eq. ( 7) and Eq. ( 8) consider all pixels equally and independently and as such cannot incorporate such constraints. With these objective functions, the AE will try to fit both low and high frequencies and may learn a latent representation that is in part tied to the higher frequencies.

To remedy this, we propose to reformulate our reconstruction loss in the frequential domain. Applying the DCT to the original image I and its AE reconstruction Ĩ, we obtain their frequential representations F and F. F is an N × N matrix, in which the energy of the different frequencies of the signal x is stored. The frequencies are ordered and go from low (F 0,0 ) to high (F N -1,N -1 ). Since there is an explicit ordering, we can choose which frequencies to prioritise in the loss. This is done by adding a weighting in the loss like so:

L DCT (F, F) = 1 N 2 N i=0 N j=0 M i,j |F i,j -Fi,j | (9)
The elements of the weighting mask M are defined as

M i,j = 1 i+j+1
, placing more emphasis on having a correct reconstruction of the lower frequencies and mostly discarding the higher ones. Although the zigzag ordering [START_REF]Direct visual servoing in the frequency domain[END_REF] is usually used to have a vectorized representation of the frequencies, we found that considering the elements of a diagonal of F -F works equally well. We evaluate the impact of the loss function of the latent space and the performance improvements in Section IV.

C. Computing the interaction matrix of a neural network

In our method, we propose to perform VS in the latent space and reformulate the error (Eq. ( 1)) as a function of the encoding of an AE:

e = z(r) -z * ( 10
)
For the robot to be controllable (by applying Eq. ( 3)), the variation of z w.r.t. to the camera velocity must be known, i.e the interaction matrix L z must be computed. We choose as our servoing features the information bottleneck z. Because the network will process an input image I, its learned representation is dependent on I and L I (see Eq. ( 5)) is required to compute L z . Computing L z from L I is a matter of chain rule derivations of the Jacobians:

L z = ∂z ∂r = ∂z ∂I ∂I ∂r = ∂z ∂I L I ( 11
)
where L I is derived from equation ( 5). In the case of a simple one-layer linear autoencoder where z = WI + b, with W, b the learned encoder parameters, The interaction matrix is equivalent to the one presented in [START_REF] Marchand | Subspace-based visual servoing[END_REF] and detailed in Eq. ( 6):

L z = ∂WI + b ∂r = W ∂I ∂r + ∂W ∂r I = WL I (12)
Linear autoencoders and PCA are tightly linked [START_REF] Plaut | From principal subspaces to principal components with linear autoencoders[END_REF], [START_REF] Kunin | Loss landscapes of regularized linear autoencoders[END_REF]: they optimise the same objective and project into the same subspace. The projection W learned with a linear AE does not have the orthogonality constraint. However, the principal directions can be recovered from W by applying a singular value decomposition.

To extend the process to the case of a nonlinear layer, one must take into account the activation function that is commonly applied after the linear transformation of the layer. A traditional fully connected layer is of the form z = a(WI+b), with a the activation function, typically applied element-wise. To find the interaction matrix associated to this nonlinear operation, we must derive w.r.t. to the pose r:

L z = ∂z ∂r = ∂a(WI + b) ∂r (13)
Applying the chain rule, we get:

L z = ∂a(WI + b) ∂WI + b ∂WI + b ∂r (14)
And using the same process than for the PCA-based interaction matrix computation, which relies on the fact that W and b are independent of the pose r (they are learned offline), the final result is:

L z = ∂a(WI + b) ∂WI + b WL I (15)
The projection operation WL I performs a linear combination of the gradient of the pixels with respect to pose and does Fig. 1: Overview of our VS process. Given an image I and its associated interaction matrix L I , we project the information onto a low dimensional embedding z and compute its interaction matrix Lz, with the dashed lines representing forward differentiation.

not influence their direction. The derivative of the activation ∂a(WI+b) ∂WI+b impacts the modelling of the interaction matrix. In the case of the ReLU activation, defined as a(x) = max(x, 0), ∂a(x) ∂x = 1 x>0 . Thus, when computing L z , this activation will act as a binary selection, keeping only the information of the filters that were activated.

Moreover, a deep network is a stack of layers. To compute the interaction matrix of the final representation, we apply the chain rule recursively, from the input to the output. Considering a stack of n layer outputs l 0 , ..., l n and the associated weights W 1 , ..., W n and biases b 1 ..., b n :

L l 0 = L I L l i = ∂a i (W i l i-1 + b i ) ∂W i l i-1 + b i W i L l i-1 (16)
This process is a direct application of the forward automatic differentiation [START_REF] Baydin | Automatic differentiation in machine learning: a survey[END_REF]. Computing the gradient in this manner is not recommended when the dimension of the output is less than that of the input, as it is less efficient than reverse differentiation. However, we are deriving a vector z in R D w.r.t the pose r, where D ≥ 6. D cannot be inferior to 6, or it will incur the loss of a degree of freedom of the camera when servoing. Thus, using forward differentiation makes sense in our case and allows us to compute L z and z in parallel. The integration of the network into the servoing loop is detailed in Figure 1.

Note that the transformation of the interaction matrix is linear, as seen in Eq. [START_REF] Hinton | Reducing the dimensionality of data with neural networks[END_REF]. However, unlike PCA, it is sampledependent because of the nonlinearities.

While we have developed the case for a multilayer perceptron, it is straightforward to extend it to other types of networks, such as CNNs. One must simply compute the Jacobian of the involved transformations, such as the convolution operation * . Considering a convolution in an intermediate layer i, C i = C i-1 * W, where C i-1 is a feature map tensor of dimensions C i-1 × H × W with C i-1 the number of features, W a set of learned filters, given the interaction matrix associated to C i-1 , L C i-1 , as a tensor of dimension 6 × C i-1 × H × W then, computing the interaction matrix L C i amounts to convolving each tensor associated to a pose component with the learned filter:

j : 0 ≤ j < 6, L C i ,j = L C i-1 ,j * W ( 17
)
Fig. 2: Simulated data generation process. Focus points, x are sampled from the blue zone. A pose r looking at the point x is then generated in the red zone, above the scene.

IV. EXPERIMENTS

In this section, we evaluate the performance of our approach for VS. We use a well known convolutional architecture and train in simulation. In the same environment, we compare our results with other photometric-based VS approaches and explore the impact of different hyperparameters on the final results. Finally, experiments on a real robot are conducted to demonstrate the capabilities of AEVS in a real world setting, both on a scene used for training and on a novel one.

A. Implementation details

To deploy our method, we train an autoencoder tasked with minimising the reconstruction error. We use ResNet-18 [START_REF] He | Deep residual learning for image recognition[END_REF] for both our encoding and decoding networks. We found that this relatively small and robust architecture (using residual connections) is sufficient for our task, although more recent ones such as EfficientNets [START_REF] Tan | EfficientNet: Rethinking model scaling for convolutional neural networks[END_REF] could have also been used. In the decoding part, we "flip" the standard ResNet, replacing the downsampling operations with upsampling ones. The weights between the two networks are not shared. We observed that Batch Normalization (BN) [START_REF] Ioffe | Batch normalization: Accelerating deep network training by reducing internal covariate shift[END_REF] had a detrimental impact on servoing. We therefore replace it with another normalization scheme, Weight Normalization (WN) [START_REF] Salimans | Weight normalization: A simple reparameterization to accelerate training of deep neural networks[END_REF]. WN encourages the norm of the parameters to grow, which is not the case for BN. When computing L z , the values coming from L I will typically be orders of magnitude smaller than the intensities in I: using BN may cause precision issues as we iterate through the layers. Moreover, we replace the classically used global average pooling at the end of the network with a grouped convolution, since the invariance induced by the pooling is not helpful for our task, and leads to poorer control at test time. After the last convolution, we project the features onto an embedding of the desired size with a linear fully connected layer.

Finally, the last requirement for training is a dataset : we use a simple simulation, similar to [START_REF] Bateux | Training Deep Neural Networks for Visual Servoing[END_REF], [START_REF] Felton | Siame-se(3): regression in se(3) for end-to-end visual servoing[END_REF], where the considered scene is planar. Training then requires a single image of the scene. To get a varied sampling of the scene, we randomly draw a point x near the center of the scene (so as to avoid seeing the edges, which are not of interest). We then sample a camera pose r above the scene, directly looking at x and with a random rotation around the focal axis (see Figure 2).

The network is trained for 50 epochs, on a dataset of 20k images for training and validated on 10K images, with a batch size of 50. We use the Adam optimiser, with a learning rate of 10 -3 . Training on a RTX 2080Ti takes around three hours with deterministic algorithms (used in all our experiments), and an hour without, making deployment fast. At inference, computing z and L z takes about 7ms on the GPU.

When performing servoing, we choose a Levenberg-Marquardt-based control law and replace the traditional velocity computation (Eq. ( 3)) with

v = -λ(H + µdiag(H)) -1 L z (z -z * ) ( 18
)
with H = L T z L z and µ = 0.01. This control law has been shown to vastly improve the results when considering photometric information for VS [START_REF] Collewet | Visual servoing set free from image processing[END_REF], [START_REF] Marchand | Subspace-based visual servoing[END_REF], [START_REF]Direct visual servoing in the frequency domain[END_REF].

B. Experiments on simulated data

The first validation of our method is shown in Fig. 3. We study the loss landscape of the error function e = zz * . To visualise this, we compute the euclidean norm of the error at different offsets from the desired pose. Our nonlinear representation effectively smoothes the servoing cost function, leading to a better convergence area at test time.

To study our method and compare it with other approaches, we develop two test sets, corresponding to different scenarios. In the first one, we generate poses r, r * , so that they look around the same point of the scene. We add noise (up to 10cm displacements) to the points observed by r to add difficulty to the test cases. This scenario will create large displacements (with some far from the training set) in translation (on all axes) and in rotation on the x/y axes to compensate for the translation. The translation is sampled uniformly in a 3D box above the scene of dimensions [1.2m, 1.2m, 0.3m]. The rotation around the z axis is kept small (few degrees). The average starting error is of 47cm±15cm and 37°±11°. In the second scenario, we study the convergence on screwing motions, where the displacement is on the z axis. For r, we create displacements with translations in [-30cm, 30cm] and rotations in [-70 • , 70 • ]. The desired poses r * are located 60cm above the scene, with a random rotation around the z axis. For the two scenarios, we generate 500 test cases r, r * . We chose those test cases because they feature large overlap between the images, and are the cases where using direct VS schemes makes the most sense. When the overlap is small, our method has a low convergence rate, as do the other direct VS methods. We first look at the performance of the loss function proposed in Section III-B and compare it with a standard reconstruction loss, the pixel-wise binary cross entropy (BCE, Eq. ( 8)). The results, displayed in Figure 4, show that our proposed loss greatly improves the results on the screw motion test case, allowing a convergence rate of up to 91% and overall improves the results when compared to PCA (detailed below). When using BCE, the convergence rate is 82.52% ± 0.4%, while it is 88.84% ± 1.5% with the frequential loss. In the look at test case, the results are similar (92.76% ± 1.75% for BCE, 92.56% ± 0.8% for the frequential loss), with a slight advantage for the BCE loss in terms of median and maximum convergence but with a higher variance overall.

Fig. 4: Convergence rate of AEVS for two loss functions on the two test cases. We report median, minimum and maximum convergence rate across 5 different seeds.

Next, we evaluate the results of our method in comparison to other direct VS approaches, namely DVS [START_REF] Collewet | Visual servoing set free from image processing[END_REF], DCT-based VS [START_REF]Direct visual servoing in the frequency domain[END_REF] and PCA-based VS [START_REF] Marchand | Subspace-based visual servoing[END_REF], as well as an end-to-end deep learning approach, Siame-se(3) [START_REF] Felton | Siame-se(3): regression in se(3) for end-to-end visual servoing[END_REF]. The latter demonstrates much higher convergence areas (beyond the ones tested here) but a much lower precision. The results are reported in Table I. For DCT-VS, PCA-VS and the two AEVS variants, we project the input to a latent space of size 32. For AEVS, we select our best-performing networks from the experiment of Figure 4 (in terms of convergence rate), trained with the two losses (BCE and the frequential domain loss presented in Section III-B) and show their results. We study the convergence rate, as well as the end error for the cases that converge to the desired pose. In all cases, the impact of dimensionality reduction is evident (second line against all four of the last lines in the table) and leads to a better convergence. In the first test case ("look at"), our method achieves better convergence than other methods, while maintaining a precise positioning. The best results are achieved when trained with the common pixel-wise BCE loss. This may indicate that in this case, learning a representation that conserves more high frequency information is helpful. For DVS, convergence is far slower and servoing must be run for more iterations than other methods, due to the shape of the cost function. Indeed, when there are compensations between translations and rotations on the x/y axes, servoing drives the process towards flat valleys of the cost function, leading to a slow convergence. Siame-se(3) manages to converge close to the desired pose in every case, but exhibits lower accuracy. For the screw motion test, our method sensibly improves convergence when compared to other methods if it is trained with the frequential loss presented in Section III-B. When using a standard pixel-wise loss, the performance falls behind other methods. Siame-se(3) produces a high error, but even in cases that did not converge, it reduces the pose error so that it reaches around 2.5 cms/°in average. For AEVS, All samples that reach a near zero velocity (they settle in a minimum of the cost function) find the global minimum, i.e the desired pose. This illustrates that the learned latent space is discriminative and the cost function smooth, leading to a correct optimization. We then study the impact of the network hyper-parameters on the results for AEVS, trained with the frequential loss (Eq. ( 9)). We first evaluate the impact of the latent size dimension (Figure 5a). It can be seen that VS works slightly better with lower dimensional representations, although using larger ones is also effective. When using a bottleneck of size 6, which is the true dimensionality of the manifold (images only depend on the pose), servoing works especially poorly in the look-at test. This may indicate that the retained information is not enough to disentangle the ambiguities between the x/y translations and y/x rotations that are present in those cases. Finally we evaluate the impact of the encoder depth on servoing (Figure 5b). To do this, we train a series of 8 ResNets. For Resnet i, only the i first residual blocks of the encoder are active and the remaining blocks only retain their skip projections. We also keep the end projection so that we reach a latent space of the same dimension. A similar operation is applied to the decoder, where the i last blocks are kept as is. It can be seen that while VS works for a linear projection of the low level features, mid/high level non-linear features acquired in the later residual blocks are impactful in learning a good representation for servoing. More experiments can be found in our supplementary material [START_REF] Felton | Visual servoing in autoencoder latent space: supplementary material[END_REF], where we study the impact of additional learning parameters, as well as perform experiments on different objects.

C. Robot experiments

Finally, we deploy AEVS on an 6 DOF gantry robot, to test on real scenes. First, we study the convergence of our method. To do so, we generate samples with increasing difficulty, sampling from Gaussian distributions with 0 means and growing standard deviations. For the x/y translations, the standard deviations are 0.02/0.05/0.1/0.2/0.4m and halve these for the z. The orientations of the cameras are such that the initial viewpoints have a large overlap with the desired one, but we also add noise ∈ [-0.1m, -0.1m] to the focal point in the scene in order to increase the difficulty. We also add rotations around the focal axis, in the [-30 • , 30 • ] range. For each difficulty batch, we generate 25 samples. We ensure that the starting poses lie in the robot workspace. The results can be seen in Figure 6. Our method exhibits a strong convergence rate and, for batches 3 and 4, the only failing cases are due to large specular reflections appearing in the starting image. This is not unexpected, as specularities are particularly impactful on photometric methods, built on the hypothesis that the scene is lambertian. For the last batch, with standard deviation 0.4m on the x/y axes, 3 out of the 6 failure cases are also due to speculars, while in the other 3, AEVS either converges to a suboptimal pose far from the desired one or leads the robot out of its workspace. Figure 6b shows the trajectories accomplished by the robot during servoing. The samples tend to be generated in a half volume, with a positive y displacement, due to a joint limit of the robot that constrains the workspace. The trajectories show a distinct pattern: a large translation on the z axis is first produced. Then, it is corrected in the following iterations, along with the remaining displacement on the other axes. This, however, is not tied to our method but seems to be a common behaviour across photometric methods, as can be seen in our next experiment. Our first detailed example (Figure 7) evaluates the method on the scene on which it was trained. We start with an initial displacement of ∆r 0 = (-32.78cm, 18.07cm, -6.16cm, 18.41°, 27.51°, 16.98°) and run our method for 1.5k iterations. Minimising the error in the latent space (Figure 7f) leads to a correct minimisation of the pose error and convergence is successful, with a final positioning error of ∆r f inal = (0.03cm, 0.05cm, 0.01cm, 0.05°, 0.03°, -0.14°). DVS, however, fails to converge. In a similar way as other photometric methods, AEVS first tends to correct the error on the z axis (although it does overestimate the translational motion in the first iterations), which accounts for the largest error in the image space. It finishes by correcting the displacement on the x/y axes. The trajectory (blue in Figure 7h) remains similar to the other methods.

In the second experiment, we study whether our method can handle novel scenes on which the AE is not explicitly trained. To do so, we train AEVS with the frequential loss on 100k images, from 10 different scenes. We train for 25 epochs, with a learning rate of 10 -4 . We select our scenes from the "car" class of the ImageNet [START_REF] Russakovsky | ImageNet Large Scale Visual Recognition Challenge[END_REF] dataset. They thus should have common semantic characteristics that we will try to exploit by servoing in the real world on a toy RC car. The starting displacement is (8.74cm, -23.67cm, -1.08cm, -18.55°, -17.92°, -32.62°), and the displacement in the image (Figure 8c) is fairly large. This scene, visible in Figure 8a and Figure 8b introduces 3D information that is not present in the first experiment. Moreover, it is quite challenging, as it contains specularities on the body and the windshield of the car, as well as high frequency patterns, such as the wheels, the checkered pattern of the decal and the added objects. Despite this, the method manages to reach a final displacement ∆r f inal of (0.31cm, -0.11cm, 0.07cm, -0.09°, -0.34°, 0.0°). There is a small remaining error, shown in Figure 8d, and is the minimum achievable error with AEVS. In this case, we still consider our method successful, considering the shift between the training set (planar images of modern cars) and the presented scene.

More experiments, including servoing on industrial objects, can be found in our supplementary material [START_REF] Felton | Visual servoing in autoencoder latent space: supplementary material[END_REF] (Section IV) to show the versatility of our method.

V. CONCLUSION

We have presented a novel way to perform visual servoing, controlling the camera motion in the latent space of an autoencoder. The method features a broad convergence area, as well an accurate positioning. The representation provided by the autoencoder is compact, and the camera motion required in order to minimise the latent error is computed analytically. The unsupervised method allows us to avoid using costly labelled data and our experiments also show that our method has a great generalization potential on unseen data. The ability to compute the interaction matrix for a generic neural network paves the way to other venues of research. The flexibility of neural networks, both in their architecture and their objective function could allow us to introduce new interesting constraints in the latent space to obtain smoother robot trajectories and improve the convergence of our method in complex cases.

Fig. 3 :

 3 Fig. 3: The servoing loss landscape for (a) DVS (b) DCT-VS (c) AEVS, on an x/y translation motion around the desired pose.

Fig. 5 :

 5 Fig. 5: Servoing results, depending on (a) latent space size and (b) network depth.

Fig. 6 :

 6 Fig. 6: Results of the large scale robot experiment. (a) Convergence rate for batches with growing difficulties. (b) Servoing trajectories. Each color corresponds to a difficulty batch and points indicate diverging samples.

Fig. 7 :

 7 Fig. 7: First experiment: (a) Starting image I. (b) Desired image I * . (c) Starting image difference I -I * . (d) Final image difference. (e) Pose difference r-r * . (f) Error in the latent space z-z * . (g) Camera velocities v. (h) 3D trajectories of the different methods.

Fig. 8 :

 8 Fig. 8: Second experiment: (a) Starting image I. (b) Desired image I * . (c) Starting image difference I -I * (d) Final image difference. (e) Pose difference rr * . (f) Error in the latent space zz * .

TABLE I :

 I Comparative results of different VS methods on two test cases. The convergence rate, as well as the end positioning error for the cases that converge are reported.