Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
iperov
GitHub Repository: iperov/deepfacelab
Path: blob/master/facelib/FaceType.py
628 views
1
from enum import IntEnum
2
3
class FaceType(IntEnum):
4
#enumerating in order "next contains prev"
5
HALF = 0
6
MID_FULL = 1
7
FULL = 2
8
FULL_NO_ALIGN = 3
9
WHOLE_FACE = 4
10
HEAD = 10
11
HEAD_NO_ALIGN = 20
12
13
MARK_ONLY = 100, #no align at all, just embedded faceinfo
14
15
@staticmethod
16
def fromString (s):
17
r = from_string_dict.get (s.lower())
18
if r is None:
19
raise Exception ('FaceType.fromString value error')
20
return r
21
22
@staticmethod
23
def toString (face_type):
24
return to_string_dict[face_type]
25
26
to_string_dict = { FaceType.HALF : 'half_face',
27
FaceType.MID_FULL : 'midfull_face',
28
FaceType.FULL : 'full_face',
29
FaceType.FULL_NO_ALIGN : 'full_face_no_align',
30
FaceType.WHOLE_FACE : 'whole_face',
31
FaceType.HEAD : 'head',
32
FaceType.HEAD_NO_ALIGN : 'head_no_align',
33
34
FaceType.MARK_ONLY :'mark_only',
35
}
36
37
from_string_dict = { to_string_dict[x] : x for x in to_string_dict.keys() }
38