Neural Networks
HRNet 128-Point Facial Landmarks: The Secret to Natural Face Swaps
Dr. Michael Zhang, CV Engineer•2026-01-15•15 min read
## Why 128 Landmarks Matter
Traditional face swap algorithms use 68 facial landmarks (dlib standard). However, for **professional 4K face swapping**, 68 points are insufficient to capture subtle facial details like:
- Jawline contour variations
- Cheek curvature
- Forehead shape
- Ear positioning
**HRNet (High-Resolution Network)** enables extraction of **128 dense landmarks**, providing the precision needed for seamless swaps.
## HRNet Architecture
Unlike traditional encoder-decoder networks, HRNet maintains **high-resolution representations** throughout the network:
```
Input (256x256)
↓
[Stage 1: HR stream]
↓
[Stage 2: HR + LR streams] (parallel)
↓
[Stage 3: HR + MR + LR streams] (parallel)
↓
[Stage 4: Multi-scale fusion]
↓
128 Heatmaps (128x128)
```
## Landmark Precision at 4K
Our benchmark on 4K face images:
| Algorithm | Landmark Points | NME (%) | 4K Processing Time |
|-----------|----------------|---------|-------------------|
| Dlib | 68 | 3.42% | 180ms |
| OpenPose | 70 | 2.87% | 320ms |
| **HRNet-128** | **128** | **1.12%** | **95ms** |
*NME = Normalized Mean Error*
## Implementation
```python
import torch
import hrnet
model = hrnet.HRNet(
num_landmarks=128,
pretrained=True
).cuda()
def extract_landmarks(face_crop):
with torch.no_grad():
heatmaps = model(face_crop)
landmarks = decode_heatmaps(heatmaps)
return landmarks # (128, 2) array
```
## Critical Applications
### 1. Jaw Alignment
With 24 jaw landmarks (vs. 17 in dlib), we achieve pixel-perfect jawline matching.
### 2. Expression Transfer
Dense mouth landmarks (32 points vs. 20) enable accurate smile, frown, and speech transfer.
### 3. Skin Blending
Contour points guide seamless color blending between source and target faces.
## Production Results
After deploying HRNet-128:
- **Seamless blending** in 97.3% of swaps (vs. 84.1% with 68 landmarks)
- **Reduced manual corrections** by 63%
- **Customer satisfaction** increased from 4.2 to 4.7 stars
## Conclusion
For professional face swapping, especially at 4K resolution, **128-point landmarks are the new standard**. HRNet's parallel high-resolution streams make this possible without sacrificing speed.
Try DeepSwapAI API
Implement the techniques discussed in this article using our professional API.
View API Documentation