Code for "Learning Feature Pyramids for Human Pose Estimation" (ICCV 2017)
Articulated human pose estimation is a fundamental yet challenging task in computer vision. The difficulty is particularly pronounced in scale variations of human body parts when camera view changes or severe foreshortening happens. Although pyramid methods are widely used to handle scale changes at inference time, learning feature pyramids in deep convolutional neural networks (DCNNs) is still not well explored. In this work, we design a Pyramid Residual Module (PRMs) to enhance the invariance in scales of DCNNs. Given input features, the PRMs learn convolutional filters on various scales of input features, which are obtained with different subsampling ratios in a multi-branch network. Moreover, we observe that it is inappropriate to adopt existing methods to initialize the weights of multi-branch networks, which achieve superior performance than plain networks in many tasks recently. Therefore, we provide theoretic derivation to extend the current weight initialization scheme to multi-branch network structures. We investigate our method on two standard benchmarks for human pose estimation. Our approach obtains state-of-the-art results on both benchmarks. Code is available at https://github.com/bearpaw/PyraNet.READ FULL TEXT VIEW PDF
Code for "Learning Feature Pyramids for Human Pose Estimation" (ICCV 2017)
Localizing body parts for human body is a fundamental yet challenging task in computer vision, and it serves as an important basis for high-level vision tasks, , activity recognition [60, 54], clothing parsing [57, 58, 36], human re-identification , and human-computer interaction. Achieving accurate localization, however, is difficult due to the highly articulated human body limbs, occlusion, change of viewpoint, and foreshortening.
Significant progress on human pose estimation has been achieved by deep convolutional neural networks (DCNNs) [53, 52, 11, 51, 42, 55, 39]. In these methods, the DCNNs learn body part detectors from images warped to the similar scale based on human body size. At inference time, testing images should also be warped to the same scale as that for training images.
Although the right scale of the full human body is provided, scales for body parts may still be inconsistent due to inter-personal body shape variations and foreshortening caused by viewpoint change and body articulation. It results in difficulty for body part detectors to localize body parts. For example, severe foreshortening is present in Figure 1. When the images are warped to the same size according to human body scale, the hand in Figure 1 (a) has a larger scale than that in Figure 1 (b). Therefore, the hand detector that can detect the hand in Figure 1 (a) might not be able to detect the hand in Figure 1 (b) reliably. In DCNNs, this problem from scale change happens not only for high-level semantics in deeper layers, but also exists for low-level features in shallower layers.
To enhance the robustness of DCNNs against scale variations of visual patterns, we design a Pyramid Residual Module to explicitly learn convolutional filters for building feature pyramids. Given input features, the Pyramid Residual Module obtains features of different scales via subsampling with different ratios. Then convolution is used to learn filters for features in different scales. The filtered features are upsampled to the same resolution and are summed together for the following processing. This Pyramid Residual Module can be used as building blocks in DCNNs for learning feature pyramids at different levels of the network.
There is a trend of designing networks with branches, , Inception models [47, 30, 48, 46] and ResNets [25, 26] for classification, ASPP-nets  for semantic segmentation, convolutional pose machines  and stacked hourglass networks  for human pose estimation, in which the input of a layer is from multiple other layers or the output of a layer is used by many other layers. Our pyramid residual module also has branches. We observe that the existing weight initialization scheme, , MSR  and Xavier  methods, are not proper for layers with branches. Therefore, we extend the current weight initialization scheme and provide theoretic derivation to show that the initialization of network parameters should take the number of branches into consideration. We also show another issue in the residual unit 
, where the variance of output of the residual unit accumulates as the depth increases. The problem is caused by the identity mapping.
Since Hourglass network, also called conv-deconv structure, is an effective structure for pose estimation , object detection , and pixel level tasks , we use it as the basic structure in experiments. We observe a problem of using residual unit for Hourglass: when outputs of two residual units are summed up, the output variance is approximately doubled, which causes difficulty in optimization. We propose a simple but efficient way with negligible additional parameters to solve this problem.
The main contributions are three folds:
We propose a Pyramid Residual Module, which enhances the invariance in scales of deep models by learning feature pyramids in DCNNs with only a small increase of complexity.
We observe that the problem of activation variance accumulation introduced by identity mapping may be harmful in some scenarios, , adding outputs of multiple residual units implemented by identity mapping  together in the Hourglass structure. A simple yet effective solution is introduced for solving this issue.
We evaluate the proposed method on two popular human pose estimation benchmarks, and report state-of-the-art results. We also demonstrate the generalization ability of our approach on standard image classification task. Ablation study demonstrates the effectiveness of the pyramid residual module, the new initialization scheme, and the approach in handling drastic activation variance increase caused by adding residual units.
Human pose estimation. Graph structures, , Pictorial structures [19, 17, 61] and loopy structures [44, 49, 18], have been broadly used to model the spatial relationships among body parts. All these methods were built on hand-crafted features such as HOG feature , and their performances relied heavily on image pyramid. Recently, deep models have achieved state-of-the-art results in human pose estimation [3, 29, 5, 55, 39, 12, 59, 13, 7, 40]. Among them, DeepPose  is one of the first attempts on using DCNNs for human pose estimation. It regressed the coordinates of body parts directly, which suffered from the problem that image-to-locations is a difficult mapping to learn. Therefore, later methods modeled part locations as Gaussian peaks in score maps, and predicted the score maps with fully convolutional networks. In order to achieve higher accuracy, multi-scale testing on image pyramids was often utilized, which produced a multi-scale feature representation. Our method is a complementary to image pyramids.
On the other hand, to learn a model with strong scale invariance, a multi-branch network trained on three scales of image pyramid was proposed in . However, when image pyramids are used for training, computation and memory linearly increases with the number of scales. In comparison, our pyramid residual module provides an efficient way of learning multi-scale features, with relatively small cost in computation and memory.
DCNNs combining multiple layers. In contrast to traditional plain networks (, AlexNet  and VGG-nets ), multi-branch networks exhibit better performance on various vision tasks. In classification, the inception models [47, 30, 48, 46] are one of the most successful multi-branch networks. The input of each module is first mapped to low dimension by convolutions, then transformed by a set of filters with different sizes to capture various context information and combined by concatenation. ResNet [25, 26] can be regarded as a two-branch networks with one identity mapping branch. ResNeXt  is an extension of ResNet, in which all branches share the same topology. The implicitly learned transforms are aggregated by summation. In our work, we use multi-branch network to explore another possibility: to learn multi-scale features.
Recent methods in pose estimation, object detection and segmentation used features from multiple layers for making predictions [37, 6, 23, 4, 39, 9]. Our approach is complementary to these works. For example, we adopt Hourglass as our basic structure, and replace its original residual units, which learn features from a single scale, with the proposed Pyramid Residual Module.
Weight initialization. Good initialization is essential for training deep models. Hinton and Salakhutdinov 
adopted the layer-by-layer pretraining strategy to train a deep autoencoder. Krizhevsky
initialized the weight of each layer by drawing samples from a Gaussian distribution with zero mean and 0.01 standard deviation. However, it has difficulty in training very deep networks due to the instability of gradients. Xavier initialization  has provided a theoretically sound estimation of the variance of weight. It assumes that the weights are initialized close to zero, hence the nonlinear activations like Sigmoid and Tanh can be regarded as linear functions. This assumption does not hold for rectifier  activations. Thus He  proposed an initialization scheme for rectifier networks based on . All the above initialization methods, however, are derived for plain networks with only one branch. We identify the problem of the initialization methods when applied for multi-branch networks. An initialization scheme for networks with multiple branches is provided to handle this problem.
An overview of the proposed framework is illustrated in Figure. 2. We adopt the highly modularized stacked Hourglass Network  as the basic network structure to investigate feature pyramid learning for human pose estimation . The building block of our network is the proposed Pyramid Residual Module (PRM). We first briefly review the structure of hourglass network. Then a detailed discussion of our pyramid residual module is presented.
Hourglass network aims at capturing information at every scale in feed-forward fashion. It first performs bottom-up processing by subsampling the feature maps, and conducts top-down processing by upsampling the feature maps with the comination of higher resolution features from bottom layers, as demonstrated in Figure. 2(b). This bottom-up, top-down processing is repeated for several times to build a “stacked hourglass” network, with intermediate supervision at the end of each stack.
The objective is to learn feature pyramids across different levels of DCNNs. It allows the network to capture feature pyramids from primitive visual patterns to high-level semantics. Motivated by recent progress on residual learning [25, 26], we propose a novel Pyramid Residual Module (PRM), which is able to learn multi-scale feature pyramids.
The PRM explicitly learns filters for input features with different resolutions. Let and be the input and the filter of the -th layer, respectively. The PRM can be formulated as,
where is feature pyramids decomposed as:
The in (2) denotes the number of pyramid levels, is the transformation for the -th pyramid level, and is the set of parameters. Outputs of transformations are summed up together, and further convolved by filters . An illustration of the pyramid residual module is illustrated in Figure. 3. To reduce the computational and space complexity, each is designed as a bottleneck structure. For example, in Figure. 3, the feature dimension is reduced by a convolution, then new features are computed on a set of subsampled input features by convolutions. Finally, all the new features are upsampled to the same dimension and are summed together.
Generation of input feature pyramids. Max-pooling or average-pooling are widely used in DCNNs to reduce the resolution of feature maps, and to encode the translation invariance. But pooling reduces the resolution too fast and coarse by a factor of an integer of at least two, which is unable to generate pyramids gently. In order to obtain input feature maps of different resolutions, we adopt the fractional max-pooling  to approximate the smoothing and subsampling process used in generating traditional image pyramids. The subsampling ratio of the th level pyramid is computed as:
where denotes the relative resolution compared with the input features. For example, when , the output has the same resolution as its input. When , the map has half resolution of its input. In experiments, we set and , with which the lowest scale in pyramid is half the resolution of its input.
PRM for general CNNs. Our PRM is a general module and can be used as the basic building block for various CNN architectures, , stacked hourglass networks  for pose estimation, and Wide Residual Nets  and ResNeXt  for image classification, as demonstrated in experiments.
Variants in pyramid structure. Besides using fractional max-pooling, convolution and upsampling to learn feature pyramids, as illustrated in Figure. 3(a-b), one can also use dilated convolution [9, 63] to compute pyramids, as shown in Figure. 3(c)(PRM-D). The summation of features in pyramid can also replaced by concatenation, as shown in Figure. 3(b)(PRM-C). We discuss the performance of these variants in experiments, and show that the design in Figure. 3(b)(PRM-B) has comparable performance with others, while maintains relatively fewer parameters and smaller computational complexity.
Weight sharing. To generate the feature pyramids, traditional methods usually apply a same handcrafted filter, , HOG, on different levels of image pyramids [1, 16]. This process corresponds to sharing the weights across different levels of pyramid , which is able to greatly reduce the number of parameters.
Complexity. The residual unit used in  has 256-d input and output, which are reduced to 128-d within the residual unit. We adopt this structure for the branch with original scale (, in Eq.(2)). Since features with smaller resolution contain relatively fewer information, we use fewer feature channels for branches with smaller scales. For example, given a PRM with five branches and 28 feature channels for branches with smaller scale (, to in Eq.(2)), the increased complexity is about only compared with residual unit in terms of both parameters and GFLOPs.
We use score maps to represent the body joint locations. Denote the ground-truth locations by , where denotes the location of the th body joint in the image. Then the ground-truth score map is generated from a Gaussian with mean and variance as follows,
where denotes the location, and
is empirically set as an identity matrixI. Each stack of hourglass network predicts score maps, , for body joints. A loss is attached at the end of each stack defined by the squared error
where is the number of samples.
During inference, we obtain the predicted body joint locations from the predicted score maps generated from the last stack of hourglass by taking the locations with the maximum score as follows:
, especially for tasks of dense prediction, where Batch Normalization is less effective because of the small minibatch due to the large memory consumption of fully convolutional networks. Existing weight initialization methods [33, 21, 24] are designed upon the assumption of a plain networks without branches. The proposed PRM has multiple branches, and does not meet the assumption. Recent developed architectures with multiple branches, , Inception models [47, 30, 48, 46] and ResNets [25, 26], are not plain network either. Hence we discuss how to derive a proper initialization for networks adding multiple branches. Our derivation mainly follows [21, 24].
Forward propagation. Generally, multi-branch networks can be characterized by the number of input and output branches. Figure. 4 (a) shows an example where the th layer has input branches and one output branch. Figure. 4 (b) shows an example where the th layer has one input branch and output branches. During forward propagation, affects the variance for the output of the th layer while does not. At the th layer, assume there are input branches and output branches. There are
input vectors. Take fully-connected layer for example, a response is computed as:
is the non-linear activation function.
As in [21, 24], we assume that and are both independent and identically distributed (i.i.d.), and they are independent of each other. Therefore, we respectively denote and as the element in and . Then we have,
where is the number of elements in for . Suppose has zero mean. The variance for the product of independent variables above is as follows:
where depends on the activation function in (8).
for ReLU andfor Tanh and Sigmoid. In order to make the variances of the output approximately the same for different layers , the following condition should be satisfied:
Hence in initialization, a proper variance for should be .
Backward propagation. Denote and by and
respectively. During backward propagation, the gradient is computed by chain rule,
Suppose and are i.i.d. and independent of each other, then has zero mean when is initialized with zero mean and symmetric with small magnitude. Let
denote the number of output neurons. Then we have,
To ensure , we must have .
In many cases, . As in , a compromise between the forward and backward constraints is to have,
Special case. For plain networks with one input and one output branch, we have in (15). In this case, the result in (15) degenerates to the conclusions obtained for Tanh and Sigmoid in  and the conclusion in  for ReLU.
General case. In general, a network with branches would have or for some s. Therefore, the number of input branches and output branches should be taken into consideration when initializing parameters. Specifically, if several multi-branch layers are stacked together without other operations (, batch normalization,convolution, ReLU, .), the output variance would be increased approximately times by using Xavier  or MSR  initialization.
Residual learning [25, 26] allows us to train extremely deep neural networks due to identity mappings. But it is also the source of its drawbacks: identity mapping keeps increasing the variances of responses when the network goes deeper, which increases the difficulty of optimization.
The response of the residual unit is computed as follows:
where denotes the residual function, , a bottleneck structure with three convolutions (). Assume and are uncorrelated, then the variance of the response of residual unit is as
where is positive.
In [25, 26], the identity mapping will be replaced by convolution layer when the resolution of feature maps is reduced, or when the dimension of feature channels are increased. This allows the networks to reset the variance of response to a small value, and avoid responses with very large variance, as shown in Figure. 5. The effect of increasing variance becomes more obvious in hourglass-like structures, where the responses of two residual units are summed together, as illustrated in Figure. 6(a). Assume branches are uncorrelated, then the variance will be increased as:
Hence the output variance is almost doubled. When the network goes deeper, the variance will increase drastically.
In this paper, we use a convolution preceding with batch normalization and ReLU to replace the identity mapping when the output of two residual units are summed up, as illustrated in Figure. 6(b). This simple replacement stops the variance explosion, as demonstrated in Figure. 6(c). In experiments, we find that breaking the variance explosion also provide a better performance (Section 5.1.3).
We conduct experiments on two widely used human pose estimation benchmarks. (i) The MPII human pose dataset , which covers a wide range of human activities with 25k images containing over 40k people. (ii) The Leeds Sports Poses (LSP)  and its extended training dataset, which contains 12k images with challenging poses in sports.
Our implementation follows . The input image is
cropped from a resized image according to the annotated body position and scale. For the LSP test set, we simply use the image center as the body position, and estimate the body scale by the image size. Training data are augmented by scaling, rotation, flipping, and adding color noise. All the models are trained using Torch
. We use RMSProp
to optimize the network on 4 Titan X GPUs with a mini-batch size of 16 (4 per GPU) for 200 epochs. The learning rate is initialized asand is dropped by 10 at the th and the th epoch. Testing is conducted on six-scale image pyramids with flipping.
Evaluation measure. Following previous work, we use the Percentage Correct Keypoints (PCK) measure  on the LSP dataset, and use the modified PCK measure that uses the matching threshold as of the head segment length (PCKh)  on the MPII dataset.
MPII Human Pose. We report the performance on MPII dataset in Table 1. Ours-A is trained using the training and validation set used in . Ours-B is trained with the same settings but using all the MPII training set. Our approach achieves PCKh score at threshold of , which is the new state-of-the-art result. Specifically, our method achieves and improvements on wrist and ankle, which are considered as the most challenging parts to be detected. Qualitative results are demonstrated in Figure. 7.
Complexity. Our model increases the number of parameters by from M to M given an eight-stack hourglass network. Our model needs GFLOPs for a RGB image, which is a increase compared to hourglass network ( GFLOPs). As reported in , deeper hourglass with more stacks hardly improves result.
LSP dataset. Table 2 presents the PCK scores at the threshold of . We follow previous methods [42, 55, 29] to train our model by adding MPII training set to the LSP and its extended training set. Our method improves the previous best result with a large margin by . For difficult body parts, , wrist and ankle, we have and improvements, respectively. Our method gains a lot due to the high occurrence of foreshortening and extreme poses presented in this dataset, as demonstrated in Figure. 7.
We conduct ablation study on the MPII validation set used in  with a 2-stack hourglass network as the basic model.
Architectures of PRM. We first evaluate different designs of PRM, as discussed in Section 3.2, with the same number of branches, and the same feature channels for each branch (, 5 branches with 28 feature channels for each pyramidal branch). We use PRM-A to PRM-D, which corresponds to Figure. 3, to denote the different architectures. Specifically, PRM-A produces separate input feature maps for different levels of pyramids, while PRM-B uses shared feature maps for all levels of pyramids. PRM-C uses concatenation instead of addition to combine features generated from pyramid, which is similar to inception models. PRM-D uses dilated convolutions, which are also used in ASPP-net , instead of pooling to build the pyramid. The validation accuracy is reported in Figure. 8(a). All the PRMs have better accuracy compared with the baseline model. We observe that the difference in accuracy between PRM-A to PRM-D is subtle, while the parameters of PRM-A/C are higher than PRM-B/B*/D (Figure. 8(b)), and the computational complexity (GFLOPs) of PRM-A/C/D are higher than PRM-B/B*. Therefore, we use PRM-B* in the rest of the experiments. Noted that increasing the number of channels to make the baseline model has the similar model size as ours (Wide BS) would slightly improve the performance. But it is still worse than ours.
Scales of pyramids. To evaluate the trade-off between the scales of pyramids , we vary the scales from 3 to 5, and fix the model size by tuning the feature channels in each scale. We observe that increasing scales generally improves the performance, as shown in Figure. 9(a-b).
Weight initialization. We compare the performance of our initialization scheme with Xavier  and MSR  methods. The training and validation curves of accuracy epoch are reported in Figure 9(c-d). It can be seen that the proposed initialization scheme achieves better performance than both methods.
Controlling variance explosion. Controlling variance explosion, as discussed in Section 4.2, obtains higher validation score (88.0) compared with the baseline model (87.6). With our pyramid residual module, the performance could be further improved to 88.5 PCKh score.
|ResNeXt-29, d ||34.4||48.8||3.65|
|ResNeXt-29, d ||68.2||184.5||3.58|
The CIFAR-10 dataset  consists of 50k training images and 10k test images with size drawn from 10 classes. We follow previous works for data preparation and augmentation. We incorporate the proposed pyramid branches into two state-of-the-art network architectures, , Wide residual networks  and ResNeXt . We add four pyramid branches with scales ranging from to into the building block of both Wide ResNet and ResNeXt. For Wide ResNet, the total width of all pyramid branches is equal to the width of the output of each residual module. For ResNeXt, we simply use the same width as its original branches for our pyramid branches. Table 3 shows the top-1 test error, model sizes and GFLOPs. Our method with similar or less model size (Ours-28-9 WRN-28-10 and Ours-29, d ResNeXt-29, d) achieve better results. A larger model with our pyramid module (Ours-29, d ) achieves test error, which is the state-of-the-art result on CIFAR-10.
This paper has proposed a Pyramid Residual Module to enhance the invariance in scales of the DCNNs. We also provide a derivation of the initialization scheme for multi-branch networks, and demonstrate its theoretical soundness and efficiency through experimental analysis. Additionally, a simple yet effective method to prevent the variances of response from explosion when adding outputs of multiple identity mappings has been proposed. Our PRMs and the initialization scheme for multi-branch networks are general, and would help other tasks.
Acknowledgment: This work is supported by SenseTime Group Limited, the General Research Fund sponsored by the Research Grants Council of Hong Kong (Project Nos. CUHK14213616, CUHK14206114, CUHK14205615, CUHK419412, CUHK14203015, CUHK14207814, and CUHK14239816), the Hong Kong Innovation and Technology Support Programme (No.ITS/121/15FX), National Natural Science Foundation of China (No. 61371192), and ONR N00014-15-1-2356.
Inside-outside net: Detecting objects in context with skip pooling and recurrent neural networks.In CVPR, 2016.
Torch7: A matlab-like environment for machine learning.In BigLearn, NIPS Workshop, 2011.
Delving deep into rectifiers: Surpassing human-level performance on imagenet classification.In ICCV, 2015.
Matching-cnn meets knn: Quasi-parametric human parsing.In CVPR, 2015.