deepinsight / deepinsight/insightface

batch SimilarityTransform

Open
#2,328 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
29.7k
Forks
6.1k
PR merge metrics
No merged PRs in 30d

Description

The following code implements face alignment using functions from the `skimage` library. In cases where there are a small number of faces, using this function for face alignment can yield satisfactory results. However, when dealing with a large collection of faces, I'm looking for a method to calculate similarity transformation matrices in batches. I have already achieved batch face alignment using similarity transformation matrices of shape [b, 2, 3] with the `kornia` library. However, I'm struggling to find a way to calculate similarity transformation matrices in batches while maintaining consistent results with the computation performed by `skimage`. Furthermore, I'm hoping to accomplish this using the PyTorch framework. I have attempted to replicate the computation of similarity transformation matrices from `skimage` using PyTorch, but the results do not match. This discrepancy could impact the accuracy of subsequent face recognition tasks. Has anyone successfully implemented this? Any help would be greatly appreciated.

```
tform = trans.SimilarityTransform()
tform.estimate(src,dst)
M = tform.params[0:2,:]
```
can stack the results of `trans.SimilarityTransform()` into a [n, 2, 3] matrix, which can then be used with `kornia.geometry.transform.warp_affine` along with the corresponding images to perform batch alignment tasks.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.