Structure-Aware Flow Generation for Human Body Reshaping

Jianqiang Ren, Yuan Yao, Biwen Lei, Miaomiao Cui, Xuansong Xie

TL;DR

This paper introduces the first end-to-end 2D flow generation framework for automatic and controllable human body reshaping. By leveraging structural priors (skeletons and Part Affinity Fields) alongside a novel compositional attention mechanism, the model generates realistic, high-resolution edits (slender or muscular) while maintaining anatomical consistency across body parts.

Figure 1. Our approach provides an efficient and controllable solu- tion for human body reshaping, allowing figures to be more slen- der (top) or muscular (bottom). The corresponding deformation flows are showcased in the top-left corners. All of the images pre- sented in this paper are included in the proposed BR-5K dataset.

What Problem Does This Paper Address?

While automatic face reshaping is a mature technology widely available in consumer apps, automatic body reshaping remains a major challenge. The human body possesses a highly flexible, articulated structure, and its appearance is further complicated by diverse clothing and complex poses.

Currently, professional photo retouchers rely on manual tools like Photoshop's Liquify brush, which requires significant time and skill. Existing automated methods generally fall into two flawed categories:

  1. Rule-based 2D deformation: Relies on detecting body contours, which is fragile and prone to artifacts under non-standard poses or loose clothing.
  2. 3D model-based approaches: Attempts to fit a 3D morphable body model to the 2D image. These methods struggle with extreme camera angles, require extensive user assistance, and fail to span the full variety of human body shapes.

Furthermore, deep generative models (like GANs) often output blurry results or introduce unrealistic artifacts when processing high-resolution images.

Methods

The authors propose a structure-aware, pixel-level warping pipeline that operates efficiently even on 4K images.

Figure 2. Overview of the proposed method. Given a high-resolution portrait image Ih, we first extract its skeleton maps S and PAFs L after down-sampling, and then generate deformation flow Fl by feeding the concatenation of Il and S into the Flow Generator. A compositional attention module (SASA) that combines perceptual correlation and structural association is introduced in the bottleneck layer to enhance manipulation consistency among related body parts. Finally, we upsample the low-resolution flow Fl to Fh and conduct a warping operation to Ih to obtain the final result. The orange dotted line denotes the flow of loss functions.

The workflow consists of the following key components:

  • Downsampling for Efficiency: The high-resolution input image ($I_h$) is downsampled to a lower resolution ($I_l$) to reduce computational overhead.
  • Pose Estimator: A pretrained pose estimation network extracts two structural priors from $I_l$: Skeleton maps ($S$) and Part Affinity Fields ($L$). Skeletons provide low-level boundaries, while PAFs encode the location and orientation of limbs.
  • Flow Generator with SASA: The low-res image and skeleton maps are concatenated and fed into an encoder-decoder network to predict a deformation flow field ($F_l$). In the bottleneck layer, a Structure Affinity Self-Attention (SASA) module ensures that edits to different limbs are globally coherent (e.g., preventing an unnaturally thick arm paired with a thin leg).
  • High-Resolution Warping: Instead of generating a high-res image from scratch, the network upsamples the predicted low-res flow field ($F_l \rightarrow F_h$) using bilinear interpolation. This high-res flow is then used to warp the original image ($I_h$), perfectly preserving high-frequency textures and details.
  • Continuous Controllability: A multiplier parameter ($\mu$) is introduced during the warping step. Adjusting $\mu$ allows users to continuously tune the reshaping effect—positive values make the subject appear more muscular, while negative values make them more slender.
Figure 4. The architecture of the SASA module. With the structure heatmaps Y and the deep feature maps X as inputs, SASA com- putes the attention residual α by a multiplicative composition of Structure Affinity Map and Self Attention Map. The ⊗and the ⊙ denote matrix and element-wise multiplication respectively.

Datasets

To train and evaluate their model, the authors introduced BR-5K, the first large-scale dataset dedicated to body reshaping.

  • Composition: 5,000 high-quality portrait photos (2K resolution) collected from Unsplash, primarily featuring female subjects across diverse ages, races, poses, and garments. Faces are obfuscated for privacy protection.
  • Ground Truth: Three professional digital artists independently retouched the photos to create aesthetically pleasing, slender figures. The best professional edit for each image was selected as the ground-truth target.
  • Split: 4,500 images for training and 500 for testing.

Key Insights and Ideas

  • Skeletons as Flow Boundaries: The authors observed that body skeletons naturally demarcate local warping orientations. The required deformation flow directions on opposite sides of a skeletal bone are typically inverted, meaning skeletons provide excellent low-level clues for flow edges.
  • PAFs as Orthogonality Constraints: Because body reshaping typically alters the width of a limb rather than its length or direction, the desired deformation flow should theoretically be perpendicular to the orientation of the limb. Since PAFs represent limb orientation, the authors enforced an orthogonality loss ($L_{orth}$) between the generated flow and the PAFs to guide accurate flow prediction.
Figure 3. The skeletons work as low-level features that are able to indicate opposite boundaries of deformation flow, while PAFs help to highlight where should be manipulated, and have orthog- onality relation with the desired deformation flow (see the arrows in dashed red boxes and flow color coding circles).
  • Compositional Attention Filters Noise: Standard self-attention mechanisms often link body parts to background regions based purely on color or texture similarity. By multiplying the self-attention map with a structure affinity map (derived from PAF masks), SASA effectively filters out background noise and forces the network to focus strictly on structurally related body regions.
Figure 5. The structure affinity tends to allocate attention to related body parts, and self-attention works mainly according to percep- tual similarity. The composition of them helps to erase some irrel- evant attention relations.

Key Results

The proposed method was evaluated against several state-of-the-art image deformation and translation models (FAL, ATW, pix2pixHD, and GFLA).

Quantitative Performance

Our method achieved the highest similarity to the professional ground truth across all standard metrics on the BR-5K test set:

  • SSIM: 0.8354 (Highest)
  • PSNR: 24.7924 (Highest)
  • LPIPS: 0.0777 (Lowest, indicating best perceptual quality)

User Study

In a blind subjective study with 40 participants evaluating 30 random examples, the proposed method was preferred 70.4% of the time over competing approaches.

Efficiency

The entire pipeline—including pose estimation, flow generation, and warping—takes approximately 5 seconds to process a 4K image on a single NVIDIA Tesla P100 GPU, making it highly viable for interactive applications.

Limitations and Future Work

The authors identify two primary limitations:

  1. Background Distortion: Because the flow field is applied to the entire image, background elements overlapping or immediately adjacent to the subject can suffer from unrealistic warping (e.g., wavy lines). While combining the method with background matting and inpainting can mitigate this, doing so accurately at high resolutions remains difficult.
  2. Dimension Constraints: The current framework focuses exclusively on weight editing (slender vs. muscular) and does not alter full-body attributes like height, which would require changing the length and direction of the underlying skeletons.

Summary updated

BibTeX
@misc{ren2022structure,
  author = {Jianqiang Ren and Yuan Yao and Biwen Lei and Miaomiao Cui and Xuansong Xie},
  title = {{Structure-Aware Flow Generation for Human Body Reshaping}},
  year = {2022},
  eprint = {2203.04670},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2203.04670},
}
Figure