AutoLink: Self-supervised Learning of Human Skeletons and Object Outlines by Linking Keypoints
Anonymous Author(s)
AfﬁliationAddress email
Abstract
Structured representations such as keypoints are widely used in pose transfer,conditional image generation, animation, and 3D reconstruction.
However, theirsupervised learning requires expensive annotation for each target domain.
Wepropose a self-supervised method that learns to disentangle object structure fromthe appearance with a graph of 2D keypoints linked by straight edges.
Boththe keypoint location and their pairwise edge weights are learned, given only acollection of images depicting the same object class.
The graph is interpretable,for example, AutoLink recovers the human skeleton topology when applied toimages showing people.
Our key ingredients are i) an encoder that predicts keypointlocations in an input image, ii) a shared graph as a latent variable that links the samepairs of keypoints in every image, iii) an intermediate edge map that combines thelatent graph edge weights and keypoint locations in a soft, differentiable manner,and iv) an inpainting objective on randomly masked images.
Although simpler,
AutoLink outperforms existing self-supervised methods on the established keypointand pose estimation benchmarks and paves the way for structure-conditionedgenerative models on more diverse datasets.
Introduction
Object structure representations are widely used in modern computer graphics and computer visiontechniques, including keypoints for image generation [67, 68, 94] and skeletons for 3D reconstruction[26, 41, 84, 99, 121].
However, the structure is usually supervised on large annotated datasets [2, 3, 61,71] or via hand-crafted parametric models [5, 59, 65, 80, 83, 112].
Neither approach generalizes wellto new domains and both require additional manual annotation whenever more detail is needed [88].
Our goal is to reconstruct the keypoint locations of an object by learning from an unlabelled imagecollection, thereby sidestepping the generalization problem.
Our key idea is to leverage that the sameobject shares the same topology by introducing an explicit graph that links the same pairs of keypointsin all instances.
By contrast, existing self-supervised keypoint learning methods model objects asa set of independent parts.
Consistency over different instances of the same object is encouragedby either enforcing parts to follow hand-crafted image transformations [37, 42, 62, 66, 102, 125] orby adding implicit bias in the network architecture that encodes such spatial equivariances [34, 35].
Only [43, 93] use an explicit skeleton representation, but both require predeﬁned topology, rely onvideo input, and [43] is trained in a CycleGAN setting that still requires manually labeled examples.
We propose a simple yet effective method to learn both the keypoints and their links withoutsupervision in terms of a sparse graph serving two purposes.
First, the graph acts as a bottleneck that
[Figure]
au t oen c ode r t ha t t r an s f e r s po s e c ond i t i
ona l G A
N (b) applications can associates observations across training images.
We enforce the same topology across instances ofthe same class by learning a shared graph with a single set of edge weights.
In the absence of labels,we train AutoLink with only an autoencoder reconstruction objective.
Since the graph bottleneckshould not model appearance, we additionally feed the decoder with the input image after maskingthe majority of its pixels.
In turn, it is important for the disentanglement that the heavily maskedimage models appearance without leaking structural information.
This is the case as inpaintingmethods are unable to infer the original image precisely from only sparse pixel colors [122, 127]unless conditioning on structure representations, such as edge maps [31, 56, 58, 75, 110].
Therefore,by forcing the autoencoder to reconstruct the original image, the detector converges to generate representative structures of images.
We demonstrate on 4 benchmarks that the trained detector has a signiﬁcantly improved keypointlocalization accuracy and on 6 additional datasets that it applies to a broader set of images spanningportraits, persons, animals, hands, and ﬂowers, which we attribute to the explicit modeling of linksin the graph.
Figure 1 shows the diverse set of image domains it applies to, including challengingtextures and uncontrolled background, how both skeleton representations as well as object outlinesare learned by varying the number of keypoints, and exempliﬁes applications to controlled imagegeneration.
The code and the pre-trained models will be released upon publication.
Ethics - Risks.
The estimated keypoints and edges could be abused for deep fakes as the drivingsignal for generative models or for unwanted surveillance applications.
However, our method workstowards improved generality, including objects and animals, and does not improve upon supervisedmodels that already exist in high detail for humans.
Beneﬁts.
Since our method is entirely selfsupervised, it can be applied to a diverse set of persons, objects, animals, or situations that have notyet been labeled.
Related Work
Most representation learning methods focus on generic feature vectors for entire images to initializedeep networks for improved object classiﬁcation [11, 32, 33, 79, 108].
By contrast, our methodintroduces explicit object structure and we review the most related approaches in the following.
Self-supervised Keypoints Detection.
The most common idea to discover keypoints in an unsupervised manner is to rely on the notion that keypoints move as the image changes.
Various constraintshave been used to enforce that the keypoints follow a known transformation, including view changesin a multi-view recording [86, 87, 101] or the natural motion in videos [20, 23, 43, 53, 55, 74, 95].
When only single images are available, artiﬁcial image deformation is applied, either from randomized [42, 66, 102, 125] or learned [107, 116] transformations within a pre-deﬁned deformationspace.
However, learned keypoints may model the background [95, 125] and struggle with largepose variation [37] as image deformations do not separate foreground from background, which areusually tuned for each dataset and bound to be small.
Most models leverage multi-branch networkarchitectures to encode the structure and appearance separately and utilize multiple losses that needto be balanced.
By contrast, we do not apply artiﬁcial transformations, use a single branch, and asingle loss which eases and stabilizes training.
To overcome the need for artiﬁcial image deformation,
He et al.
[34, 35] exploit GANs to generate images along with corresponding keypoints and later usethem to train a detector.
However, this leads to even more complex network architectures and comeswith instabilities in GAN training, limiting their applicability to complex objects like human bodies.
Skeleton Representations.
Bone maps representing the keypoints connectivity as afﬁnity ﬁelds [9]or via explicit offsets [82] are used in supervised human, animal, and object pose estimation.
Weuse a similar edge map representation but learn both the location and linking from scratch withoutannotations.
In the weakly-supervised setting, Jakab et al.
[43] exploit CycleGAN [128] to translatebetween image and edge maps.
The graph connectivity is predeﬁned to the human skeleton andedges are supervised by a large dataset of unpaired ground truth object edges, which can come from adifferent dataset but are manually annotated.
Schmidtke et al.
[93] overcome the manual labeling bydeforming a template skeleton.
However, they both require the known connectivity of the keypointsand videos for training while ours learns both the keypoints and connectivity from a collection ofsingle images.
Noguchi et al.
[78] heuristically generate the skeleton by linking the centers of thelearned Signed Distance Field [70] for parts.
However, they require videos without the backgroundof the same object, and the learned skeleton does not generalize to other objects of the same class.
Object Sketch Learning.
Sketches are made of strokes drawn by a pen.
It is a concise andabstract representation, which can be used in object recognition [115, 119] and image retrieval[104, 114, 120].
There are two common sketch representations used in neural models [113]: blackwhite raster images [91, 105, 118], often used for image-to-image translation [40, 48, 81, 128] andsequences of points (pen coordinates) [24, 30, 90], which is usually used by recurrent generationmodels [8, 12, 19, 28, 30, 47].
This graph representation is similar to ours.
However, instead oflearning to mimic human drawings, ours directly predicts both the keypoints and their connectivityon real natural images.
Structure-enhanced Image Inpainting.
When key parts are missing in an image, e.g., eyes on facesor arms of humans, it is hard for inpainting networks to imagine the content accurately from scratch.
Therefore, additional structural cues are detected to guide the subsequent image generation.
Thestructural cues can be supervised segmentation masks [31, 60, 98, 126], foreground contours [110],and landmarks [56, 117, 123], or automatically extracted edges [7, 45, 58, 75, 111] and low-frequencyimage components [85, 106].
Our reconstruction objective can be seen as such two-stage inpainting,but self-supervised and with the image edges replaced with the learned graph edge representation.
Self-supervised Foreground Segmentation. Traditional methods use color [129], contrast [13],and hand-crafted features [44] to cluster foreground pixels. A recent trend is exploiting inpaintingtechniques to segment the foreground. Chen et al.
[10] and Arandjelovi´c et al. [4] use a GANto inpaint the background at the predicted segmentation mask, assuming that the object texturecan be changed without changing the data distribution due to the independence of foreground andbackground. Savarese [92] proposes to minimize the mutual information between the inpaintedforeground and background. When the object is small compared to the background, an additionalobject detection module [18] and temporal [51] or multi-view [52] information is required.
Differentfrom these previous methods, we utilize a form of inpainting to learn sparse keypoints instead of
[Figure]
segmentation.
Our learned edges form a sparse foreground shape, but further extensions would benecessary to transfer the edge maps boundary
Method
We leverage that the objects in the dataset share the same topology and can be represented as a graphthat connects keypoints by a set of edges.
To learn the keypoints and edges, we design an autoencoderthat aims to accurately reconstruct the input image, with the graph as the intermediate representation.
To encode the input image into a graph, we detect the keypoints and create an edge heatmap based onlearnable edge weights.
To mostly obtain appearance information, we mask out the majority of theimage, which reduces the structure information to a very low level.
The edge heatmap is combinedwith the masked image to reconstruct the original image.
Since the missing structure is importantto reconstructing the original image, the network is forced to learn the structure of the object in aself-supervised manner.
Figure 2 shows an overview of our method.
Formally, given an image I 2 R H ⇥ W ⇥ 3 with height H and width W we aim to learn a set ofkeypoints { k i } Ki =1 ,
where k i
[  1 , 1] ⇥
[  1 , 1] ⇢ R 2 is the normalized keypoint coordinate, and Kis the number of keypoints.
We use a ResNet with upsampling [109] to detect keypoints.
Afterward,we draw a differentiable edge [73] between each pair of keypoints.
The edge map S 2 R H ⇥ W isconcatenated along the channel dimension with the randomly masked image I m 2 R H ⇥ W ⇥ 3 andfed into a UNet [89] to obtain the reconstructed image I 0 .
The detailed network architectures canbe found in Appendix D.
3.1 Image Structure Representation
In this section, we introduce the generation of keypoints and the edge map from the image.
Let
H 2 R H ⇥ W ⇥ K be the K heatmaps generated by a ResNet with upsampling [109] from the image I .
The keypoint k
i is calculated by the differentiable soft-argmax function,
[Equation]
where p 2 [  1 , 1] ⇥ [  1 , 1] is the normalized pixel coordinates.
Given two keypoints k i , k j , we draw a differentiable edge map S ij , where values are 1 on the edgelinked by the two keypoints and decrease exponentially based on the distance to the line. Formally,the edge map S ij is a Gaussian extended along the line [73], deﬁned as
[Equation]
where  is a hyperparameter controlling the thickness of the edge, and d ij ( p ) is the L 2 distancebetween the pixel p and the edge drawn by keypoints k i and k j , [Equation] where t = ( p  k i
[Equation]
k
[Equation]
k
[Equation]
k k
[Equation] k [Equation] We assign a weight w ij > 0 to each edge, which is enforced to be positive by SoftPlus [22].
Thisweight is learned during training and shared across all object instances in a dataset.
Finally, we takethe maximum at each pixel of the heatmaps to obtain the ﬁnal edge map S 2 R H ⇥ W ,
[Equation]
Taking the maximum at each pixel avoids the entanglement of the edge weights and the convolutionkernel weights, which is further explained in Section 4.4.
3.2 Image Reconstruction
The masked image I m is generated by ﬁrst uniformly dividing the image I into a 16 ⇥ 16 grid, andrandomly masking out 80% of the grid cells, similar to [33].
We concatenate the masked image withthe edge map and feed it into a UNet decoder [89] to reconstruct the original image,
[Equation]
where  means concatenation along the channel dimension and ↵ is a learnable parameter thatcompensates for the change of the edge weight magnitude during training.
↵ is initialized to 1.
Wefound this parameter to be helpful in training stability.
Different to [43], we have no ground truth forthe edge map.
Our edge map is an unobserved latent variable.
Thus we only minimize the differenceof the original image and the reconstructed image by the perceptual loss [46],
[Equation]
where N is the number of examples and  is the feature extractor.
The perceptual loss is believed tomeasure the structure similarity [21, 27, 46], and leads to more robust training [42, 43].
3.3 Implementation Details
We use the Adam optimizer [54] with a learning rate of 10  4 with  1 = 0 .
9 ,  2 = 0 .
The batchsize is 64.
We train for 20k iterations.
It takes 3 hours to train on a single V100 GPU.
All images areresized to 128 ⇥ 128 .
The learning rate for the edge weights is multiplied by 512 due to the smallgradient of SoftPlus [22] when the value is close to 0.
To show the robustness of our model, wereport all experiments on the sampling strategy of masking 80% of the 16 ⇥ 16 patches.
We performexperiments with the same edge thickness of  2 = 5 e  5 for all benchmark datasets.
We train 10times and report the mean and the standard deviation of the evaluation metrics.
Although it alreadyoutperforms other work in most experiments, we also tune thicknesses to each individual dataset, asothers did for their hyperparameters, which further improves the results.
The tuned thicknesses canbe found in Appendix B.
The only other hyperparameter is the number of keypoints, which we rangefrom 4 to 32 and set to that of the established benchmarks for quantitative comparisons.
Experiments
In this section, we compare our results to the related methods, showing that our model is simple yet effective.
Besides, we perform a number of ablation studies on hyperparameters and algorithm variants,exhibiting the robustness of our model and justifying the necessity of every model component.
L a t e n t K e ypo i n t GAN [ 34 ] GAN S e g []
O u r s O u r s ( e dg e s )
[Table]
4.1 Datasets and Evaluation Metrics
[Table] CelebA-aligned [63] contains 200k celebrity faces aligned in center.
We follow [102] splitting it intothree subsets: CelebA training set without MAFL (160k images), MAFL training set (19k), MAFLtest set (1k).
We train our network on the CelebA training set without MAFL.
To quantitativelyevaluate the consistency of our predicted keypoints, we follow [102] training a linear regressionwithout bias from our detected keypoints to the ground truth keypoints on the MAFL training set andreporting the mean L 2 error normalized by inter-ocular distance on the MAFL test set.
CelebA-in-the-wild [63] contains celebrity faces in unconstrained conditions.
We follow [37] andﬁrst split it into three subsets as for CelebA-aligned, and then remove the images where a face coversless than 30% of the area, which results in 45,609 images for model training, 5,379 with keypointlabels for regression, and 283 for testing.
The evaluation metric is the same as CelebA-aligned.
Human3.6m [39] contains human activity videos in static backgrounds.
We follow [125] consideringsix activities (direction, discussion, posing, waiting, greeting, walking), and using subjects 1, 5, 6, 7,8, 9 for training and 11 for testing.
This results in 796,648 images for training and 87,975 images fortesting.
The evaluation metric is the regressed (without bias) mean L 2 error normalized by the imagesize.
We remove the background as in [66, 125] to make a fair comparison to others.
To underlinethe robustness against structured backgrounds we also report the numbers including background.
DeepFashion [64] contains 53k in-shop clothes images.
We follow [66] only keeping the full-bodyimages.
We 10604 images for training and 1179 images for testing We use the keypoints [Table]
distance normalized by the image size (lower is better).
A star ? means being reported by [15], † means being reported by [37]
[Table]
and ‡ means tested by us with their ofﬁcial code; all other numbers are taken from the respective papers. The number of keypoints is K = 10 for CUB-aligned and K = 4 for CUB-001, CUB-002, CUB-003, and CUB-all. [Table] generated by AlphaPose [25] as the ground truth.
The evaluation metric is Percentage of Correct
Keypoints of d=6 pixels in resolution 256 ⇥ 256 .
Taichi [96] contains 3049 training videos and 285 test videos of people performing Tai-Chi, with thevarious appearance of foreground and background.
We follow [97] using 5000 and 300 images (notcontained in training data) for training a linear regression and for testing, respectively.
The evaluationmetric, mean average error (MAE), is calculated as the sum of the L 2 error in resolution 256 ⇥ 256 .
CUB-200-2011 [103] consists of 11,788 images of birds.
We follow two established protocols[15, 66] to evaluate our method: 1) Images are cropped based on the bird landmarks, aligned to faceto the left [66], and seabirds are removed; 2) Birds are cropped based on the given bounding box andthe train/val/test split of [15] is used.
In both cases, the evaluation metric is the regressed (withoutbias) mean L 2 error normalized by the cropped image size.
Flower [77], 11k Hands [1], Horses [128], and Zebras [128] are used for qualitative experiments.
VoxCeleb2 [16] and AFHQ [14] are used for pose transfer and conditional image generation,respectively.
Horses and Zebras are extracted from the CycleGAN dataset [128] by removing theimages with multiple horses and aligning them to face left.
Note that the horses and zebra are trainedseparately, yet the model learns similar structures.
The train/test split of Flower follows [10].
All theother datasets follow the train/test split speciﬁed by the dataset.
4.2 Qualitative Analysis
We qualitatively compare our detected keypoints with other methods and show the examples of thelearned edges in Figure 3.
For visualization purposes, we scale the edge weights to obtain visibleedges.
We use the same number of keypoints as the previous method [35] for a fair comparison,which are 8 for CelebA-in-the-Wild, 16 for DeepFashion, and 10 for Taichi.
We will discuss moreon the choice of the number of keypoints in Ablation Study 4.4.
As shown in Figure 3, our modelnot only detects consistent keypoints but also learns reasonable edges, such as human skeletons in
DeepFashion and Taichi.
For example, the feet are clearly connected with the corresponding knees,and there is no edge between the left and right hands.
We show 105 images with detected keypointsand visualized graph structure for each dataset in Figure 9-21 in the Appendix, demonstrating thatour model works on various classes of objects of diverse appearance and complex backgrounds.
4.3 Quantitative Analysis
We compare the keypoint detection results with other methods in Table 1 (CelebA), Table 2 (Human3.6, DeepFashion, Taichi), and Table 3 (CUB).
Our simple model outperforms all other unsupervised methods in all benchmarks, except for the most constrained setting CelebA-aligned and
CUB-aligned where all methods perform well and the results are comparable.
The results on CelebAin Table 1 conﬁrms that our model is more robust to poses in the wild.
Since self-supervised partsegmentation methods are usually more robust on wild faces [35, 37, 62], we also include themfor comparison, demonstrating the robustness of our model over existing baselines.
The results on Human3.6m and DeepFashion in Table 2 show the capability of our model to detect keypoints onhuman bodies of either similar or diverse appearances.
The result on Taichi in Table 2 demonstratesthe general applicability of our model to human bodies of diverse poses in complex backgrounds.
4.4 Ablation Tests
We tested the effect of 1) different number of keypoints and thickness (Figure 4 and Figure F); 2)different masking strategy (Figure 5); 3) different edge heatmap generation (Figure 6b); 4) differenttexture; 5) structured background (Figure 6c).
The details and the quantitative results that validatethat the full model outperforms all other variants can be found in the Appendix F.
[Figure]
Limitations and Future Work
As shown before, if the background is highly structured, the keypoints will appear on the background.
We can use a post graph clustering to separate the object from the background.
Similar to the previous2D self-supervised methods [35, 66, 97], our model cannot model occlusion well.
We show in Figure 6d left that the occluded right arm becomes the back when the person turns to the left.
Inaddition, as for all other methods, the model cannot distinguish the left and right sides of the objectsas shown in Figure 6d middle and right.
We believe it is necessary to model the structure in 3D tosolve these problems.
Conclusion
We presented a simple approach for learning a spatial graph representation from unlabelled imagecollections by reconstructing masked images.
The crucial part is our learnable graph design modelingthe relationship between different keypoints.
It is simpler than existing alternatives and opens up apath for image understanding, image editing, and learning 3D models from 2D images.