{'fraction_non_alphanumeric': 0.030097483227695614, 'fraction_numerical': 0.010118981430001112, 'mean_word_length': 4.735544217687075, 'pattern_counts': {'":': 0, '<': 2, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
A Kendall Shape Space Approach to 3D Shape Estimation from 2D Landmarks

3D shapes provide substantially more information than 2D images. However, the acquisition of 3D shapes is sometimes very difficult or even impossible in comparison with acquiring 2D images, making it necessary to derive the 3D shape from 2D images. Although this is, in general, a mathematically ill-posed problem, it might be solved by constraining the problem formulation using prior information. Here, we present a new approach based on Kendall's shape space to reconstruct 3D shapes from single monocular 2D images. The work is motivated by an application to study the feeding behavior of the basking shark, an endangered species whose massive size and mobility render 3D shape data nearly impossible to obtain, hampering understanding of their feeding behaviors and ecology. 2D images of these animals in feeding position, however, are readily available. We compare our approach with state-of-the-art shape-based approaches, both on human stick models and on shark head skeletons. Using a small set of training shapes, we show that the Kendall shape space approach is substantially more robust than previous methods and results in plausible shapes. This is essential for the motivating application in which specimens are rare and therefore only few training shapes are available.


Introduction
The reconstruction of a 3D shape from 2D images is an important problem of computer vision that has been the subject of research for decades [34,6]. It is a widespread challenge with sample applications including motion recognition and tracking, autonomous driving, as well as robot-assisted surgery and navigation. Generally, estimating the 3D shape of an object from single monocular 2D images is an ill-posed problem in the sense of Hadamard. To tackle this problem, several approaches have been proposed, the choice of which greatly depends on the type and amount of data, and the application.
One common approach is to use a series of 2D images [15,7] or multiple cameras [19,16,24]. This is used, for example, in photogrammetry. In order to calculate the depth, corresponding points in 2D images need to be identified [29,7,1].

arXiv:2207.12687v1 [cs.CV] 26 Jul 2022
Another approach is based on physical modeling of the object to be estimated [32,2]. Here, the object is described as a kinematic tree consisting of segments connected by joints. Each joint contains some degrees of freedom (DOF), indicating the directions it is allowed to move. The object is modeled by the DOF of all joints. Length constraints can also be added, such as limb lengths constraints in a human pose. This helps reduce the depth ambiguity by constraining the relative position of the joints.
In lieu of additional viewpoints or physical models, another line of work regularizes the estimation problem by employing prior knowledge learned from examples of the respective object class. Some works in this category are based on the concept of shape spaces. Here, the 3D shape of an object is estimated by interpolating through a set of pre-defined 3D shapes, called training shapes, that represent possible deformations of the object. Given a 2D projection of the object, the aim is to find the ideal camera parameters and the shape coefficients describing the interpolation. Most commonly, active shape model (ASM) techniques are used [23,14,30,35,38,37]. ASM has been used intensively for the purpose of recognizing and locating non-rigid objects in the presence of noise and occlusion [13,4]. It aims at providing a robust approach, which accommodates shape variability by arguing that when the objects deform in ways characteristic to the class of objects they represent, the method should be able to recognize them. Here, the shape of a class of objects is described by a set of labeled landmark points, each representing a particular part of the object or its boundary. Given a set of pre-defined basis shapes of an object, the assumption is that any shape of the object can be described by linearly interpolating between basis shapes. The legitimacy of the model is determined by the set of training shapes, which needs to include the variability in the shape of the object.
Apart from these more classical approaches, recent years have mostly been devoted to the development of deep learning-based methods that exploit domainspecific data repositories with abundant samples (e.g., ShapeNet, Human3.6M ). In 2017, a kinematic skeleton fitting method using a convolutional neural network (CNN) was proposed that regresses 2D and 3D joint positions jointly in real-time [21]. More recently, Procrustean regression networks (PRN) were proposed [26]. Using a novel loss function, they solve the problem of automatically determining the rotation. Another recent deep learning-based method, KShapeNet [11], makes use of Kendall's shape space by modeling shape sequences first as trajectories on Kendall's non-linear shape space, which are then mapped to the linear tangent space. The authors report [11] that the non-linear motion can be captured better using their approach than using previous geometric deep-learning methods.
In general, the training of deep neural network models requires a considerable amount of data. While the generalization of learned models to new classes with few available examples has become a highly popular research topic (see e.g. [22]), such base models are rarely available in many applications. There is therefore a strong impetus to develop so-called shallow learning approaches that can be applied even if few-shot learning is not an option. Our work contributes to this area by deriving a novel shape space-based approach. We demonstrate the effectiveness of the proposed scheme in an application to the study of marine animal behavior. In this application, we are faced with the retrieval of the 3D shape of a non-rigid (biological) object -the head skeleton of a basking shark -from single monocular 2D images. Basking sharks (Cetorhinus maximus) are massive animals and thought to be one of the most efficient filter-feeding fish in terms of the throughput of water filtered through their gill rakers [31]. Details about the underlying morphology of the basking shark filter apparatus and particularly how it is configured when the animal feeds have not been studied due to various challenges in acquiring real-world data. In this study, we address this issue, using several computed-tomography (CT) scans to create skeletal representations of basking shark head structure. From these, and known aspects of the biology (e.g. shark cranial anatomy, feeding behaviors), we semi-automatically created plausible configurations of the skeleton which we use as training shapes to describe the shape space. The ultimate goal is, given a photograph of a basking shark in feeding position, to estimate a plausible 3D shape of the skeletal representation from the training data and annotations of the skeletal joints in the form of 2D landmarks.
Since the number of training shapes is very limited in our application, deep learning-based methods cannot be applied. When using only a single 2D image, photogrammetry-based methods also cannot be applied. And for a physical modeling-based approach, information about the movement of the skeletal elements that is supported by the joints would be necessary. This information is not available. We therefore resort to shape space-based methods. In particular, we develop a new Kendall shape space (KSS) approach for the reconstruction of 3D shape from 2D landmarks. Our overall workflow is sketched in Fig. 1. In order to evaluate our approach, we compare it qualitatively and quantitatively with state-of-the-art ASM approaches [37] on both human poses and basking shark skeletons. Due to the limited number of training shapes for the basking sharks, we are mainly interested in the performance of the approaches w.r.t. a small number of training shapes.
The results of our experiments suggest that our method is substantially more robust than previous shape space-based methods. This is particularly true for real world data both of human beings and shark data. It is also computationally very efficient and provides plausible interpolations without auxiliary regularization since the estimated shape will always lie on a subspace in Kendall's shape space spanned by the training data.
The source code of the proposed method together with the derived basking shark shapes have been made publicly available [27].

Methods
In this work, we approach the problem of estimating the shape of 3D objects from single images. To this end, we employ a landmark-based representation, viz. a set of ordered 3D points (x i ) i=1,...,k that correspond to homologous points (e.g. joint centers in a skeleton) common to all subjects belonging to the object class under study. By assuming the weak perspective camera model, the projection or forward map is given by the linear system where X ∈ R 3×k and W ∈ R 2×k denote the matrices of stacked landmarks and their 2D projections, respectively. The rotation R ∈ SO(3) and translation t ∈ R 2 encode the camera coordinate system while the projection is carried out by the matrix where the scalar α depends only on the focal length and distance to the object. The inverse problem of finding the 3D configuration corresponding to given projections is commonly formulated in terms of a least-squares problem. However, the underdeterminedness renders such a problem ill-posed requiring inclusion of prior knowledge in order to obtain feasible solutions. An established strategy based on the active shape model [9] is to restrict the search space to linear combinations of basis shapes B 1 , . . . , B n ∈ R 3×k , i.e.
with weights c j satisfying the constraint j c j = 1. The quality of this approach, however, depends on the validity of the assumption that instances of the object class are well approximated by a hyper-planar manifold. In general, the shape of an object is considered to be invariant under rotation, translation and scaling and, hence, takes values in a nonlinear space with quotient structure. In particular, for landmark-based representations, this concept gives rise to the well-known Kendall shape space [17]. The non-Euclidean nature of shape space not only violates the linearity assumption but furthermore prevents direct application of algebraic expressions such as Eq. (2) due to the lack of a global vector space structure. Nevertheless, the framework of (computational) differential geometry provides us with a rich toolset to generalize the ASM approach for use within the reconstruction problem.

Geometric model
Before we formulate a manifold version of the least-squares estimation, we first recall essential notions and properties from Kendall's shape space. We refer the reader to the comprehensive work [18] for an in-depth introduction. Let X ∈ R m×k be the matrix holding k landmarks x i ∈ R m as columns. We remove the effect of translations and scaling by subtracting the row-wise mean from each landmark and then dividing X by its Frobenius norm (denoted · ). The set of all such configurations constitutes the pre-shape space Now, the left action of SO(m) on S k m given by (R, X) → RX defines an equivalence relation given by X ∼ Y if and only if Y = RX for some R ∈ SO(m). Kendall's shape space is defined as the quotient Σ k m = S k m /∼. Now, denoting the canonical projection of ∼ by π and the spherical distance by d S (X, Y ) = arccos X, Y , the induced distance between any two shapes π(X) and π(Y ) is given by where λ 1 ≥ λ 2 ≥ · · · ≥ λ m−1 ≥ |λ m | are the pseudo-singular values of Y X T [25].
The points X and Y are said to be well-positioned (denoted by X w ∼ Y ), if and only if, Y X T is symmetric and d S (X, Y ) = d Σ (X, Y ). Note that for m ≥ 3, the shape space Σ k m contains singularities making it a strata of manifolds with varying dimensions.
In order to generalize the ASM approach, we first note that Eq. (2) effectively parametrizes the affine subspace spanned by the basis shapes. A common approach to obtain equivalent notions in Riemannian manifolds is to define geodesic subspaces that are spanned by generalized straight lines (geodesics) emanating from a reference point and with directions restricted to a linear subspace of the tangent space [10]. However, as geodesic subspaces rely on tangent vectors, they can only be defined within regular strata of the shape space. Therefore, we opt for an alternative construction by Pennec [28] called barycentric subspaces, which are defined as the locus of points that are weighted means of the basis shapes. Specifically, let b 1 = π(B 1 ), . . . , b n = π(B n ) ∈ Σ k m be a set of n distinct basis shapes, then the Fréchet barycentric subspace is given by With a notion of affine submanifold at hand, we next derive a reprojection error that is defined on Kendall's shape space. Consistently to the 3D case, we will treat the 2D projections as points in shape space Σ k 2 and employ the geodesic distance as objective for the reconstruction problem. To this end, we re-formulate the projection (1) as a map from 3D KSS to 2D KSS by where ν performs normalization (i.e. projects onto the sphere) and the subscript [1,2] refers to the first two rows of R ∈ SO(3). To assure class invariance under ∼, we introduce the map π † , which yields a unique representative for a shape by well-positioning to a fixed reference pre-shape X ∈ S k 3 , viz.
Note that due to the quotient structure, the re-formulation no longer depends on the scaling and translation camera parameters α and t found in the original formulation (1).
We are now in the position to obtain a geometry-aware counterpart of the estimation problem in terms of the projection (4) and the Fréchet barycentric subspace resulting in the following optimization problem

Algorithmic treatment
In order to solve the reconstruction problem (6), we employ an alternating optimization strategy taking advantage of the product structure of the search space, viz. F BS (Bj )j × SO (3). Each outer iteration thus consists of two steps: First, rotation R is minimized while considering the current shape estimate p fixed. To this end, we perform Riemannian optimization on the Stiefel manifold utilizing the Pymanopt [5] library. Second, we fix the rotation R and solve the resulting sub-problem w.r.t. shape p parametrized by barycentric weights. For Riemannian computations on Kendall's space space, we employ Morphomatics [3]. As both steps are guaranteed to weakly decrease the reconstruction objective, we obtain a simple, yet convergent optimization scheme. In particular, both subproblems are solved employing steepest descent strategies, where gradients are computed via automatic differentiation with JAX [12]. Due to the non-Euclidean structure of the shape space, there are no closedform expressions for determining the (weighted) Fréchet mean of a given collection of sample points. Here, we adopt an efficient, inductive estimator to derive a parameterization of the Fréchet barycentric subspace that exhibits only a linear computational cost in the number of basis shapes. In particular, let b 1 , . . . , b n ∈ Σ k 3 and w 1 , . . . , w n ∈ R such that n j=1 w j = 0, then the parameterization (w j ) j → µ n ∈ Σ k 3 is given by the recursion where γ bj µj−1 denotes the shortest geodesic from µ j−1 to b j . Note that under certain conditions (cf. [8]) the recursion can be shown to converge to the actual weighted Fréchet mean. In any case, we expect the Fréchet barycentric subspace to be contained in the image of the above parameterization.

Experiments
We perform qualitative and quantitative evaluation of the proposed Kendall shape space (KSS ) approach in experiments concerning the estimation of human poses as well as head skeletons of basking sharks. Throughout the experiments, we additionally provide results for the vanilla ASM approach as well as a recent convex relaxation thereof presented by Zhou et al. [37]. We will refer to the former and latter as ASM non-convex and ASM convex, respectively.

Human Pose Estimation
The design of this experiment closely follows the setup proposed in [37] in order to provide comparability. In particular, we employ the MoCap dataset 4 for defining training and test shapes. Sequences from subject 86 are used as training data and sequences from subjects 13, 14 and 15 are used as testing data. All sequences are composed of a variety of poses, including running, climbing, jumping, and dancing, and can hence be used to define a comprehensive set of basis shapes. While 41 landmarks are used to encode human poses in the MoCap database, we use a reduced representation comprising a subset of 15 landmarks mimicking the construction in [37]. To reduce the effects of rotation and translation as much as possible for the Euclidean approaches, we perform generalized Procrustes analysis of the data during pre-processing.
As this dataset features abundant training data, we apply a strategy to learn an appropriate set of a restricted number of basis shapes. An immediate choice to determine such a set would be to perform barycentric subspace analysis [28], thus finding an optimal subspace w.r.t. unexplained variance. However, as this could introduce a positive bias for our approach when comparing to the Euclidean ones, we opt for the established k-means clustering [20]. Specifically, we set the basis shapes as the arithmetic means of each determined cluster thereby providing a homogeneous sampling according to the Euclidean metric. Quantitative Testing Similar to the creation of basis shapes, 200 shapes were chosen for each of the test subjects by performing k-means clustering on the pose sequences. The shapes were then projected along the z-direction to create the 2D landmarks. We then estimated the 3D shapes from the 2D landmarks for all approaches with different numbers of basis shapes (32, 64, and 128) and computed for each reconstruction the estimation error as the Procrustes distance (3) between the true and estimated shapes. Fig. 2 shows boxplots of estimation errors obtained for the derived test shapes for the ASM non-convex, ASM convex, and our approach (listed as KSS), respectively. Table 1 gives an overview of the error distribution. Statistical Friedman tests were conducted for the different combinations of test subjects and number of basis shapes to examine the effect that the reconstruction methods had on estimation errors. Results showed that the methods lead to statistically significant differences in estimation errors (p < 0.001). The Kendall shape space approach out-performs the other approaches by estimating the unknown 3D shapes with consistently lower errors for all sets of basis shapes and test subjects. The accuracy of the approach is directly proportional to the number of basis shapes used. Qualitative Testing Next, we investigate the performance of the approaches in estimating the 3D pose of people in real-world images with manually labelled landmarks. Fig. 3 shows the estimated 3D poses of a basket ball player from different viewpoints using all three approaches. The ASM approaches perform very well in estimating a 3D shape that fits to the 2D landmarks, but the estimated shapes are implausible, which can be seen by viewing them from the side. Moreover, they are vastly different from the basis shapes. The proposed approach, although compromising an exact fit to the 2D landmarks, is able to estimate the 3D pose with greater plausibility. This may be attributed to more consistent interpolation between the basis shapes adhering to the Kendall shape space constraints, which lead to reduced distortion of the basis shapes. A similar scenario is shown in Fig. 4. Here, however, even though the KSS results in a plausible shape, it does not fit to the shape we would expect to obtain. This is most likely attributed to the fact that the ballet pose cannot be estimated from the given basis shapes.

Estimating Head Skeletons of Basking Sharks
In this section, we give the results for the application that motivated the new approach for shape estimation, that is, the estimation of the shape of the head skeletons of basking sharks in feeding position. As specimens are hard to come by and the species is heavily protected under conservation laws in many countries, the ability to extract the 3D structure of the head region non-invasively, using real-world underwater images is a great contribution to the field of biology. We use computed tomography (CT) scans of the heads of three basking sharks (Cetorhinus maximus) from two museum collections (BMNH: British Museum of Natural History; ZMUC: Zoological Museum, University of Copen- ZMUC (no accession number), size: 512×512×1862. BS1 and BS2 were scanned at the Royal Brompton Hospital, BS3 at the Aarhus University Hospital. CT data were used to derive basis shapes and test the methods on real-world images of the species with manually labelled landmarks. BS3 is shown in Fig. 5a.
Basking sharks feed by holding their mouths agape and ballooning the pharynx (throat region), allowing water to flow out the gill slits on the sides of the head [31,33,36]. The pharynx is supported by jointed branchial arches, comprising rod-like skeletal elements linked together to form a mobile skeletal basket around the throat, which can expand and collapse. The kinematics of the pharyngeal skeleton are key to the filtering mechanism, but cannot be visualized from outside the body. From the CT scans of basking sharks, the relevant elements of the head skeleton (the jaw, hyoid and branchial arches, skull, and spine) are isolated using manual and automatic segmentation techniques. These isolated elements are then used to create a piece-wise linear skeleton of the sharks' pharyngeal region by labelling the start and end points of each skeletal element (e.g. the rod-like ceratobranchial cartilages; Fig. 5b) and connecting each point pair via a linear segment. Due to preservation conditions (e.g. specimens fixed in nonphysiological positions), sharks in the CT scans showed non-physiological deformations (e.g. the branchial basket collapsed asymmetrically under the shark's weight), structures needed correction before creating the set of basis shapes. Due to the bilateral symmetry of basking sharks, their right and left halves are essentially identical: skeletons were split into right and left halves which could later be mirrored to create full skeletons. A set of optimization problems which aim to conserve the lengths of segments were used to move the spine and the ventral plate (a portion of the branchial basket) of the half skeletons into an anatomically plausible position [36]. The mouth of the skeleton was opened using the same method. The corrected skeletons were then mirrored w.r.t. the sagittal plane. Fig. 5c visualizes this process. The anatomical arrangements of the final   Analysis of reconstruction accuracy Similar to human pose estimation, quantitative and qualitative analyses were performed for all approaches. In the quantitative experiments, we used the head skeleton shapes (29 in total) of one of the basking sharks to estimate the shapes (28/29) of the other two. Two types of projections, bilaterally symmetric and asymmetric, are used to estimate the 3D shape. The former is the case when viewing the shark anteriorly (from the front) and the latter when viewing from the side (e.g. where one side of the throat is more visible than the other). Both scenarios are equally important when extracting the 3D shape from images. Fig. 6 shows the errors in estimation using all the approaches and Table 2 provides some error statistics. Again, statistically signif- Fig. 6: Boxplots of shape estimation errors of basking shark test shapes for the three approaches using the basis shapes from BS3.
icant differences have been confirmed via Friedmann tests (p < 0.001) for each combination of subject and viewpoints. Contrary to the human pose estimation, the ASM non-convex and our approach provide similar estimation errors for the basking shark experiment with the former being slightly superior for 5 out of the 8 cases. These results indicate that the basking shark data might be located in a region of relatively low curvature in shape space that is well approximated by a hyper-plane.
Qualitative validation on underwater imagery We investigated the performances of the approaches in estimating the 3D structure of basking shark heads in underwater images with manually placed landmarks. Shapes from all three sharks (86 in total) were used as basis shapes. Figs. 7 and 8 show the results obtained using the two ASM approaches and the novel KSS approach. Similarly to the results for the estimation of real-world human poses, the shape estimations obtained from the two ASM approaches fit the 2D landmarks very well but fail to produce convincing results when looking from a different view. This is particularly striking for the ASM convex approach but is also noticeable for the ASM non-convex method-the estimated shape of which is unnaturally elongated. In contrast, applying the KSS approach results in 3D shapes that are very plausible and show a widely opened mouth.

Conclusion
In this work, we have proposed a novel, non-Euclidean approach for the estimation of 3D shapes from single monocular 2D images. In particular, we generalized the established active shape model approach to Kendall's shape space combining concepts from geometric statistics and computational differential geometry. The resulting geometric model provides efficient, yet highly consistent estimation of 3D shapes due to a natural encoding of constraints. We have demonstrated the performance of our approach in experiments on the reconstruction of human poses as well as head skeletons of basking sharks. The advantages of the proposed scheme are particularly apparent in qualitative comparison to previous approaches that rely on assumptions of linearity. While former approaches attained lower reprojection errors, the corresponding 3D shapes show defects like non-physiological distortions indicating a need for further domain-specific regularization. For example, the convex relaxation of the ASM proposed in [37] developed strong asymmetries although basis shapes are symmetric. In contrast, our geometric method yielded highly physiological re- sults even in challenging situations where the target shape differed greatly from the training distribution.
In future work, we plan to extend our approach to more advanced camera models to be able to account for strong perspective effects. Furthermore, while we use the 2D Kendall shape space distance as reprojection error, weighted or 1 -like extensions could be employed to incorporate uncertainty in 2D landmark detection or to increase robustness against outliers, respectively.