https://github.com/xiaochus/FaceRecognition/blob/0ad55dfeb86b23752a7adc146b88f11ea7c0f2ab/utils/utils.py#L29