HandCraft: Anatomically Correct Restoration of Malformed Hands in Diffusion Generated Images

Zhenyue Qin, Yiqun Zhang, Yang Liu, Dylan Campbell · DOI

Abstract

Generative diffusion models often struggle with human anatomy, particularly hands, leading to "nightmare" artifacts like extra digits or impossible joints. We present HandCraft, a plug-and-play framework that restores anatomical realism to these images. By aligning a parametric 3D hand template to the malformed region and utilizing it as a conditioning signal for ControlNet, HandCraft achieves high-fidelity restoration without model fine-tuning.

Introduction

Despite the rapid advancement of text-to-image models like Stable Diffusion, the "six-finger" problem remains a persistent hurdle. These models lack an intrinsic understanding of human skeletal structure, often resulting in hands that fall deep into the "uncanny valley." Current solutions, such as manual inpainting or complex prompt engineering, are labor-intensive and inconsistent. HandCraft addresses this by automating the restoration process, ensuring anatomical correctness while preserving the original image's artistic style and composition.

Methodology

The HandCraft pipeline consists of three primary stages:

  1. Hand Detection and Pose Estimation: The system employs YOLOv8 to localize the malformed hand and MediaPipe to estimate the broader body pose. This step is critical for determining the intended placement of the hand, even when the generated pixels are severely distorted.
  2. Conditioning Signal Generation: Rather than attempting to fit a mesh to a malformed hand—a process prone to "garbage in, garbage out" errors—HandCraft utilizes a library of anatomically correct 3D hand templates. These templates undergo scaling, translation, rotation, and chirality (left/right) correction to align with the detected pose, producing a high-quality depth map and a template mask.
  3. Hand Restoration via ControlNet: The original image, the aligned depth map, and a "union mask" (the combination of the bounding box and the template shape) are processed by ControlNet. This guides the model to repaint the hand area with structural precision.

Datasets and Evaluation

To benchmark the framework, the authors introduced the MalHand datasets:

  • Training Set: 60,000 images with intentionally "broken" hands derived from the HaGRID dataset.
  • Evaluation Set: 1,500 portraits categorized into MalHand-realistic (1,000 images) and MalHand-artistic (500 images).

Results and Discussion

HandCraft demonstrates superior performance over existing baselines like HandRefiner. Quantitatively, it achieved a mean hand pose confidence ($c_{pose}$) of 0.79, significantly higher than HandRefiner’s 0.54. Furthermore, HandCraft excels in image integrity, maintaining a PSNR of 23.40 dB, nearly double that of its competitors. This ensures that the restoration process does not inadvertently alter surrounding elements like clothing or background.

Qualitative comparison of HandCraft restoration across realistic and artistic styles, showing various gestures (b-d) from malformed inputs (a).

Qualitatively, the framework successfully handles diverse aesthetic domains, from photorealistic portraits to stylized anime. The use of the "union mask" strategy is pivotal here, as it prevents the restoration from bleeding into the background while providing enough space for the new, correct hand geometry. Precise alignment of the template is the difference between a realistic hand and a "mirrored" anatomical disaster.

Conclusion

HandCraft provides a robust, automated solution to one of the most visible flaws in AI-generated imagery. By leveraging 3D templates as structural priors, it bridges the gap between generative flexibility and anatomical necessity. Future work may explore user-controlled gesture selection and further refinement of boundary artifacts.

Summary updated

BibTeX
@inproceedings{qin2025handcraft,
  author = {Zhenyue Qin and Yiqun Zhang and Yang Liu and Dylan Campbell},
  title = {{HandCraft: Anatomically Correct Restoration of Malformed Hands in Diffusion Generated Images}},
  booktitle = {IEEE/CVF Winter Conference on Applications of Computer Vision},
  year = {2025},
  doi = {10.1109/wacv61041.2025.00386},
}
Figure